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