53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import { ApiProperty } from "@nestjs/swagger";
|
|
import { Type } from "class-transformer";
|
|
import {
|
|
ArrayNotEmpty,
|
|
ArrayUnique,
|
|
IsArray,
|
|
IsEmail,
|
|
IsISO8601,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString,
|
|
Max,
|
|
Min,
|
|
} from "class-validator";
|
|
|
|
export class UpsertVacationDto {
|
|
@ApiProperty({ example: "jane.doe@example.com" })
|
|
@IsEmail()
|
|
email!: string;
|
|
|
|
@ApiProperty({
|
|
type: [String],
|
|
example: ["2025-07-14", "2025-07-15"],
|
|
description: "ISO dates that represent the vacation request.",
|
|
})
|
|
@IsArray()
|
|
@ArrayNotEmpty()
|
|
@ArrayUnique()
|
|
@IsISO8601({}, { each: true })
|
|
dates!: string[];
|
|
|
|
@ApiProperty({
|
|
required: false,
|
|
example: "Summer break",
|
|
description: "Optional comment applied to every date.",
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
comment?: string;
|
|
|
|
@ApiProperty({
|
|
required: false,
|
|
example: 8,
|
|
description: "Hours requested per day. Used as default when creating shifts.",
|
|
})
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsNumber({ maxDecimalPlaces: 2 })
|
|
@Min(0)
|
|
@Max(24)
|
|
requested_hours?: number;
|
|
}
|