We need to update how shotcodes are generated and stored. to do this: projects need a new field called - showId (1–10 chars, `[A-Z0-9_]`, uppercase) - projectType (`STANDARD` or `EPISODIC`) # Shot Naming Conventions ## Shot Code Format Shot codes are auto-generated on creation ### Standard Project ``` {SHOW_ID}_{SCENE}_{SHOT_NUMBER} ``` Example: `PRJX_10_0010` ### Episodic Project ``` {SHOW_ID}_{EPISODE}_{SCENE}_{SHOT_NUMBER} ``` Example: `PRJX_101_10_0010` --- ## Segments | Segment | Source | Notes | |---|---|---| | `SHOW_ID` | `Project.showId` | 1–10 chars, letters/numbers/underscores, stored uppercase. Set once on the project. | | `EPISODE` | `Shot.episode` | Only present on `EPISODIC` projects. Free-text, stored uppercase (e.g. `EP01`). | | `SCENE` | `Shot.scene` | Required on every shot. Stored uppercase (e.g. `SC010`). | | `SHOT_NUMBER` | Auto-incremented | 4-digit zero-padded integer, increments by 10 (e.g. `0010`, `0020`). | --- ## Auto-Incrementing Shot Numbers The shot number is scoped to the **scene within a project** (and additionally to the **episode** for episodic projects): - On create, the system queries `MAX(shotNumber)` for all shots sharing the same `projectId + scene` (+ `episode` for episodic). - The new shot number = `MAX + 10`, starting at `0010` when no prior shots exist in that scene. - The number is zero-padded to 4 digits. This means shot numbers are **non-contiguous by design** — gaps allow shots to be inserted between existing ones without renumbering. When a shot is **duplicated**, it inherits the scene/episode of the original and receives the next available shot number in that scope. Only the trailing 4-digit segment in the code is replaced; the rest of the code is preserved. --- ## Where Fields Come From | Field | Model | Required? | |---|---|---| | `showId` | `Project` | Yes — validated 1–10 chars, `[A-Z0-9_]` | | `projectCode` | `Project` | Yes — unique across all projects, used for billing/reference (not in shot code) | | `projectType` | `Project` | Yes — `STANDARD` or `EPISODIC`; controls whether episode segment is included | | `scene` | `Shot` | Yes — required by `shotSchema` | | `episode` | `Shot` | Optional — only meaningful (and included in code) when `projectType === EPISODIC` | | `shotGroup` | `Shot` | Optional — organisational grouping only, not part of the shot code | --- ## Notes - `projectCode` is a separate billing/admin identifier on the Project and does **not** appear in shot codes. Shot codes use `showId` instead. - Shot codes are not regenerated on edit — if scene or episode values change after creation, the stored `shotCode` will not reflect those changes. - All string segments are uppercased before being written into the code.