mindpm 1.2.21 → 1.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +22 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1022,6 +1022,25 @@ var getTaskHistory = async (_req, res, params) => {
|
|
|
1022
1022
|
).all(params.id);
|
|
1023
1023
|
sendJson(res, 200, rows);
|
|
1024
1024
|
};
|
|
1025
|
+
var createSession = async (req, res, params) => {
|
|
1026
|
+
const db2 = getDb();
|
|
1027
|
+
const body = await parseBody(req);
|
|
1028
|
+
if (!body.summary || typeof body.summary !== "string") {
|
|
1029
|
+
sendJson(res, 400, { error: "summary is required" });
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
const project = db2.prepare("SELECT id FROM projects WHERE id = ?").get(params.pid);
|
|
1033
|
+
if (!project) {
|
|
1034
|
+
sendJson(res, 404, { error: "Project not found" });
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
const id = generateId();
|
|
1038
|
+
db2.prepare(
|
|
1039
|
+
"INSERT INTO sessions (id, project_id, summary, next_steps) VALUES (?, ?, ?, ?)"
|
|
1040
|
+
).run(id, params.pid, body.summary, body.next_steps ?? null);
|
|
1041
|
+
const session = db2.prepare("SELECT * FROM sessions WHERE id = ?").get(id);
|
|
1042
|
+
sendJson(res, 201, session);
|
|
1043
|
+
};
|
|
1025
1044
|
var listDecisions = async (_req, res, params) => {
|
|
1026
1045
|
const db2 = getDb();
|
|
1027
1046
|
const rows = db2.prepare("SELECT * FROM decisions WHERE project_id = ? ORDER BY created_at DESC").all(params.pid);
|
|
@@ -1031,6 +1050,7 @@ var routes = [
|
|
|
1031
1050
|
{ method: "GET", pattern: "/api/projects", handler: listProjects },
|
|
1032
1051
|
{ method: "GET", pattern: "/api/projects/:id", handler: getProject },
|
|
1033
1052
|
{ method: "PATCH", pattern: "/api/projects/:id", handler: updateProject },
|
|
1053
|
+
{ method: "POST", pattern: "/api/projects/:pid/sessions", handler: createSession },
|
|
1034
1054
|
{ method: "GET", pattern: "/api/projects/:pid/decisions", handler: listDecisions },
|
|
1035
1055
|
{ method: "GET", pattern: "/api/projects/:pid/tasks", handler: listTasks },
|
|
1036
1056
|
{ method: "POST", pattern: "/api/projects/:pid/tasks", handler: createTask },
|
|
@@ -1161,13 +1181,13 @@ function startHttpServer(port) {
|
|
|
1161
1181
|
}
|
|
1162
1182
|
});
|
|
1163
1183
|
server2.on("error", (err) => {
|
|
1164
|
-
_httpPort = null;
|
|
1165
1184
|
if (err.code === "EADDRINUSE") {
|
|
1166
1185
|
process.stderr.write(
|
|
1167
|
-
`[mindpm]
|
|
1186
|
+
`[mindpm] Port ${port} already in use. Kanban UI served by existing process at http://localhost:${port}
|
|
1168
1187
|
`
|
|
1169
1188
|
);
|
|
1170
1189
|
} else {
|
|
1190
|
+
_httpPort = null;
|
|
1171
1191
|
process.stderr.write(`[mindpm] HTTP server error: ${err.message}
|
|
1172
1192
|
`);
|
|
1173
1193
|
}
|