Skip to content

fix: persist movie format flags, add VHS and Digital formats#86

Merged
mforce merged 3 commits into
mainfrom
fix/85-movie-format-flags
Jun 1, 2026
Merged

fix: persist movie format flags, add VHS and Digital formats#86
mforce merged 3 commits into
mainfrom
fix/85-movie-format-flags

Conversation

@mforce

@mforce mforce commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes movie format checkboxes not persisting after save, and adds two new formats: VHS and Digital.

Tracking issue: Closes #85

Bug fix

The frontend sends formats as a bitwise integer (e.g. 3 for DVD | Blu-ray) via fetch. The server's global JsonStringEnumConverter expected a string like "Dvd, BluRay" and silently fell back to None (0) when it received a number. Every format selection was lost on save.

Fix: Changed MovieDto.Formats from MovieFormat to int so the integer passes through JSON unchanged. Internal casts in ToDto/ApplyDto keep the domain model intact.

New formats

Added Vhs = 8 and Digital = 16 to the [Flags] MovieFormat enum. They appear as independent toggle buttons on the movie form alongside the existing DVD / Blu-ray / UHD Blu-ray options.

Verification

  • Server: 366/366 tests pass (3 new)
  • Client: build clean, 106/106 tests pass
  • ci-local: OK

Files changed

File Change
Collectify.Domain/Enums/MovieFormat.cs Added Vhs, Digital
Collectify.Api/Endpoints/MoviesEndpoints.cs DTO Formatsint, cast internally
client/services/types.ts Added VHS and Digital to type + flags array
tests/Api/MoviesEndpointsTests.cs 3 new tests for integer round-trip and new formats

@mforce mforce left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One doc follow-up before this disappears into the merge mist:

docs/data-model.md still says “All enums serialize as strings (already configured globally via JsonStringEnumConverter).” This PR intentionally makes movie formats cross the wire as an integer bitmask instead, and the issue is specifically about that contract. Please update the docs to call out MovieFormat/movie formats as the exception, otherwise the next pass through the data model docs could easily reintroduce the string enum behavior.

Code-wise this looks good to me: the DTO boundary now returns numeric flags, the new values are power-of-two flags, and the raw JSON integration tests cover create/update/new-format round-trips.

The frontend sends 'formats' as a bitwise integer (e.g. 3 for Dvd|BluRay)
but the global JsonStringEnumConverter expected a string like "Dvd, BluRay"
and silently fell back to None (0). Changing the DTO property from
MovieFormat to int lets the integer pass through JSON unchanged.

Also adds Vhs (8) and Digital (16) to the [Flags] enum.

Closes #85
@mforce mforce force-pushed the fix/85-movie-format-flags branch from 9fcfd03 to 875a4c5 Compare June 1, 2026 03:06
@mforce mforce merged commit b45d93e into main Jun 1, 2026
13 checks passed
@mforce mforce deleted the fix/85-movie-format-flags branch June 1, 2026 03:32
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.

Bug: Movie format selection not persisting after save

1 participant