chore(repo): remove dead code and useless tests (#3375)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-10 21:43:29 +02:00
1 parent 7e177a1c90
commit 1cd62eb661
1391 files changed
+783 -120415

No files matched your search

@@ -2,13 +2,7 @@
import {mapStripePaymentIntentToRow} from '@app/api/billing/mappers/StripeToBillingMapper';
import {isExistingNewer} from '@app/api/billing/repositories/BillingRepoHelpers';
import {
fetchMany,
fetchOne,
fetchPage,
type PagedQueryResult,
upsertOne,
} from '@app/api/database/CassandraQueryExecution';
import {fetchOne, upsertOne} from '@app/api/database/CassandraQueryExecution';
import type {BillingPaymentIntentRow} from '@app/api/database/types/BillingTypes';
import {BillingPaymentIntents, BillingPaymentIntentsByCustomer} from '@app/api/Tables';
import type Stripe from 'stripe';
@@ -17,40 +11,12 @@ const FETCH_BY_ID = BillingPaymentIntents.selectCql({
where: BillingPaymentIntents.where.eq('provider_id'),
limit: 1,
});
const FETCH_BY_CUSTOMER = BillingPaymentIntentsByCustomer.selectCql({
where: BillingPaymentIntentsByCustomer.where.eq('customer_id'),
});
const FETCH_BY_PROVIDER_IDS = BillingPaymentIntents.selectCql({
where: BillingPaymentIntents.where.in('provider_id', 'provider_ids'),
});
export class BillingPaymentIntentRepository {
async findById(providerId: string): Promise<BillingPaymentIntentRow | null> {
return fetchOne<BillingPaymentIntentRow>(FETCH_BY_ID, {provider_id: providerId});
}
async listByCustomer(
customerId: string,
page?: {
pageSize: number;
pageState?: string | null;
},
): Promise<PagedQueryResult<BillingPaymentIntentRow>> {
const refsPage = await fetchPage<{
provider_id: string;
}>(
FETCH_BY_CUSTOMER,
{customer_id: customerId},
{pageSize: page?.pageSize ?? 50, pageState: page?.pageState ?? null},
);
if (refsPage.rows.length === 0) {
return {rows: [], pageState: refsPage.pageState};
}
const ids = refsPage.rows.map((r) => r.provider_id);
const rows = await fetchMany<BillingPaymentIntentRow>(FETCH_BY_PROVIDER_IDS, {provider_ids: ids});
return {rows, pageState: refsPage.pageState};
}
async upsertFromStripe(pi: Stripe.PaymentIntent): Promise<{
changed: boolean;
row: BillingPaymentIntentRow;