MCPcopy
hub / github.com/callumalpass/tasknotes / createTask

Method createTask

src/api/TasksController.ts:147–163  ·  view source on GitHub ↗
(req: HTTPRequestLike, res: HTTPResponseLike)

Source from the content-addressed store, hash-verified

145
146 @Post("/api/tasks")
147 async createTask(req: HTTPRequestLike, res: HTTPResponseLike): Promise<void> {
148 try {
149 const taskData = await this.parseRequestBody<TaskCreationData>(req);
150
151 if (!taskData.title || !taskData.title.trim()) {
152 this.sendResponse(res, 400, this.errorResponse("Title is required"));
153 return;
154 }
155
156 // TaskService.createTask() applies defaults automatically
157 const result = await this.taskService.createTask(taskData);
158
159 this.sendResponse(res, 201, this.successResponse(result.taskInfo));
160 } catch (error: unknown) {
161 this.sendResponse(res, 400, this.errorResponse(this.getErrorMessage(error)));
162 }
163 }
164
165 @Get("/api/tasks/:id")
166 async getTask(

Callers

nothing calls this directly

Calls 5

sendResponseMethod · 0.80
errorResponseMethod · 0.80
successResponseMethod · 0.80
createTaskMethod · 0.65
getErrorMessageMethod · 0.45

Tested by

no test coverage detected