feat: Implement file upload and management features in ProjectViewPage
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user