MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / buildActiveGrantsFilter

Function buildActiveGrantsFilter

packages/billing/src/balance-calculator.ts:71–79  ·  view source on GitHub ↗
(userId: string, now: Date)

Source from the content-addressed store, hash-verified

69> /* + whatever else you call */
70
71function buildActiveGrantsFilter(userId: string, now: Date) {
72 return and(
73 eq(schema.creditLedger.user_id, userId),
74 or(
75 isNull(schema.creditLedger.expires_at),
76 gt(schema.creditLedger.expires_at, now),
77 ),
78 )
79}
80
81/**
82 * Gets active grants for a user, ordered by expiration (soonest first), then priority, and creation date.

Callers 2

getOrderedActiveGrantsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected