MCPcopy Index your code
hub / github.com/simstudioai/sim / getPersonalUsageSnapshot

Function getPersonalUsageSnapshot

apps/sim/lib/billing/threshold-billing.ts:546–559  ·  view source on GitHub ↗
(userId: string)

Source from the content-addressed store, hash-verified

544}
545
546async function getPersonalUsageSnapshot(userId: string): Promise<PersonalUsageSnapshot | null> {
547 const [stats] = await db
548 .select({
549 currentPeriodCost: userStats.currentPeriodCost,
550 proPeriodCostSnapshot: userStats.proPeriodCostSnapshot,
551 proPeriodCostSnapshotAt: userStats.proPeriodCostSnapshotAt,
552 lastPeriodCost: userStats.lastPeriodCost,
553 })
554 .from(userStats)
555 .where(eq(userStats.userId, userId))
556 .limit(1)
557
558 return stats ? personalUsageSnapshotFromStats(stats) : null
559}
560
561function personalUsageSnapshotFromStats(stats: {
562 currentPeriodCost: string | number | null

Callers 1

Calls 2

eqFunction · 0.50

Tested by

no test coverage detected