mirror of
https://github.com/immich-app/immich.git
synced 2026-02-28 01:29:04 +03:00
feat: editing descriminator (#26336)
This commit is contained in:
@@ -16117,7 +16117,15 @@
|
|||||||
{
|
{
|
||||||
"$ref": "#/components/schemas/AssetEditActionMirror"
|
"$ref": "#/components/schemas/AssetEditActionMirror"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"discriminator": {
|
||||||
|
"mapping": {
|
||||||
|
"crop": "#/components/schemas/AssetEditActionCrop",
|
||||||
|
"mirror": "#/components/schemas/AssetEditActionMirror",
|
||||||
|
"rotate": "#/components/schemas/AssetEditActionRotate"
|
||||||
|
},
|
||||||
|
"propertyName": "action"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"minItems": 1,
|
"minItems": 1,
|
||||||
"type": "array"
|
"type": "array"
|
||||||
@@ -16188,7 +16196,15 @@
|
|||||||
{
|
{
|
||||||
"$ref": "#/components/schemas/AssetEditActionMirror"
|
"$ref": "#/components/schemas/AssetEditActionMirror"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"discriminator": {
|
||||||
|
"mapping": {
|
||||||
|
"crop": "#/components/schemas/AssetEditActionCrop",
|
||||||
|
"mirror": "#/components/schemas/AssetEditActionMirror",
|
||||||
|
"rotate": "#/components/schemas/AssetEditActionRotate"
|
||||||
|
},
|
||||||
|
"propertyName": "action"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"minItems": 1,
|
"minItems": 1,
|
||||||
"type": "array"
|
"type": "array"
|
||||||
|
|||||||
@@ -118,7 +118,15 @@ export class AssetEditActionListDto {
|
|||||||
Array.isArray(edits) ? edits.map((item) => plainToInstance(getActionClass(item), item)) : edits,
|
Array.isArray(edits) ? edits.map((item) => plainToInstance(getActionClass(item), item)) : edits,
|
||||||
)
|
)
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
anyOf: Object.values(actionToClass).map((target) => ({ $ref: getSchemaPath(target) })),
|
items: {
|
||||||
|
anyOf: Object.values(actionToClass).map((type) => ({ $ref: getSchemaPath(type) })),
|
||||||
|
discriminator: {
|
||||||
|
propertyName: 'action',
|
||||||
|
mapping: Object.fromEntries(
|
||||||
|
Object.entries(actionToClass).map(([action, type]) => [action, getSchemaPath(type)]),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
description: 'List of edit actions to apply (crop, rotate, or mirror)',
|
description: 'List of edit actions to apply (crop, rotate, or mirror)',
|
||||||
})
|
})
|
||||||
edits!: AssetEditActionItem[];
|
edits!: AssetEditActionItem[];
|
||||||
|
|||||||
Reference in New Issue
Block a user