feat: add agent task schema and CRUD API (closes #96, closes #97)

This commit is contained in:
Jason Woltje
2026-01-29 23:26:22 -06:00
parent 59aec28d5c
commit da4fb72902
13 changed files with 2534 additions and 4 deletions

View File

@@ -0,0 +1,48 @@
import { AgentTaskStatus, AgentTaskPriority } from "@prisma/client";
import {
IsOptional,
IsEnum,
IsInt,
Min,
Max,
IsString,
IsUUID,
} from "class-validator";
import { Type } from "class-transformer";
/**
* DTO for querying agent tasks with pagination and filters
*/
export class QueryAgentTasksDto {
@IsOptional()
@Type(() => Number)
@IsInt({ message: "page must be an integer" })
@Min(1, { message: "page must be at least 1" })
page?: number;
@IsOptional()
@Type(() => Number)
@IsInt({ message: "limit must be an integer" })
@Min(1, { message: "limit must be at least 1" })
@Max(100, { message: "limit must not exceed 100" })
limit?: number;
@IsOptional()
@IsEnum(AgentTaskStatus, { message: "status must be a valid AgentTaskStatus" })
status?: AgentTaskStatus;
@IsOptional()
@IsEnum(AgentTaskPriority, { message: "priority must be a valid AgentTaskPriority" })
priority?: AgentTaskPriority;
@IsOptional()
@IsString({ message: "agentType must be a string" })
agentType?: string;
@IsOptional()
@IsUUID("4", { message: "createdById must be a valid UUID" })
createdById?: string;
// Internal field set by controller/guard
workspaceId?: string;
}