feat: image editing (#24155)

This commit is contained in:
Brandon Wees
2026-01-09 17:59:52 -05:00
committed by GitHub
parent 76241a7b2b
commit e8c80d88a5
141 changed files with 7836 additions and 1634 deletions
+43
View File
@@ -81,6 +81,49 @@ export const ValidateUUID = (options?: UUIDOptions & ApiPropertyOptions) => {
);
};
export function IsAxisAlignedRotation() {
return ValidateBy(
{
name: 'isAxisAlignedRotation',
validator: {
validate(value: any) {
return [0, 90, 180, 270].includes(value);
},
defaultMessage: buildMessage(
(eachPrefix) => eachPrefix + '$property must be one of the following values: 0, 90, 180, 270',
{},
),
},
},
{},
);
}
@ValidatorConstraint({ name: 'uniqueEditActions' })
class UniqueEditActionsValidator implements ValidatorConstraintInterface {
validate(edits: { action: string; parameters?: unknown }[]): boolean {
if (!Array.isArray(edits)) {
return true;
}
const actionSet = new Set<string>();
for (const edit of edits) {
const key = edit.action === 'mirror' ? `${edit.action}-${JSON.stringify(edit.parameters)}` : edit.action;
if (actionSet.has(key)) {
return false;
}
actionSet.add(key);
}
return true;
}
defaultMessage(): string {
return 'Duplicate edit actions are not allowed';
}
}
export const IsUniqueEditActions = () => Validate(UniqueEditActionsValidator);
export class UUIDParamDto {
@IsNotEmpty()
@IsUUID('4')