mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat: batch change date and time relatively (#17717)
Co-authored-by: marcel.kuehne <> Co-authored-by: Zack Pollard <zackpollard@ymail.com>
This commit is contained in:
parent
df2525ee08
commit
011a667314
19 changed files with 574 additions and 52 deletions
|
|
@ -22,11 +22,13 @@ import {
|
|||
Validate,
|
||||
ValidateBy,
|
||||
ValidateIf,
|
||||
ValidationArguments,
|
||||
ValidationOptions,
|
||||
ValidatorConstraint,
|
||||
ValidatorConstraintInterface,
|
||||
buildMessage,
|
||||
isDateString,
|
||||
isDefined,
|
||||
} from 'class-validator';
|
||||
import { CronJob } from 'cron';
|
||||
import { DateTime } from 'luxon';
|
||||
|
|
@ -146,6 +148,27 @@ export function Optional({ nullable, emptyToNull, ...validationOptions }: Option
|
|||
return applyDecorators(...decorators);
|
||||
}
|
||||
|
||||
export function IsNotSiblingOf(siblings: string[], validationOptions?: ValidationOptions) {
|
||||
return ValidateBy(
|
||||
{
|
||||
name: 'isNotSiblingOf',
|
||||
constraints: siblings,
|
||||
validator: {
|
||||
validate(value: any, args: ValidationArguments) {
|
||||
if (!isDefined(value)) {
|
||||
return true;
|
||||
}
|
||||
return args.constraints.filter((prop) => isDefined((args.object as any)[prop])).length === 0;
|
||||
},
|
||||
defaultMessage: (args: ValidationArguments) => {
|
||||
return `${args.property} cannot exist alongside any of the following properties: ${args.constraints.join(', ')}`;
|
||||
},
|
||||
},
|
||||
},
|
||||
validationOptions,
|
||||
);
|
||||
}
|
||||
|
||||
export const ValidateHexColor = () => {
|
||||
const decorators = [
|
||||
IsHexColor(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue