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>
This commit is contained in:
Gustavo Henrique Santos Souza de Miranda
2025-12-07 02:15:57 -03:00
co-authored by Claude Sonnet 4.5
parent ace73ae9c0
commit 745ba7e5fc
10 changed files with 573 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
syntax = "proto3";
option java_package = "com.mediamanager.protocol.messages";
option java_outer_classname = "AlbumArtMessages";
package mediamanager.messages;
message AlbumArt {
int32 id = 1;
string filepath = 2;
}
message CreateAlbumArtRequest {
string filepath = 1;
}
message CreateAlbumArtResponse {
AlbumArt albumart = 1;
}
message GetAlbumArtsRequest {
}
message GetAlbumArtsResponse {
repeated AlbumArt albumarts = 1;
}
message GetAlbumArtByIdRequest {
int32 id = 1;
}
message GetAlbumArtByIdResponse {
AlbumArt albumart = 1;
}
message UpdateAlbumArtRequest {
int32 id = 1;
string filepath = 2; // Novo nome
}
message UpdateAlbumArtResponse {
AlbumArt albumart = 1;
}
message DeleteAlbumArtRequest {
int32 id = 1;
}
message DeleteAlbumArtResponse {
bool success = 1;
string message = 2;
}