Implement many-to-many movie sharing - #31
Merged
Merged
Conversation
Nottezz
commented
Aug 30, 2026
Owner
- 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
- 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
Codecov Report❌ Patch coverage is 📢 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.