( req: HTTPRequestLike, res: HTTPResponseLike, params?: Record<string, string> )
| 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( |
no test coverage detected