Refactors the album slice across the stack

This commit is contained in:
BinaryAlley committed 2026-09-25 13:18:50 -07:00
1 parent b51013a9e9
commit e842c7baaf
20 files changed
+241 -206

No files matched your search

@@ -18,6 +18,5 @@ public static partial class ApiRoutes
public const string DELETE_ALBUM = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}";
public const string GET_ALBUM_TRACKS = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks";
public const string GET_ALBUM_TRACKS_LITE = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/lite";
public const string ADD_TRACK = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks";
}
}
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.AddAlbum;
/// <summary>
/// API endpoint for the <c>/{libraryId}/artists/{artistId}/albums</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists/{artistId}/albums</c> route.
/// </summary>
public class AddAlbumEndpoint : BaseEndpoint<AddAlbumRequest, IResult>
{
@@ -19,7 +19,7 @@ public class DeleteAlbumEndpointSummary : Summary<DeleteAlbumEndpoint, EmptyRequ
public DeleteAlbumEndpointSummary()
{
Summary = "Deletes an existing album.";
Description = "Deletes the album identified by the path, together with its tracks. An artist must always keep at least one album. The album is deleted by an Admin, who can delete the albums of all libraries, or by the owner of the library of the album.";
Description = "Deletes the album identified by the route, together with its tracks. An artist must always keep at least one album. The album is deleted by an Admin, who can delete the albums of all libraries, or by the owner of the library of the album.";
Response(200, "The album was successfully deleted.");
@@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetAlbum;
/// <summary>
/// API endpoint for the <c>/artists/{artistId}/albums/{albumId}</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists/{artistId}/albums/{albumId}</c> route.
/// </summary>
public class GetAlbumEndpoint : BaseEndpoint<FastEndpoints.EmptyRequest, IResult>
{
@@ -149,7 +149,7 @@ public class GetAlbumEndpointSummary : Summary<GetAlbumEndpoint, EmptyRequest>
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "You are not authorized",
detail = "Authentication failed",
instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}"
},
new
@@ -157,7 +157,7 @@ public class GetAlbumEndpointSummary : Summary<GetAlbumEndpoint, EmptyRequest>
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "Invalid token: The token expired at '01/01/2024 01:00:00'",
detail = "The token has expired",
instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}"
},
new
@@ -208,6 +208,8 @@ public class GetAlbumEndpointSummary : Summary<GetAlbumEndpoint, EmptyRequest>
{
"General.Validation", new[]
{
"LibraryIdCannotBeEmpty",
"ArtistIdCannotBeEmpty",
"AlbumIdCannotBeEmpty"
}
}
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetAlbumTracks;
/// <summary>
/// API endpoint for the <c>/artists/{artistId}/albums/{albumId}/tracks</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks</c> route.
/// </summary>
public class GetAlbumTracksEndpoint : BaseEndpoint<FastEndpoints.EmptyRequest, IResult>
{
@@ -47,6 +47,8 @@ public class GetAlbumTracksEndpointSummary : Summary<GetAlbumTracksEndpoint, Emp
ResponseParam<TrackResponse>(r => r.MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable.");
ResponseParam<TrackResponse>(r => r.CreatedOnUtc, "The date and time when the track was created.");
ResponseParam<TrackResponse>(r => r.UpdatedOnUtc, "The date and time when the track was last updated, if applicable.");
ResponseParam<TrackResponse>(r => r.Moods, "The list of moods of the track.");
ResponseParam<TrackResponse>(r => r.Isrcs, "The list of ISRC (International Standard Recording Code) of the track.");
ResponseParam<TrackResponse>(r => r.Contributors, "The list of references to the media contributors that performed on the track, each with the role they played.");
ResponseParam<TrackResponse>(r => r.Ratings, "The list of ratings for this track.");
ResponseParam<TrackResponse>(r => r.Metadata!.DurationInSeconds, "The duration of the audio of the track in seconds.");
@@ -69,8 +71,6 @@ public class GetAlbumTracksEndpointSummary : Summary<GetAlbumTracksEndpoint, Emp
ResponseParam<TrackResponse>(r => r.Metadata!.OriginalLanguage!.NativeName, "The native name of the original language of the track, if applicable.");
ResponseParam<TrackResponse>(r => r.Metadata!.Genres, "The list of genres associated with the track.");
ResponseParam<TrackResponse>(r => r.Metadata!.Tags, "The list of tags that further describe or categorize the track.");
ResponseParam<TrackResponse>(r => r.Moods, "The list of moods of the track.");
ResponseParam<TrackResponse>(r => r.Isrcs, "The list of ISRC (International Standard Recording Code) of the track.");
Response(200, "The list of tracks of the album is returned.",
example: new TrackResponse[]
@@ -256,7 +256,7 @@ public class GetAlbumTracksEndpointSummary : Summary<GetAlbumTracksEndpoint, Emp
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "You are not authorized",
detail = "Authentication failed",
instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/tracks"
},
new
@@ -264,7 +264,7 @@ public class GetAlbumTracksEndpointSummary : Summary<GetAlbumTracksEndpoint, Emp
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "Invalid token: The token expired at '01/01/2024 01:00:00'",
detail = "The token has expired",
instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/tracks"
},
new
@@ -315,6 +315,8 @@ public class GetAlbumTracksEndpointSummary : Summary<GetAlbumTracksEndpoint, Emp
{
"General.Validation", new[]
{
"LibraryIdCannotBeEmpty",
"ArtistIdCannotBeEmpty",
"AlbumIdCannotBeEmpty"
}
}
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetAlbumTracksLite;
/// <summary>
/// API endpoint for the <c>/artists/{artistId}/albums/{albumId}/tracks/lite</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/lite</c> route.
/// </summary>
public class GetAlbumTracksLiteEndpoint : BaseEndpoint<GetAlbumTracksLiteRequest, IResult>
{
@@ -70,7 +70,7 @@ public class GetAlbumTracksLiteEndpointSummary : Summary<GetAlbumTracksLiteEndpo
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "You are not authorized",
detail = "Authentication failed",
instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/tracks/lite"
},
new
@@ -78,7 +78,7 @@ public class GetAlbumTracksLiteEndpointSummary : Summary<GetAlbumTracksLiteEndpo
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "Invalid token: The token expired at '01/01/2024 01:00:00'",
detail = "The token has expired",
instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/tracks/lite"
},
new
@@ -129,6 +129,8 @@ public class GetAlbumTracksLiteEndpointSummary : Summary<GetAlbumTracksLiteEndpo
{
"General.Validation", new[]
{
"LibraryIdCannotBeEmpty",
"ArtistIdCannotBeEmpty",
"AlbumIdCannotBeEmpty"
}
}
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbum;
/// <summary>
/// API endpoint for the <c>/{libraryId}/artists/{artistId}/albums/{albumId}</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists/{artistId}/albums/{albumId}</c> route.
/// </summary>
public class UpdateAlbumEndpoint : BaseEndpoint<UpdateAlbumRequest, IResult>
{
@@ -28,13 +28,13 @@ public class UpdateAlbumEndpointSummary : Summary<UpdateAlbumEndpoint, UpdateAlb
public UpdateAlbumEndpointSummary()
{
Summary = "Updates an existing album.";
Description = "Updates the details of the album identified by the request, returning the full details of the updated album. The album is updated by an Admin, who can update the albums of all libraries, or by the owner of the library of the album.";
Description = "Updates the details of the album identified by the route, returning the full details of the updated album. The album is updated by an Admin, who can update the albums of all libraries, or by the owner of the library of the album.";
RequestParam(r => r.Metadata, "The album metadata of the album. Required.");
RequestParam(r => r.Metadata!.Title, "The title of the album. Required.");
RequestParam(r => r.Metadata!.OriginalTitle, "The original title of the album. Optional.");
RequestParam(r => r.Metadata!.Description, "The description of the album. Optional.");
RequestParam(r => r.Metadata!.ReleaseInfo, "The release information, including release date and other relevant details. Optional.");
RequestParam(r => r.Metadata!.ReleaseInfo, "The release information, including release date and other relevant details. Required.");
RequestParam(r => r.Metadata!.ReleaseInfo!.OriginalReleaseDate, "The original release date of the album. Optional.");
RequestParam(r => r.Metadata!.ReleaseInfo!.OriginalReleaseYear, "The original release year of the album. Optional.");
RequestParam(r => r.Metadata!.ReleaseInfo!.ReReleaseDate, "The re-release or reissue date of the album. Optional.");
@@ -46,15 +46,15 @@ public class UpdateAlbumEndpointSummary : Summary<UpdateAlbumEndpoint, UpdateAlb
RequestParam(r => r.Metadata!.TotalDiscs, "The number of discs of the release. Optional.");
RequestParam(r => r.Metadata!.TotalTracks, "The number of tracks of the release. Optional.");
RequestParam(r => r.Metadata!.Language, "The language of the album. Optional.");
RequestParam(r => r.Metadata!.Language!.LanguageCode, "The ISO 639-1 two-letter language code of the album. Optional.");
RequestParam(r => r.Metadata!.Language!.LanguageName, "The full name of the language of the album in English. Optional.");
RequestParam(r => r.Metadata!.Language!.LanguageCode, "The ISO 639-1 two-letter language code of the album. Required.");
RequestParam(r => r.Metadata!.Language!.LanguageName, "The full name of the language of the album in English. Required.");
RequestParam(r => r.Metadata!.Language!.NativeName, "The native name of the language of the album. Optional.");
RequestParam(r => r.Metadata!.OriginalLanguage, "The original language of the album, if it has been translated. Optional.");
RequestParam(r => r.Metadata!.OriginalLanguage!.LanguageCode, "The ISO 639-1 two-letter original language code of the album. Optional.");
RequestParam(r => r.Metadata!.OriginalLanguage!.LanguageName, "The full name of the original language of the album in English. Optional.");
RequestParam(r => r.Metadata!.OriginalLanguage!.LanguageCode, "The ISO 639-1 two-letter original language code of the album. Required.");
RequestParam(r => r.Metadata!.OriginalLanguage!.LanguageName, "The full name of the original language of the album in English. Required.");
RequestParam(r => r.Metadata!.OriginalLanguage!.NativeName, "The native name of the original language of the album. Optional.");
RequestParam(r => r.Metadata!.Genres, "The list of genres associated with the album. Optional.");
RequestParam(r => r.Metadata!.Tags, "The list of tags that further describe or categorize the album. Optional.");
RequestParam(r => r.Metadata!.Genres, "The list of genres associated with the album. Required.");
RequestParam(r => r.Metadata!.Tags, "The list of tags that further describe or categorize the album. Required.");
RequestParam(r => r.MediaFormat, "The physical or digital medium of the album. Optional.");
RequestParam(r => r.Barcode, "The barcode of the album. Optional.");
RequestParam(r => r.CatalogNumber, "The catalog number of the album. Optional.");
@@ -290,9 +290,18 @@ public class UpdateAlbumEndpointSummary : Summary<UpdateAlbumEndpoint, UpdateAlb
}
);
Response(404, "The request failed because the requested album, its media library, or one of the referenced media contributors does not exist.", "application/problem+json",
Response(404, "The request failed because the requested artist or album, its media library, or one of the referenced media contributors does not exist.", "application/problem+json",
example: new[]
{
new
{
type = "https://tools.ietf.org/html/rfc9110#section-15.5.5",
title = "General.NotFound",
status = 404,
detail = "ArtistNotFound",
instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}",
traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00"
},
new
{
type = "https://tools.ietf.org/html/rfc9110#section-15.5.5",
@@ -323,6 +332,18 @@ public class UpdateAlbumEndpointSummary : Summary<UpdateAlbumEndpoint, UpdateAlb
}
);
Response(409, "The request failed because a unique constraint was violated.", "application/problem+json",
example: new
{
type = "https://tools.ietf.org/html/rfc9110#section-15.5.10",
title = "General.Conflict",
status = 409,
detail = "UniqueConstraintViolation",
instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}",
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-00"
}
);
Response(422, "The request did not pass validation checks.", "application/problem+json",
example: new
{