Initial release
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
export type TaskStatus = "pending" | "in-progress" | "blocked" | "done";
|
||||
|
||||
export interface Task {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
status: TaskStatus;
|
||||
parentId: number | null;
|
||||
childrenIds: number[];
|
||||
}
|
||||
|
||||
export interface TaskSnapshot {
|
||||
tasks: Task[];
|
||||
nextId: number;
|
||||
}
|
||||
|
||||
export interface AddTaskDraft {
|
||||
name: string;
|
||||
description: string;
|
||||
status?: TaskStatus;
|
||||
parentId?: number;
|
||||
children?: AddTaskDraft[];
|
||||
}
|
||||
|
||||
export interface TaskPatch {
|
||||
id: number;
|
||||
name?: string;
|
||||
description?: string;
|
||||
status?: TaskStatus;
|
||||
parentId?: number | null;
|
||||
position?: number;
|
||||
}
|
||||
|
||||
export interface TaskStats {
|
||||
total: number;
|
||||
pending: number;
|
||||
inProgress: number;
|
||||
blocked: number;
|
||||
done: number;
|
||||
}
|
||||
|
||||
export interface TaskToolDetails {
|
||||
action: "add" | "update" | "remove" | "list" | "get";
|
||||
snapshot: TaskSnapshot;
|
||||
affected: Task[];
|
||||
errors?: string[];
|
||||
}
|
||||
|
||||
export class TaskValidationError extends Error {
|
||||
readonly errors: string[];
|
||||
|
||||
constructor(errors: string[]) {
|
||||
super(errors.join("\n"));
|
||||
this.name = "TaskValidationError";
|
||||
this.errors = errors;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user