Skip to content

(feature): adds production planning - #22

Merged
Bishopukpai merged 2 commits into
mainfrom
feature/production-planning
Aug 29, 2026
Merged

Bishopukpai merged 2 commits into
mainfrom
feature/production-planning

Conversation

@Bishopukpai

@Bishopukpai Bishopukpai commented Aug 29, 2026 •

Copy link
Copy Markdown
Owner

Production Planning Module & MongoDB API Integration

🚀 Summary

Introduces Production Planning features for ScenePilot, establishing a structured data layer to manage scenes, shoot schedules, filming locations, cast, and crew rosters.

This PR turns ScenePilot into an operational production hub by establishing normalized data schemas and single-table embedded document strategies using the native MongoDB driver. It implements automatic plan initialization alongside section-based atomic updates ($push) for scene breakdowns, location logging, cast/crew tracking, and shoot day scheduling.

The implementation establishes a clear operational workflow for:

  • Automatic creation and fetching of project-scoped production plans without requiring explicit initialization endpoints.

  • Atomic section updates (scenes, locations, cast, crew, shootDays) with automatic MongoDB ObjectId generation for sub-documents.

  • Data structure validation utilizing Zod schemas for production elements.

  • Reusable client-side state orchestration via custom React hooks.

  • Tabbed UI navigation allowing production teams to manage script breakdowns and call sheets in one place.

Authenticated project members can now:

  • Retrieve or automatically initialize a complete production breakdown plan for any project.

  • Add and review script scenes with scene numbers, descriptions, required equipment, and production notes.

  • Plan shoot days by linking dates, locations, assigned scenes, call times, and roster info.

  • Catalog shooting locations with physical addresses and associated scene numbers.

  • Maintain cast and crew directories with roles, contacts, availability, and department details.

📦 Changes Made

📦 Production Data Schemas & Validation

  • Defined TypeScript interfaces and Zod schemas (models/ProductionPlan.ts):

  • Established schemas for Scene, Location, Cast, Crew, and ShootDay.

  • Unified all production elements under a project-scoped schema structure (ProductionPlan).

🌐API Routes

Implemented native driver API endpoints (app/api/projects/[projectId]/production/route.ts):

- GET /api/projects/[projectId]/tasks (or /api/projects/[projectId]/production): Connects via native MongoClient, queries production_plans by projectId, and automatically upserts an empty document if none exists.

  • PATCH /api/projects/[projectId]/production: Accepts section (scenes | locations | cast | crew | shootDays) and item payload. Generates a new ObjectId for embedded items and appends it via $push while maintaining createdAt and updatedAt timestamps.

🧪How to Test

TypeScript & Linting Validation

Run:

npx tsc --noEmit
npm run lint

Expected result: 0 errors, 0 warnings.

Testing API via Browser Console

  1. Log into the application as an authenticated user.
  2. Open the browser console and test fetching/auto-creating a production plan:
fetch("/api/projects/YOUR_PROJECT_ID/production", {
  method: "GET",
  headers: { "Content-Type": "application/json" }
})
  .then(async (res) => console.log("GET Plan Response:", await res.json()))
  .catch(console.error);
Expected behavior: Returns a production plan object containing empty array fields and a valid _id.

Test adding a scene via PATCH:

fetch("/api/projects/YOUR_PROJECT_ID/production", {
  method: "PATCH",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    section: "scenes",
    item: {
      sceneNumber: "1A",
      description: "Exterior shot of headquarters at dawn",
      characters: ["Alex"],
      location: "Main HQ"
    }
  })
})
  .then(async (res) => console.log("PATCH Scene Response:", await res.json()))
  .catch(console.error);

Expected behavior: Returns the updated plan document with the new scene appended inside the scenes array, complete with an assigned _id.

📋 Pre-Merge Checklist

  • [x] Schema validation created for scenes, shoot days, locations, cast, and crew
  • [x] GET route implemented with native MongoClient driver and automatic document creation
  • [x] PATCH route implemented with $push section updates and { upsert: true }
  • [x] Section parameter validation added to prevent arbitrary document writes
  • [x] Native MongoDB driver connection compatibility verified
  • [x] npx tsc --noEmit passes
  • [x] npm run lint passes
  • [x] No credentials or environment variables committed

🔐 Security & Safety Notes

  • All production planning endpoints authenticate requests via getServerSession(authOptions).
  • Section validation ensures only whitelisted sub-arrays (scenes, locations, cast, crew, shootDays) can be targeted during PATCH operations.

🔄 Next Steps

Production Scheduling

Create:

  • Production calendar
  • Shoot calendar
  • Task deadlines
  • Shoot days
  • Milestones

@netlify

netlify Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for scenepilot ready!

Name Link
🔨 Latest commit e4c4b63
🔍 Latest deploy log https://app.netlify.com/projects/scenepilot/deploys/6a9226d0d6790b0008bc1465
😎 Deploy Preview https://deploy-preview-22--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 29, 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: 5eb3775d-a49b-4180-9f79-97333f0139a9


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 e521e9d into main Aug 29, 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