From 9cc0852236a9d28fee10bd9f4c4c5fe20ba70f12 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Sat, 10 Oct 2026 07:42:00 +0300 Subject: [PATCH] Adds the music library API endpoints, their OpenAPI summaries, and the endpoint tests --- .../AddAlbum/AddAlbumEndpointSummary.cs | 228 ++++++++------ .../GetAlbum/GetAlbumEndpointSummary.cs | 23 +- .../GetAlbumTracksEndpointSummary.cs | 82 ++--- .../UpdateAlbum/UpdateAlbumEndpointSummary.cs | 50 ++-- .../AddArtist/AddArtistEndpointSummary.cs | 283 +++++++++++------- .../GetArtist/GetArtistEndpointSummary.cs | 130 +++++++- .../GetArtistAlbumsEndpointSummary.cs | 42 ++- .../GetArtists/GetArtistsEndpointSummary.cs | 245 ++++++++++++++- .../UpdateArtistEndpointSummary.cs | 256 ++++++++++------ .../AddTrack/AddTrackEndpointSummary.cs | 86 +++--- .../GetTrack/GetTrackEndpointSummary.cs | 43 +-- .../UpdateTrack/UpdateTrackEndpointSummary.cs | 84 +++--- .../Books/AddBook/AddBookEndpointSummary.cs | 1 + .../Books/GetBook/GetBookEndpointSummary.cs | 1 + .../Books/GetBooks/GetBooksEndpointSummary.cs | 1 + .../UpdateBook/UpdateBookEndpointSummary.cs | 1 + .../GetUserSettingsEndpointSummary.cs | 1 + .../UpdateUserSettingsEndpointSummary.cs | 3 + src/Lumina.Presentation.Api/Program.cs | 1 + .../Albums/AddAlbum/AddAlbumEndpointTests.cs | 6 +- .../UpdateAlbum/UpdateAlbumEndpointTests.cs | 4 +- .../AddArtist/AddArtistEndpointTests.cs | 25 +- .../GetArtist/GetArtistEndpointTests.cs | 2 +- .../GetArtists/GetArtistsEndpointTests.cs | 8 +- .../UpdateArtist/UpdateArtistEndpointTests.cs | 11 +- .../Tracks/AddTrack/AddTrackEndpointTests.cs | 166 +++++----- .../UpdateTrack/UpdateTrackEndpointTests.cs | 130 ++++---- .../Albums/AddAlbum/AddAlbumEndpointTests.cs | 4 +- .../UpdateAlbum/UpdateAlbumEndpointTests.cs | 6 +- .../AddArtist/AddArtistEndpointTests.cs | 12 +- .../UpdateArtist/UpdateArtistEndpointTests.cs | 9 +- .../Tracks/AddTrack/AddTrackEndpointTests.cs | 4 +- .../UpdateTrack/UpdateTrackEndpointTests.cs | 6 +- .../GetPermissionsEndpointTests.cs | 8 +- .../Albums/AddAlbum/AddAlbumEndpointTests.cs | 2 +- .../UpdateAlbum/UpdateAlbumEndpointTests.cs | 2 +- .../AddArtist/AddArtistEndpointTests.cs | 2 +- .../UpdateArtist/UpdateArtistEndpointTests.cs | 2 +- .../Tracks/AddTrack/AddTrackEndpointTests.cs | 1 - .../UpdateTrack/UpdateTrackEndpointTests.cs | 1 - 40 files changed, 1305 insertions(+), 667 deletions(-) diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointSummary.cs index a039dd41..26fc8125 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointSummary.cs @@ -1,4 +1,4 @@ -#region ========================================================================= USING ===================================================================================== +#region ========================================================================= USING ===================================================================================== using FastEndpoints; using Lumina.Contracts.DTO.Common; using Lumina.Contracts.DTO.MediaContributors; @@ -41,18 +41,15 @@ public class AddAlbumEndpointSummary : Summary r.Metadata!.ReleaseInfo!.ReReleaseYear, "The re-release or reissue year of the album. Optional."); RequestParam(r => r.Metadata!.ReleaseInfo!.ReleaseCountry, "The country or region of the release of the album. Optional."); RequestParam(r => r.Metadata!.ReleaseInfo!.ReleaseVersion, "The version or edition of the release of the album. Optional."); - RequestParam(r => r.Metadata!.ReleaseType, "The type of the release. Optional."); + RequestParam(r => r.Metadata!.ReleaseTypes, "The type of the release. Optional."); RequestParam(r => r.Metadata!.ReleaseStatus, "The status of the release. Optional."); 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."); @@ -310,7 +329,7 @@ public class AddAlbumEndpointSummary : Summary r.Metadata!.Genres, "The list of genres associated with 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."); + RequestParam(r => r.CatalogNumbers, "The catalog numbers of the album. Optional."); RequestParam(r => r.MusicBrainzReleaseId, "The MusicBrainz identifier of the release. Optional."); RequestParam(r => r.MusicBrainzReleaseGroupId, "The MusicBrainz identifier of the release group. Optional."); RequestParam(r => r.MusicBrainzReleaseArtistId, "The MusicBrainz identifier of the release artist. Optional."); @@ -324,13 +343,13 @@ public class AddAlbumEndpointSummary : Summary(r => r.Metadata!.Title, "The title of the album."); ResponseParam(r => r.Metadata!.OriginalTitle, "The original title of the album, if applicable."); ResponseParam(r => r.Metadata!.Description, "The description of the album, if applicable."); - ResponseParam(r => r.Metadata!.ReleaseType, "The type of the release, if applicable."); + ResponseParam(r => r.Metadata!.ReleaseTypes, "The type of the release, if applicable."); ResponseParam(r => r.Metadata!.ReleaseStatus, "The status of the release, if applicable."); ResponseParam(r => r.Metadata!.TotalDiscs, "The number of discs of the release, if applicable."); ResponseParam(r => r.Metadata!.TotalTracks, "The number of tracks of the release."); ResponseParam(r => r.MediaFormat, "The physical or digital medium of the album, if applicable."); ResponseParam(r => r.Barcode, "The barcode of the album, if applicable."); - ResponseParam(r => r.CatalogNumber, "The catalog number of the album, if applicable."); + ResponseParam(r => r.CatalogNumbers, "The catalog numbers of the album, if applicable."); ResponseParam(r => r.MusicBrainzReleaseId, "The MusicBrainz identifier of the release, if applicable."); ResponseParam(r => r.MusicBrainzReleaseGroupId, "The MusicBrainz identifier of the release group, if applicable."); ResponseParam(r => r.MusicBrainzReleaseArtistId, "The MusicBrainz identifier of the release artist, if applicable."); @@ -363,11 +382,12 @@ public class AddAlbumEndpointSummary : Summary ResponseParam(r => r.Metadata!.Title, "The title of the album."); ResponseParam(r => r.Metadata!.OriginalTitle, "The original title of the album, if applicable."); ResponseParam(r => r.Metadata!.Description, "The description of the album, if applicable."); - ResponseParam(r => r.Metadata!.ReleaseType, "The type of the release, if applicable."); + ResponseParam(r => r.Metadata!.ReleaseTypes, "The type of the release, if applicable."); ResponseParam(r => r.Metadata!.ReleaseStatus, "The status of the release, if applicable."); ResponseParam(r => r.Metadata!.TotalDiscs, "The number of discs of the release, if applicable."); ResponseParam(r => r.Metadata!.TotalTracks, "The number of tracks of the release."); ResponseParam(r => r.MediaFormat, "The physical or digital medium of the album, if applicable."); ResponseParam(r => r.Barcode, "The barcode of the album, if applicable."); - ResponseParam(r => r.CatalogNumber, "The catalog number of the album, if applicable."); + ResponseParam(r => r.CatalogNumbers, "The catalog numbers of the album, if applicable."); ResponseParam(r => r.MusicBrainzReleaseId, "The MusicBrainz identifier of the release, if applicable."); ResponseParam(r => r.MusicBrainzReleaseGroupId, "The MusicBrainz identifier of the release group, if applicable."); ResponseParam(r => r.MusicBrainzReleaseArtistId, "The MusicBrainz identifier of the release artist, if applicable."); @@ -70,15 +70,16 @@ public class GetAlbumEndpointSummary : Summary Id: Guid.NewGuid(), ArtistId: Guid.NewGuid(), LibraryId: Guid.NewGuid(), - Metadata: new AlbumMetadataDto( + Metadata: new MusicAlbumMetadataDto( Title: "A Night at the Opera", OriginalTitle: "A Night at the Opera", Description: "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.", + Disambiguation: "original release", ReleaseInfo: new ReleaseInfoDto( OriginalReleaseDate: new DateOnly(1975, 11, 21), OriginalReleaseYear: 1975, - ReReleaseDate: default, - ReReleaseYear: default, + ReReleaseDate: new DateOnly(2011, 11, 21), + ReReleaseYear: 2011, ReleaseCountry: ReleaseCountry.GB, ReleaseVersion: "Remastered" ), @@ -100,19 +101,21 @@ public class GetAlbumEndpointSummary : Summary new TagDto(Name: "classic"), new TagDto(Name: "vinyl") ], - ReleaseType: MusicReleaseType.Album, + Script: "Latn", + ReleaseTypes: [MusicReleaseType.Album], ReleaseStatus: MusicReleaseStatus.Official, TotalDiscs: 1, TotalTracks: 12 ), MediaFormat: MusicMediaFormat.CD, + Packaging: MusicReleasePackaging.JewelCase, Barcode: "0042282778329", - CatalogNumber: "EMC 4008", + CatalogNumbers: ["EMC 4008"], + Label: "EMI", + ASIN: "B000002UTK", MusicBrainzReleaseId: Guid.NewGuid(), MusicBrainzReleaseGroupId: Guid.NewGuid(), MusicBrainzReleaseArtistId: Guid.NewGuid(), - CreatedOnUtc: DateTime.UtcNow, - UpdatedOnUtc: DateTime.UtcNow, Contributors: [ new MediaContributorReferenceDto( ContributorId: Guid.NewGuid(), @@ -137,6 +140,8 @@ public class GetAlbumEndpointSummary : Summary VoteCount: 1234 ) ], + CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc), + UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc), Tracks: [] ) ); diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracks/GetAlbumTracksEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracks/GetAlbumTracksEndpointSummary.cs index 269da0ab..e9c3f688 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracks/GetAlbumTracksEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracks/GetAlbumTracksEndpointSummary.cs @@ -41,10 +41,10 @@ public class GetAlbumTracksEndpointSummary : Summary(r => r.Script, "The script used by the language of the track, if applicable."); ResponseParam(r => r.Key, "The musical key of the track, if applicable."); ResponseParam(r => r.Bpm, "The tempo of the track in beats per minute, if applicable."); - ResponseParam(r => r.Work, "The title of the work the track is a recording of, if applicable."); + ResponseParam(r => r.Work!.Title, "The title of the work the track is a recording of, if applicable."); ResponseParam(r => r.MusicBrainzRecordingId, "The MusicBrainz identifier of the recording, if applicable."); ResponseParam(r => r.MusicBrainzTrackId, "The MusicBrainz identifier of the track, if applicable."); - ResponseParam(r => r.MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); + ResponseParam(r => r.Work!.MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); ResponseParam(r => r.CreatedOnUtc, "The date and time when the track was created."); ResponseParam(r => r.UpdatedOnUtc, "The date and time when the track was last updated, if applicable."); ResponseParam(r => r.Moods, "The list of moods of the track."); @@ -80,15 +80,16 @@ public class GetAlbumTracksEndpointSummary : Summary r.Metadata!.ReleaseInfo!.ReReleaseYear, "The re-release or reissue year of the album. Optional."); RequestParam(r => r.Metadata!.ReleaseInfo!.ReleaseCountry, "The country or region of the release of the album. Optional."); RequestParam(r => r.Metadata!.ReleaseInfo!.ReleaseVersion, "The version or edition of the release of the album. Optional."); - RequestParam(r => r.Metadata!.ReleaseType, "The type of the release. Optional."); + RequestParam(r => r.Metadata!.ReleaseTypes, "The type of the release. Optional."); RequestParam(r => r.Metadata!.ReleaseStatus, "The status of the release. Optional."); 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."); @@ -57,7 +57,7 @@ public class UpdateAlbumEndpointSummary : Summary 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."); + RequestParam(r => r.CatalogNumbers, "The catalog numbers of the album. Optional."); RequestParam(r => r.MusicBrainzReleaseId, "The MusicBrainz identifier of the release. Optional."); RequestParam(r => r.MusicBrainzReleaseGroupId, "The MusicBrainz identifier of the release group. Optional."); RequestParam(r => r.MusicBrainzReleaseArtistId, "The MusicBrainz identifier of the release artist. Optional."); @@ -65,22 +65,19 @@ public class UpdateAlbumEndpointSummary : Summary r.Ratings, "The list of ratings for this album. Required."); ExampleRequest = new UpdateAlbumRequest( - Metadata: new AlbumMetadataDto( + Metadata: new MusicAlbumMetadataDto( Title: "A Night at the Opera", OriginalTitle: "A Night at the Opera", Description: "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.", + Disambiguation: "original release", ReleaseInfo: new ReleaseInfoDto( OriginalReleaseDate: new DateOnly(1975, 11, 21), OriginalReleaseYear: 1975, - ReReleaseDate: default, - ReReleaseYear: default, + ReReleaseDate: new DateOnly(2011, 11, 21), + ReReleaseYear: 2011, ReleaseCountry: ReleaseCountry.GB, ReleaseVersion: "Remastered" ), - ReleaseType: MusicReleaseType.Album, - ReleaseStatus: MusicReleaseStatus.Official, - TotalDiscs: 1, - TotalTracks: 12, Language: new LanguageInfoDto( LanguageCode: "en", LanguageName: "English", @@ -100,11 +97,19 @@ public class UpdateAlbumEndpointSummary : Summary(r => r.Metadata!.Title, "The title of the album."); ResponseParam(r => r.Metadata!.OriginalTitle, "The original title of the album, if applicable."); ResponseParam(r => r.Metadata!.Description, "The description of the album, if applicable."); - ResponseParam(r => r.Metadata!.ReleaseType, "The type of the release, if applicable."); + ResponseParam(r => r.Metadata!.ReleaseTypes, "The type of the release, if applicable."); ResponseParam(r => r.Metadata!.ReleaseStatus, "The status of the release, if applicable."); ResponseParam(r => r.Metadata!.TotalDiscs, "The number of discs of the release, if applicable."); ResponseParam(r => r.Metadata!.TotalTracks, "The number of tracks of the release."); ResponseParam(r => r.MediaFormat, "The physical or digital medium of the album, if applicable."); ResponseParam(r => r.Barcode, "The barcode of the album, if applicable."); - ResponseParam(r => r.CatalogNumber, "The catalog number of the album, if applicable."); + ResponseParam(r => r.CatalogNumbers, "The catalog numbers of the album, if applicable."); ResponseParam(r => r.MusicBrainzReleaseId, "The MusicBrainz identifier of the release, if applicable."); ResponseParam(r => r.MusicBrainzReleaseGroupId, "The MusicBrainz identifier of the release group, if applicable."); ResponseParam(r => r.MusicBrainzReleaseArtistId, "The MusicBrainz identifier of the release artist, if applicable."); @@ -177,15 +182,16 @@ public class UpdateAlbumEndpointSummary : Summary r.Name, "The name of the artist. Required."); + RequestParam(r => r.Metadata!.Name, "The name of the artist. Required."); RequestParam(r => r.Website, "The website of the artist. Optional."); RequestParam(r => r.MusicBrainzArtistId, "The MusicBrainz identifier of the artist. Optional."); RequestParam(r => r.Contributors, "The list of media contributors that make up the artist. Required."); @@ -308,20 +346,20 @@ public class AddArtistEndpointSummary : Summary r.Albums![0].Metadata!.Language, "The language of the album. Optional."); RequestParam(r => r.Albums![0].Metadata!.Language!.LanguageCode, "The ISO code of the language (e.g., \"en\" for English). Required."); RequestParam(r => r.Albums![0].Metadata!.Language!.LanguageName, "The name of the language in English. Required."); - RequestParam(r => r.Albums![0].Metadata!.Language!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); + RequestParam(r => r.Albums![0].Metadata!.Language!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); RequestParam(r => r.Albums![0].Metadata!.OriginalLanguage, "The original language of the album, if it has been translated. Optional."); RequestParam(r => r.Albums![0].Metadata!.OriginalLanguage!.LanguageCode, "The ISO code of the language (e.g., \"en\" for English). Required."); RequestParam(r => r.Albums![0].Metadata!.OriginalLanguage!.LanguageName, "The name of the language in English. Required."); - RequestParam(r => r.Albums![0].Metadata!.OriginalLanguage!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); + RequestParam(r => r.Albums![0].Metadata!.OriginalLanguage!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); RequestParam(r => r.Albums![0].Metadata!.Tags, "The list of tags that further describe or categorize the album. Required."); RequestParam(r => r.Albums![0].Metadata!.Genres, "The list of genres associated with the album. Required."); - RequestParam(r => r.Albums![0].Metadata!.ReleaseType, "The type of the release. Optional."); + RequestParam(r => r.Albums![0].Metadata!.ReleaseTypes, "The type of the release. Optional."); RequestParam(r => r.Albums![0].Metadata!.ReleaseStatus, "The status of the release. Optional."); RequestParam(r => r.Albums![0].Metadata!.TotalDiscs, "The number of discs of the release. Optional."); RequestParam(r => r.Albums![0].Metadata!.TotalTracks, "The number of tracks of the release. Optional."); RequestParam(r => r.Albums![0].MediaFormat, "The physical or digital medium of the album. Optional."); RequestParam(r => r.Albums![0].Barcode, "The barcode of the album. Optional."); - RequestParam(r => r.Albums![0].CatalogNumber, "The catalog number of the album. Optional."); + RequestParam(r => r.Albums![0].CatalogNumbers, "The catalog numbers of the album. Optional."); RequestParam(r => r.Albums![0].MusicBrainzReleaseId, "The MusicBrainz identifier of the release. Optional."); RequestParam(r => r.Albums![0].MusicBrainzReleaseGroupId, "The MusicBrainz identifier of the release group. Optional."); RequestParam(r => r.Albums![0].MusicBrainzReleaseArtistId, "The MusicBrainz identifier of the release artist. Optional."); @@ -343,11 +381,11 @@ public class AddArtistEndpointSummary : Summary r.Albums![0].Tracks![0].Metadata!.Language, "The language of the track. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Language!.LanguageCode, "The ISO code of the language (e.g., \"en\" for English). Required."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Language!.LanguageName, "The name of the language in English. Required."); - RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Language!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); + RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Language!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.OriginalLanguage, "The original language of the track, if it has been translated. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.OriginalLanguage!.LanguageCode, "The ISO code of the language (e.g., \"en\" for English). Required."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.OriginalLanguage!.LanguageName, "The name of the language in English. Required."); - RequestParam(r => r.Albums![0].Tracks![0].Metadata!.OriginalLanguage!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); + RequestParam(r => r.Albums![0].Tracks![0].Metadata!.OriginalLanguage!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Tags, "The list of tags that further describe or categorize the track. Required."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Genres, "The list of genres associated with the track. Required."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.DurationInSeconds, "The duration of the audio of the track in seconds. Required."); @@ -361,10 +399,10 @@ public class AddArtistEndpointSummary : Summary r.Albums![0].Tracks![0].Script, "The script used by the language of the track. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Key, "The musical key of the track. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Bpm, "The tempo of the track in beats per minute. Optional."); - RequestParam(r => r.Albums![0].Tracks![0].Work, "The title of the work the track is a recording of. Optional."); + RequestParam(r => r.Albums![0].Tracks![0].Work!.Title, "The title of the work the track is a recording of. Optional."); RequestParam(r => r.Albums![0].Tracks![0].MusicBrainzRecordingId, "The MusicBrainz identifier of the recording. Optional."); RequestParam(r => r.Albums![0].Tracks![0].MusicBrainzTrackId, "The MusicBrainz identifier of the track. Optional."); - RequestParam(r => r.Albums![0].Tracks![0].MusicBrainzWorkId, "The MusicBrainz identifier of the work. Optional."); + RequestParam(r => r.Albums![0].Tracks![0].Work!.MusicBrainzWorkId, "The MusicBrainz identifier of the work. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Moods, "The list of moods of the track. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Isrcs, "The list of ISRC (International Standard Recording Code) of the track. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Contributors, "The list of media contributors that performed on the track. Required."); @@ -372,7 +410,7 @@ public class AddArtistEndpointSummary : Summary(r => r.Id, "The Id of the artist."); ResponseParam(r => r.LibraryId, "The Id of the media library this artist belongs to."); - ResponseParam(r => r.Name, "The name of the artist."); + ResponseParam(r => r.Metadata!.Name, "The name of the artist."); ResponseParam(r => r.Website, "The website of the artist, if applicable."); ResponseParam(r => r.MusicBrainzArtistId, "The MusicBrainz identifier of the artist, if applicable."); ResponseParam(r => r.Contributors, "The list of references to the media contributors that make up the artist, each with the role they played."); @@ -401,13 +439,13 @@ public class AddArtistEndpointSummary : Summary(r => r.Albums![0].Metadata!.OriginalLanguage!.NativeName, "The native name of the original language of the album."); ResponseParam(r => r.Albums![0].Metadata!.Tags, "The list of tags of the album."); ResponseParam(r => r.Albums![0].Metadata!.Genres, "The list of genres of the album."); - ResponseParam(r => r.Albums![0].Metadata!.ReleaseType, "The type of the release of the album."); + ResponseParam(r => r.Albums![0].Metadata!.ReleaseTypes, "The type of the release of the album."); ResponseParam(r => r.Albums![0].Metadata!.ReleaseStatus, "The status of the release of the album."); ResponseParam(r => r.Albums![0].Metadata!.TotalDiscs, "The number of discs of the release of the album."); ResponseParam(r => r.Albums![0].Metadata!.TotalTracks, "The number of tracks of the release of the album."); ResponseParam(r => r.Albums![0].MediaFormat, "The physical or digital medium of the album, if applicable."); ResponseParam(r => r.Albums![0].Barcode, "The barcode of the album, if applicable."); - ResponseParam(r => r.Albums![0].CatalogNumber, "The catalog number of the album, if applicable."); + ResponseParam(r => r.Albums![0].CatalogNumbers, "The catalog numbers of the album, if applicable."); ResponseParam(r => r.Albums![0].MusicBrainzReleaseId, "The MusicBrainz identifier of the release, if applicable."); ResponseParam(r => r.Albums![0].MusicBrainzReleaseGroupId, "The MusicBrainz identifier of the release group, if applicable."); ResponseParam(r => r.Albums![0].MusicBrainzReleaseArtistId, "The MusicBrainz identifier of the release artist, if applicable."); @@ -452,10 +490,10 @@ public class AddArtistEndpointSummary : Summary(r => r.Albums![0].Tracks![0].Script, "The script used by the language of the track, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].Key, "The musical key of the track, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].Bpm, "The tempo of the track in beats per minute, if applicable."); - ResponseParam(r => r.Albums![0].Tracks![0].Work, "The title of the work the track is a recording of, if applicable."); + ResponseParam(r => r.Albums![0].Tracks![0].Work!.Title, "The title of the work the track is a recording of, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].MusicBrainzRecordingId, "The MusicBrainz identifier of the recording, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].MusicBrainzTrackId, "The MusicBrainz identifier of the track, if applicable."); - ResponseParam(r => r.Albums![0].Tracks![0].MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); + ResponseParam(r => r.Albums![0].Tracks![0].Work!.MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].CreatedOnUtc, "The date and time when the track was created."); ResponseParam(r => r.Albums![0].Tracks![0].UpdatedOnUtc, "The date and time when the track was last updated, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].Moods, "The list of moods of the track."); @@ -469,14 +507,39 @@ public class AddArtistEndpointSummary : Summary ResponseParam(r => r.Id, "The Id of the artist."); ResponseParam(r => r.LibraryId, "The Id of the media library this artist belongs to."); - ResponseParam(r => r.Name, "The name of the artist."); + ResponseParam(r => r.Metadata!.Name, "The name of the artist."); ResponseParam(r => r.Website, "The website of the artist, if applicable."); ResponseParam(r => r.MusicBrainzArtistId, "The MusicBrainz identifier of the artist, if applicable."); ResponseParam(r => r.Contributors, "The list of references to the media contributors that make up the artist, each with the role they played."); @@ -37,17 +43,127 @@ public class GetArtistEndpointSummary : Summary example: new ArtistResponse( Id: Guid.NewGuid(), LibraryId: Guid.NewGuid(), - Name: "Queen", + Metadata: new MusicArtistMetadataDto( + Name: "Queen", + SortName: "Queen", + Disambiguation: "British rock band", + Type: MusicArtistType.Group, + Gender: MusicArtistGender.NotApplicable, + Country: "GB", + Area: new MusicAreaDto(MusicBrainzAreaId: Guid.NewGuid(), Name: "United Kingdom", SortName: "United Kingdom", Disambiguation: "sovereign state", Type: "Country", Iso3166Code: "GB"), + BeginArea: new MusicAreaDto(MusicBrainzAreaId: Guid.NewGuid(), Name: "United Kingdom", SortName: "United Kingdom", Disambiguation: "sovereign state", Type: "Country", Iso3166Code: "GB"), + EndArea: new MusicAreaDto(MusicBrainzAreaId: Guid.NewGuid(), Name: "United Kingdom", SortName: "United Kingdom", Disambiguation: "sovereign state", Type: "Country", Iso3166Code: "GB"), + LifeSpanBegin: new DateOnly(1970, 6, 27), + LifeSpanEnd: new DateOnly(1991, 11, 24), + IsEnded: false, + Aliases: [new MusicArtistAliasDto(Name: "The Queen", SortName: "Queen", Type: "Artist name", Locale: "en", IsPrimary: false, BeginDate: new DateOnly(1970, 6, 27), EndDate: new DateOnly(1991, 11, 24), IsEnded: true)], + Genres: [new GenreDto(Name: "Rock")], + Tags: [new TagDto(Name: "classic")] + ), Website: "https://www.queenonline.com", MusicBrainzArtistId: Guid.NewGuid(), + Ipis: ["00012345678"], + Isnis: ["0000000123456789"], Contributors: [ - new(ContributorId: Guid.NewGuid(), Role: MediaContributorRole.Vocals), - new(ContributorId: Guid.NewGuid(), Role: MediaContributorRole.Guitar) + new MediaContributorReferenceDto(ContributorId: Guid.NewGuid(), Role: MediaContributorRole.Vocals), + new MediaContributorReferenceDto(ContributorId: Guid.NewGuid(), Role: MediaContributorRole.Guitar) ], - Albums: [], - CreatedOnUtc: DateTime.UtcNow, - UpdatedOnUtc: DateTime.UtcNow + CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc), + UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc), + Ratings: [new AudioRatingDto(Value: 4.5M, MaxValue: 5, Source: AudioRatingSource.MusicBrainz, VoteCount: 2345)], + Albums: + [ + new( + Id: Guid.NewGuid(), + ArtistId: Guid.NewGuid(), + LibraryId: Guid.NewGuid(), + Metadata: new( + Title: "A Night at the Opera", + OriginalTitle: "A Night at the Opera", + Description: "The fourth studio album by the British rock band Queen, released in 1975. It was the most expensive album ever recorded at the time of its release.", + Disambiguation: "original release", + ReleaseInfo: new( + OriginalReleaseDate: new DateOnly(1975, 11, 21), + OriginalReleaseYear: 1975, + ReReleaseDate: new DateOnly(2011, 11, 21), + ReReleaseYear: 2011, + ReleaseCountry: ReleaseCountry.GB, + ReleaseVersion: "Remastered" + ), + Language: new(LanguageCode: "en", LanguageName: "English", NativeName: "English"), + OriginalLanguage: new(LanguageCode: "en", LanguageName: "English", NativeName: "English"), + Genres: [new(Name: "Rock"), new(Name: "Progressive Rock")], + Tags: [new(Name: "classic"), new(Name: "vinyl")], + Script: "Latn", + ReleaseTypes: [MusicReleaseType.Album], + ReleaseStatus: MusicReleaseStatus.Official, + TotalDiscs: 1, + TotalTracks: 12 + ), + MediaFormat: MusicMediaFormat.CD, + Packaging: MusicReleasePackaging.JewelCase, + Barcode: "0042282778329", + CatalogNumbers: ["EMC 4008"], + Label: "EMI", + ASIN: "B000002UTK", + MusicBrainzReleaseId: Guid.NewGuid(), + MusicBrainzReleaseGroupId: Guid.NewGuid(), + MusicBrainzReleaseArtistId: Guid.NewGuid(), + Contributors: [new MediaContributorReferenceDto(ContributorId: Guid.NewGuid(), Role: MediaContributorRole.Producer)], + Ratings: [new(Value: 4.5M, MaxValue: 5, Source: AudioRatingSource.MusicBrainz, VoteCount: 2345)], + CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc), + UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc), + Tracks: + [ + new( + Id: Guid.NewGuid(), + AlbumId: Guid.NewGuid(), + LibraryId: Guid.NewGuid(), + Path: "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac", + Metadata: new( + Title: "Bohemian Rhapsody", + OriginalTitle: "Bohemian Rhapsody", + Description: "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.", + Disambiguation: "album version", + ReleaseInfo: new( + OriginalReleaseDate: new DateOnly(1975, 10, 31), + OriginalReleaseYear: 1975, + ReReleaseDate: new DateOnly(2011, 11, 21), + ReReleaseYear: 2011, + ReleaseCountry: ReleaseCountry.GB, + ReleaseVersion: "Original" + ), + Language: new(LanguageCode: "en", LanguageName: "English", NativeName: "English"), + OriginalLanguage: new(LanguageCode: "en", LanguageName: "English", NativeName: "English"), + Tags: [new(Name: "classic"), new(Name: "epic")], + Genres: [new(Name: "Rock"), new(Name: "Progressive Rock")], + DurationInSeconds: 354, + SampleRate: 44100, + Channels: 2, + BitDepth: 16, + AudioCodec: "FLAC", + Bitrate: 980, + IsVideo: false + ), + Script: "Latn", + Key: MusicKey.CMajor, + Bpm: 72, + Work: new MusicWorkDto(MusicBrainzWorkId: Guid.NewGuid(), Title: "Bohemian Rhapsody", Type: "Song", Languages: [new LanguageInfoDto(LanguageCode: "en", LanguageName: "English", NativeName: "English")], Iswcs: ["T-010489707-6"]), + Isrcs: [new(Value: "GBUM71029604")], + Moods: [new(Name: "dramatic"), new(Name: "anxious")], + MusicBrainzRecordingId: Guid.NewGuid(), + MusicBrainzTrackId: Guid.NewGuid(), + Contributors: [new MediaContributorReferenceDto(ContributorId: Guid.NewGuid(), Role: MediaContributorRole.Vocals)], + Ratings: [new(Value: 4.5M, MaxValue: 5, Source: AudioRatingSource.MusicBrainz, VoteCount: 2345)], + TrackNumber: 1, + DiscNumber: 1, + CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc), + UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc) + ) + ] + ) + ] ) ); diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs index 447e7594..a70cc6d0 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs @@ -35,13 +35,13 @@ public class GetArtistAlbumsEndpointSummary : Summary(r => r.Metadata!.Title, "The title of the album."); ResponseParam(r => r.Metadata!.OriginalTitle, "The original title of the album, if applicable."); ResponseParam(r => r.Metadata!.Description, "The description of the album, if applicable."); - ResponseParam(r => r.Metadata!.ReleaseType, "The type of the release, if applicable."); + ResponseParam(r => r.Metadata!.ReleaseTypes, "The type of the release, if applicable."); ResponseParam(r => r.Metadata!.ReleaseStatus, "The status of the release, if applicable."); ResponseParam(r => r.Metadata!.TotalDiscs, "The number of discs of the release, if applicable."); ResponseParam(r => r.Metadata!.TotalTracks, "The number of tracks of the release."); ResponseParam(r => r.MediaFormat, "The physical or digital medium of the album, if applicable."); ResponseParam(r => r.Barcode, "The barcode of the album, if applicable."); - ResponseParam(r => r.CatalogNumber, "The catalog number of the album, if applicable."); + ResponseParam(r => r.CatalogNumbers, "The catalog numbers of the album, if applicable."); ResponseParam(r => r.MusicBrainzReleaseId, "The MusicBrainz identifier of the release, if applicable."); ResponseParam(r => r.MusicBrainzReleaseGroupId, "The MusicBrainz identifier of the release group, if applicable."); ResponseParam(r => r.MusicBrainzReleaseArtistId, "The MusicBrainz identifier of the release artist, if applicable."); @@ -72,15 +72,16 @@ public class GetArtistAlbumsEndpointSummary : Summary(r => r.Id, "The Id of the artist."); ResponseParam(r => r.LibraryId, "The Id of the media library this artist belongs to."); - ResponseParam(r => r.Name, "The name of the artist."); + ResponseParam(r => r.Metadata!.Name, "The name of the artist."); ResponseParam(r => r.Website, "The website of the artist, if applicable."); ResponseParam(r => r.MusicBrainzArtistId, "The MusicBrainz identifier of the artist, if applicable."); ResponseParam(r => r.Contributors, "The list of references to the media contributors that make up the artist, each with the role they played."); @@ -52,24 +59,244 @@ public class GetArtistsEndpointSummary : Summary r.Name, "The name of the artist. Required."); + RequestParam(r => r.Metadata!.Name, "The name of the artist. Required."); RequestParam(r => r.Website, "The website of the artist. Optional."); RequestParam(r => r.MusicBrainzArtistId, "The MusicBrainz identifier of the artist. Optional."); RequestParam(r => r.Contributors, "The list of media contributors that make up the artist. Required."); @@ -52,20 +52,20 @@ public class UpdateArtistEndpointSummary : Summary r.Albums![0].Metadata!.Language, "The language of the album. Optional."); RequestParam(r => r.Albums![0].Metadata!.Language!.LanguageCode, "The ISO code of the language (e.g., \"en\" for English). Required."); RequestParam(r => r.Albums![0].Metadata!.Language!.LanguageName, "The name of the language in English. Required."); - RequestParam(r => r.Albums![0].Metadata!.Language!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); + RequestParam(r => r.Albums![0].Metadata!.Language!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); RequestParam(r => r.Albums![0].Metadata!.OriginalLanguage, "The original language of the album, if it has been translated. Optional."); RequestParam(r => r.Albums![0].Metadata!.OriginalLanguage!.LanguageCode, "The ISO code of the language (e.g., \"en\" for English). Required."); RequestParam(r => r.Albums![0].Metadata!.OriginalLanguage!.LanguageName, "The name of the language in English. Required."); - RequestParam(r => r.Albums![0].Metadata!.OriginalLanguage!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); + RequestParam(r => r.Albums![0].Metadata!.OriginalLanguage!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); RequestParam(r => r.Albums![0].Metadata!.Tags, "The list of tags that further describe or categorize the album. Required."); RequestParam(r => r.Albums![0].Metadata!.Genres, "The list of genres associated with the album. Required."); - RequestParam(r => r.Albums![0].Metadata!.ReleaseType, "The type of the release. Optional."); + RequestParam(r => r.Albums![0].Metadata!.ReleaseTypes, "The type of the release. Optional."); RequestParam(r => r.Albums![0].Metadata!.ReleaseStatus, "The status of the release. Optional."); RequestParam(r => r.Albums![0].Metadata!.TotalDiscs, "The number of discs of the release. Optional."); RequestParam(r => r.Albums![0].Metadata!.TotalTracks, "The number of tracks of the release. Optional."); RequestParam(r => r.Albums![0].MediaFormat, "The physical or digital medium of the album. Optional."); RequestParam(r => r.Albums![0].Barcode, "The barcode of the album. Optional."); - RequestParam(r => r.Albums![0].CatalogNumber, "The catalog number of the album. Optional."); + RequestParam(r => r.Albums![0].CatalogNumbers, "The catalog numbers of the album. Optional."); RequestParam(r => r.Albums![0].MusicBrainzReleaseId, "The MusicBrainz identifier of the release. Optional."); RequestParam(r => r.Albums![0].MusicBrainzReleaseGroupId, "The MusicBrainz identifier of the release group. Optional."); RequestParam(r => r.Albums![0].MusicBrainzReleaseArtistId, "The MusicBrainz identifier of the release artist. Optional."); @@ -88,11 +88,11 @@ public class UpdateArtistEndpointSummary : Summary r.Albums![0].Tracks![0].Metadata!.Language, "The language of the track. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Language!.LanguageCode, "The ISO code of the language (e.g., \"en\" for English). Required."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Language!.LanguageName, "The name of the language in English. Required."); - RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Language!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); + RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Language!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.OriginalLanguage, "The original language of the track, if it has been translated. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.OriginalLanguage!.LanguageCode, "The ISO code of the language (e.g., \"en\" for English). Required."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.OriginalLanguage!.LanguageName, "The name of the language in English. Required."); - RequestParam(r => r.Albums![0].Tracks![0].Metadata!.OriginalLanguage!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); + RequestParam(r => r.Albums![0].Tracks![0].Metadata!.OriginalLanguage!.NativeName, "The native name of the language (e.g., \"Español\" for Spanish). Optional."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Tags, "The list of tags that further describe or categorize the track. Required."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.Genres, "The list of genres associated with the track. Required."); RequestParam(r => r.Albums![0].Tracks![0].Metadata!.DurationInSeconds, "The duration of the audio of the track in seconds. Required."); @@ -106,19 +106,37 @@ public class UpdateArtistEndpointSummary : Summary r.Albums![0].Tracks![0].Script, "The script used by the language of the track. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Key, "The musical key of the track. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Bpm, "The tempo of the track in beats per minute. Optional."); - RequestParam(r => r.Albums![0].Tracks![0].Work, "The title of the work the track is a recording of. Optional."); + RequestParam(r => r.Albums![0].Tracks![0].Work!.Title, "The title of the work the track is a recording of. Optional."); RequestParam(r => r.Albums![0].Tracks![0].MusicBrainzRecordingId, "The MusicBrainz identifier of the recording. Optional."); RequestParam(r => r.Albums![0].Tracks![0].MusicBrainzTrackId, "The MusicBrainz identifier of the track. Optional."); - RequestParam(r => r.Albums![0].Tracks![0].MusicBrainzWorkId, "The MusicBrainz identifier of the work. Optional."); + RequestParam(r => r.Albums![0].Tracks![0].Work!.MusicBrainzWorkId, "The MusicBrainz identifier of the work. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Moods, "The list of moods of the track. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Isrcs, "The list of ISRC (International Standard Recording Code) of the track. Optional."); RequestParam(r => r.Albums![0].Tracks![0].Contributors, "The list of media contributors that performed on the track. Required."); RequestParam(r => r.Albums![0].Tracks![0].Ratings, "The list of ratings for this track. Required."); ExampleRequest = new UpdateArtistRequest( - Name: "Queen", + Metadata: new MusicArtistMetadataDto( + Name: "Queen", + SortName: "Queen", + Disambiguation: "British rock band", + Type: MusicArtistType.Group, + Gender: MusicArtistGender.NotApplicable, + Country: "GB", + Area: new MusicAreaDto(MusicBrainzAreaId: Guid.NewGuid(), Name: "United Kingdom", SortName: "United Kingdom", Disambiguation: "sovereign state", Type: "Country", Iso3166Code: "GB"), + BeginArea: new MusicAreaDto(MusicBrainzAreaId: Guid.NewGuid(), Name: "United Kingdom", SortName: "United Kingdom", Disambiguation: "sovereign state", Type: "Country", Iso3166Code: "GB"), + EndArea: new MusicAreaDto(MusicBrainzAreaId: Guid.NewGuid(), Name: "United Kingdom", SortName: "United Kingdom", Disambiguation: "sovereign state", Type: "Country", Iso3166Code: "GB"), + LifeSpanBegin: new DateOnly(1970, 6, 27), + LifeSpanEnd: new DateOnly(1991, 11, 24), + IsEnded: false, + Aliases: [new MusicArtistAliasDto(Name: "The Queen", SortName: "Queen", Type: "Artist name", Locale: "en", IsPrimary: false, BeginDate: new DateOnly(1970, 6, 27), EndDate: new DateOnly(1991, 11, 24), IsEnded: true)], + Genres: [new GenreDto(Name: "Rock")], + Tags: [new TagDto(Name: "classic")] + ), Website: "https://www.queenonline.com", MusicBrainzArtistId: Guid.NewGuid(), + Ipis: ["00012345678"], + Isnis: ["0000000123456789"], Contributors: [ new MediaContributorReferenceDto( @@ -130,18 +148,20 @@ public class UpdateArtistEndpointSummary : Summary(r => r.Id, "The Id of the artist."); ResponseParam(r => r.LibraryId, "The Id of the media library this artist belongs to."); - ResponseParam(r => r.Name, "The name of the artist."); + ResponseParam(r => r.Metadata!.Name, "The name of the artist."); ResponseParam(r => r.Website, "The website of the artist, if applicable."); ResponseParam(r => r.MusicBrainzArtistId, "The MusicBrainz identifier of the artist, if applicable."); ResponseParam(r => r.Contributors, "The list of references to the media contributors that make up the artist, each with the role they played."); @@ -400,13 +438,13 @@ public class UpdateArtistEndpointSummary : Summary(r => r.Albums![0].Metadata!.OriginalLanguage!.NativeName, "The native name of the original language of the album."); ResponseParam(r => r.Albums![0].Metadata!.Tags, "The list of tags of the album."); ResponseParam(r => r.Albums![0].Metadata!.Genres, "The list of genres of the album."); - ResponseParam(r => r.Albums![0].Metadata!.ReleaseType, "The type of the release of the album."); + ResponseParam(r => r.Albums![0].Metadata!.ReleaseTypes, "The type of the release of the album."); ResponseParam(r => r.Albums![0].Metadata!.ReleaseStatus, "The status of the release of the album."); ResponseParam(r => r.Albums![0].Metadata!.TotalDiscs, "The number of discs of the release of the album."); ResponseParam(r => r.Albums![0].Metadata!.TotalTracks, "The number of tracks of the release of the album."); ResponseParam(r => r.Albums![0].MediaFormat, "The physical or digital medium of the album, if applicable."); ResponseParam(r => r.Albums![0].Barcode, "The barcode of the album, if applicable."); - ResponseParam(r => r.Albums![0].CatalogNumber, "The catalog number of the album, if applicable."); + ResponseParam(r => r.Albums![0].CatalogNumbers, "The catalog numbers of the album, if applicable."); ResponseParam(r => r.Albums![0].MusicBrainzReleaseId, "The MusicBrainz identifier of the release, if applicable."); ResponseParam(r => r.Albums![0].MusicBrainzReleaseGroupId, "The MusicBrainz identifier of the release group, if applicable."); ResponseParam(r => r.Albums![0].MusicBrainzReleaseArtistId, "The MusicBrainz identifier of the release artist, if applicable."); @@ -451,10 +489,10 @@ public class UpdateArtistEndpointSummary : Summary(r => r.Albums![0].Tracks![0].Script, "The script used by the language of the track, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].Key, "The musical key of the track, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].Bpm, "The tempo of the track in beats per minute, if applicable."); - ResponseParam(r => r.Albums![0].Tracks![0].Work, "The title of the work the track is a recording of, if applicable."); + ResponseParam(r => r.Albums![0].Tracks![0].Work!.Title, "The title of the work the track is a recording of, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].MusicBrainzRecordingId, "The MusicBrainz identifier of the recording, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].MusicBrainzTrackId, "The MusicBrainz identifier of the track, if applicable."); - ResponseParam(r => r.Albums![0].Tracks![0].MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); + ResponseParam(r => r.Albums![0].Tracks![0].Work!.MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].CreatedOnUtc, "The date and time when the track was created."); ResponseParam(r => r.Albums![0].Tracks![0].UpdatedOnUtc, "The date and time when the track was last updated, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].Moods, "The list of moods of the track."); @@ -472,29 +510,49 @@ public class UpdateArtistEndpointSummary : Summary r.Path, "The file system path of the track. Required."); @@ -150,10 +157,10 @@ public class AddTrackEndpointSummary : Summary r.Script, "The script used by the language of the track. Optional."); RequestParam(r => r.Key, "The musical key of the track. Optional."); RequestParam(r => r.Bpm, "The tempo of the track in beats per minute. Optional."); - RequestParam(r => r.Work, "The title of the work the track is a recording of. Optional."); + RequestParam(r => r.Work!.Title, "The title of the work the track is a recording of. Optional."); RequestParam(r => r.MusicBrainzRecordingId, "The MusicBrainz identifier of the recording. Optional."); RequestParam(r => r.MusicBrainzTrackId, "The MusicBrainz identifier of the track. Optional."); - RequestParam(r => r.MusicBrainzWorkId, "The MusicBrainz identifier of the work. Optional."); + RequestParam(r => r.Work!.MusicBrainzWorkId, "The MusicBrainz identifier of the work. Optional."); RequestParam(r => r.Moods, "The list of moods of the track. Optional."); RequestParam(r => r.Isrcs, "The list of ISRC (International Standard Recording Code) of the track. Optional."); RequestParam(r => r.Contributors, "The list of media contributors that performed on the track. Required."); @@ -171,10 +178,10 @@ public class AddTrackEndpointSummary : Summary(r => r.Script, "The script used by the language of the track, if applicable."); ResponseParam(r => r.Key, "The musical key of the track, if applicable."); ResponseParam(r => r.Bpm, "The tempo of the track in beats per minute, if applicable."); - ResponseParam(r => r.Work, "The title of the work the track is a recording of, if applicable."); + ResponseParam(r => r.Work!.Title, "The title of the work the track is a recording of, if applicable."); ResponseParam(r => r.MusicBrainzRecordingId, "The MusicBrainz identifier of the recording, if applicable."); ResponseParam(r => r.MusicBrainzTrackId, "The MusicBrainz identifier of the track, if applicable."); - ResponseParam(r => r.MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); + ResponseParam(r => r.Work!.MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); ResponseParam(r => r.CreatedOnUtc, "The date and time when the track was created."); ResponseParam(r => r.UpdatedOnUtc, "The date and time when the track was last updated, if applicable."); ResponseParam(r => r.Moods, "The list of moods of the track."); @@ -208,15 +215,16 @@ public class AddTrackEndpointSummary : Summary ResponseParam(r => r.Script, "The script used by the language of the track, if applicable."); ResponseParam(r => r.Key, "The musical key of the track, if applicable."); ResponseParam(r => r.Bpm, "The tempo of the track in beats per minute, if applicable."); - ResponseParam(r => r.Work, "The title of the work the track is a recording of, if applicable."); + ResponseParam(r => r.Work!.Title, "The title of the work the track is a recording of, if applicable."); ResponseParam(r => r.MusicBrainzRecordingId, "The MusicBrainz identifier of the recording, if applicable."); ResponseParam(r => r.MusicBrainzTrackId, "The MusicBrainz identifier of the track, if applicable."); - ResponseParam(r => r.MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); + ResponseParam(r => r.Work!.MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); ResponseParam(r => r.CreatedOnUtc, "The date and time when the track was created."); ResponseParam(r => r.UpdatedOnUtc, "The date and time when the track was last updated, if applicable."); ResponseParam(r => r.Moods, "The list of moods of the track."); @@ -78,15 +78,16 @@ public class GetTrackEndpointSummary : Summary AlbumId: Guid.NewGuid(), LibraryId: Guid.NewGuid(), Path: "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac", - Metadata: new AudioMetadataDto( + Metadata: new MusicTrackMetadataDto( Title: "Bohemian Rhapsody", OriginalTitle: "Bohemian Rhapsody", Description: "A song by the British rock band Queen. It was written by Freddie Mercury and originally released on the album A Night at the Opera in 1975.", + Disambiguation: "album version", ReleaseInfo: new ReleaseInfoDto( OriginalReleaseDate: new DateOnly(1975, 10, 31), OriginalReleaseYear: 1975, - ReReleaseDate: default, - ReReleaseYear: default, + ReReleaseDate: new DateOnly(2011, 11, 21), + ReReleaseYear: 2011, ReleaseCountry: ReleaseCountry.GB, ReleaseVersion: "Original" ), @@ -113,26 +114,28 @@ public class GetTrackEndpointSummary : Summary Channels: 2, BitDepth: 16, AudioCodec: "FLAC", - Bitrate: 980 + Bitrate: 980, + IsVideo: false ), - TrackNumber: 1, - DiscNumber: 1, Script: "Latn", Key: MusicKey.CMajor, Bpm: 72, - Work: "Bohemian Rhapsody", - MusicBrainzRecordingId: Guid.NewGuid(), - MusicBrainzTrackId: Guid.NewGuid(), - MusicBrainzWorkId: Guid.NewGuid(), - CreatedOnUtc: DateTime.UtcNow, - UpdatedOnUtc: DateTime.UtcNow, + Work: new MusicWorkDto( + MusicBrainzWorkId: Guid.NewGuid(), + Title: "Bohemian Rhapsody", + Type: "Song", + Languages: [new LanguageInfoDto(LanguageCode: "en", LanguageName: "English", NativeName: "English")], + Iswcs: ["T-010489707-6"] + ), + Isrcs: [ + new IsrcDto(Value: "GBUM71029604") + ], Moods: [ new MoodDto(Name: "dramatic"), new MoodDto(Name: "anxious") ], - Isrcs: [ - new IsrcDto(Value: "GBUM71029604") - ], + MusicBrainzRecordingId: Guid.NewGuid(), + MusicBrainzTrackId: Guid.NewGuid(), Contributors: [ new MediaContributorReferenceDto( ContributorId: Guid.NewGuid(), @@ -156,7 +159,11 @@ public class GetTrackEndpointSummary : Summary Source: AudioRatingSource.LastFm, VoteCount: 1234 ) - ] + ], + TrackNumber: 1, + DiscNumber: 1, + CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc), + UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc) ) ); diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointSummary.cs index 300f67a3..e873a6d6 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointSummary.cs @@ -32,10 +32,11 @@ public class UpdateTrackEndpointSummary : Summary r.Path, "The file system path of the track. Required."); @@ -150,10 +157,10 @@ public class UpdateTrackEndpointSummary : Summary r.Script, "The script used by the language of the track. Optional."); RequestParam(r => r.Key, "The musical key of the track. Optional."); RequestParam(r => r.Bpm, "The tempo of the track in beats per minute. Optional."); - RequestParam(r => r.Work, "The title of the work the track is a recording of. Optional."); + RequestParam(r => r.Work!.Title, "The title of the work the track is a recording of. Optional."); RequestParam(r => r.MusicBrainzRecordingId, "The MusicBrainz identifier of the recording. Optional."); RequestParam(r => r.MusicBrainzTrackId, "The MusicBrainz identifier of the track. Optional."); - RequestParam(r => r.MusicBrainzWorkId, "The MusicBrainz identifier of the work. Optional."); + RequestParam(r => r.Work!.MusicBrainzWorkId, "The MusicBrainz identifier of the work. Optional."); RequestParam(r => r.Moods, "The list of moods of the track. Optional."); RequestParam(r => r.Isrcs, "The list of ISRC (International Standard Recording Code) of the track. Optional."); RequestParam(r => r.Contributors, "The list of media contributors that performed on the track. Required."); @@ -171,10 +178,10 @@ public class UpdateTrackEndpointSummary : Summary(r => r.Script, "The script used by the language of the track, if applicable."); ResponseParam(r => r.Key, "The musical key of the track, if applicable."); ResponseParam(r => r.Bpm, "The tempo of the track in beats per minute, if applicable."); - ResponseParam(r => r.Work, "The title of the work the track is a recording of, if applicable."); + ResponseParam(r => r.Work!.Title, "The title of the work the track is a recording of, if applicable."); ResponseParam(r => r.MusicBrainzRecordingId, "The MusicBrainz identifier of the recording, if applicable."); ResponseParam(r => r.MusicBrainzTrackId, "The MusicBrainz identifier of the track, if applicable."); - ResponseParam(r => r.MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); + ResponseParam(r => r.Work!.MusicBrainzWorkId, "The MusicBrainz identifier of the work, if applicable."); ResponseParam(r => r.CreatedOnUtc, "The date and time when the track was created."); ResponseParam(r => r.UpdatedOnUtc, "The date and time when the track was last updated, if applicable."); ResponseParam(r => r.Moods, "The list of moods of the track."); @@ -208,15 +215,16 @@ public class UpdateTrackEndpointSummary : Summary r.ItemsPerPage, "The number of library items displayed per page when pagination is enabled. Required."); RequestParam(r => r.ShouldIgnoreThePrefixForAlphaPicker, "Whether the \"The\" prefix of library item titles is ignored by the alpha picker, or not. Required."); RequestParam(r => r.IsThemeCachingEnabled, "Whether the theme data served to this user is cached, or not. Required."); + RequestParam(r => r.ShouldAggregateMetadataWhenMissing, "Whether the metadata of the media library items is aggregated from multiple providers, when fields are missing, or not. Required."); + RequestParam(r => r.ShouldAggregateArtworkWhenMissing, "Whether the artwork of the media library items is aggregated from multiple providers, when it is missing, or not. Required."); RequestParam(r => r.ShouldRenderPdfAsImages, "Whether PDF books are rendered as page images for the user, or not. Required."); RequestParam(r => r.ShouldPreserveBookStyles, "Whether the styles of the book content are preserved when it is rendered for the user, or not. Required."); diff --git a/src/Lumina.Presentation.Api/Program.cs b/src/Lumina.Presentation.Api/Program.cs index 811b1de9..73d8fe89 100644 --- a/src/Lumina.Presentation.Api/Program.cs +++ b/src/Lumina.Presentation.Api/Program.cs @@ -109,6 +109,7 @@ public class Program { ILogger logger = services.GetRequiredService>(); logger.LogCritical(ex, "Failed to run database migrations"); + throw; } } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs index 61082ddd..16334bc6 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs @@ -43,7 +43,7 @@ public class AddAlbumEndpointTests : IClassFixture(content, _jsonOptions); Assert.NotNull(artistResponse); Assert.Equal(libraryId, artistResponse!.LibraryId); - Assert.Equal("Queen", artistResponse.Name); + Assert.Equal("Queen", artistResponse.Metadata.Name); Assert.NotNull(artistResponse.Albums); AlbumResponse albumResponse = Assert.Single(artistResponse.Albums!); Assert.Equal("A Night at the Opera", albumResponse.Metadata.Title); @@ -105,7 +106,7 @@ public class AddArtistEndpointTests : IClassFixture artist.Name == "Artist A"); - Assert.Contains(paginatedArtists.Data, artist => artist.Name == "Artist B"); + Assert.Contains(paginatedArtists.Data, artist => artist.Metadata.Name == "Artist A"); + Assert.Contains(paginatedArtists.Data, artist => artist.Metadata.Name == "Artist B"); } [Fact] @@ -100,7 +100,7 @@ public class GetArtistsEndpointTests : IClassFixture? paginatedArtists = await response.Content.ReadFromJsonAsync>(_jsonOptions); Assert.NotNull(paginatedArtists); ArtistResponse artist = Assert.Single(paginatedArtists!.Data); - Assert.Equal("Fellowship", artist.Name); + Assert.Equal("Fellowship", artist.Metadata.Name); Assert.Equal(1, paginatedArtists.Count); } @@ -126,7 +126,7 @@ public class GetArtistsEndpointTests : IClassFixture(content, _jsonOptions); Assert.NotNull(artistResponse); Assert.Equal(artistId, artistResponse!.Id); - Assert.Equal("Queen Updated", artistResponse.Name); + Assert.Equal("Queen Updated", artistResponse.Metadata.Name); using IServiceScope scope = _apiFactory.Services.CreateScope(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); @@ -170,7 +171,7 @@ public class UpdateArtistEndpointTests : IClassFixture (language.LanguageCode, language.LanguageName, language.NativeName)).OrderBy(language => language.LanguageCode), + trackResponse.Work.Languages!.Select(language => (language.LanguageCode, language.LanguageName, language.NativeName)).OrderBy(language => language.LanguageCode)); + Assert.Equal( + trackRequest.Work.Iswcs!.OrderBy(iswc => iswc), + trackResponse.Work.Iswcs!.OrderBy(iswc => iswc)); Assert.Equal(trackRequest.MusicBrainzRecordingId, trackResponse.MusicBrainzRecordingId); Assert.Equal(trackRequest.MusicBrainzTrackId, trackResponse.MusicBrainzTrackId); - Assert.Equal(trackRequest.MusicBrainzWorkId, trackResponse.MusicBrainzWorkId); - // metadata checks + // Metadata checks. Assert.Equal(metadata.Title, trackResponse.Metadata.Title); Assert.Equal(metadata.OriginalTitle, trackResponse.Metadata.OriginalTitle); Assert.Equal(metadata.Description, trackResponse.Metadata.Description); @@ -184,7 +194,7 @@ public class AddTrackEndpointTests : IClassFixture genre.Name).OrderBy(name => name), trackResponse.Metadata.Genres!.Select(genre => genre.Name).OrderBy(name => name)); @@ -208,7 +218,7 @@ public class AddTrackEndpointTests : IClassFixture tag.Name).OrderBy(name => name), trackResponse.Metadata.Tags!.Select(tag => tag.Name).OrderBy(name => name)); - // moods, ISRCs, contributors and ratings checks + // Moods, ISRCs, contributors and ratings checks. Assert.Equal( trackRequest.Moods!.Select(mood => mood.Name).OrderBy(name => name), trackResponse.Moods!.Select(mood => mood.Name).OrderBy(name => name)); @@ -222,7 +232,7 @@ public class AddTrackEndpointTests : IClassFixture rating.Source == AudioRatingSource.MusicBrainz && rating.Value == 4.5m && rating.MaxValue == 5 && rating.VoteCount == 2345); Assert.Contains(trackResponse.Ratings, rating => rating.Source == AudioRatingSource.LastFm && rating.Value == 4.8m && rating.MaxValue == 5 && rating.VoteCount == 1234); - // check Location header + // Check Location header. Assert.NotNull(response.Headers.Location); string locationUri = response.Headers.Location!.ToString(); Assert.EndsWith($"/api/v1/libraries/{_libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackResponse.Id}", locationUri); @@ -233,7 +243,7 @@ public class AddTrackEndpointTests : IClassFixture, IDisposabl private readonly LuminaApiFactory _apiFactory; private readonly HttpClient _client; private readonly AddAlbumRequestFixture _addAlbumRequestFixture = new(); - private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new(); + private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new(); private readonly LibraryEntityFixture _libraryEntityFixture = new(); private readonly ArtistEntityFixture _artistEntityFixture = new(); private readonly AlbumEntityFixture _albumEntityFixture = new(); @@ -158,7 +158,7 @@ public class AddAlbumEndpointTests : IClassFixture, IDisposabl _seededUsernames.Add(username); (Guid libraryId, Guid artistId) = await SeedLibraryArtistAndAlbumAsync(userId); AddAlbumRequest request = _addAlbumRequestFixture.Create( - metadata: _albumMetadataDtoFixture.Create(title: maliciousTitle), + metadata: _musicAlbumMetadataDtoFixture.Create(title: maliciousTitle), contributors: [], ratings: [], tracks: []); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs index 15190c19..22bec8c6 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs @@ -33,7 +33,7 @@ public class UpdateAlbumEndpointTests : IClassFixture, IDispos { private readonly LuminaApiFactory _apiFactory; private readonly UpdateAlbumRequestFixture _updateAlbumRequestFixture = new(); - private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new(); + private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new(); private readonly LibraryEntityFixture _libraryEntityFixture = new(); private readonly ArtistEntityFixture _artistEntityFixture = new(); private readonly AlbumEntityFixture _albumEntityFixture = new(); @@ -104,7 +104,7 @@ public class UpdateAlbumEndpointTests : IClassFixture, IDispos (Guid userId, string username) = await _apiFactory.CreateAndAuthenticateUserAsync(client); _seededUsernames.Add(username); (Guid libraryId, Guid artistId, Guid albumId) = await SeedLibraryArtistAndAlbumAsync(userId); - UpdateAlbumRequest request = _updateAlbumRequestFixture.Create(metadata: _albumMetadataDtoFixture.Create(title: maliciousTitle), contributors: [], ratings: []); + UpdateAlbumRequest request = _updateAlbumRequestFixture.Create(metadata: _musicAlbumMetadataDtoFixture.Create(title: maliciousTitle), contributors: [], ratings: []); // Act HttpResponseMessage response = await client.PutAsJsonAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/albums/{albumId}", request); @@ -223,7 +223,7 @@ public class UpdateAlbumEndpointTests : IClassFixture, IDispos (Guid victimUserId, string victimUsername) = await _apiFactory.CreateAndAuthenticateUserAsync(victimClient); _seededUsernames.Add(victimUsername); (_, Guid victimArtistId, Guid victimAlbumId) = await SeedLibraryArtistAndAlbumAsync(victimUserId); - UpdateAlbumRequest request = _updateAlbumRequestFixture.Create(metadata: _albumMetadataDtoFixture.Create(title: "Hijacked"), contributors: [], ratings: []); + UpdateAlbumRequest request = _updateAlbumRequestFixture.Create(metadata: _musicAlbumMetadataDtoFixture.Create(title: "Hijacked"), contributors: [], ratings: []); // Act HttpResponseMessage response = await client.PutAsJsonAsync($"/api/v1/libraries/{ownLibraryId}/artists/{victimArtistId}/albums/{victimAlbumId}", request); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs index 42a97d3b..23cf6b48 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management; using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary; using Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums; using Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists; using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums; @@ -34,6 +35,7 @@ public class AddArtistEndpointTests : IClassFixture, IDisposab private readonly LuminaApiFactory _apiFactory; private readonly HttpClient _client; private readonly AddArtistRequestFixture _addArtistRequestFixture = new(); + private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new(); private readonly AddAlbumRequestFixture _addAlbumRequestFixture = new(); private readonly LibraryEntityFixture _libraryEntityFixture = new(); private readonly JsonSerializerOptions _jsonOptions = new() @@ -58,7 +60,7 @@ public class AddArtistEndpointTests : IClassFixture, IDisposab { // Arrange Guid libraryId = Guid.NewGuid(); - AddArtistRequest request = _addArtistRequestFixture.Create(name: "Queen", contributors: [], albums: []); + AddArtistRequest request = _addArtistRequestFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: "Queen"), contributors: [], albums: []); // Act HttpResponseMessage response = await _client.PostAsJsonAsync($"/api/v1/libraries/{libraryId}/artists", request); @@ -80,7 +82,7 @@ public class AddArtistEndpointTests : IClassFixture, IDisposab public async Task AddArtist_WhenUnauthorized_ShouldNotLeakSensitiveData() { // Arrange - AddArtistRequest request = _addArtistRequestFixture.Create(name: "Queen", contributors: [], albums: []); + AddArtistRequest request = _addArtistRequestFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: "Queen"), contributors: [], albums: []); // Act HttpResponseMessage response = await _client.PostAsJsonAsync($"/api/v1/libraries/{Guid.NewGuid()}/artists", request); @@ -103,7 +105,7 @@ public class AddArtistEndpointTests : IClassFixture, IDisposab // Arrange (Guid _, string username) = await _apiFactory.CreateAndAuthenticateUserAsync(_client); _seededUsernames.Add(username); - AddArtistRequest request = _addArtistRequestFixture.Create(name: "Queen", contributors: [], albums: []); + AddArtistRequest request = _addArtistRequestFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: "Queen"), contributors: [], albums: []); // Act HttpResponseMessage response = await _client.PostAsJsonAsync($"/api/v1/libraries/{Uri.EscapeDataString(maliciousLibraryId)}/artists", request); @@ -130,7 +132,7 @@ public class AddArtistEndpointTests : IClassFixture, IDisposab _seededUsernames.Add(username); Guid libraryId = await SeedLibraryAsync(userId); AddAlbumRequest album = _addAlbumRequestFixture.Create(contributors: [], ratings: [], tracks: []); - AddArtistRequest request = _addArtistRequestFixture.Create(name: maliciousName, contributors: [], albums: [album]); + AddArtistRequest request = _addArtistRequestFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: maliciousName), contributors: [], albums: [album]); // Act HttpResponseMessage response = await _client.PostAsJsonAsync($"/api/v1/libraries/{libraryId}/artists", request); @@ -159,7 +161,7 @@ public class AddArtistEndpointTests : IClassFixture, IDisposab (Guid _, string requesterUsername) = await _apiFactory.CreateAndAuthenticateUserAsync(_client); _seededUsernames.Add(requesterUsername); AddAlbumRequest album = _addAlbumRequestFixture.Create(contributors: [], ratings: [], tracks: []); - AddArtistRequest request = _addArtistRequestFixture.Create(name: "Queen", contributors: [], albums: [album]); + AddArtistRequest request = _addArtistRequestFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: "Queen"), contributors: [], albums: [album]); // Act HttpResponseMessage response = await _client.PostAsJsonAsync($"/api/v1/libraries/{libraryId}/artists", request); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs index 909cc08b..c73a891b 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs @@ -33,8 +33,9 @@ public class UpdateArtistEndpointTests : IClassFixture, IDispo { private readonly LuminaApiFactory _apiFactory; private readonly UpdateArtistRequestFixture _updateArtistRequestFixture = new(); + private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new(); private readonly UpdateArtistAlbumRequestFixture _updateArtistAlbumRequestFixture = new(); - private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new(); + private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new(); private readonly LibraryEntityFixture _libraryEntityFixture = new(); private readonly ArtistEntityFixture _artistEntityFixture = new(); private readonly AlbumEntityFixture _albumEntityFixture = new(); @@ -107,11 +108,11 @@ public class UpdateArtistEndpointTests : IClassFixture, IDispo (Guid artistId, Guid albumId) = await SeedArtistAsync(libraryId, userId); UpdateArtistAlbumRequest album = _updateArtistAlbumRequestFixture.Create( albumId: albumId, - metadata: _albumMetadataDtoFixture.Create(title: "Updated Album"), + metadata: _musicAlbumMetadataDtoFixture.Create(title: "Updated Album"), contributors: [], ratings: [], tracks: []); - UpdateArtistRequest request = _updateArtistRequestFixture.Create(name: maliciousName, contributors: [], albums: [album]); + UpdateArtistRequest request = _updateArtistRequestFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: maliciousName), contributors: [], albums: [album]); // Act HttpResponseMessage response = await client.PutAsJsonAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}", request); @@ -240,7 +241,7 @@ public class UpdateArtistEndpointTests : IClassFixture, IDispo _seededUsernames.Add(victimUsername); Guid victimLibraryId = Guid.NewGuid(); (Guid victimArtistId, _) = await SeedArtistAsync(victimLibraryId, victimUserId); - UpdateArtistRequest request = _updateArtistRequestFixture.Create(name: "Hijacked", contributors: [], albums: []); + UpdateArtistRequest request = _updateArtistRequestFixture.Create(metadata: _musicArtistMetadataDtoFixture.Create(name: "Hijacked"), contributors: [], albums: []); // Act HttpResponseMessage response = await client.PutAsJsonAsync($"/api/v1/libraries/{ownLibraryId}/artists/{victimArtistId}", request); diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs index 614bd079..07d1d272 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs @@ -33,7 +33,7 @@ public class AddTrackEndpointTests : IClassFixture, IDisposabl private readonly LuminaApiFactory _apiFactory; private readonly HttpClient _client; private readonly AddTrackRequestFixture _addTrackRequestFixture = new(); - private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new(); + private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new(); private readonly LibraryEntityFixture _libraryEntityFixture = new(); private readonly ArtistEntityFixture _artistEntityFixture = new(); private readonly AlbumEntityFixture _albumEntityFixture = new(); @@ -201,7 +201,7 @@ public class AddTrackEndpointTests : IClassFixture, IDisposabl (Guid libraryId, Guid artistId, Guid albumId) = await SeedLibraryArtistAndAlbumAsync(userId); AddTrackRequest request = _addTrackRequestFixture.Create( path: Path.Combine(_libraryContentLocation, $"{Guid.NewGuid():N}.flac"), - metadata: _audioMetadataDtoFixture.Create(title: maliciousTitle), + metadata: _musicTrackMetadataDtoFixture.Create(title: maliciousTitle), contributors: []); // Act diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs index 564d78e4..eafa1ec8 100644 --- a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs @@ -37,7 +37,7 @@ public class UpdateTrackEndpointTests : IClassFixture, IDispos private readonly LuminaApiFactory _apiFactory; private readonly UpdateTrackRequestFixture _updateTrackRequestFixture = new(); - private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new(); + private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new(); private readonly ArtistEntityFixture _artistEntityFixture = new(); private readonly AlbumEntityFixture _albumEntityFixture = new(); private readonly TrackEntityFixture _trackEntityFixture = new(); @@ -95,7 +95,7 @@ public class UpdateTrackEndpointTests : IClassFixture, IDispos (Guid artistId, Guid albumId, Guid trackId) = SeedArtistGraph(libraryId); UpdateTrackRequest request = _updateTrackRequestFixture.Create( path: Path.Combine(s_contentRootPath, $"injected-{Guid.NewGuid():N}.flac"), - metadata: _audioMetadataDtoFixture.Create(title: maliciousTitle), + metadata: _musicTrackMetadataDtoFixture.Create(title: maliciousTitle), moods: [], isrcs: [], contributors: [], @@ -263,7 +263,7 @@ public class UpdateTrackEndpointTests : IClassFixture, IDispos Guid victimLibraryId = Guid.NewGuid(); SeedLibrary(victimLibraryId, victimUserId); (Guid victimArtistId, Guid victimAlbumId, Guid victimTrackId) = SeedArtistGraph(victimLibraryId); - UpdateTrackRequest request = _updateTrackRequestFixture.Create(metadata: _audioMetadataDtoFixture.Create(title: "Hijacked")); + UpdateTrackRequest request = _updateTrackRequestFixture.Create(metadata: _musicTrackMetadataDtoFixture.Create(title: "Hijacked")); // Act HttpResponseMessage response = await client.PutAsJsonAsync($"/api/v1/libraries/{ownLibraryId}/artists/{victimArtistId}/albums/{victimAlbumId}/tracks/{victimTrackId}", request); diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissions/GetPermissionsEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissions/GetPermissionsEndpointTests.cs index e80810c0..1f9e977f 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissions/GetPermissionsEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Admin/Authorization/Permissions/GetPermissions/GetPermissionsEndpointTests.cs @@ -2,6 +2,7 @@ using FastEndpoints; using Lumina.Application.Common.CQRS; using Lumina.Application.Core.Admin.Authorization.Permissions.Queries.GetPermissions; +using Lumina.Contracts.Fixtures.Core.Responses.Authorization; using Lumina.Contracts.Responses.Authorization; using Lumina.Domain.Common.Primitives; using Lumina.Domain.SharedKernel.Common.Enums.Authorization; @@ -27,6 +28,7 @@ public class GetPermissionsEndpointTests { private readonly IQueryHandler>> _mockHandler; private readonly GetPermissionsEndpoint _sut; + private readonly PermissionResponseFixture _permissionResponseFixture = new(); /// /// Initializes a new instance of the class. @@ -44,9 +46,9 @@ public class GetPermissionsEndpointTests CancellationToken cancellationToken = CancellationToken.None; IEnumerable expectedResponse = [ - new(Guid.NewGuid(), AuthorizationPermission.CanViewUsers), - new(Guid.NewGuid(), AuthorizationPermission.CanDeleteUsers), - new(Guid.NewGuid(), AuthorizationPermission.CanRegisterUsers) + _permissionResponseFixture.Create(id: Guid.NewGuid(), permissionName: AuthorizationPermission.CanViewUsers), + _permissionResponseFixture.Create(id: Guid.NewGuid(), permissionName: AuthorizationPermission.CanDeleteUsers), + _permissionResponseFixture.Create(id: Guid.NewGuid(), permissionName: AuthorizationPermission.CanRegisterUsers) ]; _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) .Returns(Result.From(expectedResponse)); diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs index 1d63089b..0a42781d 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/AddAlbum/AddAlbumEndpointTests.cs @@ -177,7 +177,7 @@ public class AddAlbumEndpointTests command.Metadata == request.Metadata && command.MediaFormat == request.MediaFormat && command.Barcode == request.Barcode && - command.CatalogNumber == request.CatalogNumber && + command.CatalogNumbers == request.CatalogNumbers && command.MusicBrainzReleaseId == request.MusicBrainzReleaseId && command.MusicBrainzReleaseGroupId == request.MusicBrainzReleaseGroupId && command.MusicBrainzReleaseArtistId == request.MusicBrainzReleaseArtistId && diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs index a065ac95..36c8961f 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointTests.cs @@ -186,7 +186,7 @@ public class UpdateAlbumEndpointTests command.Metadata == request.Metadata && command.MediaFormat == request.MediaFormat && command.Barcode == request.Barcode && - command.CatalogNumber == request.CatalogNumber && + command.CatalogNumbers == request.CatalogNumbers && command.MusicBrainzReleaseId == request.MusicBrainzReleaseId && command.MusicBrainzReleaseGroupId == request.MusicBrainzReleaseGroupId && command.MusicBrainzReleaseArtistId == request.MusicBrainzReleaseArtistId && diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs index c907b11c..fee92864 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointTests.cs @@ -159,7 +159,7 @@ public class AddArtistEndpointTests await _mockHandler.Received(1).HandleAsync( Arg.Is(command => command.LibraryId == libraryId.ToString() && - command.Name == request.Name && + command.Metadata == request.Metadata && command.Website == request.Website && command.MusicBrainzArtistId == request.MusicBrainzArtistId && command.Contributors == request.Contributors && diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs index dd3599f1..b78bc67e 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointTests.cs @@ -172,7 +172,7 @@ public class UpdateArtistEndpointTests Arg.Is(command => command.LibraryId == libraryId.ToString() && command.ArtistId == artistId.ToString() && - command.Name == request.Name && + command.Metadata == request.Metadata && command.Website == request.Website && command.MusicBrainzArtistId == request.MusicBrainzArtistId && command.Contributors == request.Contributors && diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs index b94aff9c..43029748 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/AddTrack/AddTrackEndpointTests.cs @@ -151,7 +151,6 @@ public class AddTrackEndpointTests command.Work == request.Work && command.MusicBrainzRecordingId == request.MusicBrainzRecordingId && command.MusicBrainzTrackId == request.MusicBrainzTrackId && - command.MusicBrainzWorkId == request.MusicBrainzWorkId && command.Moods == request.Moods && command.Isrcs == request.Isrcs && command.Contributors == request.Contributors && diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs index f4c557f8..31623a6d 100644 --- a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs @@ -168,7 +168,6 @@ public class UpdateTrackEndpointTests command.Work == request.Work && command.MusicBrainzRecordingId == request.MusicBrainzRecordingId && command.MusicBrainzTrackId == request.MusicBrainzTrackId && - command.MusicBrainzWorkId == request.MusicBrainzWorkId && command.Moods == request.Moods && command.Isrcs == request.Isrcs && command.Contributors == request.Contributors &&