fix: add asset upload medium test (#25144)

This commit is contained in:
Jason Rasmussen
2026-01-08 17:01:25 -05:00
committed by GitHub
parent 8136d7fd54
commit 191401f2f1
7 changed files with 127 additions and 11 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ export class AssetMediaCreateDto extends AssetMediaBase {
@Optional()
@ValidateNested({ each: true })
@IsArray()
metadata!: AssetMetadataUpsertItemDto[];
metadata?: AssetMetadataUpsertItemDto[];
@ApiProperty({ type: 'string', format: 'binary', required: false })
[UploadFieldName.SIDECAR_DATA]?: any;
@@ -258,6 +258,10 @@ export class AssetRepository {
}
upsertMetadata(id: string, items: Array<{ key: string; value: object }>) {
if (items.length === 0) {
return [];
}
return this.db
.insertInto('asset_metadata')
.values(items.map((item) => ({ assetId: id, ...item })))