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