feat: stream originals with download accounting
This commit is contained in:
1 parent
c400167b8f
commit
8871e4794a
28 files changed
+4081
-8
No files matched your search
@@ -18,7 +18,13 @@ export type PostgresTestDatabase = {
|
||||
database: NodePgDatabase<typeof schema>;
|
||||
pool: Pool;
|
||||
seedEditorialWithUsage(): Promise<DownloadSeed>;
|
||||
insertDownload(input: DownloadSeed & { idempotencyKey: string }): Promise<void>;
|
||||
insertDownload(
|
||||
input: DownloadSeed & {
|
||||
id?: string;
|
||||
idempotencyKey: string;
|
||||
intentKind?: "new_usage" | "repeat_download";
|
||||
},
|
||||
): Promise<void>;
|
||||
applyRemainingMigrations(): Promise<void>;
|
||||
stop(): Promise<void>;
|
||||
};
|
||||
@@ -47,12 +53,14 @@ export async function startPostgres({ through }: { through?: string } = {}): Pro
|
||||
},
|
||||
async insertDownload(input) {
|
||||
await db.insert(schema.downloadEvents).values({
|
||||
id: input.id,
|
||||
editorialAccountId: input.editorialId,
|
||||
usageId: input.usageId,
|
||||
immichAssetId: input.assetId,
|
||||
requestId: randomUUID(),
|
||||
idempotencyKey: input.idempotencyKey,
|
||||
requestFingerprint: "0".repeat(64),
|
||||
intentKind: input.intentKind ?? "new_usage",
|
||||
});
|
||||
},
|
||||
async applyRemainingMigrations() {
|
||||
|
||||
Reference in new issue
Block a user