feat(shot-status): bulk-assign selected shots to an artist
Deploy / deploy (push) Successful in 6m30s
Deploy / deploy (push) Successful in 6m30s
Adds an "Assign Artist" entry to the bulk actions menu, backed by a bulkAssignArtist server action. The action re-checks the target user server-side — a deactivated account or a CLIENT is rejected rather than trusted from the picker — and passing null clears the assignment, so reassignment and hand-back are the same flow. Like single-shot assignment in updateShot this writes the column and sends no notification, so reshuffling a batch during planning stays quiet. Also renders the Artist column the page was already querying but never showing; without it there was no way to see the result of an assignment. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,15 @@ async function getEpisodeDueDatesForProject(projectId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
/** Everyone a shot can be handed to — clients and deactivated accounts excluded. */
|
||||
async function getAssignableArtists() {
|
||||
return db.user.findMany({
|
||||
where: { isActive: true, role: { not: "CLIENT" } },
|
||||
select: { id: true, name: true, email: true, image: true },
|
||||
orderBy: { name: "asc" },
|
||||
});
|
||||
}
|
||||
|
||||
async function getShotsForProject(projectId: string) {
|
||||
return db.shot.findMany({
|
||||
where: { projectId },
|
||||
@@ -62,10 +71,11 @@ export default async function ShotStatusPage({
|
||||
const { projectId } = await searchParams;
|
||||
const canManage = ["ADMIN", "PRODUCER", "SUPERVISOR"].includes(session.user.role);
|
||||
|
||||
const [projects, shots, episodeDueDates] = await Promise.all([
|
||||
const [projects, shots, episodeDueDates, artists] = await Promise.all([
|
||||
getProjects(),
|
||||
projectId ? getShotsForProject(projectId) : Promise.resolve([]),
|
||||
projectId ? getEpisodeDueDatesForProject(projectId) : Promise.resolve([]),
|
||||
canManage ? getAssignableArtists() : Promise.resolve([]),
|
||||
]);
|
||||
|
||||
const selectedProject = projects.find((p) => p.id === projectId) ?? null;
|
||||
@@ -77,6 +87,7 @@ export default async function ShotStatusPage({
|
||||
selectedProject={selectedProject}
|
||||
shots={shots as any}
|
||||
episodeDueDates={episodeDueDates}
|
||||
artists={artists}
|
||||
canManage={canManage}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user