MCPcopy Index your code
hub / github.com/TrafficGuard/typedai / CodeTaskRepository

Interface CodeTaskRepository

src/codeTask/codeTaskRepository.ts:6–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4 * Interface defining the persistence operations for Code tasks and presets.
5 */
6export interface CodeTaskRepository {
7 /**
8 * Saves a new CodeTask to the persistent store.
9 * Implementations should handle setting appropriate timestamps if not provided.
10 * @param codeTask The complete CodeTask object to save.
11 * @returns The ID of the saved codeTask.
12 * @throws Error if a codeTask with the same ID already exists.
13 */
14 createCodeTask(codeTask: CodeTask): Promise<string>;
15
16 /**
17 * Retrieves a specific CodeTask by its ID for a given user.
18 * @param userId The ID of the user owning the codeTask.
19 * @param codeTaskId The ID of the CodeTask to retrieve.
20 * @returns The CodeTask if found and authorized, otherwise null.
21 */
22 getCodeTask(userId: string, codeTaskId: string): Promise<CodeTask | null>;
23
24 /**
25 * Lists all CodeTasks for a specific user, ordered by creation date descending.
26 * @param userId The ID of the user whose codeTasks to list.
27 * @returns An array of CodeTasks.
28 */
29 listCodeTasks(userId: string): Promise<CodeTask[]>;
30
31 /**
32 * Updates specified fields of an existing CodeTask.
33 * Implementations should handle updating the 'updatedAt' timestamp.
34 * @param userId The ID of the user owning the codeTask.
35 * @param codeTaskId The ID of the CodeTask to update.
36 * @param updates An object containing the fields to update.
37 * @throws Error if the codeTask is not found for the user.
38 */
39 updateCodeTask(userId: string, codeTaskId: string, updates: UpdateCodeTaskData): Promise<void>;
40
41 /**
42 * Deletes a CodeTask by its ID for a given user.
43 * Should not throw an error if the codeTask doesn't exist.
44 * @param userId The ID of the user owning the codeTask.
45 * @param codeTaskId The ID of the CodeTask to delete.
46 */
47 deleteCodeTask(userId: string, codeTaskId: string): Promise<void>;
48
49 /**
50 * Saves a new CodeTaskPreset to the persistent store.
51 * Implementations should handle setting appropriate timestamps if not provided.
52 * @param preset The complete CodeTaskPreset object to save.
53 * @returns The ID of the saved preset.
54 * @throws Error if a preset with the same ID already exists.
55 */
56 saveCodeTaskPreset(preset: CodeTaskPreset): Promise<string>;
57
58 /**
59 * Lists all CodeTaskPresets for a specific user, ordered by creation date descending.
60 * @param userId The ID of the user whose presets to list.
61 * @returns An array of CodeTaskPresets.
62 */
63 listCodeTaskPresets(userId: string): Promise<CodeTaskPreset[]>;

Callers

nothing calls this directly

Implementers 6

PostgresCodeTaskRepositorysrc/modules/postgres/postgresCodeTaskR
MongoCodeTaskRepositorysrc/modules/mongo/MongoCodeTaskReposit
InMemoryCodeTaskRepositorysrc/modules/memory/inMemoryCodeTaskRep
FirestoreCodeTaskRepositorysrc/modules/firestore/firestoreCodeTas
CodeTaskServiceClientfrontend/src/app/modules/codeTask/code
CodeTaskServiceImplsrc/codeTask/codeTaskServiceImpl.ts

Calls

no outgoing calls

Tested by

no test coverage detected