mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
dto refactor
add logging handle metadata
This commit is contained in:
@@ -255,6 +255,18 @@ export class AssetRepository {
|
||||
return this.db.insertInto('asset').values(asset).returningAll().executeTakeFirstOrThrow();
|
||||
}
|
||||
|
||||
createWithMetadata(asset: Insertable<AssetTable> & { id: string }, metadata?: AssetMetadataItem[]) {
|
||||
if (!metadata || metadata.length === 0) {
|
||||
return this.db.insertInto('asset').values(asset).execute();
|
||||
}
|
||||
|
||||
return this.db
|
||||
.with('asset', (qb) => qb.insertInto('asset').values(asset).returning('id'))
|
||||
.insertInto('asset_metadata')
|
||||
.values(metadata.map(({ key, value }) => ({ assetId: asset.id, key, value })))
|
||||
.execute();
|
||||
}
|
||||
|
||||
getCompletionMetadata(assetId: string, ownerId: string) {
|
||||
return this.db
|
||||
.selectFrom('asset')
|
||||
|
||||
@@ -62,15 +62,11 @@ export class StorageRepository {
|
||||
}
|
||||
|
||||
createWriteStream(filepath: string): Writable {
|
||||
return createWriteStream(filepath, { flags: 'w' });
|
||||
}
|
||||
|
||||
overwriteWriteStream(filepath: string, offset = 0): Writable {
|
||||
return createWriteStream(filepath, { flags: 'r+', start: offset });
|
||||
return createWriteStream(filepath, { flags: 'w', highWaterMark: 1024 * 1024 });
|
||||
}
|
||||
|
||||
createOrAppendWriteStream(filepath: string): Writable {
|
||||
return createWriteStream(filepath, { flags: 'a' });
|
||||
return createWriteStream(filepath, { flags: 'a', highWaterMark: 1024 * 1024 });
|
||||
}
|
||||
|
||||
createOrOverwriteFile(filepath: string, buffer: Buffer) {
|
||||
|
||||
Reference in New Issue
Block a user