MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / deleteOrgUsageFor

Function deleteOrgUsageFor

apps/web/src/scripts/usage/lib/generate-mock-usage.ts:127–138  ·  view source on GitHub ↗
(organizationId: string)

Source from the content-addressed store, hash-verified

125 * `seed-fake-usage-for-org.ts` to avoid orphaning rows.
126 */
127export async function deleteOrgUsageFor(organizationId: string): Promise<{ deleted: number }> {
128 await db.execute(sql`
129 DELETE FROM microdollar_usage_metadata
130 WHERE id IN (
131 SELECT id FROM microdollar_usage WHERE organization_id = ${organizationId}
132 )
133 `);
134 const result = await db
135 .delete(microdollar_usage)
136 .where(eq(microdollar_usage.organization_id, organizationId));
137 return { deleted: result.rowCount ?? 0 };
138}
139
140/**
141 * Delete personal-scope microdollar_usage + metadata for a single user

Callers 1

runFunction · 0.90

Calls 3

executeMethod · 0.80
deleteMethod · 0.65
sqlFunction · 0.50

Tested by

no test coverage detected