39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import {
|
|
IsString,
|
|
IsOptional,
|
|
IsIn,
|
|
IsObject,
|
|
IsArray,
|
|
} from "class-validator";
|
|
|
|
/**
|
|
* DTO for querying chart widget data
|
|
*/
|
|
export class ChartQueryDto {
|
|
@IsString({ message: "chartType must be a string" })
|
|
@IsIn(["bar", "line", "pie", "donut"], {
|
|
message: "chartType must be one of: bar, line, pie, donut",
|
|
})
|
|
chartType!: "bar" | "line" | "pie" | "donut";
|
|
|
|
@IsString({ message: "dataSource must be a string" })
|
|
@IsIn(["tasks", "events", "projects"], {
|
|
message: "dataSource must be one of: tasks, events, projects",
|
|
})
|
|
dataSource!: "tasks" | "events" | "projects";
|
|
|
|
@IsString({ message: "groupBy must be a string" })
|
|
@IsIn(["status", "priority", "project", "day", "week", "month"], {
|
|
message: "groupBy must be one of: status, priority, project, day, week, month",
|
|
})
|
|
groupBy!: "status" | "priority" | "project" | "day" | "week" | "month";
|
|
|
|
@IsOptional()
|
|
@IsObject({ message: "filter must be an object" })
|
|
filter?: Record<string, unknown>;
|
|
|
|
@IsOptional()
|
|
@IsArray({ message: "colors must be an array" })
|
|
colors?: string[];
|
|
}
|