Repository navigation
Features/production tasks backend - #20
Merged
Merged
Conversation
✅ Deploy Preview for scenepilot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task Backend API creation
🚀 ## Summary
Adds a complete production work-management system to track assets, assignments, priorities, status workflows, comments, and audit activities.
This PR extends the project system beyond membership and settings by introducing task-level execution workflows. Organization and project members can now create, assign, update, and monitor production tasks within specific projects, enabling full task lifecycle management from backlog to completion.
The implementation establishes a clear operational workflow for:
Authenticated project members can now:
BACKLOG,TODO,IN_PROGRESS,IN_REVIEW,DONE).LOW,MEDIUM,HIGH,URGENT).📦 Changes Made
📦 Task Data Model
Added the task model (
models/Task.ts) with nested comment and activity schemas.The model establishes the relationship:
Each task document stores:
titledescriptionprojectIdorganizationIdassigneeIdcreatedByIdstatus(BACKLOG|TODO|IN_PROGRESS|IN_REVIEW|DONE)priority(LOW|MEDIUM|HIGH|URGENT)dueDatecomments(author,content,createdAt)activities(actor,action,details,createdAt)🌐 Task API Routes
Implemented API endpoints for fetching, creating, updating, and commenting on tasks:
GET /api/projects/[projectId]/tasks: Fetches all tasks for a project with populated assignee, creator, comment author, and activity actor details.POST /api/projects/[projectId]/tasks: Creates a new task, validates project existence, scopes the task to the project's organization, and logs aTASK_CREATEDactivity.PATCH /api/tasks/[taskId]: Updates task fields (title, description, status, priority, assignee, due date) or appends a comment. Automatically appends audit entries to the task's activity log for status, priority, assignee, or comment changes.🎣 Custom Task Hook
Created
useProjectTasks(hooks/useProjectTasks.ts) to encapsulate state management, error state, task list updates, task creation, and patch actions for frontend integration.🎨 Production Tasks Kanban Board UI
Implemented
ProductionTasksBoard(components/ProductionTasksBoard.tsx):Backlog,To Do,In Production,In Review,Done).LOW,MEDIUM,HIGH,URGENT).💡 Why It Changed
Work Management Requires Dedicated Task Tracking
Projects need granular work units to manage actual production output. Project membership alone defines who is on the team, but tasks define what needs to be done, who is doing it, and when it is due.
Immutable Activity Logs Provide Auditability
In collaborative production environments, tracking status changes, priority shifts, and member reassignments is essential for operational clarity. Storing activity records inside each task guarantees an immediate audit trail without external audit dependencies.
🧪 How to Test
TypeScript Validation
Run:
Expected result: 0 errors.
Linting
Run:
Expected result: 0 errors, 0 warnings.
Create a Task
Run the following in the browser console while authenticated:
Expected behavior: Task is created with an initial
TASK_CREATEDentry in its activity log.Update Task Status & Priority
Expected behavior: Status and priority update successfully; two new entries (
STATUS_UPDATED,PRIORITY_UPDATED) are appended to the task's activity array.Add Task Comment
Expected behavior: Comment is added to the task's
commentsarray with the authenticated user set as the author, and aCOMMENT_ADDEDactivity is logged.📋 Pre-Merge Checklist
GET) implemented with populated fieldsPOST) implemented with initial activity loggingPATCH) implemented for field, status, and comment updatesuseProjectTasks) creatednpx tsc --noEmitpassesnpm run lintpasses🔐 Security Notes
getServerSession(authOptions)before performing reads or writes.organizationId, preventing cross-tenant data leakage.session.user.id) rather than untrusted client input.🔄 Next Steps
dnd-kitor@hello-pangea/dndfor smooth drag-and-drop status column updates.