Refactors the artist slice across the stack

This commit is contained in:
BinaryAlley committed 2026-09-25 13:18:27 -07:00
1 parent b398f26bfe
commit b51013a9e9
24 files changed
+404 -222

No files matched your search

@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.AddArtist;
/// <summary>
/// API endpoint for the <c>/{libraryId}/artists</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists</c> route.
/// </summary>
public class AddArtistEndpoint : BaseEndpoint<AddArtistRequest, IResult>
{
@@ -458,10 +458,10 @@ public class AddArtistEndpointSummary : Summary<AddArtistEndpoint, AddArtistRequ
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].CreatedOnUtc, "The date and time when the track was created.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].UpdatedOnUtc, "The date and time when the track was last updated, if applicable.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Contributors, "The list of references to the media contributors that performed on the track, each with the role they played.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Ratings, "The list of ratings for the track.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Moods, "The list of moods of the track.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Isrcs, "The list of ISRC (International Standard Recording Code) of the track.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Contributors, "The list of references to the media contributors that performed on the track, each with the role they played.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Ratings, "The list of ratings for the track.");
ResponseParam<ArtistResponse>(r => r.CreatedOnUtc, "The date and time when the artist was created.");
ResponseParam<ArtistResponse>(r => r.UpdatedOnUtc, "The date and time when the artist was last updated, if applicable.");
@@ -610,6 +610,15 @@ public class AddArtistEndpointSummary : Summary<AddArtistEndpoint, AddArtistRequ
MusicBrainzWorkId: Guid.NewGuid(),
CreatedOnUtc: DateTime.UtcNow,
UpdatedOnUtc: default,
Moods:
[
new(Name: "dramatic"),
new(Name: "anxious")
],
Isrcs:
[
new(Value: "GBUM71029604")
],
Contributors:
[
new(
@@ -635,15 +644,6 @@ public class AddArtistEndpointSummary : Summary<AddArtistEndpoint, AddArtistRequ
Source: AudioRatingSource.LastFm,
VoteCount: 1234
)
],
Moods:
[
new(Name: "dramatic"),
new(Name: "anxious")
],
Isrcs:
[
new(Value: "GBUM71029604")
]
),
new(
@@ -701,6 +701,15 @@ public class AddArtistEndpointSummary : Summary<AddArtistEndpoint, AddArtistRequ
MusicBrainzWorkId: Guid.NewGuid(),
CreatedOnUtc: DateTime.UtcNow,
UpdatedOnUtc: default,
Moods:
[
new(Name: "happy"),
new(Name: "warm")
],
Isrcs:
[
new(Value: "GBUM71029609")
],
Contributors:
[
new(
@@ -726,15 +735,6 @@ public class AddArtistEndpointSummary : Summary<AddArtistEndpoint, AddArtistRequ
Source: AudioRatingSource.LastFm,
VoteCount: 567
)
],
Moods:
[
new(Name: "happy"),
new(Name: "warm")
],
Isrcs:
[
new(Value: "GBUM71029609")
]
)
]
@@ -19,7 +19,7 @@ public class DeleteArtistEndpointSummary : Summary<DeleteArtistEndpoint, EmptyRe
public DeleteArtistEndpointSummary()
{
Summary = "Deletes an existing artist.";
Description = "Deletes the artist identified by the request, together with its albums and tracks. The artist is deleted by an Admin, who can delete the artists of all libraries, or by the owner of the library of the artist.";
Description = "Deletes the artist identified by the route, together with its albums and tracks. The artist is deleted by an Admin, who can delete the artists of all libraries, or by the owner of the library of the artist.";
Response(200, "The artist was successfully deleted.");
@@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetArtist;
/// <summary>
/// API endpoint for the <c>/artists/{artistId}</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists/{artistId}</c> route.
/// </summary>
public class GetArtistEndpoint : BaseEndpoint<FastEndpoints.EmptyRequest, IResult>
{
@@ -59,7 +59,7 @@ public class GetArtistEndpointSummary : Summary<GetArtistEndpoint, 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()}"
},
new
@@ -67,7 +67,7 @@ public class GetArtistEndpointSummary : Summary<GetArtistEndpoint, 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()}"
},
new
@@ -118,6 +118,7 @@ public class GetArtistEndpointSummary : Summary<GetArtistEndpoint, EmptyRequest>
{
"General.Validation", new[]
{
"LibraryIdCannotBeEmpty",
"ArtistIdCannotBeEmpty"
}
}
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetArtistAlbums;
/// <summary>
/// API endpoint for the <c>/artists/{artistId}/albums</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists/{artistId}/albums</c> route.
/// </summary>
public class GetArtistAlbumsEndpoint : BaseEndpoint<FastEndpoints.EmptyRequest, IResult>
{
@@ -225,7 +225,7 @@ public class GetArtistAlbumsEndpointSummary : Summary<GetArtistAlbumsEndpoint, E
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"
},
new
@@ -233,7 +233,7 @@ public class GetArtistAlbumsEndpointSummary : Summary<GetArtistAlbumsEndpoint, E
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"
},
new
@@ -284,6 +284,7 @@ public class GetArtistAlbumsEndpointSummary : Summary<GetArtistAlbumsEndpoint, E
{
"General.Validation", new[]
{
"LibraryIdCannotBeEmpty",
"ArtistIdCannotBeEmpty"
}
}
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetArtistAlbumsLite;
/// <summary>
/// API endpoint for the <c>/artists/{artistId}/albums/lite</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists/{artistId}/albums/lite</c> route.
/// </summary>
public class GetArtistAlbumsLiteEndpoint : BaseEndpoint<GetArtistAlbumsLiteRequest, IResult>
{
@@ -67,7 +67,7 @@ public class GetArtistAlbumsLiteEndpointSummary : Summary<GetArtistAlbumsLiteEnd
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/lite"
},
new
@@ -75,7 +75,7 @@ public class GetArtistAlbumsLiteEndpointSummary : Summary<GetArtistAlbumsLiteEnd
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/lite"
},
new
@@ -126,6 +126,7 @@ public class GetArtistAlbumsLiteEndpointSummary : Summary<GetArtistAlbumsLiteEnd
{
"General.Validation", new[]
{
"LibraryIdCannotBeEmpty",
"ArtistIdCannotBeEmpty"
}
}
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetArtists;
/// <summary>
/// API endpoint for the <c>/artists</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists</c> route.
/// </summary>
public class GetArtistsEndpoint : BaseEndpoint<GetArtistsRequest, IResult>
{
@@ -22,7 +22,7 @@ public class GetArtistsEndpointSummary : Summary<GetArtistsEndpoint, GetArtistsR
public GetArtistsEndpointSummary()
{
Summary = "Retrieves the list of artists of a media library.";
Description = "Returns the paginated list of the artists of the media library identified by the request, with the full details of each artist. The page is returned to an Admin, who can see the artists of all libraries, or to the owner of the library.";
Description = "Returns the paginated list of the artists of the media library identified by the route, with the full details of each artist. The page is returned to an Admin, who can see the artists of all libraries, or to the owner of the library.";
ExampleRequest = new GetArtistsRequest(
CurrentPage: 1,
@@ -87,7 +87,7 @@ public class GetArtistsEndpointSummary : Summary<GetArtistsEndpoint, GetArtistsR
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"
},
new
@@ -95,7 +95,7 @@ public class GetArtistsEndpointSummary : Summary<GetArtistsEndpoint, GetArtistsR
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"
},
new
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetArtistsLite;
/// <summary>
/// API endpoint for the <c>/artists/lite</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists/lite</c> route.
/// </summary>
public class GetArtistsLiteEndpoint : BaseEndpoint<GetArtistsLiteRequest, IResult>
{
@@ -66,7 +66,7 @@ public class GetArtistsLiteEndpointSummary : Summary<GetArtistsLiteEndpoint, Get
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/lite"
},
new
@@ -74,7 +74,7 @@ public class GetArtistsLiteEndpointSummary : Summary<GetArtistsLiteEndpoint, Get
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/lite"
},
new
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtist;
/// <summary>
/// API endpoint for the <c>/{libraryId}/artists/{artistId}</c> route.
/// API endpoint for the <c>/libraries/{libraryId}/artists/{artistId}</c> route.
/// </summary>
public class UpdateArtistEndpoint : BaseEndpoint<UpdateArtistRequest, IResult>
{
@@ -1,4 +1,4 @@
#region ========================================================================= USING =====================================================================================
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
@@ -30,7 +30,7 @@ public class UpdateArtistEndpointSummary : Summary<UpdateArtistEndpoint, UpdateA
public UpdateArtistEndpointSummary()
{
Summary = "Updates an existing artist.";
Description = "Updates the details of the artist identified by the request, together with its contributors and albums, returning the full details of the updated artist. The artist is updated by an Admin, who can update the artists of all libraries, or by the owner of the library of the artist.";
Description = "Updates the details of the artist identified by the route, together with its contributors and albums, returning the full details of the updated artist. The artist is updated by an Admin, who can update the artists of all libraries, or by the owner of the library of the artist.";
RequestParam(r => r.Name, "The name of the artist. Required.");
RequestParam(r => r.Website, "The website of the artist. Optional.");
@@ -457,10 +457,10 @@ public class UpdateArtistEndpointSummary : Summary<UpdateArtistEndpoint, UpdateA
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].CreatedOnUtc, "The date and time when the track was created.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].UpdatedOnUtc, "The date and time when the track was last updated, if applicable.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Contributors, "The list of references to the media contributors that performed on the track, each with the role they played.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Ratings, "The list of ratings for the track.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Moods, "The list of moods of the track.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Isrcs, "The list of ISRC (International Standard Recording Code) of the track.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Contributors, "The list of references to the media contributors that performed on the track, each with the role they played.");
ResponseParam<ArtistResponse>(r => r.Albums![0].Tracks![0].Ratings, "The list of ratings for the track.");
ResponseParam<ArtistResponse>(r => r.CreatedOnUtc, "The date and time when the artist was created.");
ResponseParam<ArtistResponse>(r => r.UpdatedOnUtc, "The date and time when the artist was last updated, if applicable.");
@@ -614,6 +614,15 @@ public class UpdateArtistEndpointSummary : Summary<UpdateArtistEndpoint, UpdateA
MusicBrainzWorkId: Guid.NewGuid(),
CreatedOnUtc: DateTime.UtcNow,
UpdatedOnUtc: DateTime.UtcNow,
Moods:
[
new MoodDto(Name: "dramatic"),
new MoodDto(Name: "anxious")
],
Isrcs:
[
new IsrcDto(Value: "GBUM71029604")
],
Contributors:
[
new MediaContributorReferenceDto(
@@ -639,15 +648,6 @@ public class UpdateArtistEndpointSummary : Summary<UpdateArtistEndpoint, UpdateA
Source: AudioRatingSource.LastFm,
VoteCount: 1234
)
],
Moods:
[
new MoodDto(Name: "dramatic"),
new MoodDto(Name: "anxious")
],
Isrcs:
[
new IsrcDto(Value: "GBUM71029604")
]
),
new TrackResponse(
@@ -705,6 +705,15 @@ public class UpdateArtistEndpointSummary : Summary<UpdateArtistEndpoint, UpdateA
MusicBrainzWorkId: Guid.NewGuid(),
CreatedOnUtc: DateTime.UtcNow,
UpdatedOnUtc: DateTime.UtcNow,
Moods:
[
new MoodDto(Name: "happy"),
new MoodDto(Name: "warm")
],
Isrcs:
[
new IsrcDto(Value: "GBUM71029609")
],
Contributors:
[
new MediaContributorReferenceDto(
@@ -730,15 +739,6 @@ public class UpdateArtistEndpointSummary : Summary<UpdateArtistEndpoint, UpdateA
Source: AudioRatingSource.LastFm,
VoteCount: 567
)
],
Moods:
[
new MoodDto(Name: "happy"),
new MoodDto(Name: "warm")
],
Isrcs:
[
new IsrcDto(Value: "GBUM71029609")
]
)
]
@@ -836,6 +836,18 @@ public class UpdateArtistEndpointSummary : Summary<UpdateArtistEndpoint, UpdateA
}
);
Response(409, "The request failed because the new artist name is already used in the library, or 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()}",
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-00"
}
);
Response(422, "The request did not pass validation checks.", "application/problem+json",
example: new
{
@@ -910,7 +922,8 @@ public class UpdateArtistEndpointSummary : Summary<UpdateArtistEndpoint, UpdateA
"BpmMustBeGreaterThanZero",
"WorkMustBeMaximum255CharactersLong",
"MoodNameCannotBeEmpty",
"IsrcValueCannotBeEmpty"
"IsrcValueCannotBeEmpty",
"TrackPathMustBeWithinLibraryContentLocations"
}
}
},