1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-09 23:17:29 +02:00

feat(api): set person color (#15937)

This commit is contained in:
Jason Rasmussen
2025-02-07 10:06:58 -05:00
committed by GitHub
parent 2e5007adef
commit 23014c263b
18 changed files with 182 additions and 21 deletions

View File

@@ -12,6 +12,7 @@ import {
IsArray,
IsBoolean,
IsDate,
IsHexColor,
IsNotEmpty,
IsOptional,
IsString,
@@ -97,6 +98,15 @@ export function Optional({ nullable, emptyToNull, ...validationOptions }: Option
return applyDecorators(...decorators);
}
export const ValidateHexColor = () => {
const decorators = [
IsHexColor(),
Transform(({ value }) => (typeof value === 'string' && value[0] !== '#' ? `#${value}` : value)),
];
return applyDecorators(...decorators);
};
type UUIDOptions = { optional?: boolean; each?: boolean; nullable?: boolean };
export const ValidateUUID = (options?: UUIDOptions) => {
const { optional, each, nullable } = { optional: false, each: false, nullable: false, ...options };