feat: Add NoteForm, ProjectForm, and ProjectTaskForm components
- Implemented NoteForm for adding notes to projects. - Created ProjectForm for managing project details with contract selection. - Developed ProjectTaskForm for adding tasks to projects, supporting both templates and custom tasks. feat: Add ProjectTasksSection component - Introduced ProjectTasksSection to display and manage tasks for a specific project. - Includes functionality for adding, updating, and deleting tasks. feat: Create TaskTemplateForm for managing task templates - Added TaskTemplateForm for creating new task templates with required wait days. feat: Implement UI components - Created reusable UI components: Badge, Button, Card, Input, Loading, Navigation. - Enhanced user experience with consistent styling and functionality. feat: Set up database and queries - Initialized SQLite database with tables for contracts, projects, tasks, project tasks, and notes. - Implemented queries for managing contracts, projects, tasks, and notes. chore: Add error handling and loading states - Improved error handling in forms and data fetching. - Added loading states for better user feedback during data operations.
This commit is contained in:
22
src/app/api/projects/[id]/route.js
Normal file
22
src/app/api/projects/[id]/route.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import {
|
||||
getProjectById,
|
||||
updateProject,
|
||||
deleteProject,
|
||||
} from "@/lib/queries/projects";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(_, { params }) {
|
||||
const project = getProjectById(params.id);
|
||||
return NextResponse.json(project);
|
||||
}
|
||||
|
||||
export async function PUT(req, { params }) {
|
||||
const data = await req.json();
|
||||
updateProject(params.id, data);
|
||||
return NextResponse.json({ success: true });
|
||||
}
|
||||
|
||||
export async function DELETE(_, { params }) {
|
||||
deleteProject(params.id);
|
||||
return NextResponse.json({ success: true });
|
||||
}
|
||||
17
src/app/api/projects/route.js
Normal file
17
src/app/api/projects/route.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { getAllProjects, createProject } from "@/lib/queries/projects";
|
||||
import initializeDatabase from "@/lib/init-db";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
// Make sure the DB is initialized before queries run
|
||||
initializeDatabase();
|
||||
|
||||
export async function GET() {
|
||||
const projects = getAllProjects();
|
||||
return NextResponse.json(projects);
|
||||
}
|
||||
|
||||
export async function POST(req) {
|
||||
const data = await req.json();
|
||||
createProject(data);
|
||||
return NextResponse.json({ success: true });
|
||||
}
|
||||
Reference in New Issue
Block a user