mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
feat(server): SyncAssetEditV1 (#26446)
* feat: SyncAssetEditV1 * fix: audit table import * fix: sql tools table fetch * fix: medium tests (wip) * fix: circ dependency * chore: finalize tests * chore: codegen/lint * fix: code review
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { ApiProperty, getSchemaPath } from '@nestjs/swagger';
|
||||
import { ApiExtraModels, ApiProperty, getSchemaPath } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import { ArrayMinSize, IsEnum, IsInt, Min, ValidateNested } from 'class-validator';
|
||||
import { ExtraModel } from 'src/dtos/sync.dto';
|
||||
import { IsAxisAlignedRotation, IsUniqueEditActions, ValidateEnum, ValidateUUID } from 'src/validation';
|
||||
|
||||
export enum AssetEditAction {
|
||||
@@ -15,7 +14,6 @@ export enum MirrorAxis {
|
||||
Vertical = 'vertical',
|
||||
}
|
||||
|
||||
@ExtraModel()
|
||||
export class CropParameters {
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
@@ -38,14 +36,12 @@ export class CropParameters {
|
||||
height!: number;
|
||||
}
|
||||
|
||||
@ExtraModel()
|
||||
export class RotateParameters {
|
||||
@IsAxisAlignedRotation()
|
||||
@ApiProperty({ description: 'Rotation angle in degrees' })
|
||||
angle!: number;
|
||||
}
|
||||
|
||||
@ExtraModel()
|
||||
export class MirrorParameters {
|
||||
@IsEnum(MirrorAxis)
|
||||
@ApiProperty({ enum: MirrorAxis, enumName: 'MirrorAxis', description: 'Axis to mirror along' })
|
||||
@@ -67,6 +63,7 @@ export type AssetEditActionItem =
|
||||
parameters: MirrorParameters;
|
||||
};
|
||||
|
||||
@ApiExtraModels(CropParameters, RotateParameters, MirrorParameters)
|
||||
export class AssetEditActionItemDto {
|
||||
@ValidateEnum({ name: 'AssetEditAction', enum: AssetEditAction, description: 'Type of edit action to perform' })
|
||||
action!: AssetEditAction;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ArrayMaxSize, IsInt, IsPositive, IsString } from 'class-validator';
|
||||
import { AssetResponseDto } from 'src/dtos/asset-response.dto';
|
||||
import { AssetEditAction } from 'src/dtos/editing.dto';
|
||||
import {
|
||||
AlbumUserRole,
|
||||
AssetOrder,
|
||||
@@ -218,6 +219,24 @@ export class SyncAssetExifV1 {
|
||||
fps!: number | null;
|
||||
}
|
||||
|
||||
@ExtraModel()
|
||||
export class SyncAssetEditV1 {
|
||||
id!: string;
|
||||
assetId!: string;
|
||||
|
||||
@ValidateEnum({ enum: AssetEditAction, name: 'AssetEditAction' })
|
||||
action!: AssetEditAction;
|
||||
parameters!: object;
|
||||
|
||||
@ApiProperty({ type: 'integer' })
|
||||
sequence!: number;
|
||||
}
|
||||
|
||||
@ExtraModel()
|
||||
export class SyncAssetEditDeleteV1 {
|
||||
editId!: string;
|
||||
}
|
||||
|
||||
@ExtraModel()
|
||||
export class SyncAssetMetadataV1 {
|
||||
@ApiProperty({ description: 'Asset ID' })
|
||||
@@ -480,6 +499,8 @@ export type SyncItem = {
|
||||
[SyncEntityType.AssetMetadataV1]: SyncAssetMetadataV1;
|
||||
[SyncEntityType.AssetMetadataDeleteV1]: SyncAssetMetadataDeleteV1;
|
||||
[SyncEntityType.AssetExifV1]: SyncAssetExifV1;
|
||||
[SyncEntityType.AssetEditV1]: SyncAssetEditV1;
|
||||
[SyncEntityType.AssetEditDeleteV1]: SyncAssetEditDeleteV1;
|
||||
[SyncEntityType.PartnerAssetV1]: SyncAssetV1;
|
||||
[SyncEntityType.PartnerAssetBackfillV1]: SyncAssetV1;
|
||||
[SyncEntityType.PartnerAssetDeleteV1]: SyncAssetDeleteV1;
|
||||
|
||||
Reference in New Issue
Block a user