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

Function getActiveSubscription

packages/billing/src/subscription.ts:588–607  ·  view source on GitHub ↗
(params: {
  userId: string
  logger: Logger
})

Source from the content-addressed store, hash-verified

586// ---------------------------------------------------------------------------
587
588export async function getActiveSubscription(params: {
589 userId: string
590 logger: Logger
591}): Promise<SubscriptionRow | null> {
592 const { userId } = params
593
594 const subs = await db
595 .select()
596 .from(schema.subscription)
597 .where(
598 and(
599 eq(schema.subscription.user_id, userId),
600 eq(schema.subscription.status, 'active'),
601 ),
602 )
603 .orderBy(desc(schema.subscription.updated_at))
604 .limit(1)
605
606 return subs[0] ?? null
607}
608
609export async function isSubscriber(params: {
610 userId: string

Callers 6

getUserUsageDataFunction · 0.90
GETFunction · 0.90
POSTFunction · 0.90
POSTFunction · 0.90
isSubscriberFunction · 0.85

Calls 1

fromMethod · 0.80

Tested by

no test coverage detected