mirror of
https://github.com/immich-app/immich.git
synced 2026-03-07 02:27:23 +03:00
feat: bulk asset metadata endpoints (#25133)
This commit is contained in:
@@ -17,9 +17,9 @@ import {
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
import { BulkIdsDto } from 'src/dtos/asset-ids.response.dto';
|
||||
import { AssetMetadataKey, AssetType, AssetVisibility } from 'src/enum';
|
||||
import { AssetType, AssetVisibility } from 'src/enum';
|
||||
import { AssetStats } from 'src/repositories/asset.repository';
|
||||
import { IsNotSiblingOf, Optional, ValidateBoolean, ValidateEnum, ValidateUUID } from 'src/validation';
|
||||
import { IsNotSiblingOf, Optional, ValidateBoolean, ValidateEnum, ValidateString, ValidateUUID } from 'src/validation';
|
||||
|
||||
export class DeviceIdDto {
|
||||
@IsNotEmpty()
|
||||
@@ -142,8 +142,8 @@ export class AssetMetadataRouteParams {
|
||||
@ValidateUUID()
|
||||
id!: string;
|
||||
|
||||
@ValidateEnum({ enum: AssetMetadataKey, name: 'AssetMetadataKey' })
|
||||
key!: AssetMetadataKey;
|
||||
@ValidateString()
|
||||
key!: string;
|
||||
}
|
||||
|
||||
export class AssetMetadataUpsertDto {
|
||||
@@ -154,26 +154,57 @@ export class AssetMetadataUpsertDto {
|
||||
}
|
||||
|
||||
export class AssetMetadataUpsertItemDto {
|
||||
@ValidateEnum({ enum: AssetMetadataKey, name: 'AssetMetadataKey' })
|
||||
key!: AssetMetadataKey;
|
||||
@ValidateString()
|
||||
key!: string;
|
||||
|
||||
@IsObject()
|
||||
value!: object;
|
||||
}
|
||||
|
||||
export class AssetMetadataMobileAppDto {
|
||||
@IsString()
|
||||
@Optional()
|
||||
iCloudId?: string;
|
||||
export class AssetMetadataBulkUpsertDto {
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => AssetMetadataBulkUpsertItemDto)
|
||||
items!: AssetMetadataBulkUpsertItemDto[];
|
||||
}
|
||||
|
||||
export class AssetMetadataBulkUpsertItemDto {
|
||||
@ValidateUUID()
|
||||
assetId!: string;
|
||||
|
||||
@ValidateString()
|
||||
key!: string;
|
||||
|
||||
@IsObject()
|
||||
value!: object;
|
||||
}
|
||||
|
||||
export class AssetMetadataBulkDeleteDto {
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => AssetMetadataBulkDeleteItemDto)
|
||||
items!: AssetMetadataBulkDeleteItemDto[];
|
||||
}
|
||||
|
||||
export class AssetMetadataBulkDeleteItemDto {
|
||||
@ValidateUUID()
|
||||
assetId!: string;
|
||||
|
||||
@ValidateString()
|
||||
key!: string;
|
||||
}
|
||||
|
||||
export class AssetMetadataResponseDto {
|
||||
@ValidateEnum({ enum: AssetMetadataKey, name: 'AssetMetadataKey' })
|
||||
key!: AssetMetadataKey;
|
||||
@ValidateString()
|
||||
key!: string;
|
||||
value!: object;
|
||||
updatedAt!: Date;
|
||||
}
|
||||
|
||||
export class AssetMetadataBulkResponseDto extends AssetMetadataResponseDto {
|
||||
assetId!: string;
|
||||
}
|
||||
|
||||
export class AssetCopyDto {
|
||||
@ValidateUUID()
|
||||
sourceId!: string;
|
||||
|
||||
@@ -4,7 +4,6 @@ import { ArrayMaxSize, IsInt, IsPositive, IsString } from 'class-validator';
|
||||
import { AssetResponseDto } from 'src/dtos/asset-response.dto';
|
||||
import {
|
||||
AlbumUserRole,
|
||||
AssetMetadataKey,
|
||||
AssetOrder,
|
||||
AssetType,
|
||||
AssetVisibility,
|
||||
@@ -167,16 +166,14 @@ export class SyncAssetExifV1 {
|
||||
@ExtraModel()
|
||||
export class SyncAssetMetadataV1 {
|
||||
assetId!: string;
|
||||
@ValidateEnum({ enum: AssetMetadataKey, name: 'AssetMetadataKey' })
|
||||
key!: AssetMetadataKey;
|
||||
key!: string;
|
||||
value!: object;
|
||||
}
|
||||
|
||||
@ExtraModel()
|
||||
export class SyncAssetMetadataDeleteV1 {
|
||||
assetId!: string;
|
||||
@ValidateEnum({ enum: AssetMetadataKey, name: 'AssetMetadataKey' })
|
||||
key!: AssetMetadataKey;
|
||||
key!: string;
|
||||
}
|
||||
|
||||
@ExtraModel()
|
||||
|
||||
Reference in New Issue
Block a user