feat: add usage and download intent accounting

This commit is contained in:
Leon Tonhäuser committed 2026-08-09 22:52:27 +02:00
1 parent 846904f3db
commit 22fe6bf659
14 files changed
+3008 -2

No files matched your search

+5
View File
@@ -15,6 +15,8 @@ type DownloadSeed = {
};
export type PostgresTestDatabase = {
database: NodePgDatabase<typeof schema>;
pool: Pool;
seedEditorialWithUsage(): Promise<DownloadSeed>;
insertDownload(input: DownloadSeed & { idempotencyKey: string }): Promise<void>;
stop(): Promise<void>;
@@ -33,6 +35,8 @@ export async function startPostgres(): Promise<PostgresTestDatabase> {
const db = drizzle({ client: pool, schema });
return {
database: db,
pool,
async seedEditorialWithUsage() {
return seedEditorialWithUsage(db);
},
@@ -43,6 +47,7 @@ export async function startPostgres(): Promise<PostgresTestDatabase> {
immichAssetId: input.assetId,
requestId: randomUUID(),
idempotencyKey: input.idempotencyKey,
requestFingerprint: "0".repeat(64),
});
},
async stop() {