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

Method toggleArchive

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

Source from the content-addressed store, hash-verified

283
284 @Post("/api/tasks/:id/archive")
285 async toggleArchive(
286 req: HTTPRequestLike,
287 res: HTTPResponseLike,
288 params?: Record<string, string>
289 ): Promise<void> {
290 try {
291 const taskId = params?.id;
292 if (!taskId) {
293 this.sendResponse(res, 400, this.errorResponse("Task ID is required"));
294 return;
295 }
296
297 const task = await this.cacheManager.getTaskInfo(taskId);
298
299 if (!task) {
300 this.sendResponse(res, 404, this.errorResponse("Task not found"));
301 return;
302 }
303
304 const updatedTask = await this.taskService.toggleArchive(task);
305
306 this.sendResponse(res, 200, this.successResponse(updatedTask));
307 } catch (error: unknown) {
308 this.sendResponse(res, 400, this.errorResponse(this.getErrorMessage(error)));
309 }
310 }
311
312 @Post("/api/tasks/:id/complete-instance")
313 async completeRecurringInstance(

Callers 1

archiveTaskMethod · 0.45

Calls 5

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

Tested by

no test coverage detected