Files
xboct-flow/src/ports.ts
T

28 lines
897 B
TypeScript

import { Task } from "@/model/task";
export interface IFileSystem {
readFile(path: string): Promise<string>;
writeFile(path: string, content: string): Promise<void>;
deleteFile(path: string): Promise<void>;
readdir(path: string): Promise<string[]>;
mkdir(path: string): Promise<void>;
}
export interface ITaskRepository {
list(folderPath: string): Promise<Task[]>;
getById(folderPath: string, id: string): Promise<Task | undefined>;
create(
folderPath: string,
task: Omit<Task, "id" | "created" | "updated">,
): Promise<Task>;
update(folderPath: string, task: Task): Promise<void>;
delete(folderPath: string, id: string): Promise<void>;
/** Absolute/joined path for the task file in `folderPath`. */
getFilePath(folderPath: string, task: Task): string;
}
export interface IConfigProvider {
getProjectTaskPath(): string | undefined;
getGlobalTaskPath(): string | undefined;
}