Commit Graph

106 Commits

Author SHA1 Message Date
Gustavo Henrique Miranda ba3e1eb19a
Merge pull request #29 from gmbrax/feature/Implement-track-management
Merge pull request #28 from gmbrax/develop
2025-12-09 19:43:55 -03:00
Gustavo Henrique Miranda c62c5a20b3
Update src/main/java/com/mediamanager/model/TrackHasComposer.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-09 19:33:52 -03:00
Gustavo Henrique Santos Souza de Miranda 2ee94c8331 Fix missing closing braces in Delete handlers
Fix compilation errors caused by missing or malformed class-closing braces
  in three Delete handler classes. These syntax errors prevented the classes
  from compiling properly.

  Changes:
  - DeleteTrackHasGenreHandler: Remove duplicate closing brace at line 62
    and ensure proper class-closing brace structure
  - DeleteTrackHasArtistHandler: Add missing class-closing brace at end of file
  - DeleteTrackHasComposerHandler: Add missing class-closing brace at end of file

  All three handlers now have correct brace structure:
    - Catch block closing brace (8 spaces indentation)
    - handle() method closing brace (4 spaces indentation)
    - Class closing brace (0 spaces indentation)

  This ensures all three classes compile successfully without syntax errors.

  Modified:
  - src/main/java/com/mediamanager/service/delegate/handler/trackhasgenre/DeleteTrackHasGenreHandler.java
  - src/main/java/com/mediamanager/service/delegate/handler/trackhasartist/DeleteTrackHasArtistHandler.java
  - src/main/java/com/mediamanager/service/delegate/handler/trackhascomposer/DeleteTrackHasComposerHandler.java

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

  Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-09 19:25:49 -03:00
Gustavo Henrique Santos Souza de Miranda be24b68923 Add ID validation to GetTrackHasGenreByIdHandler
Add validation to reject ID values <= 0 in GetTrackHasGenreByIdHandler
  before calling the service layer. This prevents the protobuf default value
  of 0 from being processed, which would incorrectly pass the null check in
  the service but represents an invalid ID.

  Changes:
  - Extract ID from GetTrackHasGenreByIdRequest and validate id <= 0
  - Throw IllegalArgumentException with message "ID must be greater than 0"
    if validation fails
  - Add specific catch block for IllegalArgumentException that returns
    HTTP 400 status code with "Validation error: " prefix
  - Mirrors validation pattern from CreateTrackHasGenreHandler

  This aligns with validation patterns used in similar handlers throughout
  the codebase (GetTrackHasArtistByIdHandler, GetTrackHasComposerByIdHandler)
  and ensures consistent error handling for invalid ID inputs.

  Modified:
  - src/main/java/com/mediamanager/service/delegate/handler/trackhasgenre/GetTrackHasGenreByIdHandler.java

  🤖 Generated with [Claude Code](https://claude.com/claude-code)
2025-12-09 19:21:04 -03:00
Gustavo Henrique Miranda 19ddf262df
Update src/main/java/com/mediamanager/service/delegate/handler/trackhasgenre/GetTrackHasGenreByIdHandler.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-09 19:18:40 -03:00
Gustavo Henrique Miranda b2571de6ad
Update src/main/java/com/mediamanager/model/TrackHasGenre.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-09 19:15:46 -03:00
Gustavo Henrique Miranda b759f0f770
Update src/main/java/com/mediamanager/service/delegate/handler/trackhasartist/DeleteTrackHasArtistHandler.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-09 19:15:25 -03:00
Gustavo Henrique Miranda e994f4ef70
Update src/main/java/com/mediamanager/service/delegate/handler/trackhascomposer/DeleteTrackHasComposerHandler.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-09 19:14:54 -03:00
Gustavo Henrique Miranda 1bbbc4f2db
Update src/main/java/com/mediamanager/model/TrackHasArtist.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-09 19:14:37 -03:00
Gustavo Henrique Santos Souza de Miranda 80ee003fc9 Implement trackhascomposer relationship management
Add complete implementation for track-composer relationship management,
  following the established trackhasgenre pattern. This enables tracking
  which composers are associated with each track in the media library.

  Changes:
  - Enhance TrackHasComposer model: Add @Entity and @Table annotations,
    nullable constraints, constructor, and toString method
  - Implement TrackHasComposerRepository with full CRUD operations
  - Implement TrackHasComposerService with business logic and validation
  - Add TrackHasComposerMapper for entity/protobuf conversion
  - Create action handlers:
    * CreateTrackHasComposerHandler (trackhascomposer.create)
    * DeleteTrackHasComposerHandler (trackhascomposer.delete)
    * GetTrackHasComposerByIdHandler (trackhascomposer.getById)
    * GetTrackHasComposerHandler (trackhascomposer.getAll)
  - Register TrackHasComposerService in DelegateActionManager for
    automatic handler discovery and dependency injection
  - Proto file (trackhascomposer.proto) was already correct

  The implementation validates track and composer 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>
2025-12-09 16:43:47 -03:00
Gustavo Henrique Santos Souza de Miranda 7fd3c3e9f7 Implement trackhasartist relationship management
Add complete implementation for track-artist relationship management,
  following the established albumhasgenre pattern. This enables tracking
  which artists are associated with each track in the media library.

  Changes:
  - Fix TrackHasArtist model: Rename from TrackHasArtistt.java (typo)
    and correct table name from "trackhasgenre" to "trackhasartist"
  - Implement TrackHasArtistRepository with full CRUD operations
  - Implement TrackHasArtistService with business logic and validation
  - Add TrackHasArtistMapper for entity/protobuf conversion
  - Create action handlers:
    * CreateTrackHasArtistHandler (trackhasartist.create)
    * DeleteTrackHasArtistHandler (trackhasartist.delete)
    * GetTrackHasArtistByIdHandler (trackhasartist.getById)
    * GetTrackHasArtistHandler (trackhasartist.getAll)
  - Register TrackHasArtistService in DelegateActionManager for
    automatic handler discovery and dependency injection
  - Proto file (trackhasartist.proto) was already correct

  The implementation validates track and artist 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>
2025-12-09 02:44:57 -03:00
Gustavo Henrique Santos Souza de Miranda e0799828d0 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>
2025-12-09 02:24:40 -03:00
Gustavo Henrique Miranda a804d76905
Merge pull request #28 from gmbrax/develop
Develop
2025-12-08 20:59:28 -03:00
Gustavo Henrique Miranda ae6f522901
Merge pull request #27 from gmbrax/fix/fix-CreateDiscHandler-Extra-Brace
Fix/fix create disc handler extra brace
2025-12-08 20:58:06 -03:00
Gustavo Henrique Santos Souza de Miranda fd71114426 Fix extra closing brace in CreateDiscHandler
Remove duplicate closing brace at end of CreateDiscHandler.java
  that was causing a syntax error.
2025-12-08 20:55:45 -03:00
Gustavo Henrique Miranda 2e0a39a455
Merge pull request #26 from gmbrax/develop
Develop
2025-12-08 20:51:38 -03:00
Gustavo Henrique Miranda eebe142b8c
Merge branch 'feature/Implement-track-management' into develop 2025-12-08 20:51:21 -03:00
Gustavo Henrique Miranda 4073c53b3d
Merge pull request #25 from gmbrax/feature/Implement-disc-management
Implement Disc entity with complete CRUD operations
2025-12-08 20:49:08 -03:00
Gustavo Henrique Santos Souza de Miranda 8208b58b34 Implement Track entity with complete CRUD operations
Add full Track implementation following the established pattern from Disc and Album entities.

  Components added:
  - Track entity model with relationships to Disc, Composer, BitDepth, BitRate, and SamplingRate
  - TrackRepository for data access layer with full CRUD operations
  - TrackService with business logic and validation
  - TrackMapper for protobuf/entity conversion
  - track.proto with all protobuf message definitions
  - Five action handlers: Create, GetAll, GetById, Update, Delete
  - TrackService registration in DelegateActionManager

  The Track entity supports:
  - Required fields: trackNumber, title, filepath, discId
  - Optional fields: duration, composerId, bitDepthId, bitRateId, samplingRateId
  - Full transaction management and error handling
  - Proper validation and logging throughout all layers
2025-12-08 20:43:08 -03:00
Gustavo Henrique Miranda dfa4185e64
Update src/main/java/com/mediamanager/service/delegate/handler/disc/CreateDiscHandler.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-08 20:42:23 -03:00
Gustavo Henrique Santos Souza de Miranda 07f7405b03 Implement Disc entity with complete CRUD operations
Add full implementation for Disc entity following existing patterns:
  - Create Disc model with Album relationship
  - Add DiscRepository for data persistence
  - Implement DiscService with business logic
  - Create DiscMapper for protobuf conversion
  - Add all handler classes (Create, Get, GetById, Update, Delete)
  - Register DiscService in DelegateActionManager
  - Define disc.proto with all message types

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

  Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-08 17:45:04 -03:00
Gustavo Henrique Miranda 61c5124d27
Merge pull request #24 from gmbrax/fix/fix-broken-album-method
Fix broken removeGenre implementation in Album entity
2025-12-08 00:39:31 -03:00
Gustavo Henrique Santos Souza de Miranda 8119530bef Fix broken removeGenre to correct logic for the null-pointer exception 2025-12-08 00:37:05 -03:00
Gustavo Henrique Santos Souza de Miranda 09d20efba6 Fix broken removeGenre to avoid possible null-pointer 2025-12-08 00:33:23 -03:00
Gustavo Henrique Santos Souza de Miranda bcd03fc7ce Fix broken removeGenre implementation in Album entity 2025-12-08 00:22:42 -03:00
Gustavo Henrique Miranda d70fae0719
Merge pull request #23 from gmbrax/feature/Implement-Album-Management
Implement Album management with full CRUD operations
2025-12-08 00:16:02 -03:00
Gustavo Henrique Miranda 9e3516aacb
Enhance genre removal logic in Album class
Update removeGenre method to check for null IDs.
2025-12-08 00:14:51 -03:00
Gustavo Henrique Miranda 7b7d1e7348
Update src/main/java/com/mediamanager/model/Album.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-08 00:11:47 -03:00
Gustavo Henrique Santos Souza de Miranda e51d5aa678 Add bidirectional Genre relationship to Album entity
This commit extends the Album entity with bidirectional relationship
  management for the AlbumHasGenre join table, enabling many-to-many
  associations between albums and genres with convenient helper methods.

  Key enhancements:

  Relationship Mapping:
  - Added OneToMany relationship from Album to AlbumHasGenre
    * Bidirectional mapping with cascade ALL and orphan removal
    * Maintains collection of album-genre associations
    * Initialized as ArrayList to prevent null pointer exceptions
    * Follows the same pattern as albumArtists relationship

  Helper Methods for Genre Management:
  - addGenre(Genre genre):
    * Creates AlbumHasGenre join table entry
    * Sets bidirectional references to Album and Genre
    * Adds association to albumGenres collection
    * Simplifies adding genres to albums programmatically

  - removeGenre(Genre genre):
    * Removes association by comparing genre IDs
    * Safely handles null checks
    * Uses removeIf for clean collection manipulation
    * Maintains referential integrity

  - getGenres():
    * Convenience method to extract Genre list from join table
    * Uses Java streams for clean transformation
    * Maps AlbumHasGenre → Genre
    * Returns List<Genre> for easy consumption

  Collection Management:
  - Added getAlbumGenres() getter
    * Returns full List<AlbumHasGenre> for direct access
    * Useful for repository-level operations

  - Added setAlbumGenres() setter
    * Allows bulk replacement of genre associations
    * Required by JPA for entity hydration

  Benefits:
  - Enables navigating from Album to associated Genres
  - Simplifies genre association management in service layer
  - Cascade operations ensure join table entries are managed automatically
  - Orphan removal prevents orphaned join table entries
  - Consistent API with existing Artist relationship methods
  - Type-safe genre management through helper methods

  Pattern Consistency:
  This implementation mirrors the albumArtists relationship structure,
  providing a consistent API for managing both artist and genre associations
  on the Album entity. Both relationships use the same cascade and orphan
  removal strategies for reliable data integrity.

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

  Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

  This commit message is ready to use in IntelliJ for the Album.java changes!
2025-12-07 23:31:07 -03:00
Gustavo Henrique Santos Souza de Miranda a102b24ecd Implement AlbumHasGenre relationship management with CRUD operations
This commit introduces the AlbumHasGenre join table entity management,
  establishing the many-to-many relationship between Album and Genre
  entities. This implementation follows the established repository pattern
  used for other join table entities like AlbumHasArtist.

  Key components implemented:

  Model Layer:
  - AlbumHasGenre entity representing the join table
  - ManyToOne relationships to Album and Genre entities
  - JPA annotations with proper foreign key constraints (nullable = false)
  - Complete getters and setters
  - Custom toString method for debugging

  Repository Layer:
  - AlbumHasGenreRepository with EntityManager-based operations
  - Full transaction management with proper rollback handling
  - Methods: save, findAll, findById, deleteById
  - No update method (join tables typically only need create/delete)

  Service Layer:
  - AlbumHasGenreService with business logic and validation
  - Constructor injection of AlbumHasGenreRepository, AlbumRepository, GenreRepository
  - Relationship validation: ensures both Album and Genre exist before creating association
  - Input validation for null/invalid IDs
  - ID validation for all operations requiring entity lookup
  - Comprehensive logging using Log4j2

  Mapper Layer:
  - AlbumHasGenreMapper for bidirectional entity/protobuf conversion
  - Foreign key mapping for Album and Genre relationships
  - Null safety checks and validation
  - Proper handling of optional ID field

  Action Handlers:
  - CreateAlbumHasGenreHandler (albumhasgenre.create)
  - GetAlbumHasGenreHandler (albumhasgenre.getAll)
  - GetAlbumHasGenreByIdHandler (albumhasgenre.getById)
  - DeleteAlbumHasGenreHandler (albumhasgenre.delete)
  - HTTP status code handling: 200 (success), 400 (validation),
    404 (not found), 500 (server error)
  - No update handler as join tables typically only require create/delete operations

  Protocol Buffers:
  - Complete proto definition with AlbumHasGenreMessages
  - Messages support fk_album_id and fk_genre_id foreign keys
  - CRUD message definitions (Create, Get, GetById, Delete)
  - No Update messages as per join table requirements

  Service Registration:
  - AlbumHasGenreRepository initialized with EntityManagerFactory
  - AlbumHasGenreService registered with ServiceLocator with required dependencies
  - Ensures all AlbumHasGenre action handlers can resolve dependencies
  - Proper dependency injection of AlbumRepository and GenreRepository

  The implementation follows best practices with proper error handling,
  logging, validation, relationship integrity checks, and consistency with
  existing codebase patterns. This enables proper many-to-many relationship
  management between albums and genres, allowing albums to be associated
  with multiple genres and vice versa.

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

  Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 23:24:52 -03:00
Gustavo Henrique Santos Souza de Miranda adb536e135 Enhance Album entity with bidirectional relationships and partial update support
This commit introduces significant improvements to the Album entity and its
  update functionality, adding bidirectional relationship management with
  AlbumHasArtist and implementing proper partial update semantics using
  protobuf wrapper types.

  Key enhancements:

  Model Layer Improvements:
  - Added OneToMany relationship from Album to AlbumHasArtist
    * Bidirectional mapping with cascade ALL and orphan removal
    * Maintains collection of album-artist associations
  - Implemented helper methods for artist management:
    * addArtist(): creates and adds AlbumHasArtist association
    * removeArtist(): removes association by artist ID
    * getArtists(): convenience method to extract Artist list from associations
  - Added getters/setters for albumArtists collection
  - Improved entity relationship management

  Service Layer Enhancements:
  - Refactored updateAlbum() to support partial updates
  - Added boolean flags to control field updates:
    * updateYear: controls whether year field should be modified
    * updateNumberOfDiscs: controls disc count updates
    * updateAlbumType: controls AlbumType relationship updates
    * updateAlbumArt: controls AlbumArt relationship updates
  - Only updates fields when explicitly provided by client
  - Maintains existing values for non-provided fields
  - Allows explicit null/removal of optional relationships
  - Improved update logic clarity and maintainability

  Handler Layer Improvements (UpdateAlbumHandler):
  - Integrated protobuf wrapper type handling
  - Uses hasYear(), hasNumberOfDiscs(), etc. to detect field presence
  - Extracts values from Int32Value wrappers
  - Passes presence flags to service layer
  - Properly distinguishes between "not provided" and "null/0"
  - Improved code formatting and readability

  Protocol Buffer Enhancements:
  - Added import for google.protobuf.wrappers
  - Changed UpdateAlbumRequest optional fields to wrapper types:
    * year: int32 → google.protobuf.Int32Value
    * number_of_discs: int32 → google.protobuf.Int32Value
    * fk_albumtype_id: int32 → google.protobuf.Int32Value
    * fk_albumart_id: int32 → google.protobuf.Int32Value
  - Enables proper optional field semantics
  - Allows clients to omit fields from update requests
  - Supports explicit null to remove relationships

  Benefits of these changes:
  - Proper partial update support: clients can update only specific fields
  - Prevents unintended field overwrites with default values
  - Bidirectional navigation from Album to Artists
  - Cascade operations for album-artist associations
  - Cleaner API semantics with explicit field presence detection
  - Better alignment with REST PATCH semantics
  - Maintains backward compatibility for required fields

  Example usage:
  - Update only name: provide name, omit other fields
  - Remove AlbumType: provide fk_albumtype_id with value 0 or null
  - Keep existing year: omit year field from request
  - Update multiple fields: provide only the fields to change

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

  Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 23:03:14 -03:00
Gustavo Henrique Santos Souza de Miranda f31c657d61 Implement AlbumHasArtist relationship management with CRUD operations
This commit introduces the AlbumHasArtist join table entity management,
establishing the many-to-many relationship between Album and Artist
entities. This implementation follows the established repository pattern
used for other entities.

Key components implemented:

Model Layer:
- AlbumHasArtist entity representing the join table
- ManyToOne relationships to Album and Artist entities
- JPA annotations with proper foreign key constraints
- Complete getters and setters
- Custom toString method for debugging

Repository Layer:
- AlbumHasArtistRepository with EntityManager-based operations
- Full transaction management with proper rollback handling
- Methods: save, findAll, findById, deleteById
- No update method (join tables typically only need create/delete)

Service Layer:
- AlbumHasArtistService with business logic and validation
- Constructor injection of AlbumHasArtistRepository, AlbumRepository, ArtistRepository
- Relationship validation: ensures both Album and Artist exist before creating association
- Input validation for null/invalid IDs
- ID validation for all operations requiring entity lookup
- Comprehensive logging using Log4j2

Mapper Layer:
- AlbumHasArtistMapper for bidirectional entity/protobuf conversion
- Foreign key mapping for Album and Artist relationships
- Null safety checks and validation
- Proper handling of optional ID field

Action Handlers:
- CreateAlbumHasArtistHandler (albumhasartist.create)
- GetAlbumHasArtistHandler (albumhasartist.getAll)
- GetAlbumHasArtistByIdHandler (albumhasartist.getById)
- DeleteAlbumHasArtistHandler (albumhasartist.delete)
- HTTP status code handling: 200 (success), 400 (validation),
  404 (not found), 500 (server error)
- No update handler as join tables typically only require create/delete operations

Protocol Buffers:
- Complete proto definition with AlbumHasArtistMessages
- Messages support album_id and artist_id foreign keys
- CRUD message definitions (Create, Get, GetById, Delete)
- No Update messages as per join table requirements

Service Registration:
- AlbumHasArtistRepository initialized with EntityManagerFactory
- AlbumHasArtistService registered with ServiceLocator with required dependencies
- Ensures all AlbumHasArtist action handlers can resolve dependencies
- Proper dependency injection of AlbumRepository and ArtistRepository

The implementation follows best practices with proper error handling,
logging, validation, relationship integrity checks, and consistency with
existing codebase patterns. This enables proper many-to-many relationship
management between albums and artists.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 21:03:20 -03:00
Gustavo Henrique Miranda dccbfcf546
Merge pull request #22 from gmbrax/feature/Implement-AlbumType-Management
Implement AlbumType management with full CRUD operations
2025-12-07 20:09:01 -03:00
Gustavo Henrique Santos Souza de Miranda 21f5b93f48 Implement Album management with full CRUD operations
This commit introduces comprehensive Album entity management following
the established repository pattern used for other entities like AlbumType
and SamplingRate. The Album entity includes relationships with AlbumType
and AlbumArt entities.

Key components implemented:

Model Layer:
- Album entity with complete field set:
  * Basic fields: id, name, year, numberOfDiscs, code, isCompilation
  * Foreign key relationships: AlbumType and AlbumArt (ManyToOne)
  * Audit timestamps: createdAt, updatedAt with JPA lifecycle hooks
- JPA annotations with @PrePersist and @PreUpdate for automatic timestamps
- Complete getters and setters

Repository Layer:
- AlbumRepository with EntityManager-based operations
- Full transaction management with proper rollback handling
- Methods: save, findAll, findById, update, deleteById

Service Layer:
- AlbumService with business logic and validation
- Constructor injection of AlbumRepository, AlbumTypeRepository, AlbumArtRepository
- Relationship handling: validates and sets AlbumType and AlbumArt entities
- Input validation for null/empty name field
- ID validation for all operations requiring entity lookup
- Comprehensive logging using Log4j2

Mapper Layer:
- AlbumMapper for bidirectional entity/protobuf conversion
- Timestamp conversion between LocalDateTime and epoch milliseconds
- Foreign key mapping for AlbumType and AlbumArt relationships
- Null safety checks and validation
- Proper handling of optional fields

Action Handlers:
- CreateAlbumHandler (album.create)
- GetAlbumHandler (album.getAll)
- GetAlbumByIdHandler (album.getById)
- UpdateAlbumHandler (album.update)
- DeleteAlbumHandler (album.delete)
- HTTP status code handling: 200 (success), 400 (validation),
  404 (not found), 500 (server error)
- Handles optional fields with proper default value checks

Protocol Buffers:
- Fixed proto definition with correct Album fields
- CreateAlbumRequest and UpdateAlbumRequest with all entity fields
- All CRUD message definitions (Create, Get, GetById, Update, Delete)
- Support for foreign keys and timestamps

Service Registration:
- AlbumRepository initialized with EntityManagerFactory
- AlbumService registered with ServiceLocator with required dependencies
- Ensures all Album action handlers can resolve dependencies

The implementation follows best practices with proper error handling,
logging, validation, relationship management, and consistency with
existing codebase patterns.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 20:07:34 -03:00
Gustavo Henrique Santos Souza de Miranda 7446047b9d Implement AlbumType management with full CRUD operations
This commit introduces comprehensive AlbumType entity management following
the established repository pattern used for other entities like SamplingRate
and AlbumArt.

Key components implemented:

Model Layer:
- AlbumType entity with id and value fields
- JPA annotations for database persistence
- Complete getters and setters

Repository Layer:
- AlbumTypeRepository with EntityManager-based operations
- Full transaction management with proper rollback handling
- Methods: save, findAll, findById, update, deleteById

Service Layer:
- AlbumTypeService with business logic and validation
- Input validation for null/empty value fields
- ID validation for all operations requiring entity lookup
- Comprehensive logging using Log4j2

Mapper Layer:
- AlbumTypeMapper for bidirectional entity/protobuf conversion
- Null safety checks and validation
- Proper handling of optional ID field

Action Handlers:
- CreateAlbumTypeHandler (albumtype.create)
- GetAlbumTypeHandler (albumtype.getAll)
- GetAlbumTypeByIdHandler (albumtype.getById)
- UpdateAlbumTypeHandler (albumtype.update)
- DeleteAlbumTypeHandler (albumtype.delete)
- HTTP status code handling: 200 (success), 400 (validation),
  404 (not found), 500 (server error)

Protocol Buffers:
- Complete proto definition with AlbumTypeMessages
- All CRUD message definitions (Create, Get, GetById, Update, Delete)

Service Registration:
- AlbumTypeRepository initialized with EntityManagerFactory
- AlbumTypeService registered with ServiceLocator for dependency injection
- Ensures all AlbumType action handlers can resolve dependencies

The implementation follows best practices with proper error handling,
logging, validation, and consistency with existing codebase patterns.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 13:15:01 -03:00
Gustavo Henrique Miranda f43c609e04
Merge pull request #21 from gmbrax/feature/Implement-AlbumArt-Management
Feature/implement album art management
2025-12-07 02:34:38 -03:00
Gustavo Henrique Miranda dc1f6dfbc8
Update src/main/java/com/mediamanager/model/AlbumArt.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-07 02:30:51 -03:00
Gustavo Henrique Miranda 0aac0f2f14
Update src/main/proto/albumart.proto
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-07 02:21:47 -03:00
Gustavo Henrique Santos Souza de Miranda 2fb890a485 Register AlbumArtService with service locator and update gitignore
This commit completes the AlbumArt feature integration by registering
the service with the dependency injection system and updating repository
ignore rules.

Service Registration:
- Initialize AlbumArtRepository with EntityManagerFactory
- Create AlbumArtService instance with repository dependency
- Register AlbumArtService with ServiceLocator for handler injection
- Ensures all AlbumArt action handlers can resolve dependencies

The service follows the established initialization pattern used by other
entities (SamplingRate, BitDepth, BitRate, etc.) ensuring consistency
across the application architecture.

Repository Configuration:
- Add src/scripts/* to .gitignore for local script files
- Add local-repo/ to .gitignore for local Maven repository cache
- Prevents accidental commits of development artifacts and dependencies

These changes complete the AlbumArt feature, making it fully operational
and accessible through the action handler system.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 02:17:29 -03:00
Gustavo Henrique Santos Souza de Miranda 745ba7e5fc Implement AlbumArt management with full CRUD operations
This commit introduces comprehensive AlbumArt entity management following
the established repository pattern used for other entities like SamplingRate.

Key components implemented:

Model Layer:
- AlbumArt entity with id and filepath fields
- JPA annotations for database persistence

Repository Layer:
- AlbumArtRepository with EntityManager-based operations
- Full transaction management with proper rollback handling
- Methods: save, findAll, findById, update, deleteById

Service Layer:
- AlbumArtService with business logic and validation
- Input validation for null/empty filepath values
- ID validation for all operations requiring entity lookup
- Comprehensive logging using Log4j2

Mapper Layer:
- AlbumArtMapper for bidirectional entity/protobuf conversion
- Null safety checks and validation
- Proper handling of optional ID field

Action Handlers:
- CreateAlbumArtHandler (albumart.create)
- GetAlbumArtHandler (albumart.getAll)
- GetAlbumArtByIdHandler (albumart.getById)
- UpdateAlbumArtHandler (albumart.update)
- DeleteAlbumArtHandler (albumart.delete)
- HTTP status code handling: 200 (success), 400 (validation),
  404 (not found), 500 (server error)

Protocol Buffers:
- Fixed java_outer_classname from "BitDepthMessages" to "AlbumArtMessages"
- All CRUD message definitions (Create, Get, GetById, Update, Delete)

The implementation follows best practices with proper error handling,
logging, validation, and consistency with existing codebase patterns.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 02:15:57 -03:00
Gustavo Henrique Miranda ace73ae9c0
Merge pull request #20 from gmbrax/feature/Implement-SamplingRate-management
Feature/implement sampling rate management
2025-12-06 23:13:46 -03:00
Gustavo Henrique Santos Souza de Miranda 94297e75b9 Add id validation and improve code formatting in updateSamplingRate
Enhance input validation and code quality in the SamplingRate service:

- Add null check for id parameter in updateSamplingRate() method to prevent
  potential NullPointerException when calling repository.findById()
- Standardize indentation throughout the updateSamplingRate() method body,
  improving code readability and consistency with project style guidelines

This complements the previous validation improvements by ensuring all
method parameters are properly validated before use, creating a more
defensive and robust API surface.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-06 22:30:51 -03:00
Gustavo Henrique Santos Souza de Miranda ff09d1b89a Fix null handling and validation in SamplingRate management
This commit addresses potential runtime exceptions and improves input validation:

- Replace Optional.of() with Optional.ofNullable() in SamplingRateRepository.findById()
  to properly handle cases where no sampling rate is found, preventing NullPointerException
- Add null validation for id parameter in SamplingRateService.deleteSamplingRate()
  to ensure proper error handling before repository operations
- Clean up code formatting in updateSamplingRate() validation block

These changes enhance the robustness of the sampling rate management feature
by preventing NPEs and providing clearer error messages for invalid inputs.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-06 22:18:57 -03:00
Gustavo Henrique Miranda 4fa147282f
Update src/main/java/com/mediamanager/service/samplingrate/SamplingRateService.java
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-06 22:07:39 -03:00
Gustavo Henrique Santos Souza de Miranda 5ff972ebcb Fix message name casing in SamplingRate proto definition
Standardize the naming convention by changing `GetSamplingRateByIDRequest`
to `GetSamplingRateByIdRequest`, using "Id" instead of "ID" for consistency
with other proto message names across the codebase. Updated the corresponding
handler to reference the corrected message name.

This aligns with the established naming pattern and improves code consistency
following the same convention applied in other proto definitions.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-06 02:55:36 -03:00
Gustavo Henrique Santos Souza de Miranda 5aeb54516c Implement sampling rate management with full CRUD operations
This commit introduces comprehensive sampling rate management functionality
to the MediaManager system, following the established patterns from BitDepth
and BitRate implementations.

Core Components Added:
- SamplingRate entity model with JPA annotations for database persistence
- SamplingRateRepository with full CRUD operations (save, findAll, findById, update, deleteById)
- SamplingRateService business logic layer with validation and error handling
- SamplingRateMapper for bidirectional entity-protobuf conversions

Protocol Buffers:
- Defined samplingrate.proto with complete message specifications
- SamplingRate message structure (id, value)
- Request/Response pairs for all CRUD operations (Create, GetAll, GetById, Update, Delete)
- Fixed typo in UpdateSamplingRateRequest (valeu -> value)

Action Handlers:
- CreateSamplingRateHandler: Validates and creates new sampling rate entries
- GetSamplingRateHandler: Retrieves all sampling rates from the database
- GetSamplingRateByIdHandler: Fetches individual sampling rates with 404 handling
- UpdateSamplingRateHandler: Updates existing sampling rates with validation
- DeleteSamplingRateHandler: Removes sampling rates with success confirmation

Integration:
- Registered SamplingRateService in DelegateActionManager
- All handlers follow the @Action annotation pattern for automatic discovery
- Consistent error handling with appropriate HTTP status codes (400, 404, 500)

This implementation provides a complete foundation for managing audio sampling
rates within the media management system, enabling clients to perform all
standard CRUD operations through the established protocol buffer interface.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-06 02:41:48 -03:00
Gustavo Henrique Miranda 1dd2542656
Merge pull request #19 from gmbrax/fix/Fix-artist-proto-mismatch
Feature/Implement-BitRate-Management
2025-12-05 21:55:31 -03:00
Gustavo Henrique Santos Souza de Miranda c787eba20e Fix field name casing in UpdateArtistResponse proto message
Change field name from 'Artist' to 'artist' to follow protobuf naming conventions, which require lowercase field names with underscores for word separation.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-05 21:48:46 -03:00
Gustavo Henrique Santos Souza de Miranda 2294a57ffd Implement bit-rate management feature
Add complete CRUD functionality for bit-rate management following the same pattern as bit-depth:
  - Create BitRate entity model with JPA annotations
  - Implement BitRateRepository with full CRUD operations
  - Add BitRateService with validation and business logic
  - Create BitRateMapper for protobuf/entity conversion
  - Implement action handlers: Create, GetAll, GetById, Update, Delete
  - Define bitrate.proto protobuf message definitions
  - Register BitRateService in DelegateActionManager

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

  Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 20:43:04 -03:00
Gustavo Henrique Miranda 8c8b8ec765
Merge pull request #17 from gmbrax/fix/Fix-Repeated-return-on-CreateBitDepthHandler
Remove duplicate `newBuilder` call in `CreateBitDepthHandler`
2025-12-05 18:12:32 -03:00