Files
edr-platform/apps/edr-hr-api/src/modules/leave/dto/leave-settings.dto.ts
2026-08-25 00:11:39 +03:00

75 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { ApiPropertyOptional } from "@nestjs/swagger";
import {
ArrayMaxSize,
IsArray,
IsBoolean,
IsEnum,
IsInt,
IsOptional,
IsString,
Max,
MaxLength,
Min,
} from "class-validator";
import { ELeaveYearBasis } from "../entities/leave-settings.entity";
export class UpdateLeaveSettingsDto {
@ApiPropertyOptional({ enum: ELeaveYearBasis })
@IsOptional()
@IsEnum(ELeaveYearBasis)
leaveYearBasis?: ELeaveYearBasis;
@ApiPropertyOptional({ minimum: 1, maximum: 12, default: 7 })
@IsOptional()
@IsInt()
@Min(1)
@Max(12)
fiscalYearStartMonth?: number;
@ApiPropertyOptional({ minimum: 1, maximum: 31, default: 8 })
@IsOptional()
@IsInt()
@Min(1)
@Max(31)
fiscalYearStartDay?: number;
@ApiPropertyOptional({
type: [Number],
example: [0, 6],
description:
"Non-working days of the week, 0 = Sunday … 6 = Saturday. Defaults to [0], " +
"the six-day week the statutory leave figures assume. Set [0,6] for a " +
"MondayFriday employer.",
})
@IsOptional()
@IsArray()
@ArrayMaxSize(6)
@IsInt({ each: true })
@Min(0, { each: true })
@Max(6, { each: true })
weekendDays?: number[];
@ApiPropertyOptional({ minimum: 0, maximum: 24, default: 6 })
@IsOptional()
@IsInt()
@Min(0)
@Max(24)
carryOverDeadlineMonths?: number;
@ApiPropertyOptional({
default: false,
description:
"Whether a request may be approved that takes a balance below zero.",
})
@IsOptional()
@IsBoolean()
allowNegativeBalance?: boolean;
@ApiPropertyOptional({ maxLength: 64 })
@IsOptional()
@IsString()
@MaxLength(64)
statuteReference?: string;
}