feat: Add Projects management feature with CRUD API and UI#475
feat: Add Projects management feature with CRUD API and UI#475devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
- Add projects table to database schema (name, description, client_id, start_date, status) - Add Joi validation schemas for project create/update - Add full CRUD REST API endpoints at /api/projects - Add comprehensive backend tests (30 test cases) - Add Project TypeScript types and API client methods - Add ProjectsPage with table view, create/edit dialog, status chips - Add Projects navigation item in sidebar layout - Wire up /projects route in App.tsx
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
||
| const payload = { | ||
| name: formData.name, | ||
| description: formData.description || undefined, |
There was a problem hiding this comment.
🟡 Clearing project description in edit form has no effect because undefined is stripped from JSON payload
In handleSubmit, description: formData.description || undefined (line 165) converts an empty description string to undefined. When JSON.stringify serializes the payload for the HTTP request, undefined values are stripped entirely. This means the backend never receives a description field, so value.description !== undefined at backend/src/routes/projects.js:149 is false and the description column is never updated.
This is inconsistent with how startDate and clientId are handled in the same payload object (lines 166-167), which use || null — null survives JSON serialization and correctly triggers the backend update logic to clear the value. A user who opens a project with an existing description, clears the field, and submits will see no change on the server.
| description: formData.description || undefined, | |
| description: formData.description || '', |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Adds a full "Projects" management feature to the timesheet app, following existing codebase patterns established by the Clients feature.
Backend:
projectstable in SQLite schema with fields:name,description,client_id(FK → clients, ON DELETE SET NULL),start_date,status(active/completed/on-hold),user_email, timestampsprojectSchema,updateProjectSchema) with status enum validation/api/projects(list, get, create, update, delete, delete-all)client_namevia LEFT JOINFrontend:
Project,CreateProjectRequest,UpdateProjectRequestTypeScript typesProjectsPagewith MUI table, create/edit dialog (client dropdown, status select, date picker), color-coded status chips, bulk delete/projectsand sidebar nav itemReview & Testing Checklist for Human
client_idFK behavior: The backend does NOT validate thatclient_idreferences an existing client when creating/updating a project — it only relies on the DB foreign key constraint. Confirm this is acceptable or if an explicit existence check should be added (likeworkEntriesdoes forclient_id)client_idset to NULL (not cascade-deleted). Verify this matches your intended behaviorstart_datefield uses<input type="date">which produces locale-dependent date strings. Verify dates display correctly across timezonesNotes
active,completed,on-hold) are enforced at the Joi validation layer only, not via a SQLite CHECK constraint, consistent with how existing fields are handled.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/807671b41b9a4aa182c652463e0cf4e1