feat: Implement file upload and management features in ProjectViewPage

This commit is contained in:
2025-09-24 21:55:44 +02:00
parent 0f451555d3
commit 96333ecced
7 changed files with 490 additions and 15 deletions

View File

@@ -4,10 +4,11 @@ import { withReadAuth, withUserAuth } from "@/lib/middleware/auth";
// GET: Get a specific task template
async function getTaskHandler(req, { params }) {
const { id } = await params;
try {
const template = db
.prepare("SELECT * FROM tasks WHERE task_id = ? AND is_standard = 1")
.get(params.id);
.get(id);
if (!template) {
return NextResponse.json(
@@ -27,6 +28,7 @@ async function getTaskHandler(req, { params }) {
// PUT: Update a task template
async function updateTaskHandler(req, { params }) {
const { id } = await params;
try {
const { name, max_wait_days, description } = await req.json();
@@ -40,7 +42,7 @@ async function updateTaskHandler(req, { params }) {
SET name = ?, max_wait_days = ?, description = ?
WHERE task_id = ? AND is_standard = 1`
)
.run(name, max_wait_days || 0, description || null, params.id);
.run(name, max_wait_days || 0, description || null, id);
if (result.changes === 0) {
return NextResponse.json(
@@ -60,10 +62,11 @@ async function updateTaskHandler(req, { params }) {
// DELETE: Delete a task template
async function deleteTaskHandler(req, { params }) {
const { id } = await params;
try {
const result = db
.prepare("DELETE FROM tasks WHERE task_id = ? AND is_standard = 1")
.run(params.id);
.run(id);
if (result.changes === 0) {
return NextResponse.json(