35 lines
795 B
TypeScript
35 lines
795 B
TypeScript
import {
|
|
IsString,
|
|
IsOptional,
|
|
IsIn,
|
|
IsBoolean,
|
|
IsNumber,
|
|
Min,
|
|
Max,
|
|
} from "class-validator";
|
|
|
|
/**
|
|
* DTO for querying calendar preview widget data
|
|
*/
|
|
export class CalendarPreviewQueryDto {
|
|
@IsString({ message: "view must be a string" })
|
|
@IsIn(["day", "week", "agenda"], {
|
|
message: "view must be one of: day, week, agenda",
|
|
})
|
|
view!: "day" | "week" | "agenda";
|
|
|
|
@IsOptional()
|
|
@IsBoolean({ message: "showTasks must be a boolean" })
|
|
showTasks?: boolean;
|
|
|
|
@IsOptional()
|
|
@IsBoolean({ message: "showEvents must be a boolean" })
|
|
showEvents?: boolean;
|
|
|
|
@IsOptional()
|
|
@IsNumber({}, { message: "daysAhead must be a number" })
|
|
@Min(1, { message: "daysAhead must be at least 1" })
|
|
@Max(30, { message: "daysAhead must not exceed 30" })
|
|
daysAhead?: number;
|
|
}
|