MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / updateTask

Method updateTask

src/api/TasksController.ts:194–222  ·  view source on GitHub ↗
(
		req: HTTPRequestLike,
		res: HTTPResponseLike,
		params?: Record<string, string>
	)

Source from the content-addressed store, hash-verified

192
193 @Put("/api/tasks/:id")
194 async updateTask(
195 req: HTTPRequestLike,
196 res: HTTPResponseLike,
197 params?: Record<string, string>
198 ): Promise<void> {
199 try {
200 const taskId = params?.id;
201 if (!taskId) {
202 this.sendResponse(res, 400, this.errorResponse("Task ID is required"));
203 return;
204 }
205
206 const updates = await this.parseRequestBody<Partial<TaskInfo> & { details?: string }>(
207 req
208 );
209
210 const originalTask = await this.cacheManager.getTaskInfo(taskId);
211 if (!originalTask) {
212 this.sendResponse(res, 404, this.errorResponse("Task not found"));
213 return;
214 }
215
216 const updatedTask = await this.taskService.updateTask(originalTask, updates);
217
218 this.sendResponse(res, 200, this.successResponse(updatedTask));
219 } catch (error: unknown) {
220 this.sendResponse(res, 400, this.errorResponse(this.getErrorMessage(error)));
221 }
222 }
223
224 @Delete("/api/tasks/:id")
225 async deleteTask(

Callers

nothing calls this directly

Calls 6

sendResponseMethod · 0.80
errorResponseMethod · 0.80
successResponseMethod · 0.80
getTaskInfoMethod · 0.65
updateTaskMethod · 0.65
getErrorMessageMethod · 0.45

Tested by

no test coverage detected