(req: http.IncomingMessage, res: http.ServerResponse, urlPath: string)
| 1354 | } |
| 1355 | |
| 1356 | private handleTaskUpdate(req: http.IncomingMessage, res: http.ServerResponse, urlPath: string): void { |
| 1357 | const taskId = urlPath.replace("/api/task/", ""); |
| 1358 | this.readBody(req, (body) => { |
| 1359 | try { |
| 1360 | const data = JSON.parse(body); |
| 1361 | const task = this.store.getTask(taskId); |
| 1362 | if (!task) { res.writeHead(404, { "Content-Type": "application/json" }); res.end(JSON.stringify({ error: "Task not found" })); return; } |
| 1363 | const newTitle = data.title ?? task.title; |
| 1364 | const newSummary = data.summary ?? task.summary; |
| 1365 | this.store.updateTask(taskId, { |
| 1366 | title: newTitle, |
| 1367 | summary: newSummary, |
| 1368 | status: data.status ?? task.status, |
| 1369 | endedAt: task.endedAt ?? undefined, |
| 1370 | }); |
| 1371 | this.embedTaskInBackground(taskId, `${newTitle ?? ""}: ${newSummary ?? ""}`); |
| 1372 | this.jsonResponse(res, { ok: true, taskId }); |
| 1373 | } catch (err) { |
| 1374 | res.writeHead(400, { "Content-Type": "application/json" }); |
| 1375 | res.end(JSON.stringify({ error: String(err) })); |
| 1376 | } |
| 1377 | }); |
| 1378 | } |
| 1379 | |
| 1380 | private async handleSkillDelete(res: http.ServerResponse, urlPath: string): Promise<void> { |
| 1381 | const skillId = urlPath.replace("/api/skill/", ""); |
no test coverage detected