Link event staffing shifts to ticketed events with auto pre-fill
Shift.ticketedEventId (nullable FK to TicketedEvent) persists the
link between a staffing shift and its parent event. The shift list
response now includes the linked event (id, slug, title, date) so
the admin UI can show context without a second request.
The Create/Edit Shift drawer gains a conditional Event picker that
only appears when kind is EVENT_STAFFING. Picking an event pre-fills
the form's date, startTime, endTime, and location (venue name +
address) — and seeds the title with "Staff: {event.title}" only if
the title field is still empty, so hand-typed overrides aren't
stomped. Switching kind away from EVENT_STAFFING clears the link.
The shifts table's Kind tag wraps in a tooltip showing the linked
event title when one is present, so organizers can see at a glance
which staffing shifts belong to which event without opening the
drawer.
Bunker Admin
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "shifts" ADD COLUMN "ticketed_event_id" TEXT;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "shifts" ADD CONSTRAINT "shifts_ticketed_event_id_fkey" FOREIGN KEY ("ticketed_event_id") REFERENCES "ticketed_events"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
@@ -876,6 +876,10 @@ model Shift {
|
||||
cutId String?
|
||||
cut Cut? @relation(fields: [cutId], references: [id], onDelete: SetNull)
|
||||
|
||||
// Event linkage (EVENT_STAFFING shifts)
|
||||
ticketedEventId String? @map("ticketed_event_id")
|
||||
ticketedEvent TicketedEvent? @relation("EventStaffingShifts", fields: [ticketedEventId], references: [id], onDelete: SetNull)
|
||||
|
||||
// Repeating shift series
|
||||
seriesId String?
|
||||
series ShiftSeries? @relation(fields: [seriesId], references: [id], onDelete: SetNull)
|
||||
@@ -5009,11 +5013,12 @@ model TicketedEvent {
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
// Relations
|
||||
createdBy User @relation("EventCreator", fields: [createdByUserId], references: [id])
|
||||
meeting Meeting? @relation("EventMeeting", fields: [meetingId], references: [id], onDelete: SetNull)
|
||||
ticketTiers TicketTier[] @relation("EventTiers")
|
||||
tickets Ticket[] @relation("EventTickets")
|
||||
checkIns CheckIn[] @relation("EventCheckIns")
|
||||
createdBy User @relation("EventCreator", fields: [createdByUserId], references: [id])
|
||||
meeting Meeting? @relation("EventMeeting", fields: [meetingId], references: [id], onDelete: SetNull)
|
||||
ticketTiers TicketTier[] @relation("EventTiers")
|
||||
tickets Ticket[] @relation("EventTickets")
|
||||
checkIns CheckIn[] @relation("EventCheckIns")
|
||||
staffingShifts Shift[] @relation("EventStaffingShifts")
|
||||
|
||||
@@index([status], map: "idx_ticketed_events_status")
|
||||
@@index([date], map: "idx_ticketed_events_date")
|
||||
|
||||
Reference in New Issue
Block a user