Skip to content

Features/production tasks backend - #20

Merged
Bishopukpai merged 2 commits into
mainfrom
features/production-tasks-backend
Aug 28, 2026
Merged

Bishopukpai merged 2 commits into
mainfrom
features/production-tasks-backend

Conversation

@Bishopukpai

Copy link
Copy Markdown
Owner

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:

  • Task creation and assignment.
  • Task status transitions across standard production stages.
  • Priority levels and due-date tracking.
  • Contextual team discussions via task comments.
  • Automatic activity logs tracking task modifications and status updates.

Authenticated project members can now:

  • Create tasks scoped to specific projects and organizations.
  • Assign tasks to team members.
  • Transition tasks across statuses (BACKLOG, TODO, IN_PROGRESS, IN_REVIEW, DONE).
  • Set and update task priorities (LOW, MEDIUM, HIGH, URGENT).
  • Attach due dates to manage asset delivery timelines.
  • Comment on tasks to maintain clear production discussion threads.
  • View immutable task activity logs detailing who modified what and when.
  • Utilize a interactive Kanban task board and item detail slide-over.

📦 Changes Made

📦 Task Data Model

Added the task model (models/Task.ts) with nested comment and activity schemas.

The model establishes the relationship:

Organization
      ↓
   Project
      ↓
    Tasks
    ├── Comments
    └── Activity Audit Log

Each task document stores:

  • title
  • description
  • projectId
  • organizationId
  • assigneeId
  • createdById
  • status (BACKLOG | TODO | IN_PROGRESS | IN_REVIEW | DONE)
  • priority (LOW | MEDIUM | HIGH | URGENT)
  • dueDate
  • comments (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 a TASK_CREATED activity.
  • 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):

  • Multi-column Kanban interface rendering tasks under their respective status columns (Backlog, To Do, In Production, In Review, Done).
  • Priority indicator badges (LOW, MEDIUM, HIGH, URGENT).
  • Modal interface for creating new production tasks.
  • Slide-over drawer displaying comprehensive task details, inline status changers, interactive comment feeds, and an activity audit log.

💡 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:

npx tsc --noEmit

Expected result: 0 errors.

Linting

Run:

npm run lint

Expected result: 0 errors, 0 warnings.

Create a Task

Run the following in the browser console while authenticated:

fetch("/api/projects/YOUR_PROJECT_ID/tasks", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    title: "Render Sequence 04",
    description: "Final render pass for main scene",
    priority: "HIGH",
    status: "TODO",
    dueDate: "2026-09-15"
  })
})
  .then(async (res) => console.log("Response:", await res.json()))
  .catch(console.error);

Expected behavior: Task is created with an initial TASK_CREATED entry in its activity log.

Update Task Status & Priority

fetch("/api/tasks/YOUR_TASK_ID", {
  method: "PATCH",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    status: "IN_PROGRESS",
    priority: "URGENT"
  })
})
  .then(async (res) => console.log("Updated Task:", await res.json()))
  .catch(console.error);

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

fetch("/api/tasks/YOUR_TASK_ID", {
  method: "PATCH",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    comment: "Initial render pass complete, ready for review."
  })
})
  .then(async (res) => console.log("Task with comment:", await res.json()))
  .catch(console.error);

Expected behavior: Comment is added to the task's comments array with the authenticated user set as the author, and a COMMENT_ADDED activity is logged.


📋 Pre-Merge Checklist

  • Task model and TypeScript interfaces created
  • Task status and priority enums defined
  • Sub-schemas created for Comments and Activities
  • Task retrieval endpoint (GET) implemented with populated fields
  • Task creation endpoint (POST) implemented with initial activity logging
  • Task update endpoint (PATCH) implemented for field, status, and comment updates
  • Activity logging implemented for status, priority, assignment, and comment changes
  • Custom hook (useProjectTasks) created
  • Interactive Kanban Board component built
  • Task details drawer with activity and comment feeds created
  • npx tsc --noEmit passes
  • npm run lint passes
  • No credentials or secrets committed
  • No unrelated changes included

🔐 Security Notes

  • Task endpoints verify authentication via getServerSession(authOptions) before performing reads or writes.
  • Created tasks automatically inherit their parent project's organizationId, preventing cross-tenant data leakage.
  • Comment authors and activity actors are derived strictly from the server session (session.user.id) rather than untrusted client input.

🔄 Next Steps

  1. Drag-and-Drop Kanban Functionality: Integrate dnd-kit or @hello-pangea/dnd for smooth drag-and-drop status column updates.
  2. Task Filter & Search: Implement frontend filtering by priority, assignee, due date, and title search.
  3. File Attachment Support: Allow users to attach asset files or preview links directly to task comments.

@netlify

netlify Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for scenepilot ready!

Name Link
🔨 Latest commit 0e77e9b
🔍 Latest deploy log https://app.netlify.com/projects/scenepilot/deploys/6a9142ef84f2da0008a2f75e
😎 Deploy Preview https://deploy-preview-20--scenepilot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 894e22b0-3b04-4928-91d5-2f6c12ab3951


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Bishopukpai
Bishopukpai merged commit e5329b4 into main Aug 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant