mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 15:30:56 +00:00
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import {
|
|
IsDateString,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString,
|
|
MaxLength,
|
|
} from "class-validator";
|
|
|
|
import { ELedgerEntryType } from "../entities/leave-ledger-entry.entity";
|
|
|
|
export class AdjustBalanceDto {
|
|
@ApiProperty({
|
|
description:
|
|
"Signed. Positive credits days, negative removes them. Posted as an " +
|
|
"ADJUSTMENT entry — nothing is overwritten.",
|
|
example: -2.5,
|
|
})
|
|
@IsNumber()
|
|
days!: number;
|
|
|
|
@ApiProperty({
|
|
maxLength: 256,
|
|
description: "Required. An unexplained adjustment is indefensible later.",
|
|
})
|
|
@IsString()
|
|
@MaxLength(256)
|
|
reason!: string;
|
|
|
|
@ApiPropertyOptional({ format: "date", description: "Defaults to today." })
|
|
@IsOptional()
|
|
@IsDateString()
|
|
effectiveOn?: string;
|
|
}
|
|
|
|
export class ReverseEntryDto {
|
|
@ApiProperty({ maxLength: 256 })
|
|
@IsString()
|
|
@MaxLength(256)
|
|
reason!: string;
|
|
}
|
|
|
|
export class LedgerEntryResponseDto {
|
|
@ApiProperty() id!: string;
|
|
@ApiProperty({ enum: ELedgerEntryType }) entryType!: ELedgerEntryType;
|
|
@ApiProperty({ description: "Signed days." }) days!: string;
|
|
@ApiProperty({ format: "date" }) effectiveOn!: string;
|
|
@ApiPropertyOptional() reason?: string | null;
|
|
@ApiPropertyOptional() sourceType?: string | null;
|
|
@ApiPropertyOptional() sourceId?: string | null;
|
|
@ApiPropertyOptional() reversesId?: string | null;
|
|
}
|