Skip to content

Gig create/update rejects venue-linked gigs (Invalid create gig data) - #257

Merged
JoshuaVSherman merged 1 commit into
devfrom
claude/256-gig-venue-linked-validation
Jul 29, 2026
Merged

Gig create/update rejects venue-linked gigs (Invalid create gig data)#257
JoshuaVSherman merged 1 commit into
devfrom
claude/256-gig-venue-linked-validation

Conversation

@JoshuaVSherman

Copy link
Copy Markdown
Contributor

Summary

  • Relax newGig's create guard (src/AgController/index.ts) to require datetime AND (venueId OR non-empty venue), dropping the hard city/usState/venue requirement that rejected every venue-linked gig from JaM's venue-picker.
  • Apply the identical rule to updateGig in the same file, keeping the Failed gig update reports nothing: updateGig swallows its error, so neither socketError nor gigUpdated is emitted #253 rethrow behavior untouched.
  • Relax src/model/gig/gig-schema.ts's venue field to required: false so Mongoose doesn't reject venue-linked docs that have no free-text venue.
  • Add create/update tests in test/AgController/index.spec.ts covering: venue-linked payload succeeds, one-off free-text-venue payload succeeds, neither venueId nor venue still rejected, missing datetime still rejected.

Closes #256

How to test locally

Run:

npm test

Expect: eslint 0 errors, typecheck clean, all vitest suites green.

Exercise the change itself with a local socketcluster-server client (or via JaM's UI once JaMmusic#1254 is unblocked): connect, authenticate, then emit newGig with a venue-linked payload:

socket.transmit('newGig', {
  token: adminToken,
  gig: { venueId: 'EXISTING_VENUE_ID', datetime: new Date(), venue: '', city: '', usState: '' },
});

Expect: server publishes gigCreated (no socketError). Repeat with editGig/gigId and confirm gigUpdated is published. Then emit a payload with neither venueId nor venue and confirm socketError with Invalid create gig data (or Invalid gig data for edit) is transmitted.

Test evidence

✖ 105 problems (0 errors, 105 warnings)

> webjamsocketserver@3.0.12 typecheck
> tsc --noEmit

> webjamsocketserver@3.0.12 test:unit
> vitest run

 Test Files  10 passed (10)
      Tests  99 passed (99)
   Start at  20:21:52
   Duration  43.91s (transform 818ms, setup 0ms, import 3.36s, tests 47.24s, environment 2ms)

🤖 Work by Claude Code — Sonnet 5

newGig/updateGig hard-required legacy city/usState/venue fields, so every
gig created via JaM's venue-picker (which sends venueId + empty legacy
fields) was rejected. Relax both guards to require datetime AND (venueId
OR non-empty venue), and drop the schema's venue required:true so Mongoose
doesn't reject venue-linked docs either.

Bump patch version 3.0.11 -> 3.0.12.
@JoshuaVSherman
JoshuaVSherman marked this pull request as ready for review July 29, 2026 00:25
@JoshuaVSherman
JoshuaVSherman merged commit daf4b6d into dev Jul 29, 2026
2 checks passed
@JoshuaVSherman
JoshuaVSherman deleted the claude/256-gig-venue-linked-validation branch July 29, 2026 00:25
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.

Gig create/update rejects venue-linked gigs (Invalid create gig data)

1 participant