feat: asset metadata (#20446)

This commit is contained in:
Jason Rasmussen
2025-08-27 14:31:23 -04:00
committed by GitHub
parent 25a94bd117
commit 88072910da
37 changed files with 1999 additions and 21 deletions
@@ -54,6 +54,7 @@ export class SyncRepository {
asset: AssetSync;
assetExif: AssetExifSync;
assetFace: AssetFaceSync;
assetMetadata: AssetMetadataSync;
authUser: AuthUserSync;
memory: MemorySync;
memoryToAsset: MemoryToAssetSync;
@@ -75,6 +76,7 @@ export class SyncRepository {
this.asset = new AssetSync(this.db);
this.assetExif = new AssetExifSync(this.db);
this.assetFace = new AssetFaceSync(this.db);
this.assetMetadata = new AssetMetadataSync(this.db);
this.authUser = new AuthUserSync(this.db);
this.memory = new MemorySync(this.db);
this.memoryToAsset = new MemoryToAssetSync(this.db);
@@ -685,3 +687,23 @@ class UserMetadataSync extends BaseSync {
.stream();
}
}
class AssetMetadataSync extends BaseSync {
@GenerateSql({ params: [dummyQueryOptions, DummyValue.UUID], stream: true })
getDeletes(options: SyncQueryOptions, userId: string) {
return this.auditQuery('asset_metadata_audit', options)
.select(['asset_metadata_audit.id', 'assetId', 'key'])
.leftJoin('asset', 'asset.id', 'asset_metadata_audit.assetId')
.where('asset.ownerId', '=', userId)
.stream();
}
@GenerateSql({ params: [dummyQueryOptions, DummyValue.UUID], stream: true })
getUpserts(options: SyncQueryOptions, userId: string) {
return this.upsertQuery('asset_metadata', options)
.select(['assetId', 'key', 'value', 'asset_metadata.updateId'])
.innerJoin('asset', 'asset.id', 'asset_metadata.assetId')
.where('asset.ownerId', '=', userId)
.stream();
}
}