feat: add domain layer
- Define Task entity and repository interface - Define State entity and repository interface
This commit is contained in:
parent
c539c9e01d
commit
7bf617bd4b
|
|
@ -0,0 +1,5 @@
|
|||
import type { TaskState } from "../task/task.entity.js";
|
||||
|
||||
export interface State {
|
||||
name: TaskState;
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import type { State } from "./state.entity.js";
|
||||
|
||||
export interface StateRepository {
|
||||
findAll(): Promise<State[]>;
|
||||
findByName(name: string): Promise<State | undefined>;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
export type TaskState = "new" | "active" | "resolved" | "closed";
|
||||
|
||||
export interface StateEntry {
|
||||
state: TaskState;
|
||||
date: string;
|
||||
}
|
||||
|
||||
export interface Task {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
dueDate: string;
|
||||
completed: boolean;
|
||||
deletedAt: Date | null;
|
||||
stateHistory: StateEntry[];
|
||||
notes: string[];
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import type { Task } from "./task.entity.js";
|
||||
|
||||
export interface TaskRepository {
|
||||
findAll(): Promise<Task[]>;
|
||||
findById(id: string): Promise<Task | undefined>;
|
||||
create(task: Task): Promise<Task>;
|
||||
update(id: string, updates: Partial<Task>): Promise<Task | undefined>;
|
||||
delete(id: string): Promise<boolean>;
|
||||
}
|
||||
Loading…
Reference in New Issue