Skip to content

Commit f7a9ce9

Browse files
tofikwestclaude
andcommitted
fix(api): purge snapshot — null out stripe IDs from dropped tables
Build was failing because the new PurgeOrganizationSnapshotService (added on main while this branch was open) queried db.organizationBilling and db.pentestSubscription, both of which we dropped in migration 20260427000000_pentest_credits. The git auto-merge couldn't catch this — it's a logical conflict, not a textual one. Replace the queries with null literals. The snapshot's `stripe.customerId` and `stripe.subscriptionId` shape is preserved so downstream consumers (purge orchestrator, restore tooling) keep working; the legacy tables had no production data anyway, and v2 billing will add new fields here when it lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f5e2528 commit f7a9ce9

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

apps/api/src/admin-organizations/purge-organization-snapshot.service.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ export class PurgeOrganizationSnapshotService {
2222
}
2323

2424
const [
25-
billing,
26-
pentest,
2725
trustResources,
2826
trustNdas,
2927
trustDocs,
@@ -36,14 +34,13 @@ export class PurgeOrganizationSnapshotService {
3634
integrations,
3735
counts,
3836
] = await Promise.all([
39-
db.organizationBilling.findUnique({
40-
where: { organizationId },
41-
select: { stripeCustomerId: true },
42-
}),
43-
db.pentestSubscription.findUnique({
44-
where: { organizationId },
45-
select: { stripeSubscriptionId: true },
46-
}),
37+
// The legacy `organization_billing` and `pentest_subscriptions`
38+
// tables were dropped in migration 20260427000000_pentest_credits;
39+
// they were Stripe-coupled records that never had production data
40+
// and have been superseded by the `pentest_credits` wallet model.
41+
// The snapshot intentionally omits them — there's nothing to
42+
// capture. If/when v2 introduces real Stripe billing, the new
43+
// tables get added here at that point.
4744
db.trustResource.findMany({
4845
where: { organizationId },
4946
select: { s3Key: true },
@@ -130,9 +127,13 @@ export class PurgeOrganizationSnapshotService {
130127
return {
131128
organization: { id: org.id, name: org.name, slug: org.slug },
132129
counts,
130+
// Stripe IDs intentionally null — the source tables were dropped
131+
// in 20260427000000_pentest_credits. The shape is preserved so
132+
// downstream consumers (purge orchestrator) don't need to change
133+
// until v2 billing replaces these.
133134
stripe: {
134-
customerId: billing?.stripeCustomerId ?? null,
135-
subscriptionId: pentest?.stripeSubscriptionId ?? null,
135+
customerId: null,
136+
subscriptionId: null,
136137
},
137138
s3KeysByBucket,
138139
knowledgeBaseDocumentIds: kbDocs.map((d) => d.id),

0 commit comments

Comments
 (0)