Skip to content

Add UserMediaList entity, migrations, and GraphQL mutations (#91)#92

Merged
vitorhugo-java merged 1 commit intomasterfrom
dev
Mar 31, 2026
Merged

Add UserMediaList entity, migrations, and GraphQL mutations (#91)#92
vitorhugo-java merged 1 commit intomasterfrom
dev

Conversation

@vitorhugo-java
Copy link
Copy Markdown
Owner

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/89ca0c56-ce40-4c65-acba-470f45c07fc0

  • Address review feedback: UUID v7 PK, remove media_type, add start/finish date, time_spent and note fields

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/f4eedc95-d767-47f2-9b4b-bdd6a2a7ebcc

  • Update src/main/resources/db/migration/V20__create_user_media_list_table.sql

  • Update src/main/resources/db/migration/V20__create_user_media_list_table.sql

  • Add @table uniqueConstraints to UserMediaListModel mirroring DB unique key

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/ebac41f8-5141-4192-9a6b-7b4b159c7e68

  • Add UserMediaListRepositoryTest @DataJpaTest and fix repository ID type to UUID

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/8bd217c1-398c-45a6-b66b-7e28bdd3e4b6


Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/351aff6c-9b13-4dca-aef3-e683b0ea4838


Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/966cc80e-e90b-49a2-9d9a-b85e965a0d61

  • Replace findAllMediaStatuses with findUserMediaLibrary query

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/84a154b0-59cd-4de9-a7f8-41a3a6ae9ce6

  • Add statusId, genreId, mediaId, categoryName filters to findUserMediaLibrary

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/b6f2c08a-c3ac-49e3-a959-88a442a3d3fe

  • Change MediaStatusModel.id to Integer, add V22 migration, fix Javadoc

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/bbdd08fd-8299-45d3-9df2-a15df46d6d4d

  • Fix CAST enum comparison and trim string filters in controller

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/431e8586-ce41-497c-8ad3-9f342e15e524


Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/18f5c822-c6fb-49ea-9fe5-aae0c61b4a39

  • Update src/main/java/com/espacogeek/geek/services/impl/UserLibraryServiceImpl.java

  • Merge 75-the-heart-of-the-tracker: refactor to UserMediaListModel, add private_list, add mutations and privacy-aware userId support

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/05f2c046-5eb1-4e38-b149-5c9d578ba82c

  • Update src/main/resources/graphql/mutation.graphqls

  • Add AccessDeniedException (3403) and NotFoundException (3404); update resolver, README, and tests

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/f1182947-602f-4761-9667-4bfd55668bab


Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/ad983dcd-9d2c-4f14-b46f-713fd081da3b

  • Update src/main/java/com/espacogeek/geek/services/impl/UserMediaListServiceImpl.java

  • Update src/main/java/com/espacogeek/geek/services/impl/UserMediaListServiceImpl.java

  • Update src/main/java/com/espacogeek/geek/services/impl/UserCustomStatusServiceImpl.java

  • Update src/main/java/com/espacogeek/geek/services/impl/UserMediaListServiceImpl.java

  • fix: update Javadoc status example from WATCHING to IN_PROGRESS

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/26a2018d-bdf3-431b-a7f1-8a7807dfebba

  • fix: use InputValidationException for validation errors; validate custom status name; atomic delete

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/5e4e945f-eb96-4619-8347-1da8d030d410

  • feat: add custom status list relationship to UserMediaList and update userMediaProgress

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/95adaabd-b150-4134-a469-96ce8b907866

  • Rename mutations, add StatusType enum, add UserMediaList fields
  • Rename userMediaProgress → upsertUserMedia in controller, service, schema, and tests
  • Rename UserStatus CRUD mutations/query → UserCustomStatus variants
  • Change UpdateUserMediaInput.status from String to StatusType enum
    • Create StatusType.graphqls enum definition
    • Remove validateStatus() (GraphQL schema now enforces enum validity)
    • Use .name() instead of .toUpperCase() in applyUpdates()
  • Add rewatchCount, isPrivate, personalNotes to UserMediaListModel
    • V26 migration to add columns to user_media_list
    • Add fields to UserMediaList.graphqls type and UpdateUserMediaInput
    • Handle new fields in UserMediaListServiceImpl.applyUpdates()
  • Update tests: unquote enum values, add new-fields test, replace invalid-status test
  • Fix personalNotes column type: use VARCHAR(2000) to match model length constraint

  • Update src/main/java/com/espacogeek/geek/services/impl/UserMediaListServiceImpl.java

  • Update src/main/resources/graphql/entity/UserMediaList.graphqls



* Add UserMediaList entity, Flyway migration, and persistence tests (#86)

* Initial plan

* Create UserMediaList entity, migration V20, and repository

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/89ca0c56-ce40-4c65-acba-470f45c07fc0

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

* Address review feedback: UUID v7 PK, remove media_type, add start/finish date, time_spent and note fields

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/f4eedc95-d767-47f2-9b4b-bdd6a2a7ebcc

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

* Update src/main/resources/db/migration/V20__create_user_media_list_table.sql

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/main/resources/db/migration/V20__create_user_media_list_table.sql

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add @table uniqueConstraints to UserMediaListModel mirroring DB unique key

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/ebac41f8-5141-4192-9a6b-7b4b159c7e68

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

* Add UserMediaListRepositoryTest @DataJpaTest and fix repository ID type to UUID

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/8bd217c1-398c-45a6-b66b-7e28bdd3e4b6

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>
Co-authored-by: Vitor Hugo <vitorhugoalvesferreira@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add MediaStatus entity and CategoryType/StatusType enums; refactor MediaCategoryModel name field (#87)

* Initial plan

* Add MediaStatus entity, CategoryType and StatusType enums, refactor MediaCategoryModel

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/351aff6c-9b13-4dca-aef3-e683b0ea4838

Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>

* feat: GraphQL query for user media library (findUserMediaLibrary) (#88)

* Initial plan

* Implement GraphQL queries for MediaStatus

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/966cc80e-e90b-49a2-9d9a-b85e965a0d61

Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>

* Replace findAllMediaStatuses with findUserMediaLibrary query

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/84a154b0-59cd-4de9-a7f8-41a3a6ae9ce6

Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>

* Add statusId, genreId, mediaId, categoryName filters to findUserMediaLibrary

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/b6f2c08a-c3ac-49e3-a959-88a442a3d3fe

Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>

* Change MediaStatusModel.id to Integer, add V22 migration, fix Javadoc

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/bbdd08fd-8299-45d3-9df2-a15df46d6d4d

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

* Fix CAST enum comparison and trim string filters in controller

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/431e8586-ce41-497c-8ad3-9f342e15e524

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>
Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

* Implement GraphQL mutations and query for user media library management (#89)

* Initial plan

* Implement GraphQL mutations addMediaToUserLibrary and removeMediaFromUserLibrary with tests

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/18f5c822-c6fb-49ea-9fe5-aae0c61b4a39

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

* Update src/main/java/com/espacogeek/geek/services/impl/UserLibraryServiceImpl.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Merge 75-the-heart-of-the-tracker: refactor to UserMediaListModel, add private_list, add mutations and privacy-aware userId support

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/05f2c046-5eb1-4e38-b149-5c9d578ba82c

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

* Update src/main/resources/graphql/mutation.graphqls

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add AccessDeniedException (3403) and NotFoundException (3404); update resolver, README, and tests

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/f1182947-602f-4761-9667-4bfd55668bab

Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>
Co-authored-by: Vitor Hugo <vitorhugoalvesferreira@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>

* Implement upsertUserMedia mutation, update StatusType, add UserCustomStatus CRUD, link custom statuses to media library entries, and add new UserMediaList fields (#90)

* Initial plan

* Implement GraphQL mutation for user media progress and custom status CRUD

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/ad983dcd-9d2c-4f14-b46f-713fd081da3b

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

* Update src/main/java/com/espacogeek/geek/services/impl/UserMediaListServiceImpl.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/main/java/com/espacogeek/geek/services/impl/UserMediaListServiceImpl.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/main/java/com/espacogeek/geek/services/impl/UserCustomStatusServiceImpl.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/main/java/com/espacogeek/geek/services/impl/UserMediaListServiceImpl.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: update Javadoc status example from WATCHING to IN_PROGRESS

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/26a2018d-bdf3-431b-a7f1-8a7807dfebba

Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>

* fix: use InputValidationException for validation errors; validate custom status name; atomic delete

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/5e4e945f-eb96-4619-8347-1da8d030d410

Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>

* feat: add custom status list relationship to UserMediaList and update userMediaProgress

Agent-Logs-Url: https://github.com/EspacoGeek-Teams/SpringAPI_EspacoGeek/sessions/95adaabd-b150-4134-a469-96ce8b907866

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

* Rename mutations, add StatusType enum, add UserMediaList fields

- Rename userMediaProgress → upsertUserMedia in controller, service, schema, and tests
- Rename UserStatus CRUD mutations/query → UserCustomStatus variants
- Change UpdateUserMediaInput.status from String to StatusType enum
  - Create StatusType.graphqls enum definition
  - Remove validateStatus() (GraphQL schema now enforces enum validity)
  - Use .name() instead of .toUpperCase() in applyUpdates()
- Add rewatchCount, isPrivate, personalNotes to UserMediaListModel
  - V26 migration to add columns to user_media_list
  - Add fields to UserMediaList.graphqls type and UpdateUserMediaInput
  - Handle new fields in UserMediaListServiceImpl.applyUpdates()
- Update tests: unquote enum values, add new-fields test, replace invalid-status test

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

* Fix personalNotes column type: use VARCHAR(2000) to match model length constraint

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>

* Update src/main/java/com/espacogeek/geek/services/impl/UserMediaListServiceImpl.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/main/resources/graphql/entity/UserMediaList.graphqls

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>
Co-authored-by: Vitor Hugo <vitorhugoalvesferreira@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: vitorhugo-java <65777252+vitorhugo-java@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: AbigailGeovana <142514517+AbigailGeovana@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 31, 2026 21:48
@vitorhugo-java vitorhugo-java merged commit 7aaf215 into master Mar 31, 2026
7 of 10 checks passed
@github-actions github-actions Bot added documentation Improvements or additions to documentation backend tests database configuration labels Mar 31, 2026
@github-actions
Copy link
Copy Markdown

Qodana for JVM

5 new problems were found

Inspection name Severity Problems
Constant values 🔶 Warning 3
Unnecessary 'null' check before method call 🔶 Warning 1
Unused assignment 🔶 Warning 1
View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2025.3.2
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a user media library feature end-to-end (DB → JPA → services → GraphQL), including privacy controls, custom per-user status labels, and additional library-entry fields.

Changes:

  • Add UserMediaList persistence model + Flyway migrations (create table, add privacy/rewatch/custom-status fields).
  • Add GraphQL query/mutations for library management (findUserMediaLibrary, addMediaToUserLibrary, removeMediaFromUserLibrary, upsertUserMedia) and custom status CRUD.
  • Introduce CategoryType / StatusType enums and wire MediaStatus onto Media.

Reviewed changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/test/java/com/espacogeek/geek/services/MediaServicePersistenceIntegrationTest.java Updates category setup to use CategoryType enum
src/test/java/com/espacogeek/geek/repositories/UserMediaListRepositoryTest.java Adds JPA persistence tests for UserMediaListRepository
src/test/java/com/espacogeek/geek/query/userstatus/UserStatusQueryTest.java Adds GraphQL query tests for custom statuses
src/test/java/com/espacogeek/geek/query/usermedialist/UserMediaLibraryQueryTest.java Adds GraphQL query tests for user media library filtering/privacy
src/test/java/com/espacogeek/geek/mutation/userstatus/UserStatusMutationTest.java Adds GraphQL mutation tests for custom status CRUD
src/test/java/com/espacogeek/geek/mutation/usermedialist/UserMediaListMutationTest.java Adds GraphQL mutation tests for library add/remove/upsert
src/main/resources/graphql/query.graphqls Adds findUserMediaLibrary + getUserCustomStatuses schema entries
src/main/resources/graphql/mutation.graphqls Adds library and custom-status mutations to schema
src/main/resources/graphql/entity/UserStatus.graphqls Adds UserStatus GraphQL type
src/main/resources/graphql/entity/UserMediaList.graphqls Adds UserMediaList type + UpdateUserMediaInput input
src/main/resources/graphql/entity/user.graphqls Exposes privateList on User GraphQL type
src/main/resources/graphql/entity/StatusType.graphqls Adds StatusType GraphQL enum
src/main/resources/graphql/entity/MediaStatus.graphqls Adds MediaStatus GraphQL type
src/main/resources/graphql/entity/Media.graphqls Exposes mediaStatus field on Media GraphQL type
src/main/resources/db/migration/V26__add_rewatch_count_is_private_personal_notes.sql Adds rewatch/private/personal-notes columns to user_media_list
src/main/resources/db/migration/V25__add_custom_status_to_user_media_list.sql Adds custom_status_id FK to user_media_list
src/main/resources/db/migration/V24__update_status_types_and_add_date_planned.sql Adds date_planned, updates status values, creates user_custom_statuses
src/main/resources/db/migration/V23__add_private_list_to_users.sql Adds private_list column to users
src/main/resources/db/migration/V22__change_media_status_id_to_int.sql Migrates media_status.id (and medias.status_id) to INT
src/main/resources/db/migration/V21__add_media_status.sql Creates media_status table + medias.status_id FK; migrates category strings
src/main/resources/db/migration/V20__create_user_media_list_table.sql Creates user_media_list table and constraints
src/main/java/com/espacogeek/geek/types/UpdateUserMediaInput.java Adds Java input DTO for upsertUserMedia
src/main/java/com/espacogeek/geek/services/UserMediaListService.java Adds service API for library query/add/remove/upsert
src/main/java/com/espacogeek/geek/services/UserCustomStatusService.java Adds service API for custom status CRUD
src/main/java/com/espacogeek/geek/services/MediaStatusService.java Adds service API for media statuses
src/main/java/com/espacogeek/geek/services/impl/UserMediaListServiceImpl.java Implements library query/add/remove/upsert logic
src/main/java/com/espacogeek/geek/services/impl/UserCustomStatusServiceImpl.java Implements custom status CRUD + validation
src/main/java/com/espacogeek/geek/services/impl/MediaStatusServiceImpl.java Implements MediaStatusService.findAll()
src/main/java/com/espacogeek/geek/repositories/UserMediaListRepository.java Adds repository + filter JPQL + delete-by-user/media
src/main/java/com/espacogeek/geek/repositories/UserLibraryRepository.java Adds @Repository annotation
src/main/java/com/espacogeek/geek/repositories/UserCustomStatusRepository.java Adds repository methods for user-scoped custom statuses
src/main/java/com/espacogeek/geek/repositories/MediaStatusRepository.java Adds repository for MediaStatusModel
src/main/java/com/espacogeek/geek/models/UserModel.java Adds privateList column mapping
src/main/java/com/espacogeek/geek/models/UserMediaListModel.java Adds UserMediaListModel entity with UUID PK and new fields
src/main/java/com/espacogeek/geek/models/UserCustomStatusModel.java Adds UserCustomStatusModel entity
src/main/java/com/espacogeek/geek/models/StatusType.java Adds StatusType enum
src/main/java/com/espacogeek/geek/models/MediaStatusModel.java Adds MediaStatusModel entity (mapped to media_status)
src/main/java/com/espacogeek/geek/models/MediaModel.java Adds mediaStatus relation to MediaModel
src/main/java/com/espacogeek/geek/models/MediaCategoryModel.java Refactors category field to CategoryType enum
src/main/java/com/espacogeek/geek/models/CategoryType.java Adds CategoryType enum
src/main/java/com/espacogeek/geek/exception/resolver/GenericExceptionResolver.java Adds new exception→errorCode mappings (2005/3403/3404), improves validation messages
src/main/java/com/espacogeek/geek/exception/NotFoundException.java Adds NotFoundException
src/main/java/com/espacogeek/geek/exception/MediaAlreadyInLibraryException.java Adds MediaAlreadyInLibraryException
src/main/java/com/espacogeek/geek/exception/AccessDeniedException.java Adds AccessDeniedException
src/main/java/com/espacogeek/geek/data/api/impl/TvSeriesApiImpl.java Adjusts MediaModel constructor call for new mediaStatus slot
src/main/java/com/espacogeek/geek/data/api/impl/MovieAPIImpl.java Adjusts MediaModel constructor call for new mediaStatus slot
src/main/java/com/espacogeek/geek/controllers/UserStatusController.java Adds GraphQL controller for custom status query/mutations
src/main/java/com/espacogeek/geek/controllers/UserMediaListController.java Adds GraphQL controller for library query/mutations + privacy checks
README.md Documents new error codes in README table

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +79 to +83
@Column(name = "rewatch_count", columnDefinition = "INT DEFAULT 0")
private Integer rewatchCount;

@Column(name = "is_private", columnDefinition = "TINYINT(1) DEFAULT 0")
private Boolean isPrivate;
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

rewatch_count and is_private are NOT NULL in the DB (V26), but these fields are nullable in the entity and have no Java-side defaults. Hibernate will typically include null values in INSERTs, which can override the DB defaults and cause DataIntegrityViolationException when persisting new entries that don’t explicitly set these fields. Consider making these fields non-nullable (nullable = false) and initializing them (field initializers / @PrePersist), or use primitive types so inserts consistently satisfy the schema.

Suggested change
@Column(name = "rewatch_count", columnDefinition = "INT DEFAULT 0")
private Integer rewatchCount;
@Column(name = "is_private", columnDefinition = "TINYINT(1) DEFAULT 0")
private Boolean isPrivate;
@Column(name = "rewatch_count", columnDefinition = "INT DEFAULT 0", nullable = false)
private int rewatchCount = 0;
@Column(name = "is_private", columnDefinition = "TINYINT(1) DEFAULT 0", nullable = false)
private boolean isPrivate = false;

Copilot uses AI. Check for mistakes.
Comment on lines +56 to +61
UserMediaListModel entry = new UserMediaListModel();
entry.setUser(user);
entry.setMedia(media);
entry.setStatus("watching");
entry.setProgress(5);

Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

This test persists UserMediaListModel without setting rewatchCount / isPrivate. With migration V26 those columns are NOT NULL, so the persist may fail depending on how Hibernate generates the INSERT (it often sends NULLs, bypassing DB defaults). Either set these fields in the test, or ensure the entity initializes them before insert.

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +11
-- Update status values in media_status table: rename WATCHING -> IN_PROGRESS and PLAN_TO_WATCH -> PLANNING
UPDATE `media_status` SET `name` = 'IN_PROGRESS' WHERE `name` = 'WATCHING';
UPDATE `media_status` SET `name` = 'PLANNING' WHERE `name` = 'PLAN_TO_WATCH';

-- Insert PAUSED status if it does not already exist
INSERT INTO `media_status` (`name`) SELECT 'PAUSED' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `media_status` WHERE `name` = 'PAUSED');

Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

This migration updates rows in media_status to user-tracking values (WATCHING→IN_PROGRESS, PLAN_TO_WATCH→PLANNING, inserts PAUSED). However media_status is also used as a FK from medias.status_id and is described in the GraphQL schema as the media’s production/release status. Renaming/adding these values can silently corrupt existing media production status data. If these are intended as user library statuses, they should not be stored in media_status (or should be a separate table), and this migration should only transform user_media_list.status / related user-library data.

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +37
@Enumerated(EnumType.STRING)
@Column(name = "name")
private StatusType name;
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

MediaStatusModel.name is mapped to the StatusType enum (PLANNING/IN_PROGRESS/...), but this entity is exposed on Media.mediaStatus and documented as production/release status. Using the user-library tracking enum here both constrains DB values to those constants and couples two different domains; it will also fail to read any existing media_status.name values that don’t match the enum exactly. Consider using a dedicated enum/type for media production status (or a plain String) and keep user tracking status separate.

Suggested change
@Enumerated(EnumType.STRING)
@Column(name = "name")
private StatusType name;
@Column(name = "name")
private String name;

Copilot uses AI. Check for mistakes.
Comment on lines +88 to +93
if (categoryNameTrimmed != null) {
try {
categoryType = CategoryType.valueOf(categoryNameTrimmed.toUpperCase());
} catch (IllegalArgumentException e) {
throw new GenericException("Invalid categoryName: " + categoryNameTrimmed);
}
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

Invalid categoryName is currently mapped to GenericException, which the GenericExceptionResolver reports as errorCode 5000 (server error). This is a client input validation issue, so it should throw InputValidationException (2004) or, better, change the GraphQL schema to accept CategoryType as an enum so invalid values are rejected at schema validation time.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +23
* @param userId the ID of the authenticated user
* @param status optional user tracking status string filter (e.g. "watching", "completed")
* @param statusId optional media production status ID filter (MediaStatusModel.id)
* @param categoryId optional media category ID filter
* @param categoryName optional media category name filter (e.g. {@link CategoryType#ANIME})
* @param genreId optional genre ID filter
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

Javadoc for status still references values like "watching"/"completed", but the new GraphQL input and service logic use StatusType values (e.g. PLANNING/IN_PROGRESS/PAUSED). Updating this prevents confusion for callers and keeps the contract accurate.

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +24
* status string, status ID (media's production status), media category ID,
* category name, genre ID, genre name, media ID, media name, and alternative title.
*
* @param userId the ID of the authenticated user (required)
* @param status optional user tracking status string filter (case-insensitive exact match)
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

Repository Javadoc describes the status filter as values like "watching"/"completed", but the mutation/input now uses StatusType values (PLANNING/IN_PROGRESS/...). Updating the comment will avoid misleading API consumers and keep docs consistent with current status semantics.

Suggested change
* status string, status ID (media's production status), media category ID,
* category name, genre ID, genre name, media ID, media name, and alternative title.
*
* @param userId the ID of the authenticated user (required)
* @param status optional user tracking status string filter (case-insensitive exact match)
* user tracking status (from {@code StatusType}, stored as a string), status ID (media's
* production status), media category ID, category name, genre ID, genre name, media ID,
* media name, and alternative title.
*
* @param userId the ID of the authenticated user (required)
* @param status optional user tracking status filter, as the string value corresponding
* to the {@code StatusType} enum (e.g. {@code "PLANNING"}, {@code "IN_PROGRESS"});
* compared using a case-insensitive exact match

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend configuration database documentation Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants