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

Method deleteTask

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

Source from the content-addressed store, hash-verified

223
224 @Delete("/api/tasks/:id")
225 async deleteTask(
226 req: HTTPRequestLike,
227 res: HTTPResponseLike,
228 params?: Record<string, string>
229 ): Promise<void> {
230 try {
231 const taskId = params?.id;
232 if (!taskId) {
233 this.sendResponse(res, 400, this.errorResponse("Task ID is required"));
234 return;
235 }
236
237 const task = await this.cacheManager.getTaskInfo(taskId);
238
239 if (!task) {
240 this.sendResponse(res, 404, this.errorResponse("Task not found"));
241 return;
242 }
243
244 await this.taskService.deleteTask(task);
245
246 this.sendResponse(
247 res,
248 200,
249 this.successResponse({ message: "Task deleted successfully" })
250 );
251 } catch (error: unknown) {
252 this.sendResponse(res, 500, this.errorResponse(this.getErrorMessage(error)));
253 }
254 }
255
256 @Post("/api/tasks/:id/toggle-status")
257 async toggleStatus(

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected