@hasna/todos 0.5.0 → 0.5.1
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/cli/index.js +36 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -8179,12 +8179,15 @@ function createFetchHandler(getPort, dashboardDir, dashboardExists) {
|
|
|
8179
8179
|
const status = url.searchParams.get("status");
|
|
8180
8180
|
const priority = url.searchParams.get("priority");
|
|
8181
8181
|
const projectId = url.searchParams.get("project_id");
|
|
8182
|
+
const planId = url.searchParams.get("plan_id");
|
|
8182
8183
|
if (status)
|
|
8183
8184
|
filter.status = status;
|
|
8184
8185
|
if (priority)
|
|
8185
8186
|
filter.priority = priority;
|
|
8186
8187
|
if (projectId)
|
|
8187
8188
|
filter.project_id = projectId;
|
|
8189
|
+
if (planId)
|
|
8190
|
+
filter.plan_id = planId;
|
|
8188
8191
|
const tasks = listTasks(filter);
|
|
8189
8192
|
const projectCache = new Map;
|
|
8190
8193
|
const planCache = new Map;
|
|
@@ -8547,6 +8550,39 @@ function createFetchHandler(getPort, dashboardDir, dashboardExists) {
|
|
|
8547
8550
|
return json({ error: e instanceof Error ? e.message : "Failed to delete plan" }, 500, port);
|
|
8548
8551
|
}
|
|
8549
8552
|
}
|
|
8553
|
+
const projectGetMatch = path.match(/^\/api\/projects\/([^/]+)$/);
|
|
8554
|
+
if (projectGetMatch && method === "GET") {
|
|
8555
|
+
try {
|
|
8556
|
+
const id = projectGetMatch[1];
|
|
8557
|
+
const project = getProject(id);
|
|
8558
|
+
if (!project)
|
|
8559
|
+
return json({ error: "Project not found" }, 404, port);
|
|
8560
|
+
return json(project, 200, port);
|
|
8561
|
+
} catch (e) {
|
|
8562
|
+
return json({ error: e instanceof Error ? e.message : "Failed to get project" }, 500, port);
|
|
8563
|
+
}
|
|
8564
|
+
}
|
|
8565
|
+
const projectPatchMatch = path.match(/^\/api\/projects\/([^/]+)$/);
|
|
8566
|
+
if (projectPatchMatch && method === "PATCH") {
|
|
8567
|
+
try {
|
|
8568
|
+
const id = projectPatchMatch[1];
|
|
8569
|
+
const contentLength = parseInt(req.headers.get("content-length") || "0", 10);
|
|
8570
|
+
if (contentLength > MAX_BODY_SIZE)
|
|
8571
|
+
return json({ error: "Request body too large" }, 413, port);
|
|
8572
|
+
const body = await parseJsonBody(req);
|
|
8573
|
+
if (!body)
|
|
8574
|
+
return json({ error: "Invalid JSON" }, 400, port);
|
|
8575
|
+
const project = updateProject(id, {
|
|
8576
|
+
name: typeof body.name === "string" ? body.name : undefined,
|
|
8577
|
+
description: typeof body.description === "string" ? body.description : body.description === null ? "" : undefined,
|
|
8578
|
+
task_list_id: typeof body.task_list_id === "string" ? body.task_list_id : body.task_list_id === null ? "" : undefined
|
|
8579
|
+
});
|
|
8580
|
+
return json(project, 200, port);
|
|
8581
|
+
} catch (e) {
|
|
8582
|
+
const status = e instanceof Error && e.name === "ProjectNotFoundError" ? 404 : 500;
|
|
8583
|
+
return json({ error: e instanceof Error ? e.message : "Failed to update project" }, status, port);
|
|
8584
|
+
}
|
|
8585
|
+
}
|
|
8550
8586
|
const projectDeleteMatch = path.match(/^\/api\/projects\/([^/]+)$/);
|
|
8551
8587
|
if (projectDeleteMatch && method === "DELETE") {
|
|
8552
8588
|
try {
|