Many-to-many movie sharing - #32
Merged
Merged
Conversation
- Add UserMovie join table with per-user watched/note/rating state
- Migrate watched/note/rating fields from Movie to UserMovie
- Add POST/DELETE /movies/{slug}/join endpoints
- Update MovieRead schema with is_joined and joined_by fields
- Update GET /movies/ to include creator's own unpublished movies
- Add join/leave actions and joined-by list on frontend
- Restrict title/description/year edits to owner only
- Remove redundant get_or_create_user_movie wrapper
- Remove unnecessary DB queries in delete_movie (204 response)
- Fix dead movie-is-None guard in update_movie_metadata
- Add many-to-many integration tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tract test - Add cascade="all, delete-orphan", passive_deletes=True to User.joined_movies so SQLAlchemy correctly deletes UserMovie rows (NOT NULL FK) on user delete in test teardown, preventing UserAlreadyExists in subsequent tests - Add is_joined and joined_by to expected_fields in test_movie_read_fields_contract to match new MovieRead schema fields added in this PR Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without cascade="all, delete-orphan" on User.movies, SQLAlchemy tried to SET NULL on movie.user_id (NOT NULL) when deleting a user in test teardown. This caused an IntegrityError, the user was never deleted, and subsequent tests failed with UserAlreadyExists. Adding cascade="all, delete-orphan" causes SQLAlchemy to delete the user''s movies first, avoiding the FK violation. UserMovies for those movies are then handled by DB-level ON DELETE CASCADE (already defined on movie_id FK). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Guard against None user in joined_by list after cascade delete - Add confirm_deleted_rows=False to UserMovie mapper to avoid StaleDataError - Enable PRAGMA foreign_keys=ON for SQLite test engine Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmtbBBZ9em68FUGqwvpiu7
config.default.yaml is provided at runtime via volume mount at /config.default.yaml, matching ROOT_DIR expected by Settings. The COPY was unreachable (outside build context) and also targeted the wrong path (/app/ vs /). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmtbBBZ9em68FUGqwvpiu7
only_mine=True now filters strictly by creator (Movie.user_id), joined movies appear only in the all-movies view (only_mine=False). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmtbBBZ9em68FUGqwvpiu7
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmtbBBZ9em68FUGqwvpiu7
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
JOIN /movies/{slug}/joinandDELETE /movies/{slug}/joinendpointsonly_minefilter to show only created movies (not joined)COPY ../config.default.yamloutside build contextTest plan
only_mine=False— shows all published movies + own unpublishedonly_mine=True— shows only movies created by the current useris_joined=true🤖 Generated with Claude Code