Implement trackhasgenre relationship management

Add complete implementation for track-genre relationship management,
  following the established albumhasgenre pattern. This enables tracking
  which genres are associated with each track in the media library.

  Changes:
  - Fix trackhasgenre.proto: Correct CreateTrackHasGenreRequest to use
    fk_track_id instead of fk_album_id
  - Enhance TrackHasGenre model with nullable constraints, constructor,
    and toString method
  - Implement TrackHasGenreRepository with full CRUD operations
  - Implement TrackHasGenreService with business logic and validation
  - Add TrackHasGenreMapper for entity/protobuf conversion
  - Create action handlers:
    * CreateTrackHasGenreHandler (trackhasgenre.create)
    * DeleteTrackHasGenreHandler (trackhasgenre.delete)
    * GetTrackHasGenreByIdHandler (trackhasgenre.getById)
    * GetTrackHasGenreHandler (trackhasgenre.getAll)
  - Register TrackHasGenreService in DelegateActionManager for
    automatic handler discovery and dependency injection

  The implementation validates track and genre existence before creating
  relationships and provides proper error handling with appropriate HTTP
  status codes.

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

  Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Gustavo Henrique Santos Souza de Miranda
2025-12-09 02:24:40 -03:00
parent a804d76905
commit e0799828d0
10 changed files with 535 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
syntax = "proto3";
option java_package = "com.mediamanager.protocol.messages";
option java_outer_classname = "TrackHasGenreMessages";
package mediamanager.messages;
message TrackHasGenre{
int32 id = 1;
int32 fk_track_id = 2;
int32 fk_genre_id =3;
}
message CreateTrackHasGenreRequest {
int32 fk_track_id = 1;
int32 fk_genre_id = 2;
}
message CreateTrackHasGenreResponse {
TrackHasGenre trackhasgenre = 1;
}
message GetTrackHasGenresRequest {
}
message GetTrackHasGenresResponse {
repeated TrackHasGenre trackhasgenre = 1;
}
message GetTrackHasGenreByIdRequest {
int32 id = 1;
}
message GetTrackHasGenreByIdResponse {
TrackHasGenre trackhasgenre = 1;
}
message DeleteTrackHasGenreRequest {
int32 id = 1;
}
message DeleteTrackHasGenreResponse {
bool success = 1;
string message = 2;
}