You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Blocks WebJamApps/JaMmusic#1254 "cannot create new gig error needs fixing immediately!" — Josh cannot post a newly booked gig. Production defect, both repos already on main.
Why
Since JaM's 3-path venue picker shipped, the "Pick Existing Venue" path sends venueId and deliberately sends empty strings for the legacy free-text fields (JaMmusic/src/containers/Music/Gigs/CreateGigDialog.tsx:65-76 passes '' for city and usState as literals; venue is only ever populated by the "No Venue (one-off)" editor).
This server still hard-requires those legacy fields, so every venue-linked gig is rejected:
src/AgController/index.ts:272 — if (gig && gig.datetime && gig.city && gig.usState && gig.venue) → else Invalid create gig data. This is the error Josh sees.
src/AgController/index.ts:308 — updateGig has the identical check (Invalid gig data), and JaMmusic/src/containers/Music/Gigs/EditGigDialog.tsx:101-105 hardcodes city:''/usState:'' on every save, so editing a venue-linked gig is broken the same way — create just fails first.
src/model/gig/gig-schema.ts:16 — venue: { type: String, required: true }. Even with the two checks relaxed, Mongoose rejects a venue-linked gig that has no free-text venue.
city/usState/venue are vestigial for the linked path: every consumer already resolves display values through the populated venue (JaMmusic/src/containers/Music/Gigs/gigs.utils.tsx:226-231, Gigs/index.tsx:26-55).
Scope
newGig (src/AgController/index.ts:272) — accept a gig when it has datetime AND (venueId OR a non-empty venue). Drop city/usState from the requirement entirely; they are display-only legacy and are resolved from the linked venue. Keep the same socketError/Invalid create gig data message shape on genuine failures.
updateGig (src/AgController/index.ts:308) — same rule, same reasoning. Keep the #253 rethrow behavior exactly as it is.
src/model/gig/gig-schema.ts:16 — venue becomes required: false. A gig is now identified by venueId OR venue; neither alone is mandatory at the schema layer, and the handler above is the gate.
Unit tests in test/AgController/index.spec.ts covering, for both create and update: venue-linked payload (venueId set, venue/city/usState empty) → succeeds; one-off payload (venue set, no venueId) → succeeds; neither venueId nor venue → still rejected with the existing message; missing datetime → still rejected.
Non-goals
No change to the legacy newTour/editTour message-name tolerance — it keeps working as-is.
No JaM/frontend changes. The companion frontend fix (EditGigDialog wiping city/usState on legacy gigs) is EditGigDialog wipes city/usState on one-off (no-venue) gigs JaMmusic#1275 "EditGigDialog wipes city/usState on one-off (no-venue) gigs" and is independent of this issue — neither blocks the other.
No data migration and no backfill of venueId onto old gigs.
web-jam-back/src/model/gig/gig-schema.ts:22 carries the same venue: required: true, but that process never creates gigs (gig-router.ts exposes only /:id/announce plus byId, and findByIdAndUpdate does not run validators by default), so it is dormant. Leave it alone here; a separate alignment issue can pick it up if it ever bites.
Acceptance criteria
Creating a gig with only datetime + venueId succeeds and publishes gigCreated.
Editing that gig with city/usState empty succeeds and publishes gigUpdated.
A one-off gig (free-text venue, no venueId) still creates and updates.
A payload with neither venueId nor venue still transmits socketError.
Full npm test green (lint + typecheck + coverage), not sub-scripts. Coverage gate stays at or above its current level.
Blocks WebJamApps/JaMmusic#1254 "cannot create new gig error needs fixing immediately!" — Josh cannot post a newly booked gig. Production defect, both repos already on
main.Why
Since JaM's 3-path venue picker shipped, the "Pick Existing Venue" path sends
venueIdand deliberately sends empty strings for the legacy free-text fields (JaMmusic/src/containers/Music/Gigs/CreateGigDialog.tsx:65-76passes''forcityandusStateas literals;venueis only ever populated by the "No Venue (one-off)" editor).This server still hard-requires those legacy fields, so every venue-linked gig is rejected:
src/AgController/index.ts:272—if (gig && gig.datetime && gig.city && gig.usState && gig.venue)→ elseInvalid create gig data. This is the error Josh sees.src/AgController/index.ts:308—updateGighas the identical check (Invalid gig data), andJaMmusic/src/containers/Music/Gigs/EditGigDialog.tsx:101-105hardcodescity:''/usState:''on every save, so editing a venue-linked gig is broken the same way — create just fails first.src/model/gig/gig-schema.ts:16—venue: { type: String, required: true }. Even with the two checks relaxed, Mongoose rejects a venue-linked gig that has no free-textvenue.city/usState/venueare vestigial for the linked path: every consumer already resolves display values through the populated venue (JaMmusic/src/containers/Music/Gigs/gigs.utils.tsx:226-231,Gigs/index.tsx:26-55).Scope
newGig(src/AgController/index.ts:272) — accept a gig when it hasdatetimeAND (venueIdOR a non-emptyvenue). Dropcity/usStatefrom the requirement entirely; they are display-only legacy and are resolved from the linked venue. Keep the samesocketError/Invalid create gig datamessage shape on genuine failures.updateGig(src/AgController/index.ts:308) — same rule, same reasoning. Keep the#253rethrow behavior exactly as it is.src/model/gig/gig-schema.ts:16—venuebecomesrequired: false. A gig is now identified byvenueIdORvenue; neither alone is mandatory at the schema layer, and the handler above is the gate.test/AgController/index.spec.tscovering, for both create and update: venue-linked payload (venueIdset,venue/city/usStateempty) → succeeds; one-off payload (venueset, novenueId) → succeeds; neithervenueIdnorvenue→ still rejected with the existing message; missingdatetime→ still rejected.Non-goals
newTour/editTourmessage-name tolerance — it keeps working as-is.city/usStateon legacy gigs) is EditGigDialog wipes city/usState on one-off (no-venue) gigs JaMmusic#1275 "EditGigDialog wipes city/usState on one-off (no-venue) gigs" and is independent of this issue — neither blocks the other.venueIdonto old gigs.web-jam-back/src/model/gig/gig-schema.ts:22carries the samevenue: required: true, but that process never creates gigs (gig-router.tsexposes only/:id/announceplusbyId, andfindByIdAndUpdatedoes not run validators by default), so it is dormant. Leave it alone here; a separate alignment issue can pick it up if it ever bites.Acceptance criteria
datetime+venueIdsucceeds and publishesgigCreated.city/usStateempty succeeds and publishesgigUpdated.venue, novenueId) still creates and updates.venueIdnorvenuestill transmitssocketError.npm testgreen (lint + typecheck + coverage), not sub-scripts. Coverage gate stays at or above its current level.