mirror of
https://github.com/gmbrax/MediaManager-core.git
synced 2026-11-09 14:00:17 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1b4033c45 |
@@ -3,10 +3,7 @@ package com.mediamanager.model;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(
|
||||
name = "trackhasartist",
|
||||
uniqueConstraints = @UniqueConstraint(columnNames = {"fk_track_id", "fk_artist_id"})
|
||||
)
|
||||
@Table(name = "trackhasartist")
|
||||
public class TrackHasArtist {
|
||||
|
||||
@Id
|
||||
|
||||
@@ -3,10 +3,7 @@ package com.mediamanager.model;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(
|
||||
name = "trackhascomposer",
|
||||
uniqueConstraints = @UniqueConstraint(columnNames = {"fk_track_id", "fk_composer_id"})
|
||||
)
|
||||
@Table(name = "trackhascomposer")
|
||||
public class TrackHasComposer {
|
||||
|
||||
@Id
|
||||
|
||||
@@ -3,8 +3,7 @@ package com.mediamanager.model;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "trackhasgenre",
|
||||
uniqueConstraints = @UniqueConstraint(columnNames = {"fk_track_id", "fk_genre_id"}))
|
||||
@Table(name = "trackhasgenre")
|
||||
public class TrackHasGenre {
|
||||
|
||||
@Id
|
||||
|
||||
+1
-1
@@ -59,4 +59,4 @@ public class DeleteTrackHasArtistHandler implements ActionHandler {
|
||||
.setPayload(deleteResponse.toByteString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -59,4 +59,4 @@ public class DeleteTrackHasComposerHandler implements ActionHandler {
|
||||
.setPayload(deleteResponse.toByteString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -59,4 +59,4 @@ public class DeleteTrackHasGenreHandler implements ActionHandler {
|
||||
.setPayload(deleteResponse.toByteString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-10
@@ -32,10 +32,6 @@ public class GetTrackHasGenreByIdHandler implements ActionHandler {
|
||||
TrackHasGenreMessages.GetTrackHasGenreByIdRequest.parseFrom(requestPayload);
|
||||
int id = getByIdRequest.getId();
|
||||
|
||||
if (id <= 0) {
|
||||
throw new IllegalArgumentException("ID must be greater than 0");
|
||||
}
|
||||
|
||||
Optional<TrackHasGenre> trackHasGenreOpt = trackHasGenreService.getTrackHasGenreById(id);
|
||||
|
||||
if (trackHasGenreOpt.isEmpty()){
|
||||
@@ -49,13 +45,7 @@ public class GetTrackHasGenreByIdHandler implements ActionHandler {
|
||||
.setTrackhasgenre(trackHasGenreProto)
|
||||
.build();
|
||||
return TransportProtocol.Response.newBuilder()
|
||||
.setStatusCode(200)
|
||||
.setPayload(getByIdResponse.toByteString());
|
||||
} catch (IllegalArgumentException e) {
|
||||
logger.error("Validation error", e);
|
||||
return TransportProtocol.Response.newBuilder()
|
||||
.setStatusCode(400)
|
||||
.setPayload(ByteString.copyFromUtf8("Validation error: " + e.getMessage()));
|
||||
} catch (Exception e) {
|
||||
logger.error("Error getting track has genre by ID", e);
|
||||
return TransportProtocol.Response.newBuilder()
|
||||
|
||||
Reference in New Issue
Block a user