From 5a27c22109e45f717d9fb44236a9cab44e9c712a Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Mon, 12 Oct 2026 19:14:35 +0300 Subject: [PATCH 01/19] Normalizes the web client request summaries to use the indefinite article. --- .../Common/Requests/Authorization/GetUserPermissionsRequest.cs | 2 +- .../Common/Requests/Authorization/GetUserRoleRequest.cs | 2 +- .../Requests/FileSystemManagement/Path/GetPathParentRequest.cs | 2 +- .../Common/Requests/Library/Management/EditLibraryRequest.cs | 2 +- .../Requests/Library/Management/GetArtworkProvidersRequest.cs | 2 +- .../Common/Requests/Library/Management/GetBookReadersRequest.cs | 2 +- .../Library/Management/GetLibraryPathTemplatePartsRequest.cs | 2 +- .../Requests/Library/Management/GetMetadataProvidersRequest.cs | 2 +- .../BookLibrary/Books/GetBooksViewRequest.cs | 2 +- .../BookLibrary/Books/Reading/ReadBookViewRequest.cs | 2 +- .../Common/Requests/Tools/SetLanguageRequest.cs | 2 +- .../Requests/UsersManagement/Authentication/LoginViewRequest.cs | 2 +- .../Common/Requests/UsersManagement/ChangePasswordRequest.cs | 2 +- .../Common/Requests/UsersManagement/LoginRequest.cs | 2 +- .../Common/Requests/UsersManagement/RecoverPasswordRequest.cs | 2 +- .../Common/Requests/UsersManagement/RegisterRequest.cs | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserPermissionsRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserPermissionsRequest.cs index 25758d63..6f40ed38 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserPermissionsRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserPermissionsRequest.cs @@ -6,7 +6,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.Authorization; /// -/// Represents the request model for retrieving the authorization permissions of a user identified by . +/// Represents a request for retrieving the authorization permissions of a user identified by . /// /// The unique identifier of the user for whom to get the authorization permissions. Required. [DebuggerDisplay("UserId: {UserId}")] diff --git a/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserRoleRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserRoleRequest.cs index 6080ba49..2a771045 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserRoleRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Authorization/GetUserRoleRequest.cs @@ -6,7 +6,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.Authorization; /// -/// Represents the request model for retrieving the authorization role of a user identified by . +/// Represents a request for retrieving the authorization role of a user identified by . /// /// The unique identifier of the user for whom to get the authorization role. Required. [DebuggerDisplay("UserId: {UserId}")] diff --git a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathParentRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathParentRequest.cs index 2adf85a3..3e807c44 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathParentRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/FileSystemManagement/Path/GetPathParentRequest.cs @@ -5,7 +5,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.FileSystemManagement.Path; /// -/// Represents the request for retrieving the parent path of a file system path. +/// Represents a request for retrieving the parent path of a file system path. /// /// The path for which the parent path is retrieved. Required. [DebuggerDisplay("Path: {Path}")] diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/EditLibraryRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/EditLibraryRequest.cs index 7c84ab5c..36d42d7c 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/EditLibraryRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/EditLibraryRequest.cs @@ -6,7 +6,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.Library.Management; /// -/// Represents the request for displaying the media library editing view. +/// Represents a request for displaying the media library editing view. /// /// The unique identifier of the media library to edit. Required. [DebuggerDisplay("Id: {Id}")] diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetArtworkProvidersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetArtworkProvidersRequest.cs index e7dc201a..f88a44bb 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetArtworkProvidersRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetArtworkProvidersRequest.cs @@ -6,7 +6,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.Library.Management; /// -/// Represents the request for retrieving the artwork providers of a media library. +/// Represents a request for retrieving the artwork providers of a media library. /// /// The unique identifier of the media library whose artwork providers are retrieved. Required. [DebuggerDisplay("LibraryId: {LibraryId}")] diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetBookReadersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetBookReadersRequest.cs index 047c2905..fbbc09c8 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetBookReadersRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetBookReadersRequest.cs @@ -6,7 +6,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.Library.Management; /// -/// Represents the request for retrieving the book readers of a media library. +/// Represents a request for retrieving the book readers of a media library. /// /// The unique identifier of the media library whose book readers are retrieved. Required. [DebuggerDisplay("LibraryId: {LibraryId}")] diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetLibraryPathTemplatePartsRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetLibraryPathTemplatePartsRequest.cs index 978d481a..0f517693 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetLibraryPathTemplatePartsRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetLibraryPathTemplatePartsRequest.cs @@ -5,7 +5,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.Library.Management; /// -/// Represents the request for retrieving the path parts available for a media library type. +/// Represents a request for retrieving the path parts available for a media library type. /// /// The media library type whose available path parts are retrieved. Required. [DebuggerDisplay("LibraryType: {LibraryType}")] diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetMetadataProvidersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetMetadataProvidersRequest.cs index 9b206b59..b2326924 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetMetadataProvidersRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/Management/GetMetadataProvidersRequest.cs @@ -6,7 +6,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.Library.Management; /// -/// Represents the request for retrieving the metadata providers of a media library. +/// Represents a request for retrieving the metadata providers of a media library. /// /// The unique identifier of the media library whose metadata providers are retrieved. Required. [DebuggerDisplay("LibraryId: {LibraryId}")] diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksViewRequest.cs index fc704c99..800ee09c 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksViewRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksViewRequest.cs @@ -6,7 +6,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books; /// -/// Represents the request for displaying the books browsing view. +/// Represents a request for displaying the books browsing view. /// /// The unique identifier of the media library whose books are browsed. Optional. [DebuggerDisplay("LibraryId: {LibraryId}")] diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/Reading/ReadBookViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/Reading/ReadBookViewRequest.cs index 0db696f3..d689f41d 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/Reading/ReadBookViewRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/Reading/ReadBookViewRequest.cs @@ -6,7 +6,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books.Reading; /// -/// Represents the request for displaying the reading view of a book. +/// Represents a request for displaying the reading view of a book. /// /// The unique identifier of the book to read. Required. /// The Id of the media library the book belongs to. Required. diff --git a/src/Lumina.Presentation.Web/Common/Requests/Tools/SetLanguageRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Tools/SetLanguageRequest.cs index fd8201aa..53135961 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Tools/SetLanguageRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Tools/SetLanguageRequest.cs @@ -5,7 +5,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.Tools; /// -/// Represents the request for setting the culture used by the application. +/// Represents a request for setting the culture used by the application. /// /// The new culture to set. Required. /// The URL to return to, after setting the new culture. Optional. diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/Authentication/LoginViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/Authentication/LoginViewRequest.cs index 6fa27d41..68cdbda0 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/Authentication/LoginViewRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/Authentication/LoginViewRequest.cs @@ -5,7 +5,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.UsersManagement.Authentication; /// -/// Represents the request for displaying the account login view. +/// Represents a request for displaying the account login view. /// /// The URL to return to, after login. Optional. [DebuggerDisplay("ReturnUrl: {ReturnUrl}")] diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/ChangePasswordRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/ChangePasswordRequest.cs index b899d829..48b36334 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/ChangePasswordRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/ChangePasswordRequest.cs @@ -5,7 +5,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.UsersManagement; /// -/// Represents the request model for account password change. +/// Represents a request for account password change. /// /// The username of the account. Required. /// The current password of the account. Required. diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/LoginRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/LoginRequest.cs index de0d572e..74743f7e 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/LoginRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/LoginRequest.cs @@ -5,7 +5,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.UsersManagement; /// -/// Represents the request model for user authentication. +/// Represents a request for user authentication. /// /// The username of the account to authenticate. Required. /// The password of the account to authenticate. Required. diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RecoverPasswordRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RecoverPasswordRequest.cs index e41f7e8a..72e570af 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RecoverPasswordRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RecoverPasswordRequest.cs @@ -5,7 +5,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.UsersManagement; /// -/// Represents the request model for account password recovery. +/// Represents a request for account password recovery. /// /// The username of the account for which to recover the password. Required. /// The TOTP (Time-Based One-Time Password) of the account for which to recover the password. Required. diff --git a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RegisterRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RegisterRequest.cs index 9aa1c105..e39ba6cf 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RegisterRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/UsersManagement/RegisterRequest.cs @@ -5,7 +5,7 @@ using System.Diagnostics; namespace Lumina.Presentation.Web.Common.Requests.UsersManagement; /// -/// Represents the request model for user registration. +/// Represents a request for user registration. /// /// The desired username for the new account. Required. /// The password for the new account. Required. From defbd9176fb06dc6267efe76b4922674171d36e6 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Mon, 12 Oct 2026 19:21:52 +0300 Subject: [PATCH 02/19] Converts the web client request objects from classes to records. --- .../Requests/Libraries/GetBooksLiteRequest.cs | 66 +++------ .../BookLibrary/Books/UpdateBookRequest.cs | 137 +++++------------- .../ReorderLibraryArtworkProvidersRequest.cs | 18 +-- .../ReorderLibraryMetadataProvidersRequest.cs | 18 +-- .../Plugins/SetBookReaderEnabledRequest.cs | 25 +--- ...SetLibraryArtworkProviderEnabledRequest.cs | 25 +--- ...etLibraryMetadataProviderEnabledRequest.cs | 26 +--- .../Plugins/UpdatePluginSettingsRequest.cs | 18 +-- .../ReorderArtworkProvidersEndpointSummary.cs | 10 +- ...ReorderMetadataProvidersEndpointSummary.cs | 10 +- ...etArtworkProviderEnabledEndpointSummary.cs | 11 +- .../SetBookReaderEnabledEndpointSummary.cs | 11 +- ...tMetadataProviderEnabledEndpointSummary.cs | 11 +- .../GetLibraryItemsEndpointSummary.cs | 21 ++- .../Books/SaveBook/SaveBookEndpoint.cs | 11 +- .../Books/SaveBook/SaveBookEndpointSummary.cs | 43 +++--- .../UpdatePluginSettingsEndpointSummary.cs | 9 +- .../Libraries/GetBooksLiteRequestFixture.cs | 23 ++- .../Books/UpdateBookRequestFixture.cs | 45 +++--- ...erLibraryArtworkProvidersRequestFixture.cs | 11 +- ...rLibraryMetadataProvidersRequestFixture.cs | 11 +- .../SetBookReaderEnabledRequestFixture.cs | 13 +- ...aryArtworkProviderEnabledRequestFixture.cs | 13 +- ...ryMetadataProviderEnabledRequestFixture.cs | 13 +- .../UpdatePluginSettingsRequestFixture.cs | 11 +- .../Books/SaveBook/SaveBookEndpointTests.cs | 20 +-- 26 files changed, 247 insertions(+), 383 deletions(-) diff --git a/src/Lumina.Presentation.Web/Common/Requests/Libraries/GetBooksLiteRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Libraries/GetBooksLiteRequest.cs index ea5c1b47..a487c67a 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Libraries/GetBooksLiteRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Libraries/GetBooksLiteRequest.cs @@ -9,48 +9,26 @@ namespace Lumina.Presentation.Web.Common.Requests.Libraries; /// /// Represents a request to get the lightweight details of the books of a media library. /// +/// The Id of the media library whose books are retrieved. Required. +/// The page of results to retrieve. Optional. +/// The maximum number of books to retrieve per page. Optional. +/// The search term used to filter results. Optional. +/// +/// The alpha key used to filter the results by the first character of their title, for the alpha picker. Optional. +/// Can be to disable alpha filtering, a single ASCII letter (case-insensitive) to filter by that letter, +/// "#" to filter by titles whose first character is a digit, or "*" to filter by titles whose first character is neither a letter nor a digit. +/// +/// Whether the leading "The " prefix of a title is ignored when computing the alpha key, or not. Optional. +/// The name of the field by which to sort the results. Optional. +/// The direction in which to sort the results. Optional. [DebuggerDisplay("LibraryId: {LibraryId}")] -public class GetBooksLiteRequest -{ - /// - /// Gets or sets the Id of the media library whose books are retrieved. - /// - public Guid LibraryId { get; set; } - - /// - /// Gets or sets the page of results to retrieve. - /// - public int? CurrentPage { get; set; } - - /// - /// Gets or sets the maximum number of books to retrieve per page. - /// - public int? PerPage { get; set; } - - /// - /// Gets or sets the search term used to filter results. - /// - public string? SearchTerm { get; set; } - - /// - /// Gets or sets the alpha key used to filter the results by the first character of their title, for the alpha picker. - /// Can be to disable alpha filtering, a single ASCII letter (case-insensitive) to filter by that letter, - /// "#" to filter by titles whose first character is a digit, or "*" to filter by titles whose first character is neither a letter nor a digit. - /// - public string? FilterAlphaKey { get; set; } - - /// - /// Gets or sets whether the leading "The " prefix of a title is ignored when computing the alpha key, or not. - /// - public bool ShouldIgnoreThePrefixForAlphaPicker { get; set; } - - /// - /// Gets or sets the name of the field by which to sort the results. - /// - public string? SortBy { get; set; } - - /// - /// Gets or sets the direction in which to sort the results. - /// - public SortOrder? SortOrder { get; set; } -} +public record GetBooksLiteRequest( + Guid LibraryId, + int? CurrentPage, + int? PerPage, + string? SearchTerm, + string? FilterAlphaKey, + bool ShouldIgnoreThePrefixForAlphaPicker, + string? SortBy, + SortOrder? SortOrder +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs index ca5fb674..a3f9cf2c 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequest.cs @@ -13,101 +13,44 @@ namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary. /// /// Represents a request to update an existing book. /// +/// The Id of the book to update, taken from the route. Required. +/// The Id of the media library the book belongs to. Required. +/// The written content metadata of the book. Required. +/// The format of the book (e.g., Hardcover, Paperback). Optional. +/// The edition of the book. Optional. +/// The volume or book number in the series. Optional. +/// The series the book is part of. Optional. +/// The ASIN (Amazon Standard Identification Number) of the book. Optional. +/// The Goodreads Id of the book. Optional. +/// The Library of Congress Control Number (LCCN) of the book. Optional. +/// The OCLC Number (WorldCat identifier) of the book. Optional. +/// The Open Library Id of the book. Optional. +/// The LibraryThing Id of the book. Optional. +/// The Google Books Id of the book. Optional. +/// The Barnes & Noble Id of the book. Optional. +/// The Apple Books Id of the book. Optional. +/// The list of ISBN (International Standard Book Number) of the book. Required. +/// The list of media contributors of the book. Required. +/// The list of ratings of the book. Required. [DebuggerDisplay("Title: {Metadata?.Title}")] -public class UpdateBookRequest -{ - /// - /// Gets or sets the Id of the book to update, taken from the route. - /// - public string? BookId { get; set; } - - /// - /// Gets or sets the Id of the media library the book belongs to. - /// - public Guid LibraryId { get; set; } - - /// - /// Gets or sets the written content metadata of the book. - /// - public WrittenContentMetadataDto? Metadata { get; set; } - - /// - /// Gets or sets the format of the book (e.g., Hardcover, Paperback), if applicable. - /// - public BookFormat? Format { get; set; } - - /// - /// Gets or sets the edition of the book, if applicable. - /// - public string? Edition { get; set; } - - /// - /// Gets or sets the volume or book number in the series, if applicable. - /// - public float? VolumeNumber { get; set; } - - /// - /// Gets or sets the series name, if the book is part of a series. - /// - public BookSeriesDto? Series { get; set; } - - /// - /// Gets or sets the ASIN (Amazon Standard Identification Number) of the book, if applicable. - /// - public string? ASIN { get; set; } - - /// - /// Gets or sets the Goodreads Id of the book, if applicable. - /// - public string? GoodreadsId { get; set; } - - /// - /// Gets or sets the Library of Congress Control Number (LCCN) of the book, if applicable. - /// - public string? LCCN { get; set; } - - /// - /// Gets or sets the OCLC Number (WorldCat identifier) of the book, if applicable. - /// - public string? OCLCNumber { get; set; } - - /// - /// Gets or sets the Open Library Id of the book, if applicable. - /// - public string? OpenLibraryId { get; set; } - - /// - /// Gets or sets the LibraryThing Id of the book, if applicable. - /// - public string? LibraryThingId { get; set; } - - /// - /// Gets or sets the Google Books Id of the book, if applicable. - /// - public string? GoogleBooksId { get; set; } - - /// - /// Gets or sets the Barnes & Noble Id of the book, if applicable. - /// - public string? BarnesAndNobleId { get; set; } - - /// - /// Gets or sets the Apple Books Id of the book, if applicable. - /// - public string? AppleBooksId { get; set; } - - /// - /// Gets or sets the list of ISBN (International Standard Book Number) of the book. - /// - public List? ISBNs { get; set; } - - /// - /// Gets or sets the list of media contributors of the book. Required. - /// - public List? Contributors { get; set; } - - /// - /// Gets or sets the list of ratings of the book. - /// - public List? Ratings { get; set; } -} +public record UpdateBookRequest( + string? BookId, + Guid LibraryId, + WrittenContentMetadataDto? Metadata, + BookFormat? Format, + string? Edition, + float? VolumeNumber, + BookSeriesDto? Series, + string? ASIN, + string? GoodreadsId, + string? LCCN, + string? OCLCNumber, + string? OpenLibraryId, + string? LibraryThingId, + string? GoogleBooksId, + string? BarnesAndNobleId, + string? AppleBooksId, + List? ISBNs, + List? Contributors, + List? Ratings +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequest.cs index 173bb1e2..86d84308 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequest.cs @@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins; /// /// Represents a request to reorder the artwork providers of a media library. /// +/// The Id of the media library whose artwork providers are reordered. Required. +/// The plugin Ids in the new order, from highest to lowest rank. Required. [DebuggerDisplay("LibraryId: {LibraryId}")] -public class ReorderLibraryArtworkProvidersRequest -{ - /// - /// Gets or sets the Id of the media library whose artwork providers are reordered. - /// - public Guid LibraryId { get; set; } - - /// - /// Gets or sets the plugin Ids in the new order, from highest to lowest rank. - /// - public List PluginIds { get; set; } = []; -} +public record ReorderLibraryArtworkProvidersRequest( + Guid LibraryId, + List PluginIds +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequest.cs index a88953b3..a4048843 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequest.cs @@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins; /// /// Represents a request to reorder the metadata providers of a media library. /// +/// The Id of the media library whose metadata providers are reordered. Required. +/// The plugin Ids in the new order, from highest to lowest rank. Required. [DebuggerDisplay("LibraryId: {LibraryId}")] -public class ReorderLibraryMetadataProvidersRequest -{ - /// - /// Gets or sets the Id of the media library whose metadata providers are reordered. - /// - public Guid LibraryId { get; set; } - - /// - /// Gets or sets the plugin Ids in the new order, from highest to lowest rank. - /// - public List PluginIds { get; set; } = []; -} +public record ReorderLibraryMetadataProvidersRequest( + Guid LibraryId, + List PluginIds +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetBookReaderEnabledRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetBookReaderEnabledRequest.cs index 4098cf1e..9c934831 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetBookReaderEnabledRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetBookReaderEnabledRequest.cs @@ -8,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins; /// /// Represents a request to enable or disable a book reader for a media library. /// +/// The Id of the media library whose book reader is enabled or disabled. Required. +/// The unique identifier of the plugin providing the book reader. Required. +/// Whether the book reader should be enabled for the media library. Required. [DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")] -public class SetBookReaderEnabledRequest -{ - /// - /// Gets or sets the Id of the media library whose book reader is enabled or disabled. Required. - /// - public Guid LibraryId { get; set; } - - /// - /// Gets or sets the unique identifier of the plugin providing the book reader. Required. - /// - public Guid PluginId { get; set; } - - /// - /// Gets or sets whether the book reader should be enabled for the media library. Required. - /// - public bool IsEnabled { get; set; } -} +public record SetBookReaderEnabledRequest( + Guid LibraryId, + Guid PluginId, + bool IsEnabled +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequest.cs index e5178468..aa55773d 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequest.cs @@ -8,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins; /// /// Represents a request to enable or disable an artwork provider for a media library. /// +/// The Id of the media library whose artwork provider is enabled or disabled. Required. +/// The unique identifier of the plugin providing the artwork. Required. +/// Whether the artwork provider should be enabled for the media library. Required. [DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")] -public class SetLibraryArtworkProviderEnabledRequest -{ - /// - /// Gets or sets the Id of the media library whose artwork provider is enabled or disabled. - /// - public Guid LibraryId { get; set; } - - /// - /// Gets or sets the unique identifier of the plugin providing the artwork. - /// - public Guid PluginId { get; set; } - - /// - /// Gets or sets whether the artwork provider should be enabled for the media library. - /// - public bool IsEnabled { get; set; } -} +public record SetLibraryArtworkProviderEnabledRequest( + Guid LibraryId, + Guid PluginId, + bool IsEnabled +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequest.cs index 38046da0..bf442946 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequest.cs @@ -1,6 +1,5 @@ #region ========================================================================= USING ===================================================================================== using System; -using System.Collections.Generic; using System.Diagnostics; #endregion @@ -9,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins; /// /// Represents a request to enable or disable a metadata provider for a media library. /// +/// The Id of the media library whose metadata provider is enabled or disabled. Required. +/// The unique identifier of the plugin providing the metadata. Required. +/// Whether the metadata provider should be enabled for the media library. Required. [DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")] -public class SetLibraryMetadataProviderEnabledRequest -{ - /// - /// Gets or sets the Id of the media library whose metadata provider is enabled or disabled. - /// - public Guid LibraryId { get; set; } - - /// - /// Gets or sets the unique identifier of the plugin providing the metadata. - /// - public Guid PluginId { get; set; } - - /// - /// Gets or sets whether the metadata provider should be enabled for the media library. - /// - public bool IsEnabled { get; set; } -} +public record SetLibraryMetadataProviderEnabledRequest( + Guid LibraryId, + Guid PluginId, + bool IsEnabled +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Plugins/UpdatePluginSettingsRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Plugins/UpdatePluginSettingsRequest.cs index c48bac46..7a03da51 100644 --- a/src/Lumina.Presentation.Web/Common/Requests/Plugins/UpdatePluginSettingsRequest.cs +++ b/src/Lumina.Presentation.Web/Common/Requests/Plugins/UpdatePluginSettingsRequest.cs @@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins; /// /// Represents a request to update the settings of a plugin. /// +/// The unique identifier of the plugin. Required. +/// The settings of the plugin. Optional. [DebuggerDisplay("PluginId: {PluginId}")] -public class UpdatePluginSettingsRequest -{ - /// - /// Gets or sets the unique identifier of the plugin. - /// - public Guid PluginId { get; set; } - - /// - /// Gets or sets the settings of the plugin. - /// - public Dictionary? Settings { get; set; } -} +public record UpdatePluginSettingsRequest( + Guid PluginId, + Dictionary? Settings +); diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointSummary.cs index 4393cec0..fbb75201 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointSummary.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderArtworkProviders/ReorderArtworkProvidersEndpointSummary.cs @@ -22,12 +22,12 @@ public class ReorderArtworkProvidersEndpointSummary : Summary r.LibraryId, "The Id of the media library whose artwork providers are reordered. Required."); + RequestParam(r => r.PluginIds, "The plugin Ids in the new order, from highest to lowest rank. Required."); - ExampleRequest = new ReorderLibraryArtworkProvidersRequest - { - LibraryId = Guid.NewGuid(), - PluginIds = [Guid.NewGuid(), Guid.NewGuid()] - }; + ExampleRequest = new ReorderLibraryArtworkProvidersRequest( + LibraryId: Guid.NewGuid(), + PluginIds: [Guid.NewGuid(), Guid.NewGuid()] + ); Response(200, "The artwork providers of the media library are reordered.", example: new SuccessResponse(true)); } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderMetadataProviders/ReorderMetadataProvidersEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderMetadataProviders/ReorderMetadataProvidersEndpointSummary.cs index e226dbe5..1ea20a6c 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderMetadataProviders/ReorderMetadataProvidersEndpointSummary.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/ReorderMetadataProviders/ReorderMetadataProvidersEndpointSummary.cs @@ -25,14 +25,14 @@ public class ReorderMetadataProvidersEndpointSummary : Summary r.LibraryId, "The Id of the media library whose metadata providers are reordered. Required."); RequestParam(r => r.PluginIds, "The plugin Ids in the new order, from highest to lowest rank. Required."); - ExampleRequest = new ReorderLibraryMetadataProvidersRequest - { - LibraryId = Guid.NewGuid(), - PluginIds = [ + ExampleRequest = new ReorderLibraryMetadataProvidersRequest( + LibraryId: Guid.NewGuid(), + PluginIds: + [ Guid.NewGuid(), Guid.NewGuid(), ] - }; + ); Response(200, "The metadata providers of the media library are reordered.", example: new SuccessResponse(true)); } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointSummary.cs index 01b8d452..7a1922e3 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointSummary.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetArtworkProviderEnabled/SetArtworkProviderEnabledEndpointSummary.cs @@ -25,12 +25,11 @@ public class SetArtworkProviderEnabledEndpointSummary : Summary r.PluginId, "The unique identifier of the plugin providing the artwork. Required."); RequestParam(r => r.IsEnabled, "Whether the artwork provider should be enabled for the media library, or not. Required."); - ExampleRequest = new SetLibraryArtworkProviderEnabledRequest - { - LibraryId = Guid.NewGuid(), - PluginId = Guid.NewGuid(), - IsEnabled = true - }; + ExampleRequest = new SetLibraryArtworkProviderEnabledRequest( + LibraryId: Guid.NewGuid(), + PluginId: Guid.NewGuid(), + IsEnabled: true + ); Response(200, "The artwork provider of the media library is enabled or disabled.", example: new SuccessResponse(true)); } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetBookReaderEnabled/SetBookReaderEnabledEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetBookReaderEnabled/SetBookReaderEnabledEndpointSummary.cs index 831c963a..bc08a3e0 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetBookReaderEnabled/SetBookReaderEnabledEndpointSummary.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetBookReaderEnabled/SetBookReaderEnabledEndpointSummary.cs @@ -25,12 +25,11 @@ public class SetBookReaderEnabledEndpointSummary : Summary r.PluginId, "The unique identifier of the plugin providing the book reader. Required."); RequestParam(r => r.IsEnabled, "Whether the book reader should be enabled for the media library, or not. Required."); - ExampleRequest = new SetBookReaderEnabledRequest - { - LibraryId = Guid.NewGuid(), - PluginId = Guid.NewGuid(), - IsEnabled = true - }; + ExampleRequest = new SetBookReaderEnabledRequest( + LibraryId: Guid.NewGuid(), + PluginId: Guid.NewGuid(), + IsEnabled: true + ); Response(200, "The book reader of the media library is enabled or disabled.", example: new SuccessResponse(true)); } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetMetadataProviderEnabled/SetMetadataProviderEnabledEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetMetadataProviderEnabled/SetMetadataProviderEnabledEndpointSummary.cs index 9edfcb0b..163d7afe 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetMetadataProviderEnabled/SetMetadataProviderEnabledEndpointSummary.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/Management/SetMetadataProviderEnabled/SetMetadataProviderEnabledEndpointSummary.cs @@ -25,12 +25,11 @@ public class SetMetadataProviderEnabledEndpointSummary : Summary r.PluginId, "The unique identifier of the plugin providing the metadata. Required."); RequestParam(r => r.IsEnabled, "Whether the metadata provider should be enabled for the media library, or not. Required."); - ExampleRequest = new SetLibraryMetadataProviderEnabledRequest - { - LibraryId = Guid.NewGuid(), - PluginId = Guid.NewGuid(), - IsEnabled = true - }; + ExampleRequest = new SetLibraryMetadataProviderEnabledRequest( + LibraryId: Guid.NewGuid(), + PluginId: Guid.NewGuid(), + IsEnabled: true + ); Response(200, "The metadata provider of the media library is enabled or disabled.", example: new SuccessResponse(true)); } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointSummary.cs index b85309ee..4e610fb3 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointSummary.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetLibraryItems/GetLibraryItemsEndpointSummary.cs @@ -33,17 +33,16 @@ public class GetLibraryItemsEndpointSummary : Summary r.SortBy, "The name of the field by which to sort the results. Optional."); RequestParam(r => r.SortOrder, "The direction in which to sort the results. Optional."); - ExampleRequest = new GetBooksLiteRequest - { - LibraryId = Guid.NewGuid(), - CurrentPage = 1, - PerPage = 48, - SearchTerm = "fellowship", - FilterAlphaKey = "f", - ShouldIgnoreThePrefixForAlphaPicker = true, - SortBy = "title", - SortOrder = SortOrder.Ascending - }; + ExampleRequest = new GetBooksLiteRequest( + LibraryId: Guid.NewGuid(), + CurrentPage: 1, + PerPage: 48, + SearchTerm: "fellowship", + FilterAlphaKey: "f", + ShouldIgnoreThePrefixForAlphaPicker: true, + SortBy: "title", + SortOrder: SortOrder.Ascending + ); Response(200, "The lightweight details of the books of the media library are returned.", example: new SuccessResponse(true, default)); } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpoint.cs index 469a89e2..0e92707d 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpoint.cs @@ -50,14 +50,15 @@ public class SaveBookEndpoint : BaseEndpoint /// Cancellation token that can be used to stop the execution. public override async Task ExecuteAsync(UpdateBookRequest request, CancellationToken cancellationToken) { - // The book is identified by the {bookId} route value, not by the id posted in the form, so that a mismatched id can never redirect - // the update to another book; the value is normalized to a Guid before it is substituted into the upstream URL, so that a crafted - // route value can never escape its URL segment, and an unparseable id is reported by the API as a missing book id. + // The book is identified by the {bookId} route value, not by the id posted in the body, so that a mismatched id can never redirect + // the update to another book; both ids are normalized to Guids before they are substituted into the upstream URL, so that a crafted + // value can never escape its URL segment, and an unparseable id is reported by the API as a missing book id. string routeId = HttpContext.Request.RouteValues["bookId"]?.ToString() ?? string.Empty; - request.BookId = Guid.TryParse(routeId, out Guid bookId) ? bookId.ToString() : Guid.Empty.ToString(); + string bookId = Guid.TryParse(routeId, out Guid parsedBookId) ? parsedBookId.ToString() : Guid.Empty.ToString(); + UpdateBookRequest requestWithRouteId = request with { BookId = bookId }; BookDetailsDto book = await _apiHttpClient.PutAsync( - ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", request.BookId), request, cancellationToken).ConfigureAwait(false); + ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", requestWithRouteId.LibraryId.ToString()).Replace("{bookId}", bookId), requestWithRouteId, cancellationToken).ConfigureAwait(false); return JsonSuccess(book); } } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointSummary.cs index 5ecaadfa..70e4ac5b 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointSummary.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointSummary.cs @@ -72,11 +72,10 @@ public class SaveBookEndpointSummary : Summary r.Contributors, "The list of media contributors of the book. Required."); RequestParam(r => r.Ratings, "The list of ratings of the book. Required."); - ExampleRequest = new UpdateBookRequest - { - BookId = Guid.NewGuid().ToString(), - LibraryId = Guid.NewGuid(), - Metadata = new WrittenContentMetadataDto + ExampleRequest = new UpdateBookRequest( + BookId: Guid.NewGuid().ToString(), + LibraryId: Guid.NewGuid(), + Metadata: new WrittenContentMetadataDto { Title = "The Fellowship of the Ring", OriginalTitle = "The Fellowship of the Ring", @@ -117,28 +116,28 @@ public class SaveBookEndpointSummary : Summary(true, default)); } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointSummary.cs index 80029d6d..3beca7a5 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointSummary.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Plugins/UpdatePluginSettings/UpdatePluginSettingsEndpointSummary.cs @@ -25,15 +25,14 @@ public class UpdatePluginSettingsEndpointSummary : Summary r.PluginId, "The unique identifier of the plugin. Required."); RequestParam(r => r.Settings, "The settings of the plugin. Optional."); - ExampleRequest = new UpdatePluginSettingsRequest - { - PluginId = Guid.NewGuid(), - Settings = new Dictionary + ExampleRequest = new UpdatePluginSettingsRequest( + PluginId: Guid.NewGuid(), + Settings: new Dictionary { { "preferredLanguage", "fr" }, { "selectionStrategy", "first" } } - }; + ); Response(200, "The settings of the plugin are updated.", example: new SuccessResponse(true)); } diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Libraries/GetBooksLiteRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Libraries/GetBooksLiteRequestFixture.cs index acf16aed..5dbca690 100644 --- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Libraries/GetBooksLiteRequestFixture.cs +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Libraries/GetBooksLiteRequestFixture.cs @@ -10,7 +10,7 @@ using System.Linq; namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Libraries; /// -/// Fixture class for the class. +/// Fixture class for the record. /// [ExcludeFromCodeCoverage] public class GetBooksLiteRequestFixture @@ -37,17 +37,16 @@ public class GetBooksLiteRequestFixture string? sortBy = null, SortOrder? sortOrder = null) { - return new GetBooksLiteRequest - { - LibraryId = libraryId ?? Guid.NewGuid(), - CurrentPage = currentPage, - PerPage = perPage, - SearchTerm = searchTerm, - FilterAlphaKey = filterAlphaKey, - ShouldIgnoreThePrefixForAlphaPicker = shouldIgnoreThePrefixForAlphaPicker, - SortBy = sortBy, - SortOrder = sortOrder - }; + return new GetBooksLiteRequest( + LibraryId: libraryId ?? Guid.NewGuid(), + CurrentPage: currentPage, + PerPage: perPage, + SearchTerm: searchTerm, + FilterAlphaKey: filterAlphaKey, + ShouldIgnoreThePrefixForAlphaPicker: shouldIgnoreThePrefixForAlphaPicker, + SortBy: sortBy, + SortOrder: sortOrder + ); } /// diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequestFixture.cs index 8d29f1f5..88b318a6 100644 --- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequestFixture.cs +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookRequestFixture.cs @@ -15,7 +15,7 @@ using System.Linq; namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books; /// -/// Fixture class for the class. +/// Fixture class for the record. /// [ExcludeFromCodeCoverage] public class UpdateBookRequestFixture @@ -73,28 +73,27 @@ public class UpdateBookRequestFixture bool includeContributors = true, bool includeRatings = true) { - return new UpdateBookRequest - { - BookId = id?.ToString() ?? Guid.NewGuid().ToString(), - LibraryId = libraryId ?? Guid.NewGuid(), - Metadata = includeMetadata ? (metadata ?? _writtenContentMetadataDtoFixture.Create()) : null, - Format = includeFormat ? _faker.PickRandom() : null, - Edition = includeEdition ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null, - VolumeNumber = includeVolumeNumber ? _faker.Random.Number(1, 3) : null, - Series = includeSeries ? _bookSeriesDtoFixture.Create() : null, - ASIN = includeAsin ? _faker.Random.String2(10) : null, - GoodreadsId = includeGoodreadsId ? _faker.Random.Number(100000, 500000).ToString() : null, - LCCN = includeLccn ? "n78890351" : null, - OCLCNumber = includeOclcNumber ? "ocm12345678" : null, - OpenLibraryId = includeOpenLibraryId ? "OL123456M" : null, - LibraryThingId = includeLibraryThingId ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null, - GoogleBooksId = includeGoogleBooksId ? CreateGoogleBooksId() : null, - BarnesAndNobleId = includeBarnesAndNobleId ? _faker.Random.String2(10, "0123456789") : null, - AppleBooksId = includeAppleBooksId ? $"id{_faker.Random.Number(1, 999999)}" : null, - ISBNs = includeIsbns ? [.. _isbnDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null, - Contributors = includeContributors ? [.. _mediaContributorDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null, - Ratings = includeRatings ? [.. _bookRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null - }; + return new UpdateBookRequest( + BookId: id?.ToString() ?? Guid.NewGuid().ToString(), + LibraryId: libraryId ?? Guid.NewGuid(), + Metadata: includeMetadata ? (metadata ?? _writtenContentMetadataDtoFixture.Create()) : null, + Format: includeFormat ? _faker.PickRandom() : null, + Edition: includeEdition ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null, + VolumeNumber: includeVolumeNumber ? _faker.Random.Number(1, 3) : null, + Series: includeSeries ? _bookSeriesDtoFixture.Create() : null, + ASIN: includeAsin ? _faker.Random.String2(10) : null, + GoodreadsId: includeGoodreadsId ? _faker.Random.Number(100000, 500000).ToString() : null, + LCCN: includeLccn ? "n78890351" : null, + OCLCNumber: includeOclcNumber ? "ocm12345678" : null, + OpenLibraryId: includeOpenLibraryId ? "OL123456M" : null, + LibraryThingId: includeLibraryThingId ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null, + GoogleBooksId: includeGoogleBooksId ? CreateGoogleBooksId() : null, + BarnesAndNobleId: includeBarnesAndNobleId ? _faker.Random.String2(10, "0123456789") : null, + AppleBooksId: includeAppleBooksId ? $"id{_faker.Random.Number(1, 999999)}" : null, + ISBNs: includeIsbns ? [.. _isbnDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null, + Contributors: includeContributors ? [.. _mediaContributorDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null, + Ratings: includeRatings ? [.. _bookRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null + ); } /// diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequestFixture.cs index ed6112c1..d0cb7a97 100644 --- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequestFixture.cs +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/ReorderLibraryArtworkProvidersRequestFixture.cs @@ -10,7 +10,7 @@ using System.Linq; namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins; /// -/// Fixture class for the class. +/// Fixture class for the record. /// [ExcludeFromCodeCoverage] public class ReorderLibraryArtworkProvidersRequestFixture @@ -27,11 +27,10 @@ public class ReorderLibraryArtworkProvidersRequestFixture Guid? libraryId = null, List? pluginIds = null) { - return new ReorderLibraryArtworkProvidersRequest - { - LibraryId = libraryId ?? Guid.NewGuid(), - PluginIds = pluginIds ?? [_faker.Random.Guid(), _faker.Random.Guid()] - }; + return new ReorderLibraryArtworkProvidersRequest( + LibraryId: libraryId ?? Guid.NewGuid(), + PluginIds: pluginIds ?? [_faker.Random.Guid(), _faker.Random.Guid()] + ); } /// diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequestFixture.cs index ff5d3855..c52dcdfc 100644 --- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequestFixture.cs +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/ReorderLibraryMetadataProvidersRequestFixture.cs @@ -10,7 +10,7 @@ using System.Linq; namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins; /// -/// Fixture class for the class. +/// Fixture class for the record. /// [ExcludeFromCodeCoverage] public class ReorderLibraryMetadataProvidersRequestFixture @@ -27,11 +27,10 @@ public class ReorderLibraryMetadataProvidersRequestFixture Guid? libraryId = null, List? pluginIds = null) { - return new ReorderLibraryMetadataProvidersRequest - { - LibraryId = libraryId ?? Guid.NewGuid(), - PluginIds = pluginIds ?? [_faker.Random.Guid(), _faker.Random.Guid()] - }; + return new ReorderLibraryMetadataProvidersRequest( + LibraryId: libraryId ?? Guid.NewGuid(), + PluginIds: pluginIds ?? [_faker.Random.Guid(), _faker.Random.Guid()] + ); } /// diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetBookReaderEnabledRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetBookReaderEnabledRequestFixture.cs index e4a4aea2..3e1047c5 100644 --- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetBookReaderEnabledRequestFixture.cs +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetBookReaderEnabledRequestFixture.cs @@ -9,7 +9,7 @@ using System.Linq; namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins; /// -/// Fixture class for the class. +/// Fixture class for the record. /// [ExcludeFromCodeCoverage] public class SetBookReaderEnabledRequestFixture @@ -26,12 +26,11 @@ public class SetBookReaderEnabledRequestFixture Guid? pluginId = null, bool? isEnabled = null) { - return new SetBookReaderEnabledRequest - { - LibraryId = libraryId ?? Guid.NewGuid(), - PluginId = pluginId ?? Guid.NewGuid(), - IsEnabled = isEnabled ?? true - }; + return new SetBookReaderEnabledRequest( + LibraryId: libraryId ?? Guid.NewGuid(), + PluginId: pluginId ?? Guid.NewGuid(), + IsEnabled: isEnabled ?? true + ); } /// diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequestFixture.cs index 5faccb34..db568e49 100644 --- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequestFixture.cs +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetLibraryArtworkProviderEnabledRequestFixture.cs @@ -10,7 +10,7 @@ using System.Linq; namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins; /// -/// Fixture class for the class. +/// Fixture class for the record. /// [ExcludeFromCodeCoverage] public class SetLibraryArtworkProviderEnabledRequestFixture @@ -29,12 +29,11 @@ public class SetLibraryArtworkProviderEnabledRequestFixture Guid? pluginId = null, bool? isEnabled = null) { - return new SetLibraryArtworkProviderEnabledRequest - { - LibraryId = libraryId ?? Guid.NewGuid(), - PluginId = pluginId ?? Guid.NewGuid(), - IsEnabled = isEnabled ?? _faker.Random.Bool() - }; + return new SetLibraryArtworkProviderEnabledRequest( + LibraryId: libraryId ?? Guid.NewGuid(), + PluginId: pluginId ?? Guid.NewGuid(), + IsEnabled: isEnabled ?? _faker.Random.Bool() + ); } /// diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequestFixture.cs index c2ff8329..fdf26cb3 100644 --- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequestFixture.cs +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/SetLibraryMetadataProviderEnabledRequestFixture.cs @@ -10,7 +10,7 @@ using System.Linq; namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins; /// -/// Fixture class for the class. +/// Fixture class for the record. /// [ExcludeFromCodeCoverage] public class SetLibraryMetadataProviderEnabledRequestFixture @@ -29,12 +29,11 @@ public class SetLibraryMetadataProviderEnabledRequestFixture Guid? pluginId = null, bool? isEnabled = null) { - return new SetLibraryMetadataProviderEnabledRequest - { - LibraryId = libraryId ?? Guid.NewGuid(), - PluginId = pluginId ?? Guid.NewGuid(), - IsEnabled = isEnabled ?? _faker.Random.Bool() - }; + return new SetLibraryMetadataProviderEnabledRequest( + LibraryId: libraryId ?? Guid.NewGuid(), + PluginId: pluginId ?? Guid.NewGuid(), + IsEnabled: isEnabled ?? _faker.Random.Bool() + ); } /// diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/UpdatePluginSettingsRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/UpdatePluginSettingsRequestFixture.cs index 90f776b4..c7520d90 100644 --- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/UpdatePluginSettingsRequestFixture.cs +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Plugins/UpdatePluginSettingsRequestFixture.cs @@ -10,7 +10,7 @@ using System.Linq; namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins; /// -/// Fixture class for the class. +/// Fixture class for the record. /// [ExcludeFromCodeCoverage] public class UpdatePluginSettingsRequestFixture @@ -27,11 +27,10 @@ public class UpdatePluginSettingsRequestFixture Guid? pluginId = null, Dictionary? settings = null) { - return new UpdatePluginSettingsRequest - { - PluginId = pluginId ?? Guid.NewGuid(), - Settings = settings ?? new Dictionary { [_faker.Lorem.Word()] = _faker.Lorem.Word() } - }; + return new UpdatePluginSettingsRequest( + PluginId: pluginId ?? Guid.NewGuid(), + Settings: settings ?? new Dictionary { [_faker.Lorem.Word()] = _faker.Lorem.Word() } + ); } /// diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointTests.cs index 2d338d39..d03bd3d1 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/SaveBook/SaveBookEndpointTests.cs @@ -45,6 +45,7 @@ public class SaveBookEndpointTests // Arrange string routeId = Guid.NewGuid().ToString(); UpdateBookRequest request = _updateBookRequestFixture.Create(); + string originalBookId = request.BookId!; BookDetailsDto expectedBook = _bookDetailsDtoFixture.Create(); _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) .Returns(expectedBook); @@ -56,8 +57,9 @@ public class SaveBookEndpointTests // Assert await _mockApiHttpClient.Received(1).PutAsync( Arg.Is(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", routeId)), - Arg.Is(forwardedRequest => forwardedRequest == request && forwardedRequest.BookId == routeId), + Arg.Is(forwardedRequest => forwardedRequest.BookId == routeId), Arg.Any()); + Assert.Equal(originalBookId, request.BookId); } [Fact] @@ -66,8 +68,7 @@ public class SaveBookEndpointTests // Arrange string routeId = Guid.NewGuid().ToString(); string bodyId = Guid.NewGuid().ToString(); - UpdateBookRequest request = _updateBookRequestFixture.Create(); - request.BookId = bodyId; + UpdateBookRequest request = _updateBookRequestFixture.Create() with { BookId = bodyId }; BookDetailsDto expectedBook = _bookDetailsDtoFixture.Create(); _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) .Returns(expectedBook); @@ -79,8 +80,9 @@ public class SaveBookEndpointTests // Assert await _mockApiHttpClient.Received(1).PutAsync( Arg.Is(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", routeId)), - Arg.Is(forwardedRequest => forwardedRequest == request && forwardedRequest.BookId == routeId && forwardedRequest.BookId != bodyId), + Arg.Is(forwardedRequest => forwardedRequest.BookId == routeId && forwardedRequest.BookId != bodyId), Arg.Any()); + Assert.Equal(bodyId, request.BookId); } [Fact] @@ -101,7 +103,7 @@ public class SaveBookEndpointTests // Assert await _mockApiHttpClient.Received(1).PutAsync( Arg.Is(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", expectedId)), - Arg.Is(forwardedRequest => forwardedRequest == request && forwardedRequest.BookId == expectedId), + Arg.Is(forwardedRequest => forwardedRequest.BookId == expectedId), Arg.Any()); } @@ -122,7 +124,7 @@ public class SaveBookEndpointTests // Assert await _mockApiHttpClient.Received(1).PutAsync( Arg.Is(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", expectedId)), - Arg.Is(forwardedRequest => forwardedRequest == request && forwardedRequest.BookId == expectedId), + Arg.Is(forwardedRequest => forwardedRequest.BookId == expectedId), Arg.Any()); } @@ -148,7 +150,7 @@ public class SaveBookEndpointTests } /// - /// Sets the id route value the endpoint reads the book Id from. + /// Sets the bookId route value the endpoint reads the book Id from. /// /// The raw route value of the book Id. private void ConfigureRequest(string routeId) @@ -157,10 +159,10 @@ public class SaveBookEndpointTests } /// - /// Leaves the id route value unset. + /// Leaves the bookId route value unset. /// private void ConfigureRequestWithoutId() { - _sut.HttpContext.Request.RouteValues.Remove("id"); + _sut.HttpContext.Request.RouteValues.Remove("bookId"); } } From 9a7a1dffb29bd026f775ae64370d117a43676cd6 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Mon, 12 Oct 2026 19:39:49 +0300 Subject: [PATCH 03/19] Adds example values to the API endpoint documentation summaries. --- .../AddAlbum/AddAlbumEndpointSummary.cs | 6 +- .../GetAlbum/GetAlbumEndpointSummary.cs | 199 +++++++++++++++++- .../GetAlbumTracksLiteEndpointSummary.cs | 7 +- .../UpdateAlbum/UpdateAlbumEndpointSummary.cs | 192 ++++++++++++++++- .../AddArtist/AddArtistEndpointSummary.cs | 6 +- .../GetArtist/GetArtistEndpointSummary.cs | 8 +- .../GetArtistAlbumsEndpointSummary.cs | 191 ++++++++++++++++- .../GetArtistAlbumsLiteEndpointSummary.cs | 11 +- .../GetArtists/GetArtistsEndpointSummary.cs | 15 +- .../GetArtistsLiteEndpointSummary.cs | 20 +- .../UpdateArtistEndpointSummary.cs | 6 +- .../Books/AddBook/AddBookEndpointSummary.cs | 2 +- .../Books/GetBooks/GetBooksEndpointSummary.cs | 4 +- .../GetBooksLiteEndpointSummary.cs | 4 +- 14 files changed, 642 insertions(+), 29 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 26fc8125..0ad7ef8f 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 @@ -11,6 +11,7 @@ using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Tracks; using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; using Lumina.Domain.SharedKernel.Common.Enums.Common; using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -636,8 +637,9 @@ public class AddAlbumEndpointSummary : Summary ResponseParam(r => r.Metadata!.Genres, "The list of genres associated with the album."); ResponseParam(r => r.Metadata!.Tags, "The list of tags that further describe or categorize the album."); ResponseParam(r => r.Tracks, "The list of tracks of the album."); + ResponseParam(r => r.CoverPath, "The path of the image representing the album, if available."); + ResponseParam(r => r.Artwork, "The stored artwork of the album, in display order, if applicable."); Response(200, "The requested album is returned.", example: new AlbumResponse( @@ -142,8 +145,200 @@ public class GetAlbumEndpointSummary : Summary ], CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc), UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc), - Tracks: [] - ) + 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 + ), + new MediaContributorReferenceDto( + ContributorId: Guid.NewGuid(), + Role: MediaContributorRole.Guitar + ) + ], + Ratings: [ + new( + Value: 4.5M, + MaxValue: 5, + Source: AudioRatingSource.MusicBrainz, + VoteCount: 2345 + ), + new( + Value: 4.8M, + MaxValue: 5, + 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) + ), + new( + Id: Guid.NewGuid(), + AlbumId: Guid.NewGuid(), + LibraryId: Guid.NewGuid(), + Path: "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac", + Metadata: new( + Title: "You're My Best Friend", + OriginalTitle: "You're My Best Friend", + Description: "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", + Disambiguation: "album version", + ReleaseInfo: new( + OriginalReleaseDate: new DateOnly(1976, 6, 18), + OriginalReleaseYear: 1976, + 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: "love") + ], + Genres: [ + new(Name: "Rock"), + new(Name: "Pop Rock") + ], + DurationInSeconds: 181, + SampleRate: 44100, + Channels: 2, + BitDepth: 16, + AudioCodec: "FLAC", + Bitrate: 912, + IsVideo: false + ), + Script: "Latn", + Key: MusicKey.BMajor, + Bpm: 118, + Work: new MusicWorkDto( + MusicBrainzWorkId: Guid.NewGuid(), + Title: "You're My Best Friend", + Type: "Song", + Languages: [new LanguageInfoDto(LanguageCode: "en", LanguageName: "English", NativeName: "English")], + Iswcs: ["T-010489707-6"] + ), + Isrcs: [ + new(Value: "GBUM71029609") + ], + Moods: [ + new(Name: "happy"), + new(Name: "warm") + ], + MusicBrainzRecordingId: Guid.NewGuid(), + MusicBrainzTrackId: Guid.NewGuid(), + Contributors: [ + new MediaContributorReferenceDto( + ContributorId: Guid.NewGuid(), + Role: MediaContributorRole.Vocals + ), + new MediaContributorReferenceDto( + ContributorId: Guid.NewGuid(), + Role: MediaContributorRole.Guitar + ) + ], + Ratings: [ + new( + Value: 4.2M, + MaxValue: 5, + Source: AudioRatingSource.MusicBrainz, + VoteCount: 1234 + ), + new( + Value: 4.4M, + MaxValue: 5, + Source: AudioRatingSource.LastFm, + VoteCount: 567 + ) + ], + TrackNumber: 7, + DiscNumber: 1, + CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc), + UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc) + ) + ], + CoverPath: "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg", + Artwork: + [ + new MediaArtworkDto(ArtworkType.Cover, 0, "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg"), + new MediaArtworkDto(ArtworkType.Back, 0, "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/back.jpg"), + new MediaArtworkDto(ArtworkType.Booklet, 0, "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/booklet.jpg") + ]) ); Response(401, "Authentication required.", "application/problem+json", diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointSummary.cs index 9d152542..ba444db1 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointSummary.cs @@ -36,6 +36,7 @@ public class GetAlbumTracksLiteEndpointSummary : Summary(r => r.Title, "The title of the track."); ResponseParam(r => r.TrackNumber, "The number of the track on its disc."); ResponseParam(r => r.DiscNumber, "The number of the disc the track belongs to, if applicable."); + ResponseParam(r => r.DurationInSeconds, "The duration of the track in seconds."); Response(200, "The paginated list of the lightweight read models of the tracks of the album is returned.", example: new PaginatedResponse @@ -46,13 +47,15 @@ public class GetAlbumTracksLiteEndpointSummary : Summary CreatedOnUtc: new DateTime(2025, 1, 15, 10, 30, 0, DateTimeKind.Utc), UpdatedOnUtc: new DateTime(2025, 1, 20, 14, 45, 0, DateTimeKind.Utc) ) - ] + ], + CoverPath: "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg", + Artwork: [new MediaArtworkDto(ArtworkType.Cover, 0, "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg")] ) - ] + ], + CoverPath: "/media/music/Queen-3b3a19f3/cover.jpg" ) ); 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 a70cc6d0..274c3421 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 @@ -8,6 +8,7 @@ using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; using Lumina.Domain.SharedKernel.Common.Enums.Common; using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -144,7 +145,103 @@ public class GetArtistAlbumsEndpointSummary : Summary r.CurrentPage, "The page of results to retrieve. Optional."); RequestParam(r => r.PerPage, "The maximum number of artists to retrieve per page. Optional."); RequestParam(r => r.SearchTerm, "The search term used to filter the artists by name. Optional."); + RequestParam(r => r.FilterAlphaKey, "The alpha key used to filter the artists by the first character of their name, for the alpha picker. Optional."); + RequestParam(r => r.ShouldIgnoreThePrefixForAlphaPicker, "Whether the leading \"The \" prefix of a name is ignored when computing the alpha key, or not."); + RequestParam(r => r.SortBy, "The name of the field by which to sort the results. Optional."); + RequestParam(r => r.SortOrder, "The direction in which to sort the results. Optional."); ResponseParam(r => r.Id, "The Id of the artist."); ResponseParam(r => r.Name, "The name of the artist."); @@ -44,11 +53,13 @@ public class GetArtistsLiteEndpointSummary : Summary MetadataProvider: default, CreatedOnUtc: DateTime.UtcNow, UpdatedOnUtc: default, - CoverPath: null + CoverPath: "/media/books/tolkien/the-fellowship-of-the-ring/cover.jpg" ) ); diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs index 7db1af98..7fa8eba3 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointSummary.cs @@ -147,7 +147,7 @@ public class GetBooksEndpointSummary : Summary Date: Mon, 12 Oct 2026 23:02:05 +0300 Subject: [PATCH 04/19] Moves the cancellation token to the last parameter position. --- .../Artwork/IMusicArtworkService.cs | 39 +- .../Artwork/MusicArtworkService.cs | 130 ++++++- .../MusicMediaLibraryScanArtworkEnricher.cs | 2 +- .../Artwork/MusicArtworkServiceTests.cs | 253 ++++++++++++- .../Artwork/MusicArtworkServiceTests.cs | 340 +++++++++++++++++- ...sicMediaLibraryScanArtworkEnricherTests.cs | 6 +- 6 files changed, 741 insertions(+), 29 deletions(-) diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkService.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkService.cs index 1754343c..3c1690e6 100644 --- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkService.cs +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkService.cs @@ -2,6 +2,7 @@ using Lumina.Contracts.DTO.Common; using Lumina.Domain.Common.Primitives; using System; +using System.IO; using System.Threading; using System.Threading.Tasks; #endregion @@ -22,10 +23,25 @@ public interface IMusicArtworkService /// The name of the artist of the album. /// The title of the album. /// The artwork to store. + /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When , no release type segment is added. /// Cancellation token that can be used to stop the execution. - /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When omitted, no release type segment is added. /// An containing either the relative path of the stored artwork, or an error. - Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, ArtworkDto artwork, CancellationToken cancellationToken, string? releaseTypeName = null); + Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, ArtworkDto artwork, string? releaseTypeName, CancellationToken cancellationToken); + + /// + /// Stores the uploaded of the album into the internal media directory, and returns the relative path of the stored artwork. + /// + /// The Id of the media library the album belongs to. + /// The Id of the album. + /// The name of the media library the album belongs to. + /// The name of the artist of the album. + /// The title of the album. + /// The stream of the uploaded artwork to store. + /// The name of the uploaded artwork file. + /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When , no release type segment is added. + /// Cancellation token that can be used to stop the execution. + /// An containing either the relative path of the stored artwork, or an error. + Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, Stream artwork, string fileName, string? releaseTypeName, CancellationToken cancellationToken); /// /// Deletes the stored artwork of the album from the internal media directory. @@ -50,6 +66,18 @@ public interface IMusicArtworkService /// An containing either the relative path of the stored artwork, or an error. Task> SaveArtistArtworkAsync(Guid libraryId, string libraryName, string artistName, ArtworkDto artwork, CancellationToken cancellationToken); + /// + /// Stores the uploaded of the artist into the internal media directory, and returns the relative path of the stored artwork. + /// + /// The Id of the media library the artist belongs to. + /// The name of the media library the artist belongs to. + /// The name of the artist. + /// The stream of the uploaded artwork to store. + /// The name of the uploaded artwork file. + /// Cancellation token that can be used to stop the execution. + /// An containing either the relative path of the stored artwork, or an error. + Task> SaveArtistArtworkAsync(Guid libraryId, string libraryName, string artistName, Stream artwork, string fileName, CancellationToken cancellationToken); + /// /// Deletes the stored artwork of the artist from the internal media directory. /// @@ -58,4 +86,11 @@ public interface IMusicArtworkService /// The name of the artist. /// An representing either a successful operation, or an error. Result DeleteArtistArtwork(Guid libraryId, string libraryName, string artistName); + + /// + /// Deletes the stored artwork file at from the internal media directory, when it still exists. + /// + /// The relative path of the stored artwork file. + /// An representing either a successful operation, or an error. + Result DeleteStoredArtwork(string artworkRelativePath); } diff --git a/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkService.cs b/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkService.cs index 28ccb723..a2c4866a 100644 --- a/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkService.cs +++ b/src/Lumina.Infrastructure/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkService.cs @@ -58,10 +58,10 @@ internal sealed class MusicArtworkService : IMusicArtworkService /// The name of the artist of the album. /// The title of the album. /// The artwork to store. + /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When , no release type segment is added. /// Cancellation token that can be used to stop the execution. - /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When omitted, no release type segment is added. /// An containing either the relative path of the stored artwork, or an error. - public async Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, ArtworkDto artwork, CancellationToken cancellationToken, string? releaseTypeName = null) + public async Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, ArtworkDto artwork, string? releaseTypeName, CancellationToken cancellationToken) { Result artworkDirectoryPathResult = BuildAlbumArtworkDirectoryPath(libraryId, albumId, libraryName, artistName, albumTitle, releaseTypeName); if (artworkDirectoryPathResult.IsFailure) @@ -86,6 +86,106 @@ internal sealed class MusicArtworkService : IMusicArtworkService return await SaveArtworkAsync(artworkDirectoryPathResult.Value, artwork, cancellationToken).ConfigureAwait(false); } + /// + /// Stores the uploaded of the album into the internal media directory, and returns the relative path of the stored artwork. + /// + /// The Id of the media library the album belongs to. + /// The Id of the album. + /// The name of the media library the album belongs to. + /// The name of the artist of the album. + /// The title of the album. + /// The stream of the uploaded artwork to store. + /// The name of the uploaded artwork file. + /// The name of the release type directory the album is stored under on disk, used to group the artwork of the different releases of an artist. When , no release type segment is added. + /// Cancellation token that can be used to stop the execution. + /// An containing either the relative path of the stored artwork, or an error. + public async Task> SaveAlbumArtworkAsync(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, Stream artwork, string fileName, string? releaseTypeName, CancellationToken cancellationToken) + { + // The uploaded bytes are persisted to a temporary file first, so that the storage pipeline can treat the upload like any other local artwork source and clean it up afterwards. + string temporaryPath = BuildTemporaryUploadPath(fileName); + try + { + await WriteUploadedArtworkAsync(artwork, temporaryPath, cancellationToken).ConfigureAwait(false); + return await SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, new ArtworkDto(ArtworkType.Cover, 0, temporaryPath, null, IsTemporary: true), releaseTypeName, cancellationToken).ConfigureAwait(false); + } + finally + { + DeleteTemporaryFile(temporaryPath); + } + } + + /// + /// Stores the uploaded of the artist into the internal media directory, and returns the relative path of the stored artwork. + /// + /// The Id of the media library the artist belongs to. + /// The name of the media library the artist belongs to. + /// The name of the artist. + /// The stream of the uploaded artwork to store. + /// The name of the uploaded artwork file. + /// Cancellation token that can be used to stop the execution. + /// An containing either the relative path of the stored artwork, or an error. + public async Task> SaveArtistArtworkAsync(Guid libraryId, string libraryName, string artistName, Stream artwork, string fileName, CancellationToken cancellationToken) + { + // The uploaded bytes are persisted to a temporary file first, so that the storage pipeline can treat the upload like any other local artwork source and clean it up afterwards. + string temporaryPath = BuildTemporaryUploadPath(fileName); + try + { + await WriteUploadedArtworkAsync(artwork, temporaryPath, cancellationToken).ConfigureAwait(false); + return await SaveArtistArtworkAsync(libraryId, libraryName, artistName, new ArtworkDto(ArtworkType.Cover, 0, temporaryPath, null, IsTemporary: true), cancellationToken).ConfigureAwait(false); + } + finally + { + DeleteTemporaryFile(temporaryPath); + } + } + + /// + /// Builds the path of the temporary file an uploaded artwork is buffered into, keeping the extension of the uploaded file so that its content can be probed by name. + /// + /// The name of the uploaded artwork file. + /// The file system path of the temporary file. + private static string BuildTemporaryUploadPath(string fileName) + { + string extension = Path.GetExtension(fileName); + if (string.IsNullOrWhiteSpace(extension)) + extension = ".img"; + return Path.Combine(Path.GetTempPath(), $"lumina-upload-{Guid.NewGuid():N}{extension}"); + } + + /// + /// Copies the uploaded stream into the temporary file at . + /// + /// The stream of the uploaded artwork. + /// The file system path of the temporary file. + /// Cancellation token that can be used to stop the execution. + private static async Task WriteUploadedArtworkAsync(Stream artwork, string temporaryPath, CancellationToken cancellationToken) + { + await using FileStream fileStream = new(temporaryPath, FileMode.Create, FileAccess.Write, FileShare.None, bufferSize: 81920, useAsync: true); + await artwork.CopyToAsync(fileStream, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the temporary file at , ignoring the failures that must not mask the result of the operation. + /// + /// The file system path of the temporary file. + private static void DeleteTemporaryFile(string temporaryPath) + { + if (!File.Exists(temporaryPath)) + return; + try + { + File.Delete(temporaryPath); + } + catch (IOException) + { + // A failed cleanup of the temporary file must not mask the result of the operation. + } + catch (UnauthorizedAccessException) + { + // A failed cleanup of the temporary file must not mask the result of the operation. + } + } + /// /// Resolves the local source of the , stores it into , and cleans up the temporary download of a remote artwork. /// @@ -159,6 +259,32 @@ internal sealed class MusicArtworkService : IMusicArtworkService return DeleteArtworkInDirectory(artworkDirectoryPathResult.Value); } + /// + /// Deletes the stored artwork file at from the internal media directory, when it still exists. + /// + /// The relative path of the stored artwork file. + /// An representing either a successful operation, or an error. + public Result DeleteStoredArtwork(string artworkRelativePath) + { + if (string.IsNullOrWhiteSpace(artworkRelativePath)) + return Result.Deleted; + + // The stored path is relative to the application's base directory, so it is rooted back to the absolute path of the file to delete. + string absolutePath = Path.Combine(AppContext.BaseDirectory, artworkRelativePath.TrimStart(_pathService.PathSeparator)); + Result filePathIdResult = FileSystemPathId.Create(absolutePath); + if (filePathIdResult.IsFailure) + return filePathIdResult.Errors; + + Result fileExistsResult = _environmentContext.FileProviderService.FileExists(filePathIdResult.Value); + if (fileExistsResult.IsFailure) + return fileExistsResult.Errors; + if (!fileExistsResult.Value) + return Result.Deleted; + + _environmentContext.FileProviderService.DeleteFile(filePathIdResult.Value); + return Result.Deleted; + } + /// /// Deletes the files directly contained in , leaving the subdirectories, such as the album directories of an artist, untouched. /// diff --git a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs index 17ff4a58..1a4e4c05 100644 --- a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs +++ b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs @@ -381,7 +381,7 @@ internal sealed class MusicMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr musicArtworkService, fileHashService, () => musicArtworkService!.DeleteAlbumArtwork(albumEntity.LibraryId, albumEntity.Id, libraryName, artistName, albumEntity.Title, releaseTypeName), - (artwork, token) => musicArtworkService!.SaveAlbumArtworkAsync(albumEntity.LibraryId, albumEntity.Id, libraryName, artistName, albumEntity.Title, artwork, token, releaseTypeName), + (artwork, token) => musicArtworkService!.SaveAlbumArtworkAsync(albumEntity.LibraryId, albumEntity.Id, libraryName, artistName, albumEntity.Title, artwork, releaseTypeName, token), shouldAggregateArtworkWhenMissing, unitOfWork, cancellationToken).ConfigureAwait(false); diff --git a/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs b/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs index 50f9f53d..16dcb9c1 100644 --- a/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs +++ b/tests/IntegrationTests/Lumina.Infrastructure.IntegrationTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs @@ -104,7 +104,7 @@ public class MusicArtworkServiceTests .Returns(Result.From(renamedFileId)); // Act - Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.False(result.IsFailure); @@ -150,7 +150,7 @@ public class MusicArtworkServiceTests .Returns(Result.From(_fileSystemPathIdFixture.Create(Path.Combine(artworkDirectoryPath, expectedFileName)))); // Act - Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath, type: artworkType, ordinal: ordinal), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath, type: artworkType, ordinal: ordinal), null, CancellationToken.None); // Assert Assert.False(result.IsFailure); @@ -187,7 +187,7 @@ public class MusicArtworkServiceTests .Returns(Result.From(_fileSystemPathIdFixture.Create(Path.Combine(artworkDirectoryPath, "cover.jpg")))); // Act - Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName: " ", albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName: " ", albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.False(result.IsFailure); @@ -218,7 +218,7 @@ public class MusicArtworkServiceTests MockPathBuilding(); // Act - Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: linkPath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: linkPath), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -246,7 +246,7 @@ public class MusicArtworkServiceTests MockPathBuilding(); // Act - Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -272,7 +272,7 @@ public class MusicArtworkServiceTests MockPathBuilding(); // Act - Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -309,7 +309,7 @@ public class MusicArtworkServiceTests .Returns(Result.From(_fileSystemPathIdFixture.Create(Path.Combine(artworkDirectoryPath, "cover.jpg")))); // Act - Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(remoteUrl: "https://coverartarchive.org/cover.jpg"), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(remoteUrl: "https://coverartarchive.org/cover.jpg"), null, CancellationToken.None); // Assert Assert.False(result.IsFailure); @@ -327,7 +327,7 @@ public class MusicArtworkServiceTests MockPathBuilding(); // Act - Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(remoteUrl: "https://coverartarchive.org/cover.jpg"), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(remoteUrl: "https://coverartarchive.org/cover.jpg"), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -342,7 +342,7 @@ public class MusicArtworkServiceTests MockPathBuilding(); // Act - Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(remoteUrl: "https://coverartarchive.org/cover.jpg"), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(remoteUrl: "https://coverartarchive.org/cover.jpg"), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -375,7 +375,7 @@ public class MusicArtworkServiceTests .Returns(Result.From(_fileSystemPathIdFixture.Create(Path.Combine(artworkDirectoryPath, "cover.jpg")))); // Act - Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath, remoteUrl: "https://coverartarchive.org/cover.jpg"), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath, remoteUrl: "https://coverartarchive.org/cover.jpg"), null, CancellationToken.None); // Assert Assert.False(result.IsFailure); @@ -402,7 +402,7 @@ public class MusicArtworkServiceTests // Act async Task Act() { - await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(remoteUrl: "https://coverartarchive.org/cover.jpg"), cancellationTokenSource.Token); + await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(remoteUrl: "https://coverartarchive.org/cover.jpg"), null, cancellationTokenSource.Token); } // Assert @@ -422,7 +422,7 @@ public class MusicArtworkServiceTests MockPathBuilding(); // Act - Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -458,7 +458,7 @@ public class MusicArtworkServiceTests .Returns(Error.Failure("Directory.Error", "Failed to create the artwork directory")); // Act - Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -494,7 +494,7 @@ public class MusicArtworkServiceTests .Returns(Error.Failure("Directory.Error", "Failed to check the artwork directory")); // Act - Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -530,7 +530,7 @@ public class MusicArtworkServiceTests .Returns(Error.Failure("FileSystem.Error", "Failed to copy the artwork")); // Act - Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -568,7 +568,7 @@ public class MusicArtworkServiceTests .Returns(Error.Failure("FileSystem.Error", "Failed to rename the artwork")); // Act - Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -613,7 +613,7 @@ public class MusicArtworkServiceTests }); // Act - Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -654,6 +654,193 @@ public class MusicArtworkServiceTests _mockFileProviderService.Received(1).DeleteFile(bookletFileId); } + [Fact] + public async Task SaveAlbumArtworkAsync_WhenAnArtworkStreamIsUploaded_ShouldStoreTheFileOnDiskAndDeleteTheTemporaryUpload() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + string libraryName = "Test Library"; + string artistName = "Test Artist"; + string albumTitle = "Test Album"; + byte[] uploadedBytes = [10, 20, 30, 40, 50]; + string libraryDirectoryPath = BuildLibraryDirectoryPath(libraryName, libraryId); + string artworkDirectoryPath = BuildArtworkDirectoryPath(libraryId, albumId, libraryName, artistName, albumTitle); + string expectedStoredPath = Path.Combine(artworkDirectoryPath, "cover.jpg"); + string? temporaryUploadPath = null; + MockRealFileSystemStubs(pathId => temporaryUploadPath = pathId.Path); + _mockFileTypeService.GetImageTypeAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(ImageType.JPEG)); + await using MemoryStream artworkStream = new(uploadedBytes); + try + { + // Act + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, artworkStream, "cover.jpg", null, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(expectedStoredPath[AppContext.BaseDirectory.Length..].Insert(0, "\\"), result.Value); + Assert.True(File.Exists(expectedStoredPath)); + Assert.Equal(uploadedBytes, File.ReadAllBytes(expectedStoredPath)); + Assert.NotNull(temporaryUploadPath); + Assert.StartsWith(Path.GetTempPath(), temporaryUploadPath); + Assert.EndsWith(".jpg", temporaryUploadPath); + Assert.False(File.Exists(temporaryUploadPath)); + } + finally + { + if (Directory.Exists(libraryDirectoryPath)) + Directory.Delete(libraryDirectoryPath, recursive: true); + } + } + + [Fact] + public async Task SaveArtistArtworkAsync_WhenAnArtworkStreamIsUploaded_ShouldStoreTheFileOnDiskAndDeleteTheTemporaryUpload() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + string libraryName = "Test Library"; + string artistName = "Test Artist"; + byte[] uploadedBytes = [60, 70, 80, 90]; + string libraryDirectoryPath = BuildLibraryDirectoryPath(libraryName, libraryId); + string artworkDirectoryPath = BuildArtistArtworkDirectoryPath(libraryId, libraryName, artistName); + string expectedStoredPath = Path.Combine(artworkDirectoryPath, "cover.png"); + string? temporaryUploadPath = null; + MockRealFileSystemStubs(pathId => temporaryUploadPath = pathId.Path); + _mockFileTypeService.GetImageTypeAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(ImageType.PNG)); + await using MemoryStream artworkStream = new(uploadedBytes); + try + { + // Act + Result result = await _sut.SaveArtistArtworkAsync(libraryId, libraryName, artistName, artworkStream, "cover.png", CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(expectedStoredPath[AppContext.BaseDirectory.Length..].Insert(0, "\\"), result.Value); + Assert.True(File.Exists(expectedStoredPath)); + Assert.Equal(uploadedBytes, File.ReadAllBytes(expectedStoredPath)); + Assert.NotNull(temporaryUploadPath); + Assert.StartsWith(Path.GetTempPath(), temporaryUploadPath); + Assert.EndsWith(".png", temporaryUploadPath); + Assert.False(File.Exists(temporaryUploadPath)); + } + finally + { + if (Directory.Exists(libraryDirectoryPath)) + Directory.Delete(libraryDirectoryPath, recursive: true); + } + } + + [Fact] + public void DeleteStoredArtwork_WhenTheFileExists_ShouldDeleteTheRealFile() + { + // Arrange + string libraryDirectoryPath = Path.Combine(AppContext.BaseDirectory, "media", "music", $"delete-{Guid.NewGuid():N}"); + Directory.CreateDirectory(libraryDirectoryPath); + string artworkPath = Path.Combine(libraryDirectoryPath, "cover.jpg"); + File.WriteAllBytes(artworkPath, [1, 2, 3]); + string artworkRelativePath = artworkPath[AppContext.BaseDirectory.Length..].Insert(0, "\\"); + _mockFileProviderService.FileExists(Arg.Any()) + .Returns(callInfo => Result.From(File.Exists(callInfo.Arg().Path))); + _mockFileProviderService.DeleteFile(Arg.Any()) + .Returns(callInfo => + { + File.Delete(callInfo.Arg().Path); + return Result.Deleted; + }); + try + { + // Act + Result result = _sut.DeleteStoredArtwork(artworkRelativePath); + + // Assert + Assert.False(result.IsFailure); + Assert.False(File.Exists(artworkPath)); + } + finally + { + if (Directory.Exists(libraryDirectoryPath)) + Directory.Delete(libraryDirectoryPath, recursive: true); + } + } + + [Fact] + public void DeleteStoredArtwork_WhenTheFileIsMissing_ShouldReturnDeleted() + { + // Arrange + string artworkRelativePath = $"\\media\\music\\missing-{Guid.NewGuid():N}.jpg"; + _mockFileProviderService.FileExists(Arg.Any()).Returns(Result.From(false)); + + // Act + Result result = _sut.DeleteStoredArtwork(artworkRelativePath); + + // Assert + Assert.False(result.IsFailure); + _mockFileProviderService.DidNotReceive().DeleteFile(Arg.Any()); + } + + [Theory] + [InlineData(null)] // a null path is a no-op + [InlineData("")] // an empty path is a no-op + [InlineData(" ")] // a whitespace path is a no-op + public void DeleteStoredArtwork_WhenThePathIsMissing_ShouldReturnDeletedWithoutTouchingTheFileSystem(string? artworkRelativePath) + { + // Act + Result result = _sut.DeleteStoredArtwork(artworkRelativePath!); + + // Assert + Assert.False(result.IsFailure); + _mockFileProviderService.DidNotReceive().FileExists(Arg.Any()); + _mockFileProviderService.DidNotReceive().DeleteFile(Arg.Any()); + } + + /// + /// Stubs the path and file system services so that the artwork storage pipeline performs real file system operations. + /// + /// Optional callback invoked with the source file of every file copy, used to observe the temporary upload. + private void MockRealFileSystemStubs(Action? onCopySource = null) + { + MockPathBuilding(); + + _mockFileProviderService.FileExists(Arg.Any()) + .Returns(callInfo => Result.From(File.Exists(callInfo.Arg().Path))); + _mockDirectoryProviderService.DirectoryExists(Arg.Any()) + .Returns(callInfo => Result.From(Directory.Exists(callInfo.Arg().Path))); + _mockDirectoryProviderService.CreateDirectory(Arg.Any(), Arg.Any()) + .Returns(callInfo => + { + string createdDirectoryPath = Path.Combine(callInfo.ArgAt(0).Path, callInfo.ArgAt(1)); + Directory.CreateDirectory(createdDirectoryPath); + return Result.From(_fileSystemPathIdFixture.Create(createdDirectoryPath)); + }); + _mockFileProviderService.CopyFile(Arg.Any(), Arg.Any(), true) + .Returns(callInfo => + { + FileSystemPathId sourcePathId = callInfo.ArgAt(0); + FileSystemPathId destinationDirectoryPathId = callInfo.ArgAt(1); + onCopySource?.Invoke(sourcePathId); + string destinationFilePath = Path.Combine(destinationDirectoryPathId.Path, Path.GetFileName(sourcePathId.Path)); + File.Copy(sourcePathId.Path, destinationFilePath, overwrite: true); + return Result.From(_fileSystemPathIdFixture.Create(destinationFilePath)); + }); + _mockFileProviderService.RenameFile(Arg.Any(), Arg.Any()) + .Returns(callInfo => + { + FileSystemPathId sourcePathId = callInfo.ArgAt(0); + string newFileName = callInfo.ArgAt(1); + string renamedFilePath = Path.Combine(Path.GetDirectoryName(sourcePathId.Path)!, newFileName); + File.Move(sourcePathId.Path, renamedFilePath); + return Result.From(_fileSystemPathIdFixture.Create(renamedFilePath)); + }); + _mockFileProviderService.DeleteFile(Arg.Any()) + .Returns(callInfo => + { + File.Delete(callInfo.Arg().Path); + return Result.Deleted; + }); + } + /// /// Stubs the path service so that building the artwork directory paths succeeds. /// @@ -708,6 +895,38 @@ public class MusicArtworkServiceTests $"{albumTitle}-{albumId}"); } + /// + /// Builds the file system path of the directory of a music media library. + /// + /// The name of the media library. + /// The Id of the media library. + /// The expected file system path of the music media library directory. + private static string BuildLibraryDirectoryPath(string libraryName, Guid libraryId) + { + return Path.Combine( + AppContext.BaseDirectory, + "media", + "music", + $"{libraryName}-{libraryId}"); + } + + /// + /// Builds the file system path of the directory that the artwork of the artist is stored into. + /// + /// The Id of the media library the artist belongs to. + /// The name of the media library the artist belongs to. + /// The name of the artist. + /// The expected file system path of the artist artwork directory. + private static string BuildArtistArtworkDirectoryPath(Guid libraryId, string libraryName, string artistName) + { + return Path.Combine( + AppContext.BaseDirectory, + "media", + "music", + $"{libraryName}-{libraryId}", + artistName); + } + /// /// Creates a temporary image file and returns its path. /// diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs index f79aef01..9ca8eaa9 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkServiceTests.cs @@ -8,6 +8,7 @@ using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.File using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Environment; using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects; using Lumina.Domain.Fixtures.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects; +using Lumina.Domain.SharedKernel.Common.Enums.PhotoLibrary; using Lumina.Infrastructure.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; using Microsoft.Extensions.Options; using NSubstitute; @@ -75,7 +76,7 @@ public class MusicArtworkServiceTests _mockFileProviderService.FileExists(Arg.Any()).Returns(Result.From(false)); // Act - Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -90,7 +91,7 @@ public class MusicArtworkServiceTests MockPathBuilding(); // Act - Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -107,7 +108,7 @@ public class MusicArtworkServiceTests .Returns(Error.Failure("FileSystem.Error", "Failed to check the artwork file")); // Act - Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: sourcePath), CancellationToken.None); + Result result = await _sut.SaveAlbumArtworkAsync(Guid.NewGuid(), Guid.NewGuid(), "Library", "Artist", "Album", _artworkDtoFixture.Create(localPath: sourcePath), null, CancellationToken.None); // Assert Assert.True(result.IsFailure); @@ -196,6 +197,307 @@ public class MusicArtworkServiceTests Assert.Equal(Errors.FileSystemManagement.InvalidPath, result.FirstError); } + [Fact] + public async Task SaveAlbumArtworkAsync_WhenAnArtworkStreamIsUploaded_ShouldStoreItAsTheCoverAndDeleteTheTemporaryUpload() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + string libraryName = "Test Library"; + string artistName = "Test Artist"; + string albumTitle = "Test Album"; + byte[] uploadedBytes = [1, 2, 3, 4, 5, 6, 7, 8]; + string artworkDirectoryPath = BuildArtworkDirectoryPath(libraryId, albumId, libraryName, artistName, albumTitle); + string renamedFilePath = Path.Combine(artworkDirectoryPath, "cover.jpg"); + string? capturedTemporaryPath = null; + byte[]? capturedBytes = null; + MockArtworkDirectoryStubs(artworkDirectoryPath); + _mockFileProviderService.FileExists(Arg.Any()).Returns(Result.From(true)); + _mockFileTypeService.GetImageTypeAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(ImageType.JPEG)); + _mockFileProviderService.CopyFile(Arg.Any(), Arg.Any(), true) + .Returns(callInfo => + { + capturedTemporaryPath = callInfo.ArgAt(0).Path; + capturedBytes = File.ReadAllBytes(capturedTemporaryPath); + return Result.From(_fileSystemPathIdFixture.Create(Path.Combine(artworkDirectoryPath, "upload.jpg"))); + }); + _mockFileProviderService.RenameFile(Arg.Any(), "cover.jpg") + .Returns(Result.From(_fileSystemPathIdFixture.Create(renamedFilePath))); + await using MemoryStream artworkStream = new(uploadedBytes); + + // Act + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, artworkStream, "cover.jpg", null, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(renamedFilePath[AppContext.BaseDirectory.Length..].Insert(0, "\\"), result.Value); + Assert.NotNull(capturedTemporaryPath); + Assert.StartsWith(Path.GetTempPath(), capturedTemporaryPath); + Assert.EndsWith(".jpg", capturedTemporaryPath); + Assert.Equal(uploadedBytes, capturedBytes); + Assert.False(File.Exists(capturedTemporaryPath)); + _mockFileProviderService.Received(1).RenameFile(Arg.Any(), "cover.jpg"); + } + + [Fact] + public async Task SaveAlbumArtworkAsync_WhenAnArtworkStreamIsUploadedWithAReleaseType_ShouldStoreTheArtworkUnderTheReleaseTypeDirectory() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + string libraryName = "Test Library"; + string artistName = "Test Artist"; + string albumTitle = "Test Album"; + string releaseTypeName = "Single"; + string artworkDirectoryPath = BuildArtworkDirectoryPath(libraryId, albumId, libraryName, artistName, albumTitle, releaseTypeName); + string renamedFilePath = Path.Combine(artworkDirectoryPath, "cover.jpg"); + MockArtworkDirectoryStubs(artworkDirectoryPath); + _mockFileProviderService.FileExists(Arg.Any()).Returns(Result.From(true)); + _mockFileTypeService.GetImageTypeAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(ImageType.JPEG)); + _mockFileProviderService.CopyFile(Arg.Any(), Arg.Any(), true) + .Returns(Result.From(_fileSystemPathIdFixture.Create(Path.Combine(artworkDirectoryPath, "upload.jpg")))); + _mockFileProviderService.RenameFile(Arg.Any(), "cover.jpg") + .Returns(Result.From(_fileSystemPathIdFixture.Create(renamedFilePath))); + await using MemoryStream artworkStream = new([1, 2, 3]); + + // Act + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, artworkStream, "cover.jpg", releaseTypeName, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockFileProviderService.Received(1).CopyFile( + Arg.Any(), + Arg.Is(pathId => pathId.Path == artworkDirectoryPath), + true); + } + + [Fact] + public async Task SaveAlbumArtworkAsync_WhenTheDownstreamStorageFails_ShouldStillDeleteTheTemporaryUpload() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + string libraryName = "Test Library"; + string artistName = "Test Artist"; + string albumTitle = "Test Album"; + string artworkDirectoryPath = BuildArtworkDirectoryPath(libraryId, albumId, libraryName, artistName, albumTitle); + string? capturedTemporaryPath = null; + MockArtworkDirectoryStubs(artworkDirectoryPath); + _mockFileProviderService.FileExists(Arg.Any()).Returns(Result.From(true)); + _mockFileTypeService.GetImageTypeAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(ImageType.JPEG)); + _mockFileProviderService.CopyFile(Arg.Any(), Arg.Any(), true) + .Returns(callInfo => + { + capturedTemporaryPath = callInfo.ArgAt(0).Path; + return Error.Failure("FileSystem.Error", "Failed to copy the artwork"); + }); + await using MemoryStream artworkStream = new([1, 2, 3, 4]); + + // Act + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, artworkStream, "cover.jpg", null, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal("FileSystem.Error", result.FirstError.Code); + Assert.NotNull(capturedTemporaryPath); + Assert.False(File.Exists(capturedTemporaryPath)); + _mockFileProviderService.DidNotReceive().RenameFile(Arg.Any(), Arg.Any()); + } + + [Theory] + [InlineData("cover")] // a name without an extension falls back to the .img extension + [InlineData("")] // an empty name falls back to the .img extension + [InlineData(null)] // a null name falls back to the .img extension + public async Task SaveAlbumArtworkAsync_WhenTheUploadedFileNameHasNoExtension_ShouldBufferTheUploadWithTheImgExtension(string? fileName) + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + string libraryName = "Test Library"; + string artistName = "Test Artist"; + string albumTitle = "Test Album"; + string artworkDirectoryPath = BuildArtworkDirectoryPath(libraryId, albumId, libraryName, artistName, albumTitle); + string? capturedTemporaryPath = null; + MockArtworkDirectoryStubs(artworkDirectoryPath); + _mockFileProviderService.FileExists(Arg.Any()).Returns(Result.From(true)); + _mockFileTypeService.GetImageTypeAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(ImageType.JPEG)); + _mockFileProviderService.CopyFile(Arg.Any(), Arg.Any(), true) + .Returns(callInfo => + { + capturedTemporaryPath = callInfo.ArgAt(0).Path; + return Result.From(_fileSystemPathIdFixture.Create(Path.Combine(artworkDirectoryPath, "upload.img"))); + }); + _mockFileProviderService.RenameFile(Arg.Any(), "cover.jpg") + .Returns(Result.From(_fileSystemPathIdFixture.Create(Path.Combine(artworkDirectoryPath, "cover.jpg")))); + await using MemoryStream artworkStream = new([1, 2, 3]); + + // Act + Result result = await _sut.SaveAlbumArtworkAsync(libraryId, albumId, libraryName, artistName, albumTitle, artworkStream, fileName!, null, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.NotNull(capturedTemporaryPath); + Assert.EndsWith(".img", capturedTemporaryPath); + } + + [Fact] + public async Task SaveArtistArtworkAsync_WhenAnArtworkStreamIsUploaded_ShouldStoreItAsTheCoverAndDeleteTheTemporaryUpload() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + string libraryName = "Test Library"; + string artistName = "Test Artist"; + byte[] uploadedBytes = [9, 8, 7, 6, 5]; + string artworkDirectoryPath = BuildArtistArtworkDirectoryPath(libraryId, libraryName, artistName); + string renamedFilePath = Path.Combine(artworkDirectoryPath, "cover.png"); + string? capturedTemporaryPath = null; + byte[]? capturedBytes = null; + MockArtworkDirectoryStubs(artworkDirectoryPath); + _mockFileProviderService.FileExists(Arg.Any()).Returns(Result.From(true)); + _mockFileTypeService.GetImageTypeAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(ImageType.PNG)); + _mockFileProviderService.CopyFile(Arg.Any(), Arg.Any(), true) + .Returns(callInfo => + { + capturedTemporaryPath = callInfo.ArgAt(0).Path; + capturedBytes = File.ReadAllBytes(capturedTemporaryPath); + return Result.From(_fileSystemPathIdFixture.Create(Path.Combine(artworkDirectoryPath, "upload.png"))); + }); + _mockFileProviderService.RenameFile(Arg.Any(), "cover.png") + .Returns(Result.From(_fileSystemPathIdFixture.Create(renamedFilePath))); + await using MemoryStream artworkStream = new(uploadedBytes); + + // Act + Result result = await _sut.SaveArtistArtworkAsync(libraryId, libraryName, artistName, artworkStream, "cover.png", CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(renamedFilePath[AppContext.BaseDirectory.Length..].Insert(0, "\\"), result.Value); + Assert.NotNull(capturedTemporaryPath); + Assert.StartsWith(Path.GetTempPath(), capturedTemporaryPath); + Assert.EndsWith(".png", capturedTemporaryPath); + Assert.Equal(uploadedBytes, capturedBytes); + Assert.False(File.Exists(capturedTemporaryPath)); + _mockFileProviderService.Received(1).RenameFile(Arg.Any(), "cover.png"); + } + + [Fact] + public async Task SaveArtistArtworkAsync_WhenTheDownstreamStorageFails_ShouldStillDeleteTheTemporaryUpload() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + string libraryName = "Test Library"; + string artistName = "Test Artist"; + string artworkDirectoryPath = BuildArtistArtworkDirectoryPath(libraryId, libraryName, artistName); + string? capturedTemporaryPath = null; + MockArtworkDirectoryStubs(artworkDirectoryPath); + _mockFileProviderService.FileExists(Arg.Any()).Returns(Result.From(true)); + _mockFileTypeService.GetImageTypeAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(ImageType.PNG)); + _mockFileProviderService.CopyFile(Arg.Any(), Arg.Any(), true) + .Returns(callInfo => + { + capturedTemporaryPath = callInfo.ArgAt(0).Path; + return Error.Failure("FileSystem.Error", "Failed to copy the artwork"); + }); + await using MemoryStream artworkStream = new([1, 2, 3]); + + // Act + Result result = await _sut.SaveArtistArtworkAsync(libraryId, libraryName, artistName, artworkStream, "cover.png", CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal("FileSystem.Error", result.FirstError.Code); + Assert.NotNull(capturedTemporaryPath); + Assert.False(File.Exists(capturedTemporaryPath)); + } + + [Theory] + [InlineData(null)] // a null path is a no-op + [InlineData("")] // an empty path is a no-op + [InlineData(" ")] // a whitespace path is a no-op + public void DeleteStoredArtwork_WhenThePathIsMissing_ShouldReturnDeletedWithoutTouchingTheFileSystem(string? artworkRelativePath) + { + // Act + Result result = _sut.DeleteStoredArtwork(artworkRelativePath!); + + // Assert + Assert.False(result.IsFailure); + _mockFileProviderService.DidNotReceive().FileExists(Arg.Any()); + _mockFileProviderService.DidNotReceive().DeleteFile(Arg.Any()); + } + + [Fact] + public void DeleteStoredArtwork_WhenTheFileDoesNotExist_ShouldReturnDeleted() + { + // Arrange + string artworkRelativePath = $"\\media\\music\\cover-{Guid.NewGuid():N}.jpg"; + _mockFileProviderService.FileExists(Arg.Any()).Returns(Result.From(false)); + + // Act + Result result = _sut.DeleteStoredArtwork(artworkRelativePath); + + // Assert + Assert.False(result.IsFailure); + _mockFileProviderService.DidNotReceive().DeleteFile(Arg.Any()); + } + + [Fact] + public void DeleteStoredArtwork_WhenTheFileExists_ShouldDeleteItAndReturnDeleted() + { + // Arrange + string artworkRelativePath = $"\\media\\music\\cover-{Guid.NewGuid():N}.jpg"; + string expectedAbsolutePath = Path.Combine(AppContext.BaseDirectory, artworkRelativePath.TrimStart('\\')); + _mockFileProviderService.FileExists(Arg.Is(pathId => pathId.Path == expectedAbsolutePath)) + .Returns(Result.From(true)); + _mockFileProviderService.DeleteFile(Arg.Any()).Returns(Result.Deleted); + + // Act + Result result = _sut.DeleteStoredArtwork(artworkRelativePath); + + // Assert + Assert.False(result.IsFailure); + _mockFileProviderService.Received(1).DeleteFile(Arg.Is(pathId => pathId.Path == expectedAbsolutePath)); + } + + [Fact] + public void DeleteStoredArtwork_WhenTheExistenceCheckFails_ShouldReturnTheError() + { + // Arrange + string artworkRelativePath = "\\media\\music\\cover.jpg"; + _mockFileProviderService.FileExists(Arg.Any()) + .Returns(Error.Failure("FileSystem.Error", "Failed to check the artwork file")); + + // Act + Result result = _sut.DeleteStoredArtwork(artworkRelativePath); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal("FileSystem.Error", result.FirstError.Code); + _mockFileProviderService.DidNotReceive().DeleteFile(Arg.Any()); + } + + [Fact] + public void DeleteStoredArtwork_WhenDeletingTheFileFails_ShouldReturnDeleted() + { + // Arrange + string artworkRelativePath = "\\media\\music\\cover.jpg"; + _mockFileProviderService.FileExists(Arg.Any()).Returns(Result.From(true)); + _mockFileProviderService.DeleteFile(Arg.Any()) + .Returns(Error.Failure("FileSystem.Error", "Failed to delete the artwork file")); + + // Act + Result result = _sut.DeleteStoredArtwork(artworkRelativePath); + + // Assert + Assert.False(result.IsFailure); + _mockFileProviderService.Received(1).DeleteFile(Arg.Any()); + } + /// /// Stubs the path service so that building the artwork directory paths succeeds. /// @@ -238,15 +540,45 @@ public class MusicArtworkServiceTests /// The name of the media library the album belongs to. /// The name of the artist of the album. /// The title of the album. + /// Optional. The name of the release type directory the album is stored under. /// The expected file system path of the album artwork directory. - private static string BuildArtworkDirectoryPath(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle) + private static string BuildArtworkDirectoryPath(Guid libraryId, Guid albumId, string libraryName, string artistName, string albumTitle, string? releaseTypeName = null) { + if (string.IsNullOrWhiteSpace(releaseTypeName)) + { + return Path.Combine( + AppContext.BaseDirectory, + "media", + "music", + $"{libraryName}-{libraryId}", + artistName, + $"{albumTitle}-{albumId}"); + } + return Path.Combine( AppContext.BaseDirectory, "media", "music", $"{libraryName}-{libraryId}", artistName, + releaseTypeName, $"{albumTitle}-{albumId}"); } + + /// + /// Builds the file system path of the directory that the artwork of the artist is stored into. + /// + /// The Id of the media library the artist belongs to. + /// The name of the media library the artist belongs to. + /// The name of the artist. + /// The expected file system path of the artist artwork directory. + private static string BuildArtistArtworkDirectoryPath(Guid libraryId, string libraryName, string artistName) + { + return Path.Combine( + AppContext.BaseDirectory, + "media", + "music", + $"{libraryName}-{libraryId}", + artistName); + } } diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricherTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricherTests.cs index 3c5e645b..a70367fc 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricherTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricherTests.cs @@ -272,8 +272,8 @@ public class MusicMediaLibraryScanArtworkEnricherTests Arg.Any(), album.Title, Arg.Is(artwork => artwork.Type == ArtworkType.Cover && artwork.Ordinal == 0), - Arg.Any(), - Arg.Any()); + Arg.Any(), + Arg.Any()); await _mockMusicArtworkRepository.Received(1).DeleteByOwnerAsync(MusicArtworkOwnerType.Album, album.Id, Arg.Any()); await _mockMusicArtworkRepository.Received(1).InsertRangeAsync( Arg.Is>(entities => entities.Count == 1 @@ -553,7 +553,7 @@ public class MusicMediaLibraryScanArtworkEnricherTests { _mockMusicArtworkService.SaveArtistArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) .Returns(Result.From("/media/music/cover.jpg")); - _mockMusicArtworkService.SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + _mockMusicArtworkService.SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) .Returns(Result.From("/media/music/cover.jpg")); _mockMusicArtworkService.DeleteArtistArtwork(Arg.Any(), Arg.Any(), Arg.Any()).Returns(Result.Deleted); _mockMusicArtworkService.DeleteAlbumArtwork(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()).Returns(Result.Deleted); From 0019821e871f2c0552cf37558f3d77dfb4118fd6 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 08:49:39 +0300 Subject: [PATCH 05/19] Turns the lowercase comments into sentences. --- .../Scheduler/SchedulerIndexViewEndpoint.cs | 4 ++-- .../Core/Endpoints/Common/BaseEndpoint.cs | 4 ++-- .../GetThumbnail/GetThumbnailEndpoint.cs | 2 +- .../Home/HomeNotFoundViewEndpoint.cs | 4 ++-- .../Books/Index/BooksIndexViewEndpoint.cs | 6 ++--- .../Themes/ThemeAssets/ThemeAssetsEndpoint.cs | 2 +- .../SetLanguage/SetLanguageEndpoint.cs | 12 +++++----- .../GetUserSettingsEndpoint.cs | 2 +- .../UpdateUserSettingsEndpoint.cs | 2 +- .../ChangePassword/ChangePasswordEndpoint.cs | 2 +- .../Authentication/Login/LoginEndpoint.cs | 22 +++++++++---------- .../Authentication/Login/LoginViewEndpoint.cs | 4 ++-- .../Authentication/Logout/LogoutEndpoint.cs | 2 +- .../RecoverPasswordViewEndpoint.cs | 2 +- .../Register/RegisterEndpoint.cs | 4 ++-- .../Register/RegisterViewEndpoint.cs | 2 +- 16 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpoint.cs index cf09450c..22be1b44 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Admin/Scheduler/SchedulerIndexViewEndpoint.cs @@ -26,10 +26,10 @@ namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Scheduler; /// public class SchedulerIndexViewEndpoint : BaseEndpoint { - // the resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath + // The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath. private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Admin.Scheduler"; private const string VIEW_RESOURCE_LOCATION = "Lumina.Presentation.Web"; - // the page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope + // The page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope. private const string VIEW_PAGE_KEY = "admin/scheduler"; private readonly IAntiforgery _antiforgery; diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs index 62ca2828..f00b760c 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Common/BaseEndpoint.cs @@ -40,8 +40,8 @@ public abstract class BaseEndpoint : EndpointAn that renders the view. protected IResult View(string viewName, object? model = null, IReadOnlyDictionary? viewData = null) { - // store the path of the displayed view in the session, so that the login redirect after the JWT token expires points to it; ignore the login endpoint, - // because it is incorrect to be redirected to the login URL, with the login URL as the return URL + // Store the path of the displayed view in the session, so that the login redirect after the JWT token expires points to it; ignore the login endpoint, + // because it is incorrect to be redirected to the login URL, with the login URL as the return URL. if (HttpContext.Request.Path != "/en-us/auth/login") HttpContext.Session.SetString(HttpContextItemKeys.LAST_DISPLAYED_VIEW, $"{HttpContext.Request.PathBase}{HttpContext.Request.Path}{HttpContext.Request.QueryString}"); return new RazorViewResult(viewName, model, viewData); diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpoint.cs index d0230562..88e0fb5e 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/FileSystemManagement/Thumbnails/GetThumbnail/GetThumbnailEndpoint.cs @@ -49,7 +49,7 @@ public class GetThumbnailEndpoint : BaseEndpoint /// Cancellation token that can be used to stop the execution. public override async Task ExecuteAsync(GetThumbnailRequest request, CancellationToken cancellationToken) { - // the thumbnail is proxied through the Web application, so that the request carries the authentication of the current user + // The thumbnail is proxied through the Web application, so that the request carries the authentication of the current user. BlobDataDto blob = await _apiHttpClient.GetBlobAsync($"{ApiRoutes.Thumbnails.GET_THUMBNAIL}?path={Uri.EscapeDataString(request.Path!)}&quality={request.Quality}", cancellationToken).ConfigureAwait(false); return Results.File(blob.Data, blob.ContentType); } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Home/HomeNotFoundViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Home/HomeNotFoundViewEndpoint.cs index 6e5c239e..155f4922 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Home/HomeNotFoundViewEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Home/HomeNotFoundViewEndpoint.cs @@ -20,10 +20,10 @@ namespace Lumina.Presentation.Web.Core.Endpoints.Home; /// public class HomeNotFoundViewEndpoint : BaseEndpoint { - // the resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath + // The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath. private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Shared.NotFound"; private const string VIEW_RESOURCE_LOCATION = "Lumina.Presentation.Web"; - // the page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope + // The page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope. private const string VIEW_PAGE_KEY = "shared/not-found"; private readonly ThemePageRenderer _themePageRenderer; diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Index/BooksIndexViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Index/BooksIndexViewEndpoint.cs index f385ddfb..8f7ff097 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Index/BooksIndexViewEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Index/BooksIndexViewEndpoint.cs @@ -25,12 +25,12 @@ namespace Lumina.Presentation.Web.Core.Endpoints.Library.WrittenContentLibrary.B /// public class BooksIndexViewEndpoint : BaseEndpoint { - // the resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it + // The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it // with the configured ResourcesPath, so "Lumina.Presentation.Web.Views.X" resolves to the embedded - // "Lumina.Presentation.Web.Core.Resources.Views.X" resource; including "Core" here would insert it twice + // "Lumina.Presentation.Web.Core.Resources.Views.X" resource; including "Core" here would insert it twice. private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Library.WrittenContentLibrary.BookLibrary.Books.Index"; private const string VIEW_RESOURCE_LOCATION = "Lumina.Presentation.Web"; - // the page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope + // The page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope. private const string VIEW_PAGE_KEY = "library/written-content-library/book-library/books/index"; private readonly IApiHttpClient _apiHttpClient; diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Themes/ThemeAssets/ThemeAssetsEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Themes/ThemeAssets/ThemeAssetsEndpoint.cs index 455c2314..889a7232 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Themes/ThemeAssets/ThemeAssetsEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Themes/ThemeAssets/ThemeAssetsEndpoint.cs @@ -51,7 +51,7 @@ public class ThemeAssetsEndpoint : BaseEndpoint if (string.IsNullOrWhiteSpace(request.ThemeId) || string.IsNullOrWhiteSpace(request.Path)) return Results.Problem(statusCode: StatusCodes.Status400BadRequest, detail: "The theme id and the asset path are required."); - // the API route token is a catch-all ("{*assetPath}"), so the replace target must include the star to match it + // The API route token is a catch-all ("{*assetPath}"), so the replace target must include the star to match it. BlobDataDto blob = await _apiHttpClient.GetBlobAsync( ApiRoutes.Themes.GET_THEME_ASSET.Replace("{themeId}", request.ThemeId).Replace("{*assetPath}", request.Path), cancellationToken).ConfigureAwait(false); return Results.File(blob.Data, blob.ContentType); diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Language/SetLanguage/SetLanguageEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Language/SetLanguage/SetLanguageEndpoint.cs index 744af3c0..62d3cba0 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Language/SetLanguage/SetLanguageEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Language/SetLanguage/SetLanguageEndpoint.cs @@ -38,7 +38,7 @@ public class SetLanguageEndpoint : BaseEndpoint /// Cancellation token that can be used to stop the execution. public override async Task ExecuteAsync(SetLanguageRequest request, CancellationToken cancellationToken) { - // store the culture preference in a cookie + // Store the culture preference in a cookie. HttpContext.Response.Cookies.Append( CookieRequestCultureProvider.DefaultCookieName, CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(request.NewCulture!)), @@ -50,25 +50,25 @@ public class SetLanguageEndpoint : BaseEndpoint Path = "/" // ensure the cookie works across all paths } ); - // determine the URL to return to, defaulting to the localized home page when no return URL is supplied + // Determine the URL to return to, defaulting to the localized home page when no return URL is supplied. string newCulture = request.NewCulture!; string returnUrl = string.IsNullOrEmpty(request.ReturnUrl) ? $"/{newCulture.ToLower()}" : request.ReturnUrl; string currentCulture = Culture; - // handle the base path, so that the culture replacement matches the URL + // Handle the base path, so that the culture replacement matches the URL. if (!string.IsNullOrEmpty(HttpContext.Request.PathBase)) returnUrl = returnUrl.Replace(HttpContext.Request.PathBase.Value!, string.Empty, StringComparison.OrdinalIgnoreCase); - // replace the current culture segment of the URL with the new one, whether or not a trailing slash is present + // Replace the current culture segment of the URL with the new one, whether or not a trailing slash is present. string currentCultureSegment = $"/{currentCulture.ToLower()}"; string newCultureSegment = $"/{newCulture.ToLower()}"; if (returnUrl.StartsWith(currentCultureSegment, StringComparison.OrdinalIgnoreCase)) returnUrl = newCultureSegment + returnUrl[currentCultureSegment.Length..]; - // re-apply the base path if present + // Re-apply the base path if present. if (!string.IsNullOrEmpty(HttpContext.Request.PathBase)) returnUrl = HttpContext.Request.PathBase.Value + returnUrl; - // redirect to the target page + // Redirect to the target page. return Results.LocalRedirect(returnUrl); } } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpoint.cs index 4e899751..bab52a28 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetUserSettings/GetUserSettingsEndpoint.cs @@ -55,7 +55,7 @@ public class GetUserSettingsEndpoint : BaseEndpoint { UserSettingsDto response = await _apiHttpClient.GetAsync(ApiRoutes.Users.GET_USER_SETTINGS, cancellationToken).ConfigureAwait(false); - // refresh the per-user theme cache preference from the stored settings, so the handler always applies the latest value + // Refresh the per-user theme cache preference from the stored settings, so the handler always applies the latest value. Guid? userId = GetCurrentUserId(); if (userId is not null) await _themeCachePreferenceService.SetAsync(userId.Value, response.IsThemeCachingEnabled, cancellationToken).ConfigureAwait(false); diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpoint.cs index 82530e78..1dd83b01 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdateUserSettings/UpdateUserSettingsEndpoint.cs @@ -56,7 +56,7 @@ public class UpdateUserSettingsEndpoint : BaseEndpoint { await _apiHttpClient.PutAsync(ApiRoutes.Users.UPDATE_USER_SETTINGS, request, cancellationToken).ConfigureAwait(false); - // keep the per-user theme cache preference in sync with the stored settings, so the handler applies it immediately + // Keep the per-user theme cache preference in sync with the stored settings, so the handler applies it immediately. Guid? userId = GetCurrentUserId(); if (userId is not null) await _themeCachePreferenceService.SetAsync(userId.Value, request.IsThemeCachingEnabled, cancellationToken).ConfigureAwait(false); diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/ChangePassword/ChangePasswordEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/ChangePassword/ChangePasswordEndpoint.cs index 2e26cf91..ee14eaed 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/ChangePassword/ChangePasswordEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/ChangePassword/ChangePasswordEndpoint.cs @@ -49,7 +49,7 @@ public class ChangePasswordEndpoint : BaseEndpointCancellation token that can be used to stop the execution. public override async Task ExecuteAsync(ChangePasswordRequest request, CancellationToken cancellationToken) { - // assign the currently logged in user as the user for which to change the password + // Assign the currently logged in user as the user for which to change the password. ChangePasswordRequest changePasswordRequest = request with { Username = User?.Identity?.Name }; ChangePasswordResponse response = await _apiHttpClient.PostAsync(ApiRoutes.Authentication.CHANGE_PASSWORD, changePasswordRequest, cancellationToken).ConfigureAwait(false); return JsonSuccess(response); diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpoint.cs index 936620e7..404582fc 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginEndpoint.cs @@ -67,9 +67,9 @@ public class LoginEndpoint : BaseEndpoint { try { - // attempt API login + // Attempt API login. LoginResponse response = await _apiHttpClient.PostAsync(ApiRoutes.Authentication.LOGIN_ACCOUNT, request, cancellationToken).ConfigureAwait(false); - // store the received token in a secure cookie + // Store the received token in a secure cookie. HttpContext.Response.Cookies.Delete("Token"); HttpContext.Response.Cookies.Append("Token", _cryptographyService.Encrypt(response.Token!), new CookieOptions { @@ -80,7 +80,7 @@ public class LoginEndpoint : BaseEndpoint IsEssential = true, SameSite = SameSiteMode.Strict }); - // tell asp.net we are logged in + // Tell ASP.NET we are logged in. List claims = [ new Claim(ClaimTypes.Name, response.Username!), @@ -89,34 +89,34 @@ public class LoginEndpoint : BaseEndpoint ]; ClaimsIdentity claimsIdentity = new(claims, CookieAuthenticationDefaults.AuthenticationScheme); await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(claimsIdentity)).ConfigureAwait(false); - // get current culture from route data or use default if not set + // Get current culture from route data or use default if not set. string currentCulture = Culture; - // handle ReturnUrl and ensure it includes the correct culture + // Handle ReturnUrl and ensure it includes the correct culture. string redirectUrl; if (!string.IsNullOrEmpty(request.ReturnUrl) && IsLocalUrl(request.ReturnUrl)) // ensure that return URL contains the correct culture redirectUrl = request.ReturnUrl.StartsWith($"/{currentCulture}/") ? request.ReturnUrl : $"/{currentCulture}{request.ReturnUrl}"; else { - // if no ReturnUrl is provided or it's invalid, use a default URL with respect to base paths + // If no ReturnUrl is provided or it's invalid, use a default URL with respect to base paths. redirectUrl = "/"; - // handle reverse proxy scenarios by respecting any base path or forwarded headers + // Handle reverse proxy scenarios by respecting any base path or forwarded headers. if (HttpContext.Request.Headers.TryGetValue("X-Forwarded-Prefix", out Microsoft.Extensions.Primitives.StringValues pathBase)) redirectUrl = pathBase + redirectUrl; - // ensure that default redirect contains the correct culture + // Ensure that default redirect contains the correct culture. if (!redirectUrl.StartsWith($"/{currentCulture}/")) redirectUrl = $"/{currentCulture}{redirectUrl}"; } - // return success status and redirect URL + // Return success status and redirect URL. return JsonSuccess(redirectUrl); } catch (ApiException apiException) { - // in this particular case, we DO NOT want to let the exception handling middleware take care of this exception, because when the user has 2FA enabled, the first auth step involves sending + // In this particular case, we DO NOT want to let the exception handling middleware take care of this exception, because when the user has 2FA enabled, the first auth step involves sending // only the username and password, in which case the server API will respond with a validation error, that TOTP code is not valid (empty); it is then that we catch this error here - // and display the form that asks the user for the TOTP code + // and display the form that asks the user for the TOTP code. if (apiException.ProblemDetails is not null && apiException.ProblemDetails.Extensions?.Count > 0 && apiException.ProblemDetails.Extensions.TryGetValue("errors", out JsonElement errorsObj)) if (errorsObj is JsonElement jsonElement && jsonElement.ValueKind == JsonValueKind.Object) foreach (JsonProperty error in jsonElement.EnumerateObject()) diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpoint.cs index 4a758ef8..dcb51bd0 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Login/LoginViewEndpoint.cs @@ -54,10 +54,10 @@ public class LoginViewEndpoint : BaseEndpoint public override Task ExecuteAsync(LoginViewRequest request, CancellationToken cancellationToken) { Dictionary viewData = new() { ["ReturnUrl"] = request.ReturnUrl }; - // if the user is already logged in, redirect them to the home page + // If the user is already logged in, redirect them to the home page. if (User?.Identity?.IsAuthenticated == true) return Task.FromResult(Results.Redirect(_urlService.GetAbsoluteUrl(WebRoutes.Home.INDEX_CULTURED)!)); - // check if the application is initialized (does contain at least the super user account); if it's not, redirect to registration view + // Check if the application is initialized (does contain at least the super user account); if it's not, redirect to registration view. string? isPendingSuperAdminSetup = HttpContext.Session.GetString(HttpContextItemKeys.PENDING_SUPER_ADMIN_SETUP); if (isPendingSuperAdminSetup == "true") return Task.FromResult(Results.Redirect(_urlService.GetAbsoluteUrl(WebRoutes.Authentication.REGISTER_VIEW)!)); diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Logout/LogoutEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Logout/LogoutEndpoint.cs index b6dae3b9..09d735c8 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Logout/LogoutEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Logout/LogoutEndpoint.cs @@ -48,7 +48,7 @@ public class LogoutEndpoint : BaseEndpoint /// Cancellation token that can be used to stop the execution. public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken) { - // if the user is not logged in, redirect them to the home page + // If the user is not logged in, redirect them to the home page. if (User?.Identity?.IsAuthenticated == false) return Results.Redirect(_urlService.GetAbsoluteUrl(WebRoutes.Home.INDEX_CULTURED)!); HttpContext.Response.Cookies.Delete("Token"); diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/RecoverPassword/RecoverPasswordViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/RecoverPassword/RecoverPasswordViewEndpoint.cs index cf3a319a..8efd51b9 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/RecoverPassword/RecoverPasswordViewEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/RecoverPassword/RecoverPasswordViewEndpoint.cs @@ -50,7 +50,7 @@ public class RecoverPasswordViewEndpoint : BaseEndpoint /// Cancellation token that can be used to stop the execution. public override Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken) { - // if the user is already logged in, redirect them to the home page + // If the user is already logged in, redirect them to the home page. if (User?.Identity?.IsAuthenticated == true) return Task.FromResult(Results.Redirect(_urlService.GetAbsoluteUrl(WebRoutes.Home.INDEX_CULTURED)!)); RecoverPasswordRequest recoverPasswordRequest = new(Username: null, TotpCode: null); diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Register/RegisterEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Register/RegisterEndpoint.cs index 7c7244ca..c7e52761 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Register/RegisterEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Register/RegisterEndpoint.cs @@ -50,9 +50,9 @@ public class RegisterEndpoint : BaseEndpoint /// Cancellation token that can be used to stop the execution. public override async Task ExecuteAsync(RegisterRequest request, CancellationToken cancellationToken) { - // call different endpoints based on the view hidden field - registration for normal users, or initial application admin account setup + // Call different endpoints based on the view hidden field - registration for normal users, or initial application admin account setup. string endpoint = request.RegistrationType == "Admin" ? ApiRoutes.Initialization.SETUP_APPLICATION : ApiRoutes.Authentication.REGISTER_ACCOUNT; - // attempt API registration + // Attempt API registration. RegisterResponse response = await _apiHttpClient.PostAsync(endpoint, request, cancellationToken).ConfigureAwait(false); return JsonSuccess(response); } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Register/RegisterViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Register/RegisterViewEndpoint.cs index 3dd37c77..34b0766f 100644 --- a/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Register/RegisterViewEndpoint.cs +++ b/src/Lumina.Presentation.Web/Core/Endpoints/UsersManagement/Authentication/Register/RegisterViewEndpoint.cs @@ -40,7 +40,7 @@ public class RegisterViewEndpoint : BaseEndpoint /// Cancellation token that can be used to stop the execution. public override Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken) { - // check if this is the initial super admin setup + // Check if this is the initial super admin setup. string? isPendingSuperAdminSetup = HttpContext.Session.GetString(HttpContextItemKeys.PENDING_SUPER_ADMIN_SETUP); string registrationType = isPendingSuperAdminSetup == "true" ? "Admin" : "User"; Dictionary viewData = new() { ["RegistrationType"] = registrationType }; From 9d82f283e4831294a56fe86e96a499b83d1651c6 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:26:14 +0300 Subject: [PATCH 06/19] Extends the music library listings with covers, sorting and alpha filtering. --- .../audio-library/music-library/Api.Albums.md | 664 +++++++++++-- .../music-library/Api.Artists.md | 929 +++++++++++++++--- .../audio-library/music-library/Api.Tracks.md | 40 +- .../music-library/artists/GetArtistsLite.http | 2 +- .../MusicLibrary/Albums/AlbumLiteRow.cs | 17 + .../MusicLibrary/Artists/ArtistLiteRow.cs | 5 + .../MusicLibrary/Tracks/TrackLiteRow.cs | 5 + .../MusicLibrary/Albums/AlbumEntityMapping.cs | 8 +- .../Albums/AlbumLiteRowMapping.cs | 5 +- .../Artists/ArtistEntityMapping.cs | 6 +- .../Artists/ArtistLiteRowMapping.cs | 3 +- .../Artists/GetArtistsLiteRequestMapping.cs | 6 +- .../Tracks/TrackLiteRowMapping.cs | 3 +- .../Queries/GetAlbum/GetAlbumQueryHandler.cs | 21 +- .../GetArtist/GetArtistQueryHandler.cs | 14 +- .../GetArtistsLite/GetArtistsLiteQuery.cs | 11 +- .../GetArtistsLiteQueryHandler.cs | 8 +- .../GetArtistsLiteQueryValidator.cs | 10 + .../DTO/Common/MediaArtworkDto.cs | 19 + .../Artists/GetArtistsLiteRequest.cs | 15 +- .../MusicLibrary/Albums/AlbumLiteResponse.cs | 10 +- .../MusicLibrary/Albums/AlbumResponse.cs | 7 +- .../Artists/ArtistLiteResponse.cs | 4 +- .../MusicLibrary/Artists/ArtistResponse.cs | 4 +- .../MusicLibrary/Tracks/TrackLiteResponse.cs | 4 +- .../MusicLibrary/AlbumRepository.cs | 10 +- .../MusicLibrary/ArtistRepository.cs | 85 +- .../ArtistAlphaFilterSpecification.cs | 127 +++ .../MusicLibrary/TrackRepository.cs | 7 +- .../AddAlbum/AddAlbumEndpointSummary.cs | 2 + .../UpdateAlbum/UpdateAlbumEndpointSummary.cs | 2 + .../AddArtist/AddArtistEndpointSummary.cs | 3 + .../GetArtist/GetArtistEndpointSummary.cs | 1 + .../GetArtistAlbumsEndpointSummary.cs | 2 + .../GetArtistAlbumsLiteEndpointSummary.cs | 3 + .../GetArtists/GetArtistsEndpointSummary.cs | 1 + .../GetArtistsLiteEndpointSummary.cs | 3 +- .../UpdateArtistEndpointSummary.cs | 3 + .../Albums/AlbumLiteRowFixture.cs | 23 +- .../Artists/ArtistLiteRowFixture.cs | 9 +- .../Tracks/TrackLiteRowFixture.cs | 7 +- .../GetArtistsLiteQueryFixture.cs | 15 +- .../Core/DTO/Common/MediaArtworkDtoFixture.cs | 47 + .../Artists/GetArtistsLiteRequestFixture.cs | 34 +- .../Albums/AlbumLiteResponseFixture.cs | 24 +- .../Albums/AlbumResponseFixture.cs | 21 +- .../Artists/ArtistLiteResponseFixture.cs | 9 +- .../Artists/ArtistResponseFixture.cs | 9 +- .../Tracks/TrackLiteResponseFixture.cs | 7 +- .../MusicLibrary/AlbumRepositoryTests.cs | 108 ++ .../MusicLibrary/ArtistRepositoryTests.cs | 253 +++++ .../ArtistAlphaFilterSpecificationTests.cs | 235 +++++ .../MusicLibrary/TrackRepositoryTests.cs | 84 +- .../GetAlbumTracksLiteEndpointTests.cs | 1 + .../GetArtistAlbumsLiteEndpointTests.cs | 6 +- .../GetArtistsLiteEndpointTests.cs | 149 +++ .../Albums/AlbumEntityMappingTests.cs | 17 + .../Albums/AlbumLiteRowMappingTests.cs | 6 + .../Artists/ArtistEntityMappingTests.cs | 17 + .../Artists/ArtistLiteRowMappingTests.cs | 2 + .../GetArtistsLiteRequestMappingTests.cs | 21 + .../Tracks/TrackLiteRowMappingTests.cs | 1 + .../GetAlbum/GetAlbumQueryHandlerTests.cs | 133 ++- .../GetArtist/GetArtistQueryHandlerTests.cs | 104 +- .../GetArtistsLiteQueryHandlerTests.cs | 37 + .../GetArtistsLiteQueryValidatorTests.cs | 152 +++ .../MusicLibrary/AlbumRepositoryTests.cs | 107 ++ .../MusicLibrary/ArtistRepositoryTests.cs | 109 ++ .../MusicLibrary/TrackRepositoryTests.cs | 65 +- 69 files changed, 3613 insertions(+), 268 deletions(-) create mode 100644 src/Lumina.Contracts/DTO/Common/MediaArtworkDto.cs create mode 100644 src/Lumina.DataAccess/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecification.cs create mode 100644 tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/MediaArtworkDtoFixture.cs create mode 100644 tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecificationTests.cs diff --git a/docs/technical/api/library/audio-library/music-library/Api.Albums.md b/docs/technical/api/library/audio-library/music-library/Api.Albums.md index 21459643..cbe5d852 100644 --- a/docs/technical/api/library/audio-library/music-library/Api.Albums.md +++ b/docs/technical/api/library/audio-library/music-library/Api.Albums.md @@ -17,6 +17,9 @@ - [Update Album](#update-album) - [Update Album Request](#update-album-request) - [Update Album Response](#update-album-response) + - [Update Album Cover](#update-album-cover) + - [Update Album Cover Request](#update-album-cover-request) + - [Update Album Cover Response](#update-album-cover-response) - [Delete Album](#delete-album) - [Get Album Tracks](#get-album-tracks) - [Get Album Tracks Request](#get-album-tracks-request) @@ -41,12 +44,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "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": null, + "disambiguation": "original release", "releaseInfo": { "originalReleaseDate": "1975-11-21", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Remastered" }, @@ -109,12 +112,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "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": null, + "disambiguation": "album version", "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, @@ -161,7 +164,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", @@ -197,12 +200,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "title": "You're My Best Friend", "originalTitle": "You're My Best Friend", "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", - "disambiguation": null, + "disambiguation": "album version", "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, @@ -231,11 +234,11 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "bitDepth": 16, "audioCodec": "FLAC", "bitrate": 912, - "acoustId": null, - "replayGainTrackGain": null, - "replayGainTrackPeak": null, - "replayGainAlbumGain": null, - "replayGainAlbumPeak": null + "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", + "replayGainTrackGain": -7.2, + "replayGainTrackPeak": 0.9812, + "replayGainAlbumGain": -6.5, + "replayGainAlbumPeak": 0.9987 }, "trackNumber": 7, "discNumber": 1, @@ -249,7 +252,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f", "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", @@ -298,12 +301,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "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": null, + "disambiguation": "original release", "releaseInfo": { "originalReleaseDate": "1975-11-21", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Remastered" }, @@ -342,7 +345,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e", "musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "contributors": [ { "contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b", @@ -377,8 +380,8 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "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": null, - "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" }, + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "tags": [ { "name": "classic" }, { "name": "epic" } ], @@ -408,12 +411,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "moods": [ { "name": "dramatic" }, { "name": "anxious" } @@ -455,8 +458,8 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "title": "You're My Best Friend", "originalTitle": "You're My Best Friend", "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", - "disambiguation": null, - "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" }, + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "tags": [ { "name": "classic" }, { "name": "love" } ], @@ -468,11 +471,11 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "bitDepth": 16, "audioCodec": "FLAC", "bitrate": 912, - "acoustId": null, - "replayGainTrackGain": null, - "replayGainTrackPeak": null, - "replayGainAlbumGain": null, - "replayGainAlbumPeak": null + "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", + "replayGainTrackGain": -7.2, + "replayGainTrackPeak": 0.9812, + "replayGainAlbumGain": -6.5, + "replayGainAlbumPeak": 0.9987 }, "trackNumber": 7, "discNumber": 1, @@ -486,12 +489,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f", "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "moods": [ { "name": "happy" }, { "name": "warm" } @@ -524,6 +527,14 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b } ] } + ], + "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg", + "artwork": [ + { + "type": "Cover", + "ordinal": 0, + "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg" + } ] } ``` @@ -553,12 +564,12 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "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": null, + "disambiguation": "original release", "releaseInfo": { "originalReleaseDate": "1975-11-21", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Remastered" }, @@ -597,7 +608,7 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e", "musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "contributors": [ { "contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b", @@ -622,7 +633,172 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "voteCount": 1234 } ], - "tracks": [] + "tracks": [ + { + "id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f", + "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "path": "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac", + "metadata": { + "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": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, + "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "tags": [ { "name": "classic" }, { "name": "epic" } ], + "genres": [ { "name": "Rock" }, { "name": "Progressive Rock" } ], + "isVideo": false, + "durationInSeconds": 354, + "sampleRate": 44100, + "channels": 2, + "bitDepth": 16, + "audioCodec": "FLAC", + "bitrate": 980, + "acoustId": "f0e1d2c3-b4a5-4c6d-8e7f-9a0b1c2d3e4f", + "replayGainTrackGain": -7.5, + "replayGainTrackPeak": 0.9877, + "replayGainAlbumGain": -6.8, + "replayGainAlbumPeak": 0.9999 + }, + "trackNumber": 1, + "discNumber": 1, + "script": "Latn", + "key": "CMajor", + "bpm": 72, + "work": { + "musicBrainzWorkId": "f6a7b8c9-d0e1-4f2a-3b4c-5d6e7f8a9b0c", + "title": "Bohemian Rhapsody", + "type": "Song", + "languages": [ + { "languageCode": "en", "languageName": "English", "nativeName": "English" } + ], + "iswcs": ["T-010489707-6"] + }, + "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", + "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "moods": [ + { "name": "dramatic" }, + { "name": "anxious" } + ], + "isrcs": [ + { "value": "GBUM71029604" } + ], + "contributors": [ + { + "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", + "role": "Vocals" + }, + { + "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", + "role": "Guitar" + } + ], + "ratings": [ + { + "value": 4.5, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 2345 + }, + { + "value": 4.8, + "maxValue": 5, + "source": "LastFm", + "voteCount": 1234 + } + ] + }, + { + "id": "8e1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b", + "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "path": "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac", + "metadata": { + "title": "You're My Best Friend", + "originalTitle": "You're My Best Friend", + "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, + "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "tags": [ { "name": "classic" }, { "name": "love" } ], + "genres": [ { "name": "Rock" }, { "name": "Pop Rock" } ], + "isVideo": false, + "durationInSeconds": 181, + "sampleRate": 44100, + "channels": 2, + "bitDepth": 16, + "audioCodec": "FLAC", + "bitrate": 912, + "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", + "replayGainTrackGain": -7.2, + "replayGainTrackPeak": 0.9812, + "replayGainAlbumGain": -6.5, + "replayGainAlbumPeak": 0.9987 + }, + "trackNumber": 7, + "discNumber": 1, + "script": "Latn", + "key": "BMajor", + "bpm": 118, + "work": { + "musicBrainzWorkId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e", + "title": "You're My Best Friend", + "type": "Song", + "languages": [ + { "languageCode": "en", "languageName": "English", "nativeName": "English" } + ], + "iswcs": ["T-010489707-6"] + }, + "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f", + "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "moods": [ + { "name": "happy" }, + { "name": "warm" } + ], + "isrcs": [ + { "value": "GBUM71029609" } + ], + "contributors": [ + { + "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", + "role": "Vocals" + }, + { + "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", + "role": "Guitar" + } + ], + "ratings": [ + { + "value": 4.2, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 1234 + }, + { + "value": 4.4, + "maxValue": 5, + "source": "LastFm", + "voteCount": 567 + } + ] + } + ], + "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg", + "artwork": [ + { + "type": "Cover", + "ordinal": 0, + "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg" + } + ] } ] ``` @@ -653,7 +829,10 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- { "id": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", "title": "A Night at the Opera", - "totalTracks": 12 + "totalTracks": 12, + "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg", + "releaseYear": 1975, + "releaseTypes": [ "Album" ] } ], "currentPage": 1, @@ -687,12 +866,12 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "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": null, + "disambiguation": "original release", "releaseInfo": { "originalReleaseDate": "1975-11-21", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Remastered" }, @@ -731,7 +910,7 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e", "musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "contributors": [ { "contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b", @@ -756,7 +935,182 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "voteCount": 1234 } ], - "tracks": [] + "tracks": [ + { + "id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f", + "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "path": "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac", + "metadata": { + "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": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, + "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "tags": [ { "name": "classic" }, { "name": "epic" } ], + "genres": [ { "name": "Rock" }, { "name": "Progressive Rock" } ], + "isVideo": false, + "durationInSeconds": 354, + "sampleRate": 44100, + "channels": 2, + "bitDepth": 16, + "audioCodec": "FLAC", + "bitrate": 980, + "acoustId": "f0e1d2c3-b4a5-4c6d-8e7f-9a0b1c2d3e4f", + "replayGainTrackGain": -7.5, + "replayGainTrackPeak": 0.9877, + "replayGainAlbumGain": -6.8, + "replayGainAlbumPeak": 0.9999 + }, + "trackNumber": 1, + "discNumber": 1, + "script": "Latn", + "key": "CMajor", + "bpm": 72, + "work": { + "musicBrainzWorkId": "f6a7b8c9-d0e1-4f2a-3b4c-5d6e7f8a9b0c", + "title": "Bohemian Rhapsody", + "type": "Song", + "languages": [ + { "languageCode": "en", "languageName": "English", "nativeName": "English" } + ], + "iswcs": ["T-010489707-6"] + }, + "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", + "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "moods": [ + { "name": "dramatic" }, + { "name": "anxious" } + ], + "isrcs": [ + { "value": "GBUM71029604" } + ], + "contributors": [ + { + "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", + "role": "Vocals" + }, + { + "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", + "role": "Guitar" + } + ], + "ratings": [ + { + "value": 4.5, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 2345 + }, + { + "value": 4.8, + "maxValue": 5, + "source": "LastFm", + "voteCount": 1234 + } + ] + }, + { + "id": "8e1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b", + "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "path": "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac", + "metadata": { + "title": "You're My Best Friend", + "originalTitle": "You're My Best Friend", + "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, + "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "tags": [ { "name": "classic" }, { "name": "love" } ], + "genres": [ { "name": "Rock" }, { "name": "Pop Rock" } ], + "isVideo": false, + "durationInSeconds": 181, + "sampleRate": 44100, + "channels": 2, + "bitDepth": 16, + "audioCodec": "FLAC", + "bitrate": 912, + "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", + "replayGainTrackGain": -7.2, + "replayGainTrackPeak": 0.9812, + "replayGainAlbumGain": -6.5, + "replayGainAlbumPeak": 0.9987 + }, + "trackNumber": 7, + "discNumber": 1, + "script": "Latn", + "key": "BMajor", + "bpm": 118, + "work": { + "musicBrainzWorkId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e", + "title": "You're My Best Friend", + "type": "Song", + "languages": [ + { "languageCode": "en", "languageName": "English", "nativeName": "English" } + ], + "iswcs": ["T-010489707-6"] + }, + "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f", + "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "moods": [ + { "name": "happy" }, + { "name": "warm" } + ], + "isrcs": [ + { "value": "GBUM71029609" } + ], + "contributors": [ + { + "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", + "role": "Vocals" + }, + { + "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", + "role": "Guitar" + } + ], + "ratings": [ + { + "value": 4.2, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 1234 + }, + { + "value": 4.4, + "maxValue": 5, + "source": "LastFm", + "voteCount": 567 + } + ] + } + ], + "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg", + "artwork": [ + { + "type": "Cover", + "ordinal": 0, + "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg" + }, + { + "type": "Back", + "ordinal": 0, + "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/back.jpg" + }, + { + "type": "Booklet", + "ordinal": 0, + "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/booklet.jpg" + } + ] } ``` @@ -775,12 +1129,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "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": null, + "disambiguation": "original release", "releaseInfo": { "originalReleaseDate": "1975-11-21", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Remastered" }, @@ -854,12 +1208,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "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": null, + "disambiguation": "original release", "releaseInfo": { "originalReleaseDate": "1975-11-21", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Remastered" }, @@ -898,7 +1252,7 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e", "musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "contributors": [ { "contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b", @@ -923,7 +1277,202 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "voteCount": 1234 } ], - "tracks": [] + "tracks": [ + { + "id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f", + "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "path": "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac", + "metadata": { + "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": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, + "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "tags": [ { "name": "classic" }, { "name": "epic" } ], + "genres": [ { "name": "Rock" }, { "name": "Progressive Rock" } ], + "isVideo": false, + "durationInSeconds": 354, + "sampleRate": 44100, + "channels": 2, + "bitDepth": 16, + "audioCodec": "FLAC", + "bitrate": 980, + "acoustId": "f0e1d2c3-b4a5-4c6d-8e7f-9a0b1c2d3e4f", + "replayGainTrackGain": -7.5, + "replayGainTrackPeak": 0.9877, + "replayGainAlbumGain": -6.8, + "replayGainAlbumPeak": 0.9999 + }, + "trackNumber": 1, + "discNumber": 1, + "script": "Latn", + "key": "CMajor", + "bpm": 72, + "work": { + "musicBrainzWorkId": "f6a7b8c9-d0e1-4f2a-3b4c-5d6e7f8a9b0c", + "title": "Bohemian Rhapsody", + "type": "Song", + "languages": [ + { "languageCode": "en", "languageName": "English", "nativeName": "English" } + ], + "iswcs": ["T-010489707-6"] + }, + "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", + "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "moods": [ + { "name": "dramatic" }, + { "name": "anxious" } + ], + "isrcs": [ + { "value": "GBUM71029604" } + ], + "contributors": [ + { + "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", + "role": "Vocals" + }, + { + "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", + "role": "Guitar" + } + ], + "ratings": [ + { + "value": 4.5, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 2345 + }, + { + "value": 4.8, + "maxValue": 5, + "source": "LastFm", + "voteCount": 1234 + } + ] + }, + { + "id": "8e1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b", + "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "path": "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac", + "metadata": { + "title": "You're My Best Friend", + "originalTitle": "You're My Best Friend", + "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, + "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "tags": [ { "name": "classic" }, { "name": "love" } ], + "genres": [ { "name": "Rock" }, { "name": "Pop Rock" } ], + "isVideo": false, + "durationInSeconds": 181, + "sampleRate": 44100, + "channels": 2, + "bitDepth": 16, + "audioCodec": "FLAC", + "bitrate": 912, + "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", + "replayGainTrackGain": -7.2, + "replayGainTrackPeak": 0.9812, + "replayGainAlbumGain": -6.5, + "replayGainAlbumPeak": 0.9987 + }, + "trackNumber": 7, + "discNumber": 1, + "script": "Latn", + "key": "BMajor", + "bpm": 118, + "work": { + "musicBrainzWorkId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e", + "title": "You're My Best Friend", + "type": "Song", + "languages": [ + { "languageCode": "en", "languageName": "English", "nativeName": "English" } + ], + "iswcs": ["T-010489707-6"] + }, + "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f", + "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "moods": [ + { "name": "happy" }, + { "name": "warm" } + ], + "isrcs": [ + { "value": "GBUM71029609" } + ], + "contributors": [ + { + "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", + "role": "Vocals" + }, + { + "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", + "role": "Guitar" + } + ], + "ratings": [ + { + "value": 4.2, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 1234 + }, + { + "value": 4.4, + "maxValue": 5, + "source": "LastFm", + "voteCount": 567 + } + ] + } + ], + "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg", + "artwork": [ + { + "type": "Cover", + "ordinal": 0, + "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg" + } + ] +} +``` + +### Update Album Cover + +Updates the cover image of the album identified by `albumId` with the image uploaded in the multipart form of the request. The album must belong to the artist identified by `artistId` and to the media library identified by `libraryId`, and the uploaded file must be an image. + +#### Update Album Cover Request + +```js +PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-4b1c-9a3e-7f6e5d4c3b2a/albums/{albumId}/cover +Content-Type: multipart/form-data; boundary=LuminaBoundary + +--LuminaBoundary +Content-Disposition: form-data; name="cover"; filename="cover.jpg" +Content-Type: image/jpeg + +< ./cover.jpg +--LuminaBoundary-- +``` + +#### Update Album Cover Response + +```js +200 Ok +``` + +```json +{ + "coverPath": "/media/music/music-3f2504e0-4f89-41d3-9a0c-0305e82c3301/Queen-2b0e5f5a-0b3f-4b7e-8f4a-8c9e3d2f5a6b/A Night at the Opera-7c1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f/cover.jpg" } ``` @@ -966,8 +1515,8 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "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": null, - "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" }, + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "tags": [ { "name": "classic" }, { "name": "epic" } ], @@ -997,12 +1546,12 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "moods": [ { "name": "dramatic" @@ -1071,7 +1620,8 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f", "title": "Bohemian Rhapsody", "trackNumber": 1, - "discNumber": 1 + "discNumber": 1, + "durationInSeconds": 354 } ], "currentPage": 1, diff --git a/docs/technical/api/library/audio-library/music-library/Api.Artists.md b/docs/technical/api/library/audio-library/music-library/Api.Artists.md index 5f37a0bb..3a5fe443 100644 --- a/docs/technical/api/library/audio-library/music-library/Api.Artists.md +++ b/docs/technical/api/library/audio-library/music-library/Api.Artists.md @@ -17,6 +17,9 @@ - [Update Artist](#update-artist) - [Update Artist Request](#update-artist-request) - [Update Artist Response](#update-artist-response) + - [Update Artist Cover](#update-artist-cover) + - [Update Artist Cover Request](#update-artist-cover-request) + - [Update Artist Cover Response](#update-artist-cover-response) - [Delete Artist](#delete-artist) ## Artist @@ -34,22 +37,36 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "metadata": { "name": "Queen", "sortName": "Queen", - "disambiguation": null, + "disambiguation": "British rock band", "type": "Group", - "gender": null, + "gender": "NotApplicable", "country": "GB", "area": { "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", "name": "United Kingdom", "sortName": "United Kingdom", - "disambiguation": null, + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "beginArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "endArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", "type": "Country", "iso3166Code": "GB" }, - "beginArea": null, - "endArea": null, "lifeSpanBegin": "1970-06-27", - "lifeSpanEnd": null, + "lifeSpanEnd": "1991-11-24", "isEnded": false, "genres": [ { "name": "Rock" } @@ -65,15 +82,15 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "locale": "en", "isPrimary": true, "beginDate": "1970-06-27", - "endDate": null, + "endDate": "1991-11-24", "isEnded": false } ] }, "website": "https://www.queenonline.com", "musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d", - "ipis": [], - "isnis": [], + "ipis": ["00012345678"], + "isnis": ["0000000123456789"], "contributors": [ { "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", "role": "Vocals" }, { "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", "role": "Guitar" } @@ -92,12 +109,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "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": null, + "disambiguation": "original release", "releaseInfo": { "originalReleaseDate": "1975-11-21", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Remastered" }, @@ -160,12 +177,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "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": null, + "disambiguation": "album version", "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, @@ -212,7 +229,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", @@ -248,12 +265,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "title": "You're My Best Friend", "originalTitle": "You're My Best Friend", "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", - "disambiguation": null, + "disambiguation": "album version", "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, @@ -282,11 +299,11 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "bitDepth": 16, "audioCodec": "FLAC", "bitrate": 912, - "acoustId": null, - "replayGainTrackGain": null, - "replayGainTrackPeak": null, - "replayGainAlbumGain": null, - "replayGainAlbumPeak": null + "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", + "replayGainTrackGain": -7.2, + "replayGainTrackPeak": 0.9812, + "replayGainAlbumGain": -6.5, + "replayGainAlbumPeak": 0.9987 }, "trackNumber": 7, "discNumber": 1, @@ -300,7 +317,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f", "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", @@ -349,22 +366,36 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "metadata": { "name": "Queen", "sortName": "Queen", - "disambiguation": null, + "disambiguation": "British rock band", "type": "Group", - "gender": null, + "gender": "NotApplicable", "country": "GB", "area": { "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", "name": "United Kingdom", "sortName": "United Kingdom", - "disambiguation": null, + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "beginArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "endArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", "type": "Country", "iso3166Code": "GB" }, - "beginArea": null, - "endArea": null, "lifeSpanBegin": "1970-06-27", - "lifeSpanEnd": null, + "lifeSpanEnd": "1991-11-24", "isEnded": false, "genres": [ { "name": "Rock" } @@ -380,17 +411,17 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "locale": "en", "isPrimary": true, "beginDate": "1970-06-27", - "endDate": null, + "endDate": "1991-11-24", "isEnded": false } ] }, "website": "https://www.queenonline.com", "musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d", - "ipis": [], - "isnis": [], + "ipis": ["00012345678"], + "isnis": ["0000000123456789"], "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "contributors": [ { "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", "role": "Vocals" }, { "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", "role": "Guitar" } @@ -412,12 +443,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "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": null, + "disambiguation": "original release", "releaseInfo": { "originalReleaseDate": "1975-11-21", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Remastered" }, @@ -456,7 +487,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e", "musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "contributors": [ { "contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b", @@ -491,8 +522,8 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "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": null, - "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" }, + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "tags": [ { "name": "classic" }, { "name": "epic" } ], @@ -522,12 +553,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "moods": [ { "name": "dramatic" }, { "name": "anxious" } @@ -569,8 +600,8 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "title": "You're My Best Friend", "originalTitle": "You're My Best Friend", "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", - "disambiguation": null, - "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" }, + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "tags": [ { "name": "classic" }, { "name": "love" } ], @@ -582,11 +613,11 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "bitDepth": 16, "audioCodec": "FLAC", "bitrate": 912, - "acoustId": null, - "replayGainTrackGain": null, - "replayGainTrackPeak": null, - "replayGainAlbumGain": null, - "replayGainAlbumPeak": null + "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", + "replayGainTrackGain": -7.2, + "replayGainTrackPeak": 0.9812, + "replayGainAlbumGain": -6.5, + "replayGainAlbumPeak": 0.9987 }, "trackNumber": 7, "discNumber": 1, @@ -600,12 +631,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f", "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "moods": [ { "name": "happy" }, { "name": "warm" } @@ -638,9 +669,18 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists } ] } + ], + "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg", + "artwork": [ + { + "type": "Cover", + "ordinal": 0, + "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg" + } ] } - ] + ], + "coverPath": "/media/music/Queen-3b3a19f3/cover.jpg" } ``` @@ -674,29 +714,320 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists?currentPage=1& "metadata": { "name": "Queen", "sortName": "Queen", - "disambiguation": null, + "disambiguation": "British rock band", "type": "Group", - "gender": null, + "gender": "NotApplicable", "country": "GB", - "area": null, - "beginArea": null, - "endArea": null, + "area": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "beginArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "endArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, "lifeSpanBegin": "1970-06-27", - "lifeSpanEnd": null, + "lifeSpanEnd": "1991-11-24", "isEnded": false, - "genres": [], - "tags": [], - "aliases": [] + "genres": [ + { "name": "Rock" } + ], + "tags": [ + { "name": "classic" } + ], + "aliases": [ + { + "name": "The Queen", + "sortName": "Queen", + "type": "Artist name", + "locale": "en", + "isPrimary": false, + "beginDate": "1970-06-27", + "endDate": "1991-11-24", + "isEnded": true + } + ] }, "website": "https://www.queenonline.com", "musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d", - "ipis": [], - "isnis": [], + "ipis": ["00012345678"], + "isnis": ["0000000123456789"], "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, - "contributors": [], - "ratings": [], - "albums": [] + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "contributors": [ + { "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", "role": "Vocals" } + ], + "ratings": [ + { + "value": 4.5, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 2345 + } + ], + "albums": [ + { + "id": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "artistId": "d7c41e6a-9f2b-4b1c-9a3e-7f6e5d4c3b2a", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "metadata": { + "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": { + "originalReleaseDate": "1975-11-21", + "originalReleaseYear": 1975, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, + "releaseCountry": "GB", + "releaseVersion": "Remastered" + }, + "language": { + "languageCode": "en", + "languageName": "English", + "nativeName": "English" + }, + "originalLanguage": { + "languageCode": "en", + "languageName": "English", + "nativeName": "English" + }, + "tags": [ + { "name": "classic" }, + { "name": "vinyl" } + ], + "genres": [ + { "name": "Rock" }, + { "name": "Progressive Rock" } + ], + "script": "Latn", + "releaseTypes": [ "Album" ], + "releaseStatus": "Official", + "totalDiscs": 1, + "totalTracks": 12, + "releaseTitle": "A Night at the Opera" + }, + "mediaFormat": "CD", + "packaging": "JewelCase", + "barcode": "0042282778329", + "catalogNumbers": ["EMC 4008"], + "label": "EMI", + "asin": "B000000000", + "musicBrainzReleaseId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d", + "musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e", + "musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "contributors": [ + { + "contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b", + "role": "Producer" + }, + { + "contributorId": "1a8c5b7d-6a9e-7c0f-db1c-4d5e6f7a8b9c", + "role": "Engineer" + } + ], + "ratings": [ + { + "value": 4.5, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 2345 + }, + { + "value": 4.8, + "maxValue": 5, + "source": "LastFm", + "voteCount": 1234 + } + ], + "tracks": [ + { + "id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f", + "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "path": "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac", + "metadata": { + "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": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, + "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "tags": [ { "name": "classic" }, { "name": "epic" } ], + "genres": [ { "name": "Rock" }, { "name": "Progressive Rock" } ], + "isVideo": false, + "durationInSeconds": 354, + "sampleRate": 44100, + "channels": 2, + "bitDepth": 16, + "audioCodec": "FLAC", + "bitrate": 980, + "acoustId": "f0e1d2c3-b4a5-4c6d-8e7f-9a0b1c2d3e4f", + "replayGainTrackGain": -7.5, + "replayGainTrackPeak": 0.9877, + "replayGainAlbumGain": -6.8, + "replayGainAlbumPeak": 0.9999 + }, + "trackNumber": 1, + "discNumber": 1, + "script": "Latn", + "key": "CMajor", + "bpm": 72, + "work": { + "musicBrainzWorkId": "f6a7b8c9-d0e1-4f2a-3b4c-5d6e7f8a9b0c", + "title": "Bohemian Rhapsody", + "type": "Song", + "languages": [ + { "languageCode": "en", "languageName": "English", "nativeName": "English" } + ], + "iswcs": ["T-010489707-6"] + }, + "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", + "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "moods": [ + { "name": "dramatic" }, + { "name": "anxious" } + ], + "isrcs": [ + { "value": "GBUM71029604" } + ], + "contributors": [ + { + "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", + "role": "Vocals" + }, + { + "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", + "role": "Guitar" + } + ], + "ratings": [ + { + "value": 4.5, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 2345 + }, + { + "value": 4.8, + "maxValue": 5, + "source": "LastFm", + "voteCount": 1234 + } + ] + }, + { + "id": "8e1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b", + "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "path": "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac", + "metadata": { + "title": "You're My Best Friend", + "originalTitle": "You're My Best Friend", + "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, + "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "tags": [ { "name": "classic" }, { "name": "love" } ], + "genres": [ { "name": "Rock" }, { "name": "Pop Rock" } ], + "isVideo": false, + "durationInSeconds": 181, + "sampleRate": 44100, + "channels": 2, + "bitDepth": 16, + "audioCodec": "FLAC", + "bitrate": 912, + "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", + "replayGainTrackGain": -7.2, + "replayGainTrackPeak": 0.9812, + "replayGainAlbumGain": -6.5, + "replayGainAlbumPeak": 0.9987 + }, + "trackNumber": 7, + "discNumber": 1, + "script": "Latn", + "key": "BMajor", + "bpm": 118, + "work": { + "musicBrainzWorkId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e", + "title": "You're My Best Friend", + "type": "Song", + "languages": [ + { "languageCode": "en", "languageName": "English", "nativeName": "English" } + ], + "iswcs": ["T-010489707-6"] + }, + "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f", + "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "moods": [ + { "name": "happy" }, + { "name": "warm" } + ], + "isrcs": [ + { "value": "GBUM71029609" } + ], + "contributors": [ + { + "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", + "role": "Vocals" + }, + { + "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", + "role": "Guitar" + } + ], + "ratings": [ + { + "value": 4.2, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 1234 + }, + { + "value": 4.4, + "maxValue": 5, + "source": "LastFm", + "voteCount": 567 + } + ] + } + ], + "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg", + "artwork": [ + { + "type": "Cover", + "ordinal": 0, + "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg" + } + ] + } + ], + "coverPath": "/media/music/Queen-3b3a19f3/cover.jpg" } ], "currentPage": 1, @@ -712,7 +1043,7 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists?currentPage=1& #### Get Artists Lite Request ```js -GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPage=1&perPage=10&searchTerm=queen +GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPage=1&perPage=10&searchTerm=queen&filterAlphaKey=q&shouldIgnoreThePrefixForAlphaPicker=true&sortBy=name&sortOrder=Ascending ``` | Query Parameter | Type | Description | @@ -720,6 +1051,10 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPa | `currentPage` | `int` | Optional. The page of results to retrieve. | | `perPage` | `int` | Optional. The maximum number of artists to retrieve per page. | | `searchTerm` | `string` | Optional. The search term used to filter the artists by name. | +| `filterAlphaKey` | `string` | Optional. Filters results by the first character of their name. A single ASCII letter (case-insensitive), `#` for names starting with a digit, or `*` for names starting with any other character. | +| `shouldIgnoreThePrefixForAlphaPicker` | `bool` | Whether the leading "The " prefix of a name should be ignored when computing the alpha key. | +| `sortBy` | `string` | Optional. The name of the field by which to sort the results. | +| `sortOrder` | `string` | Optional. The direction in which to sort the results (`Ascending` or `Descending`). | #### Get Artists Lite Response @@ -732,7 +1067,8 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPa "data": [ { "id": "d7c41e6a-9f2b-4b1c-9a3e-7f6e5d4c3b2a", - "name": "Queen" + "name": "Queen", + "coverPath": "/media/music/Queen-3b3a19f3/cover.jpg" } ], "currentPage": 1, @@ -764,22 +1100,36 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "metadata": { "name": "Queen", "sortName": "Queen", - "disambiguation": null, + "disambiguation": "British rock band", "type": "Group", - "gender": null, + "gender": "NotApplicable", "country": "GB", "area": { "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", "name": "United Kingdom", "sortName": "United Kingdom", - "disambiguation": null, + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "beginArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "endArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", "type": "Country", "iso3166Code": "GB" }, - "beginArea": null, - "endArea": null, "lifeSpanBegin": "1970-06-27", - "lifeSpanEnd": null, + "lifeSpanEnd": "1991-11-24", "isEnded": false, "genres": [ { "name": "Rock" } @@ -795,17 +1145,17 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "locale": "en", "isPrimary": true, "beginDate": "1970-06-27", - "endDate": null, + "endDate": "1991-11-24", "isEnded": false } ] }, "website": "https://www.queenonline.com", "musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d", - "ipis": [], - "isnis": [], + "ipis": ["00012345678"], + "isnis": ["0000000123456789"], "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "contributors": [ { "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", "role": "Vocals" }, { "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", "role": "Guitar" } @@ -818,7 +1168,253 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "voteCount": 2345 } ], - "albums": [] + "albums": [ + { + "id": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "artistId": "d7c41e6a-9f2b-4b1c-9a3e-7f6e5d4c3b2a", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "metadata": { + "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": { + "originalReleaseDate": "1975-11-21", + "originalReleaseYear": 1975, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, + "releaseCountry": "GB", + "releaseVersion": "Remastered" + }, + "language": { + "languageCode": "en", + "languageName": "English", + "nativeName": "English" + }, + "originalLanguage": { + "languageCode": "en", + "languageName": "English", + "nativeName": "English" + }, + "tags": [ + { "name": "classic" }, + { "name": "vinyl" } + ], + "genres": [ + { "name": "Rock" }, + { "name": "Progressive Rock" } + ], + "script": "Latn", + "releaseTypes": [ "Album" ], + "releaseStatus": "Official", + "totalDiscs": 1, + "totalTracks": 12, + "releaseTitle": "A Night at the Opera" + }, + "mediaFormat": "CD", + "packaging": "JewelCase", + "barcode": "0042282778329", + "catalogNumbers": ["EMC 4008"], + "label": "EMI", + "asin": "B000000000", + "musicBrainzReleaseId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d", + "musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e", + "musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "contributors": [ + { + "contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b", + "role": "Producer" + }, + { + "contributorId": "1a8c5b7d-6a9e-7c0f-db1c-4d5e6f7a8b9c", + "role": "Engineer" + } + ], + "ratings": [ + { + "value": 4.5, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 2345 + }, + { + "value": 4.8, + "maxValue": 5, + "source": "LastFm", + "voteCount": 1234 + } + ], + "tracks": [ + { + "id": "9f0e1d2c-3b4a-4c6d-8e7f-9a0b1c2d3e4f", + "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "path": "/music/queen/a-night-at-the-opera/01-bohemian-rhapsody.flac", + "metadata": { + "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": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, + "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "tags": [ { "name": "classic" }, { "name": "epic" } ], + "genres": [ { "name": "Rock" }, { "name": "Progressive Rock" } ], + "isVideo": false, + "durationInSeconds": 354, + "sampleRate": 44100, + "channels": 2, + "bitDepth": 16, + "audioCodec": "FLAC", + "bitrate": 980, + "acoustId": "f0e1d2c3-b4a5-4c6d-8e7f-9a0b1c2d3e4f", + "replayGainTrackGain": -7.5, + "replayGainTrackPeak": 0.9877, + "replayGainAlbumGain": -6.8, + "replayGainAlbumPeak": 0.9999 + }, + "trackNumber": 1, + "discNumber": 1, + "script": "Latn", + "key": "CMajor", + "bpm": 72, + "work": { + "musicBrainzWorkId": "f6a7b8c9-d0e1-4f2a-3b4c-5d6e7f8a9b0c", + "title": "Bohemian Rhapsody", + "type": "Song", + "languages": [ + { "languageCode": "en", "languageName": "English", "nativeName": "English" } + ], + "iswcs": ["T-010489707-6"] + }, + "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", + "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "moods": [ + { "name": "dramatic" }, + { "name": "anxious" } + ], + "isrcs": [ + { "value": "GBUM71029604" } + ], + "contributors": [ + { + "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", + "role": "Vocals" + }, + { + "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", + "role": "Guitar" + } + ], + "ratings": [ + { + "value": 4.5, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 2345 + }, + { + "value": 4.8, + "maxValue": 5, + "source": "LastFm", + "voteCount": 1234 + } + ] + }, + { + "id": "8e1f2a3b-4c5d-4e6f-8a9b-0c1d2e3f4a5b", + "albumId": "e8d52f7b-0a3c-4c2d-ab4f-8a7b6c5d4e3f", + "libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a", + "path": "/music/queen/a-night-at-the-opera/07-youre-my-best-friend.flac", + "metadata": { + "title": "You're My Best Friend", + "originalTitle": "You're My Best Friend", + "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, + "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, + "tags": [ { "name": "classic" }, { "name": "love" } ], + "genres": [ { "name": "Rock" }, { "name": "Pop Rock" } ], + "isVideo": false, + "durationInSeconds": 181, + "sampleRate": 44100, + "channels": 2, + "bitDepth": 16, + "audioCodec": "FLAC", + "bitrate": 912, + "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", + "replayGainTrackGain": -7.2, + "replayGainTrackPeak": 0.9812, + "replayGainAlbumGain": -6.5, + "replayGainAlbumPeak": 0.9987 + }, + "trackNumber": 7, + "discNumber": 1, + "script": "Latn", + "key": "BMajor", + "bpm": 118, + "work": { + "musicBrainzWorkId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e", + "title": "You're My Best Friend", + "type": "Song", + "languages": [ + { "languageCode": "en", "languageName": "English", "nativeName": "English" } + ], + "iswcs": ["T-010489707-6"] + }, + "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f", + "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", + "createdOnUtc": "2025-01-01T12:00:00.0000000Z", + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", + "moods": [ + { "name": "happy" }, + { "name": "warm" } + ], + "isrcs": [ + { "value": "GBUM71029609" } + ], + "contributors": [ + { + "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", + "role": "Vocals" + }, + { + "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", + "role": "Guitar" + } + ], + "ratings": [ + { + "value": 4.2, + "maxValue": 5, + "source": "MusicBrainz", + "voteCount": 1234 + }, + { + "value": 4.4, + "maxValue": 5, + "source": "LastFm", + "voteCount": 567 + } + ] + } + ], + "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg", + "artwork": [ + { + "type": "Cover", + "ordinal": 0, + "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg" + } + ] + } + ], + "coverPath": "/media/music/Queen-3b3a19f3/cover.jpg" } ``` @@ -836,22 +1432,36 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "metadata": { "name": "Queen", "sortName": "Queen", - "disambiguation": null, + "disambiguation": "British rock band", "type": "Group", - "gender": null, + "gender": "NotApplicable", "country": "GB", "area": { "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", "name": "United Kingdom", "sortName": "United Kingdom", - "disambiguation": null, + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "beginArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "endArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", "type": "Country", "iso3166Code": "GB" }, - "beginArea": null, - "endArea": null, "lifeSpanBegin": "1970-06-27", - "lifeSpanEnd": null, + "lifeSpanEnd": "1991-11-24", "isEnded": false, "genres": [ { "name": "Rock" } @@ -867,15 +1477,15 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "locale": "en", "isPrimary": true, "beginDate": "1970-06-27", - "endDate": null, + "endDate": "1991-11-24", "isEnded": false } ] }, "website": "https://www.queenonline.com", "musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d", - "ipis": [], - "isnis": [], + "ipis": ["00012345678"], + "isnis": ["0000000123456789"], "contributors": [ { "contributorId": "6a3f0c2d-1b4e-4f5a-8c6d-9e0f1a2b3c4d", "role": "Vocals" }, { "contributorId": "7b4e1d3f-2c5a-4e6b-9d7e-0f1a2b3c4d5e", "role": "Guitar" } @@ -895,12 +1505,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "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": null, + "disambiguation": "original release", "releaseInfo": { "originalReleaseDate": "1975-11-21", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Remastered" }, @@ -964,12 +1574,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "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": null, + "disambiguation": "album version", "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, @@ -1016,7 +1626,7 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", @@ -1053,12 +1663,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "title": "You're My Best Friend", "originalTitle": "You're My Best Friend", "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", - "disambiguation": null, + "disambiguation": "album version", "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, @@ -1087,11 +1697,11 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "bitDepth": 16, "audioCodec": "FLAC", "bitrate": 912, - "acoustId": null, - "replayGainTrackGain": null, - "replayGainTrackPeak": null, - "replayGainAlbumGain": null, - "replayGainAlbumPeak": null + "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", + "replayGainTrackGain": -7.2, + "replayGainTrackPeak": 0.9812, + "replayGainAlbumGain": -6.5, + "replayGainAlbumPeak": 0.9987 }, "trackNumber": 7, "discNumber": 1, @@ -1105,7 +1715,7 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f", "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", @@ -1154,22 +1764,36 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "metadata": { "name": "Queen", "sortName": "Queen", - "disambiguation": null, + "disambiguation": "British rock band", "type": "Group", - "gender": null, + "gender": "NotApplicable", "country": "GB", "area": { "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", "name": "United Kingdom", "sortName": "United Kingdom", - "disambiguation": null, + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "beginArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", + "type": "Country", + "iso3166Code": "GB" + }, + "endArea": { + "musicBrainzAreaId": "7f2a1b3c-4d5e-4f6a-8b9c-0d1e2f3a4b5c", + "name": "United Kingdom", + "sortName": "United Kingdom", + "disambiguation": "sovereign state", "type": "Country", "iso3166Code": "GB" }, - "beginArea": null, - "endArea": null, "lifeSpanBegin": "1970-06-27", - "lifeSpanEnd": null, + "lifeSpanEnd": "1991-11-24", "isEnded": false, "genres": [ { "name": "Rock" } @@ -1185,15 +1809,15 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "locale": "en", "isPrimary": true, "beginDate": "1970-06-27", - "endDate": null, + "endDate": "1991-11-24", "isEnded": false } ] }, "website": "https://www.queenonline.com", "musicBrainzArtistId": "6f9c0b2a-1d3e-4a5b-8c7d-9e0f1a2b3c4d", - "ipis": [], - "isnis": [], + "ipis": ["00012345678"], + "isnis": ["0000000123456789"], "createdOnUtc": "2025-01-01T12:00:00.0000000Z", "updatedOnUtc": "2025-02-01T12:00:00.0000000Z", "contributors": [ @@ -1217,12 +1841,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "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": null, + "disambiguation": "original release", "releaseInfo": { "originalReleaseDate": "1975-11-21", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Remastered" }, @@ -1261,7 +1885,7 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "musicBrainzReleaseGroupId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e", "musicBrainzReleaseArtistId": "c3d4e5f6-a7b8-4c9d-0e1f-2a3b4c5d6e7f", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "contributors": [ { "contributorId": "0e7b4a6c-5f8d-6b9e-ca0b-3c4d5e6f7a8b", @@ -1296,8 +1920,8 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "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": null, - "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" }, + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "tags": [ { "name": "classic" }, { "name": "epic" } ], @@ -1327,12 +1951,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "moods": [ { "name": "dramatic" }, { "name": "anxious" } @@ -1374,8 +1998,8 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "title": "You're My Best Friend", "originalTitle": "You're My Best Friend", "description": "A song by the British rock band Queen, written by bass guitarist John Deacon. It was originally released on the album A Night at the Opera in 1975 and as a single in 1976.", - "disambiguation": null, - "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" }, + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1976-06-18", "originalReleaseYear": 1976, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "tags": [ { "name": "classic" }, { "name": "love" } ], @@ -1387,11 +2011,11 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "bitDepth": 16, "audioCodec": "FLAC", "bitrate": 912, - "acoustId": null, - "replayGainTrackGain": null, - "replayGainTrackPeak": null, - "replayGainAlbumGain": null, - "replayGainAlbumPeak": null + "acoustId": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", + "replayGainTrackGain": -7.2, + "replayGainTrackPeak": 0.9812, + "replayGainAlbumGain": -6.5, + "replayGainAlbumPeak": 0.9987 }, "trackNumber": 7, "discNumber": 1, @@ -1405,12 +2029,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "0f3e4d5c-6b7a-4f8e-9d0c-1b2a3c4d5e6f", "musicBrainzTrackId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "moods": [ { "name": "happy" }, { "name": "warm" } @@ -1443,9 +2067,48 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId} } ] } + ], + "coverPath": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg", + "artwork": [ + { + "type": "Cover", + "ordinal": 0, + "path": "/media/music/Queen-3b3a19f3/A Night at the Opera-e8d52f7b/cover.jpg" + } ] } - ] + ], + "coverPath": "/media/music/Queen-3b3a19f3/cover.jpg" +} +``` + +### Update Artist Cover + +Updates the cover image of the artist identified by `artistId` with the image uploaded in the multipart form of the request. The artist must belong to the media library identified by `libraryId`, and the uploaded file must be an image. + +#### Update Artist Cover Request + +```js +PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{artistId}/cover +Content-Type: multipart/form-data; boundary=LuminaBoundary + +--LuminaBoundary +Content-Disposition: form-data; name="cover"; filename="cover.jpg" +Content-Type: image/jpeg + +< ./cover.jpg +--LuminaBoundary-- +``` + +#### Update Artist Cover Response + +```js +200 Ok +``` + +```json +{ + "coverPath": "/media/music/music-3f2504e0-4f89-41d3-9a0c-0305e82c3301/Queen-2b0e5f5a-0b3f-4b7e-8f4a-8c9e3d2f5a6b/cover.jpg" } ``` diff --git a/docs/technical/api/library/audio-library/music-library/Api.Tracks.md b/docs/technical/api/library/audio-library/music-library/Api.Tracks.md index bdb6e2d9..4cf0d71c 100644 --- a/docs/technical/api/library/audio-library/music-library/Api.Tracks.md +++ b/docs/technical/api/library/audio-library/music-library/Api.Tracks.md @@ -30,12 +30,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "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": null, + "disambiguation": "album version", "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, @@ -82,7 +82,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", @@ -130,8 +130,8 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "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": null, - "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" }, + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "tags": [ { "name": "classic" }, { "name": "epic" } ], @@ -161,12 +161,12 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "moods": [ { "name": "dramatic" @@ -232,8 +232,8 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "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": null, - "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" }, + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "tags": [ { "name": "classic" }, { "name": "epic" } ], @@ -263,12 +263,12 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "moods": [ { "name": "dramatic" @@ -325,12 +325,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "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": null, + "disambiguation": "album version", "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, - "reReleaseDate": null, - "reReleaseYear": null, + "reReleaseDate": "2011-11-21", + "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, @@ -377,7 +377,7 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", @@ -425,8 +425,8 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "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": null, - "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": null, "reReleaseYear": null, "releaseCountry": "GB", "releaseVersion": "Original" }, + "disambiguation": "album version", + "releaseInfo": { "originalReleaseDate": "1975-10-31", "originalReleaseYear": 1975, "reReleaseDate": "2011-11-21", "reReleaseYear": 2011, "releaseCountry": "GB", "releaseVersion": "Original" }, "language": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "originalLanguage": { "languageCode": "en", "languageName": "English", "nativeName": "English" }, "tags": [ { "name": "classic" }, { "name": "epic" } ], @@ -456,12 +456,12 @@ PUT api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b- "languages": [ { "languageCode": "en", "languageName": "English", "nativeName": "English" } ], - "iswcs": [] + "iswcs": ["T-010489707-6"] }, "musicBrainzRecordingId": "d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a", "musicBrainzTrackId": "e5f6a7b8-c9d0-4e1f-2a3b-4c5d6e7f8a9b", "createdOnUtc": "2025-01-01T12:00:00.0000000Z", - "updatedOnUtc": null, + "updatedOnUtc": "2025-01-20T14:45:00.0000000Z", "moods": [ { "name": "dramatic" diff --git a/docs/technical/requests/library/audio-library/music-library/artists/GetArtistsLite.http b/docs/technical/requests/library/audio-library/music-library/artists/GetArtistsLite.http index c95805e1..679436a5 100644 --- a/docs/technical/requests/library/audio-library/music-library/artists/GetArtistsLite.http +++ b/docs/technical/requests/library/audio-library/music-library/artists/GetArtistsLite.http @@ -1,2 +1,2 @@ -GET {{host}}/api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPage=1&perPage=10&searchTerm=queen +GET {{host}}/api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/lite?currentPage=1&perPage=10&searchTerm=queen&filterAlphaKey=q&shouldIgnoreThePrefixForAlphaPicker=true&sortBy=name&sortOrder=Ascending Authorization: Bearer {{ACCESS_TOKEN}} diff --git a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRow.cs b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRow.cs index 93b67e3a..9a74fa8a 100644 --- a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRow.cs +++ b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRow.cs @@ -1,5 +1,7 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; using System; +using System.Collections.Generic; #endregion namespace Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Albums; @@ -23,4 +25,19 @@ public sealed record AlbumLiteRow /// Gets the number of tracks of the release. /// public int TotalTracks { get; init; } + + /// + /// Gets the path of the image representing the album, if available. + /// + public string? CoverPath { get; init; } + + /// + /// Gets the release year of the album (the re-release year, if available, or the original release year), if known. + /// + public int? ReleaseYear { get; init; } + + /// + /// Gets the set of types of the release. + /// + public List? ReleaseTypes { get; init; } } diff --git a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRow.cs b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRow.cs index 27aae3d4..31970314 100644 --- a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRow.cs +++ b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRow.cs @@ -18,4 +18,9 @@ public sealed record ArtistLiteRow /// Gets the name of the artist. /// public required string Name { get; init; } + + /// + /// Gets the path of the image representing the artist, if available. + /// + public string? CoverPath { get; init; } } diff --git a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRow.cs b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRow.cs index 2b21efcf..33275f1a 100644 --- a/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRow.cs +++ b/src/Lumina.Application/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRow.cs @@ -28,4 +28,9 @@ public sealed record TrackLiteRow /// Gets the number of the disc the track belongs to, if applicable. /// public int? DiscNumber { get; init; } + + /// + /// Gets the duration of the track in seconds. + /// + public int DurationInSeconds { get; init; } } diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMapping.cs index add81757..887dcb2c 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMapping.cs @@ -157,8 +157,10 @@ public static class AlbumEntityMapping /// Converts to . /// /// The repository entity to be converted. + /// The optional path of the image representing the album. + /// The optional stored artwork of the album, in display order. /// The converted response entity. - public static AlbumResponse ToResponse(this AlbumEntity repositoryEntity) + public static AlbumResponse ToResponse(this AlbumEntity repositoryEntity, string? coverPath = null, IReadOnlyList? artwork = null) { ReleaseInfoDto releaseInfo = new( repositoryEntity.OriginalReleaseDate, @@ -220,7 +222,9 @@ public static class AlbumEntityMapping repositoryEntity.UpdatedOnUtc, [.. repositoryEntity.Contributors.Select(contributor => new MediaContributorReferenceDto(contributor.MediaContributorId, contributor.Role))], [.. repositoryEntity.Ratings.ToResponses()], - [.. repositoryEntity.Tracks.Select(track => track.ToResponse())]); + [.. repositoryEntity.Tracks.Select(track => track.ToResponse())], + coverPath, + artwork ?? []); } /// diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMapping.cs index 4d5075a6..4cc0c2b7 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMapping.cs @@ -24,7 +24,10 @@ public static class AlbumLiteRowMapping return new AlbumLiteResponse( readModel.Id, readModel.Title, - readModel.TotalTracks); + readModel.TotalTracks, + readModel.CoverPath, + readModel.ReleaseYear, + readModel.ReleaseTypes); } /// diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMapping.cs index bf1560ba..c77a161e 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMapping.cs @@ -147,8 +147,9 @@ public static class ArtistEntityMapping /// Converts to . /// /// The repository entity to be converted. + /// The optional path of the image representing the artist. /// The converted response entity. - public static ArtistResponse ToResponse(this ArtistEntity repositoryEntity) + public static ArtistResponse ToResponse(this ArtistEntity repositoryEntity, string? coverPath = null) { MusicArtistMetadataDto metadata = new( repositoryEntity.Name, @@ -178,7 +179,8 @@ public static class ArtistEntityMapping repositoryEntity.UpdatedOnUtc, [.. repositoryEntity.Contributors.Select(contributor => new MediaContributorReferenceDto(contributor.MediaContributorId, contributor.Role))], [.. repositoryEntity.Ratings.ToResponses()], - [.. repositoryEntity.Albums.Select(album => album.ToResponse())]); + [.. repositoryEntity.Albums.Select(album => album.ToResponse())], + coverPath); } /// diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMapping.cs index b68bd3a7..d1d6c91a 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMapping.cs @@ -23,7 +23,8 @@ public static class ArtistLiteRowMapping { return new ArtistLiteResponse( readModel.Id, - readModel.Name); + readModel.Name, + readModel.CoverPath); } /// diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMapping.cs index 2eebc351..78957980 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMapping.cs @@ -30,6 +30,10 @@ public static class GetArtistsLiteRequestMapping return new GetArtistsLiteQuery( libraryId, paginationData, - request.SearchTerm); + request.SearchTerm, + request.FilterAlphaKey, + request.ShouldIgnoreThePrefixForAlphaPicker, + request.SortBy, + request.SortOrder); } } diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMapping.cs index a32662b9..cd5b67ca 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMapping.cs @@ -25,7 +25,8 @@ public static class TrackLiteRowMapping readModel.Id, readModel.Title, readModel.TrackNumber, - readModel.DiscNumber); + readModel.DiscNumber, + readModel.DurationInSeconds); } /// diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandler.cs index e0d81c41..7bf9d626 100644 --- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandler.cs @@ -8,11 +8,15 @@ using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwn using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary; using Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.Albums; +using Lumina.Contracts.DTO.Common; using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using System; using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using ApplicationErrors = Lumina.Application.Common.Errors.Errors; @@ -88,6 +92,21 @@ public class GetAlbumQueryHandler : IQueryHandler> getArtworkResult = await _unitOfWork.MusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, cancellationToken).ConfigureAwait(false); + if (getArtworkResult.IsFailure) + return getArtworkResult.Errors; + string? coverPath = getArtworkResult.Value + .Where(artwork => artwork.ArtworkType == ArtworkType.Cover) + .Select(artwork => artwork.FileName) + .FirstOrDefault(); + + // Only the artwork whose file has already been stored can be presented, so the ones that are still pending resolution are left out. + List artwork = [.. getArtworkResult.Value + .Where(storedArtwork => !string.IsNullOrWhiteSpace(storedArtwork.FileName)) + .Select(storedArtwork => new MediaArtworkDto(storedArtwork.ArtworkType, storedArtwork.Ordinal, storedArtwork.FileName!))]; + + return existingAlbum.ToResponse(coverPath, artwork); } } diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandler.cs index 6f712640..b9d0c4f5 100644 --- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandler.cs @@ -11,8 +11,11 @@ using Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.A using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using System; using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using ApplicationErrors = Lumina.Application.Common.Errors.Errors; @@ -87,6 +90,15 @@ public class GetArtistQueryHandler : IQueryHandler> getArtworkResult = await _unitOfWork.MusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Artist, artistId, cancellationToken).ConfigureAwait(false); + if (getArtworkResult.IsFailure) + return getArtworkResult.Errors; + string? coverPath = getArtworkResult.Value + .Where(artwork => artwork.ArtworkType == ArtworkType.Cover) + .Select(artwork => artwork.FileName) + .FirstOrDefault(); + + return existingArtist.ToResponse(coverPath); } } diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQuery.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQuery.cs index 53533ad6..04bc19e2 100644 --- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQuery.cs +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQuery.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using Lumina.Application.Common.CQRS; using Lumina.Application.Common.DTO.Pagination; +using Lumina.Domain.SharedKernel.Common.Enums.Common; using System.Diagnostics; #endregion @@ -12,9 +13,17 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists /// The unique identifier of the media library whose artists are retrieved, taken from the route. /// The object containing the requested pagination data. /// The search term used to filter the artists by name. +/// The alpha key used to filter the artists by the first character of their name. +/// Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not. +/// The name of the field by which to sort the results. +/// The direction in which to sort the results. [DebuggerDisplay("LibraryId: {LibraryId}")] public record GetArtistsLiteQuery( string? LibraryId, PaginationDataDto? PaginationData, - string? SearchTerm + string? SearchTerm, + string? FilterAlphaKey, + bool ShouldIgnoreThePrefixForAlphaPicker, + string? SortBy, + SortOrder? SortOrder ) : IQuery; diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandler.cs index 01a281e2..5915245c 100644 --- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandler.cs @@ -78,12 +78,16 @@ public class GetArtistsLiteQueryHandler : IQueryHandler> getArtistsResult = await _unitOfWork.ArtistRepository.GetAllLiteAsync( query.PaginationData, - filterModel: filter, + query.SortBy, + query.SortOrder, + filter, cancellationToken: cancellationToken).ConfigureAwait(false); return getArtistsResult.Match(value => Result.From(value.ToResponses()), errors => errors); } diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidator.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidator.cs index 3955889e..5825d84a 100644 --- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidator.cs +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidator.cs @@ -1,4 +1,5 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DTO.Filtering; using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Utilities; using Lumina.Domain.Common.Errors; @@ -26,5 +27,14 @@ public class GetArtistsLiteQueryValidator : AbstractValidator Guid.TryParse(libraryId, out Guid parsedLibraryId) && parsedLibraryId != Guid.Empty) .When(query => query.LibraryId is not null && query.LibraryId.Length > 0) .WithError(Errors.Library.LibraryIdCannotBeEmpty); + + // The alpha key must be exactly one of the three picker bucket kinds, so that the filter specification can + // derive the key of a name unambiguously: no filter, a number bucket, a symbol bucket, or a single ASCII letter. + RuleFor(query => query.FilterAlphaKey) + .Must(alphaKey => alphaKey is null + || alphaKey == LibraryItemAlphaKeys.NUMBER + || alphaKey == LibraryItemAlphaKeys.SYMBOL + || (alphaKey.Length == 1 && char.IsAsciiLetter(alphaKey[0]))) + .WithError(Errors.Library.InvalidFilterAlphaKey); } } diff --git a/src/Lumina.Contracts/DTO/Common/MediaArtworkDto.cs b/src/Lumina.Contracts/DTO/Common/MediaArtworkDto.cs new file mode 100644 index 00000000..7edd6862 --- /dev/null +++ b/src/Lumina.Contracts/DTO/Common/MediaArtworkDto.cs @@ -0,0 +1,19 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; +using System.Diagnostics; +#endregion + +namespace Lumina.Contracts.DTO.Common; + +/// +/// Data transfer object for a stored piece of artwork of a media item. +/// +/// The type of the artwork, like the cover or the back of the media item. +/// The ordinal of the artwork within its type, so that multiple artworks of the same type can be ordered. +/// The relative path of the stored artwork file. +[DebuggerDisplay("Type: {Type}, Ordinal: {Ordinal}, Path: {Path}")] +public sealed record MediaArtworkDto( + ArtworkType Type, + int Ordinal, + string Path +); diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequest.cs index c4ff7444..82c4ca82 100644 --- a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequest.cs +++ b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequest.cs @@ -1,4 +1,5 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Domain.SharedKernel.Common.Enums.Common; using System.Diagnostics; #endregion @@ -10,9 +11,21 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artis /// The page of results to retrieve. Optional. /// The maximum number of artists to retrieve per page. Optional. /// The search term used to filter the artists by name. Optional. +/// +/// The alpha key used to filter the results by the first character of their name, for the alpha picker. Optional. +/// Can be to disable alpha filtering, a single ASCII letter (case-insensitive) to filter by that letter, +/// "#" to filter by names whose first character is a digit, or "*" to filter by names whose first character is neither a letter nor a digit. +/// +/// Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not. Optional. +/// The name of the field by which to sort the results. Optional. +/// The direction in which to sort the results. Optional. [DebuggerDisplay("SearchTerm: {SearchTerm}")] public record GetArtistsLiteRequest( int? CurrentPage, int? PerPage, - string? SearchTerm + string? SearchTerm, + string? FilterAlphaKey, + bool ShouldIgnoreThePrefixForAlphaPicker, + string? SortBy, + SortOrder? SortOrder ); diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponse.cs index ac6aa364..87411bb1 100644 --- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponse.cs +++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponse.cs @@ -1,5 +1,7 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; using System; +using System.Collections.Generic; using System.Diagnostics; #endregion @@ -11,9 +13,15 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albu /// The Id of the album. /// The title of the album. /// The number of tracks of the release. +/// The path of the image representing the album, if available. +/// The release year of the album (the re-release year, if available, or the original release year), if known. +/// The set of types of the release. [DebuggerDisplay("Title: {Title}")] public record AlbumLiteResponse( Guid Id, string Title, - int TotalTracks + int TotalTracks, + string? CoverPath, + int? ReleaseYear, + List? ReleaseTypes ); diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs index 84760c8f..cd72e94a 100644 --- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs +++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs @@ -1,4 +1,5 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Contracts.DTO.Common; using Lumina.Contracts.DTO.MediaContributors; using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary; using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary; @@ -32,6 +33,8 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albu /// The list of references to the media contributors that performed on the album, each with the role they played. /// The list of ratings for this album. /// The list of tracks of the album. +/// The path of the image representing the album, if available. +/// The stored artwork of the album, in display order, so that all of its pieces can be presented, not just the cover. [DebuggerDisplay("Title: {Metadata.Title}")] public record AlbumResponse( Guid Id, @@ -51,5 +54,7 @@ public record AlbumResponse( DateTime? UpdatedOnUtc, List? Contributors, List? Ratings, - List? Tracks + List? Tracks, + string? CoverPath, + IReadOnlyList Artwork ); diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponse.cs index aa4b7faf..f5cc8ea7 100644 --- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponse.cs +++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponse.cs @@ -10,8 +10,10 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Arti /// /// The Id of the artist. /// The name of the artist. +/// The path of the image representing the artist, if available. [DebuggerDisplay("Name: {Name}")] public record ArtistLiteResponse( Guid Id, - string Name + string Name, + string? CoverPath ); diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs index ec147700..9a51928c 100644 --- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs +++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs @@ -25,6 +25,7 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Arti /// The list of references to the media contributors that make up the artist, each with the role they played. /// The list of ratings for this artist. /// The list of albums of the artist, each with its own list of tracks. +/// The path of the image representing the artist, if available. [DebuggerDisplay("Name: {Metadata.Name}")] public record ArtistResponse( Guid Id, @@ -38,5 +39,6 @@ public record ArtistResponse( DateTime? UpdatedOnUtc, List? Contributors, List? Ratings, - List? Albums + List? Albums, + string? CoverPath ); diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponse.cs index 263b3669..071776ea 100644 --- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponse.cs +++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponse.cs @@ -12,10 +12,12 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Trac /// The title of the track. /// The number of the track on its disc. /// The number of the disc the track belongs to, if applicable. +/// The duration of the track in seconds. [DebuggerDisplay("Title: {Title}")] public record TrackLiteResponse( Guid Id, string Title, int TrackNumber, - int? DiscNumber + int? DiscNumber, + int DurationInSeconds ); diff --git a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/AlbumRepository.cs b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/AlbumRepository.cs index c0f21bbb..232342f7 100644 --- a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/AlbumRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/AlbumRepository.cs @@ -284,7 +284,15 @@ internal sealed class AlbumRepository : IAlbumRepository { Id = album.Id, Title = album.Title, - TotalTracks = album.TotalTracks + TotalTracks = album.TotalTracks, + // The release year and the release types are exposed so that the clients can group and order the releases of an artist. + ReleaseYear = album.ReReleaseYear ?? album.OriginalReleaseYear, + ReleaseTypes = album.ReleaseTypes.Select(releaseType => releaseType.ReleaseType).ToList(), + // The cover of the album is the cover artwork stored for it, if any, and it is exposed so that the clients can display it without loading the whole album. + CoverPath = _luminaDbContext.MusicArtwork + .Where(artwork => artwork.OwnerType == MusicArtworkOwnerType.Album && artwork.OwnerId == album.Id && artwork.ArtworkType == ArtworkType.Cover) + .Select(artwork => artwork.FileName) + .FirstOrDefault() }); if (paginationData is null) diff --git a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/ArtistRepository.cs b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/ArtistRepository.cs index fea91e76..ff9a8e08 100644 --- a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/ArtistRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/ArtistRepository.cs @@ -18,6 +18,8 @@ using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Expressions; +using System.Reflection; using System.Threading; using System.Threading.Tasks; #endregion @@ -29,6 +31,10 @@ namespace Lumina.DataAccess.Core.Repositories.MusicLibrary; /// internal sealed class ArtistRepository : IArtistRepository { + private static readonly MethodInfo s_toLowerMethod = typeof(string).GetMethod(nameof(string.ToLower), Type.EmptyTypes)!; + private static readonly MethodInfo s_startsWithMethod = typeof(string).GetMethod(nameof(string.StartsWith), [typeof(string)])!; + private static readonly MethodInfo s_substringMethod = typeof(string).GetMethod(nameof(string.Substring), [typeof(int)])!; + private readonly LuminaDbContext _luminaDbContext; private readonly IAlbumRepository _albumRepository; private readonly ITrackRepository _trackRepository; @@ -488,7 +494,7 @@ internal sealed class ArtistRepository : IArtistRepository if (filterSpecification is not null) artistsQuery = artistsQuery.Where(filterSpecification.ToExpression()); - IQueryable orderedArtistsQuery = ApplySorting(artistsQuery, sortBy, sortOrder ?? SortOrder.Ascending); + IQueryable orderedArtistsQuery = ApplySorting(artistsQuery, sortBy, sortOrder ?? SortOrder.Ascending, libraryFilter.ShouldIgnoreThePrefixForAlphaPicker); // If no pagination was requested, return all the artists of the library. if (paginationData is null) @@ -559,11 +565,16 @@ internal sealed class ArtistRepository : IArtistRepository if (filterSpecification is not null) artistsQuery = artistsQuery.Where(filterSpecification.ToExpression()); - IQueryable liteRowsQuery = ApplySorting(artistsQuery, sortBy, sortOrder ?? SortOrder.Ascending) + IQueryable liteRowsQuery = ApplySorting(artistsQuery, sortBy, sortOrder ?? SortOrder.Ascending, libraryFilter.ShouldIgnoreThePrefixForAlphaPicker) .Select(artist => new ArtistLiteRow { Id = artist.Id, - Name = artist.Name + Name = artist.Name, + // The cover of the artist is the cover artwork stored for it, if any, and it is exposed so that the clients can display it without loading the whole artist. + CoverPath = _luminaDbContext.MusicArtwork + .Where(artwork => artwork.OwnerType == MusicArtworkOwnerType.Artist && artwork.OwnerId == artist.Id && artwork.ArtworkType == ArtworkType.Cover) + .Select(artwork => artwork.FileName) + .FirstOrDefault() }); // If no pagination was requested, return all the artists of the library. @@ -607,11 +618,22 @@ internal sealed class ArtistRepository : IArtistRepository /// A filter specification that can be used to query artists matching the provided criteria. private static FilterSpecification? BuildFilterSpecification(LibraryFilterDto libraryFilter) { + FilterSpecification? filterSpecification = null; + // Include the search term filter, if provided. if (!string.IsNullOrWhiteSpace(libraryFilter.SearchTerm)) - return new ArtistSearchSpecification(libraryFilter.SearchTerm); + filterSpecification = new ArtistSearchSpecification(libraryFilter.SearchTerm); - return null; + // Include the alpha key filter, if provided. + if (libraryFilter.FilterAlphaKey is not null) + { + ArtistAlphaFilterSpecification alphaFilterSpecification = new(libraryFilter.FilterAlphaKey, libraryFilter.ShouldIgnoreThePrefixForAlphaPicker); + filterSpecification = filterSpecification is null + ? alphaFilterSpecification + : filterSpecification.And(alphaFilterSpecification); + } + + return filterSpecification; } /// @@ -620,8 +642,8 @@ internal sealed class ArtistRepository : IArtistRepository /// The query to sort. /// The field to sort by (case-insensitive). /// The direction of the sorting. - /// An ordered artists query. - private static IOrderedQueryable ApplySorting(IQueryable artistsQuery, string? sortBy, SortOrder sortOrder) + /// Whether a leading "the " prefix of a name is ignored when deriving the name sort key, or not. + private static IOrderedQueryable ApplySorting(IQueryable artistsQuery, string? sortBy, SortOrder sortOrder, bool shouldIgnoreThePrefixForAlphaPicker) { return sortBy?.ToLowerInvariant() switch { @@ -638,11 +660,41 @@ internal sealed class ArtistRepository : IArtistRepository ? artistsQuery.OrderByDescending(artist => artist.UpdatedOnUtc).ThenBy(artist => artist.Id) : artistsQuery.OrderBy(artist => artist.UpdatedOnUtc).ThenBy(artist => artist.Id), _ => sortOrder == SortOrder.Descending - ? artistsQuery.OrderByDescending(artist => artist.Name).ThenBy(artist => artist.Id) - : artistsQuery.OrderBy(artist => artist.Name).ThenBy(artist => artist.Id), + ? artistsQuery.OrderByDescending(BuildNameSortKey(shouldIgnoreThePrefixForAlphaPicker)).ThenBy(artist => artist.Id) + : artistsQuery.OrderBy(BuildNameSortKey(shouldIgnoreThePrefixForAlphaPicker)).ThenBy(artist => artist.Id), }; } + /// + /// Builds the expression that derives the name sort key of an artist, matching the effective name used by the alpha filter: + /// the name lowercased, falling back to an empty string when the name is , and optionally + /// stripped of a leading "the " prefix. + /// + /// Whether a leading "the " prefix of a name is ignored when deriving the name sort key, or not. + /// An expression that evaluates to the name sort key of an artist. + private static Expression> BuildNameSortKey(bool shouldIgnoreThePrefixForAlphaPicker) + { + ParameterExpression artist = Expression.Parameter(typeof(ArtistEntity), "artist"); + + Expression nameProperty = Expression.Property(artist, nameof(ArtistEntity.Name)); + + // The raw name: the name, unless it is null, in which case an empty string is used. + Expression rawName = Expression.Coalesce(nameProperty, Expression.Constant(string.Empty)); + + MethodCallExpression lowerName = Expression.Call(rawName, s_toLowerMethod); + + // When ignoring the "The " prefix, strip a leading "the " from the lowercased name. + Expression effectiveName = lowerName; + if (shouldIgnoreThePrefixForAlphaPicker) + { + MethodCallExpression startsWithThe = Expression.Call(lowerName, s_startsWithMethod, Expression.Constant("the ")); + MethodCallExpression strippedName = Expression.Call(lowerName, s_substringMethod, Expression.Constant(4)); + effectiveName = Expression.Condition(startsWithThe, strippedName, lowerName); + } + + return Expression.Lambda>(effectiveName, artist); + } + /// /// Gets the artist of the library identified by that has the provided . /// @@ -793,4 +845,19 @@ internal sealed class ArtistRepository : IArtistRepository .ExecuteUpdateAsync(setters => setters.SetProperty(artist => artist.MetadataStatus, MetadataStatus.Pending), cancellationToken).ConfigureAwait(false); return Result.Updated; } + + /// + /// Deletes all the artists of the media library identified by , together with their albums and tracks and their related data. + /// + /// The Id of the media library whose artists are deleted. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + public async Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken) + { + // The albums, tracks and the related data of the artists are removed by the database, through the cascading foreign keys. + await _luminaDbContext.Artists + .Where(artist => artist.LibraryId == libraryId) + .ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + return Result.Deleted; + } } diff --git a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecification.cs b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecification.cs new file mode 100644 index 00000000..c178cafe --- /dev/null +++ b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecification.cs @@ -0,0 +1,127 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Common.DTO.Filtering; +using Lumina.Application.Common.Specifications; +using Microsoft.EntityFrameworkCore; +using System; +using System.Linq.Expressions; +using System.Reflection; +#endregion + +namespace Lumina.DataAccess.Core.Repositories.MusicLibrary.Specifications; + +/// +/// Represents a filter specification for filtering artists by the alpha key of their name, for the alpha picker. +/// The alpha key is the first character of the name, lowercased, and optionally computed after ignoring a leading "The " prefix. +/// +internal sealed class ArtistAlphaFilterSpecification : FilterSpecification +{ + private static readonly MethodInfo s_toLowerMethod = typeof(string).GetMethod(nameof(string.ToLower), Type.EmptyTypes)!; + private static readonly MethodInfo s_startsWithMethod = typeof(string).GetMethod(nameof(string.StartsWith), [typeof(string)])!; + private static readonly MethodInfo s_substringMethod = typeof(string).GetMethod(nameof(string.Substring), [typeof(int)])!; + private static readonly MethodInfo s_globMethod = typeof(SqliteDbFunctionsExtensions) + .GetMethod(nameof(SqliteDbFunctionsExtensions.Glob), [typeof(DbFunctions), typeof(string), typeof(string)])!; + + private readonly string? _filterAlphaKey; + private readonly bool _shouldIgnoreThePrefixForAlphaPicker; + + /// + /// Initializes a new instance of the class. + /// + /// The alpha key to filter by. A single ASCII letter, , or . + /// Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not. + public ArtistAlphaFilterSpecification(string? filterAlphaKey, bool shouldIgnoreThePrefixForAlphaPicker) + { + _filterAlphaKey = filterAlphaKey; + _shouldIgnoreThePrefixForAlphaPicker = shouldIgnoreThePrefixForAlphaPicker; + } + + /// + /// Creates a LINQ expression that represents the predicate defined by the current specification. + /// + /// An expression tree that can be used to evaluate whether an satisfies the specification criteria. + public override Expression> ToExpression() + { + // When no alpha key was requested, every artist matches. + if (_filterAlphaKey is null) + return artist => true; + + ParameterExpression artist = Expression.Parameter(typeof(ArtistEntity), "artist"); + Expression effectiveName = BuildEffectiveName(artist); + + if (_filterAlphaKey == LibraryItemAlphaKeys.NUMBER) + return BuildGlobPredicate(artist, effectiveName, "[0-9]*"); + + if (_filterAlphaKey == LibraryItemAlphaKeys.SYMBOL) + return BuildSymbolPredicate(artist, effectiveName); + + // The alpha key is a single ASCII letter. + string globPattern = char.ToLowerInvariant(_filterAlphaKey[0]) + "*"; + return BuildGlobPredicate(artist, effectiveName, globPattern); + } + + /// + /// Builds the expression representing the lowercased name used to derive the alpha key, falling back to an empty string + /// when the name is or empty, and optionally stripped of a leading "the " prefix. + /// + /// The parameter representing the artist entity. + /// The expression of the effective name. + private Expression BuildEffectiveName(ParameterExpression artist) + { + Expression nameProperty = Expression.Property(artist, nameof(ArtistEntity.Name)); + + // The raw name is the name, unless it is null, in which case an empty string is used. + Expression rawName = Expression.Coalesce(nameProperty, Expression.Constant(string.Empty)); + + MethodCallExpression lowerName = Expression.Call(rawName, s_toLowerMethod); + + // When ignoring the "The " prefix, a leading "the " is stripped from the lowercased name. + Expression effectiveName = lowerName; + if (_shouldIgnoreThePrefixForAlphaPicker) + { + MethodCallExpression startsWithThe = Expression.Call(lowerName, s_startsWithMethod, Expression.Constant("the ")); + MethodCallExpression strippedName = Expression.Call(lowerName, s_substringMethod, Expression.Constant(4)); + effectiveName = Expression.Condition(startsWithThe, strippedName, lowerName); + } + + return effectiveName; + } + + /// + /// Builds a predicate that is satisfied when the effective name starts with a glob pattern. + /// + /// The parameter representing the artist entity. + /// The expression of the effective name. + /// The glob pattern the effective name must match. + /// The built predicate. + private static Expression> BuildGlobPredicate(ParameterExpression artist, Expression effectiveName, string globPattern) + { + MethodCallExpression glob = BuildGlobCall(effectiveName, globPattern); + return Expression.Lambda>(glob, artist); + } + + /// + /// Builds a predicate that is satisfied when the first character of the effective name is neither a letter nor a digit. + /// + /// The parameter representing the artist entity. + /// The expression of the effective name. + /// The built predicate. + private static Expression> BuildSymbolPredicate(ParameterExpression artist, Expression effectiveName) + { + Expression notLetter = Expression.Not(BuildGlobCall(effectiveName, "[a-z]*")); + Expression notDigit = Expression.Not(BuildGlobCall(effectiveName, "[0-9]*")); + return Expression.Lambda>(Expression.AndAlso(notLetter, notDigit), artist); + } + + /// + /// Builds the call to for the effective name and the provided glob pattern. + /// + /// The expression of the effective name. + /// The glob pattern the effective name must match. + /// The built method call. + private static MethodCallExpression BuildGlobCall(Expression effectiveName, string globPattern) + { + Expression functions = Expression.Property(null, typeof(EF), nameof(EF.Functions)); + return Expression.Call(s_globMethod, functions, effectiveName, Expression.Constant(globPattern)); + } +} diff --git a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/TrackRepository.cs b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/TrackRepository.cs index 4837ccf2..a4bbe4ad 100644 --- a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/TrackRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/TrackRepository.cs @@ -242,7 +242,7 @@ internal sealed class TrackRepository : ITrackRepository .Include(track => track.Contributors) .AsSplitQuery() .Where(track => track.AlbumId == albumId) - .OrderBy(track => track.DiscNumber) + .OrderBy(track => track.DiscNumber ?? 1) // some releases don't have a disc number, assume 1 .ThenBy(track => track.TrackNumber) .ThenBy(track => track.Id) .ToListAsync(cancellationToken).ConfigureAwait(false); @@ -262,7 +262,7 @@ internal sealed class TrackRepository : ITrackRepository IQueryable liteRowsQuery = _luminaDbContext.Tracks .AsNoTracking() .Where(track => track.AlbumId == albumId) - .OrderBy(track => track.DiscNumber) + .OrderBy(track => track.DiscNumber ?? 1) // some releases don't have a disc number, assume 1 .ThenBy(track => track.TrackNumber) .ThenBy(track => track.Id) .Select(track => new TrackLiteRow @@ -270,7 +270,8 @@ internal sealed class TrackRepository : ITrackRepository Id = track.Id, Title = track.Title, TrackNumber = track.TrackNumber, - DiscNumber = track.DiscNumber + DiscNumber = track.DiscNumber, + DurationInSeconds = track.DurationInSeconds }); if (paginationData is null) 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 0ad7ef8f..fedd2b40 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 @@ -373,6 +373,8 @@ public class AddAlbumEndpointSummary : Summary(r => r.Metadata!.Genres, "The list of genres associated with the album."); ResponseParam(r => r.Metadata!.Tags, "The list of tags that further describe or categorize the album."); ResponseParam(r => r.Tracks, "The list of tracks of the album."); + ResponseParam(r => r.CoverPath, "The path of the image representing the album, if available."); + ResponseParam(r => r.Artwork, "The stored artwork of the album, in display order, if applicable."); Response(201, "The newly created album is returned.", example: new AlbumResponse( diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointSummary.cs index c2a2d4a1..2bf29528 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbum/UpdateAlbumEndpointSummary.cs @@ -177,6 +177,8 @@ public class UpdateAlbumEndpointSummary : Summary(r => r.Metadata!.Genres, "The list of genres associated with the album."); ResponseParam(r => r.Metadata!.Tags, "The list of tags that further describe or categorize the album."); ResponseParam(r => r.Tracks, "The list of tracks of the album."); + ResponseParam(r => r.CoverPath, "The path of the image representing the album, if available."); + ResponseParam(r => r.Artwork, "The stored artwork of the album, in display order, if applicable."); Response(200, "The updated album is returned.", example: new AlbumResponse( diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointSummary.cs index 728d1333..33ce2af1 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/AddArtist/AddArtistEndpointSummary.cs @@ -455,6 +455,8 @@ public class AddArtistEndpointSummary : Summary(r => r.Albums![0].Contributors, "The list of references to the media contributors that performed on the album, each with the role they played."); ResponseParam(r => r.Albums![0].Ratings, "The list of ratings for the album."); ResponseParam(r => r.Albums![0].Tracks, "The list of tracks of the album."); + ResponseParam(r => r.Albums![0].CoverPath, "The path of the image representing the album, if available."); + ResponseParam(r => r.Albums![0].Artwork, "The stored artwork of the album, in display order, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].Id, "The Id of the track."); ResponseParam(r => r.Albums![0].Tracks![0].AlbumId, "The Id of the album the track belongs to."); ResponseParam(r => r.Albums![0].Tracks![0].LibraryId, "The Id of the media library this track belongs to."); @@ -503,6 +505,7 @@ public class AddArtistEndpointSummary : Summary(r => r.Albums![0].Tracks![0].Ratings, "The list of ratings for the track."); ResponseParam(r => r.CreatedOnUtc, "The date and time when the artist was created."); ResponseParam(r => r.UpdatedOnUtc, "The date and time when the artist was last updated, if applicable."); + ResponseParam(r => r.CoverPath, "The path of the image representing the artist, if available."); Response(201, "The new artist is returned.", example: new ArtistResponse( diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtist/GetArtistEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtist/GetArtistEndpointSummary.cs index fb2d67a0..0a93393c 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtist/GetArtistEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtist/GetArtistEndpointSummary.cs @@ -39,6 +39,7 @@ public class GetArtistEndpointSummary : Summary ResponseParam(r => r.Albums, "The list of albums of the artist, each with its own list of tracks."); ResponseParam(r => r.CreatedOnUtc, "The date and time when the artist was created."); ResponseParam(r => r.UpdatedOnUtc, "The date and time when the artist was last updated, if applicable."); + ResponseParam(r => r.CoverPath, "The path of the image representing the artist, if available."); Response(200, "The requested artist is returned.", example: new ArtistResponse( 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 274c3421..4d4546b0 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 @@ -65,6 +65,8 @@ public class GetArtistAlbumsEndpointSummary : Summary(r => r.Metadata!.Genres, "The list of genres associated with the album."); ResponseParam(r => r.Metadata!.Tags, "The list of tags that further describe or categorize the album."); ResponseParam(r => r.Tracks, "The list of tracks of the album."); + ResponseParam(r => r.CoverPath, "The path of the image representing the album, if available."); + ResponseParam(r => r.Artwork, "The stored artwork of the album, in display order, if applicable."); Response(200, "The list of albums of the artist is returned.", example: new AlbumResponse[] diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointSummary.cs index 20c6f4b7..5db7a2b5 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointSummary.cs @@ -36,6 +36,9 @@ public class GetArtistAlbumsLiteEndpointSummary : Summary(r => r.Id, "The Id of the album."); ResponseParam(r => r.Title, "The title of the album."); ResponseParam(r => r.TotalTracks, "The number of tracks of the release."); + ResponseParam(r => r.CoverPath, "The path of the image representing the album, if available."); + ResponseParam(r => r.ReleaseYear, "The release year of the album (the re-release year, if available, or the original release year), if known."); + ResponseParam(r => r.ReleaseTypes, "The set of types of the release."); Response(200, "The paginated list of the lightweight read models of the albums of the artist is returned.", example: new PaginatedResponse diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtists/GetArtistsEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtists/GetArtistsEndpointSummary.cs index 5b367e6c..237b933d 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtists/GetArtistsEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtists/GetArtistsEndpointSummary.cs @@ -51,6 +51,7 @@ public class GetArtistsEndpointSummary : Summary(r => r.Albums, "The list of albums of the artist, each with its own list of tracks."); ResponseParam(r => r.CreatedOnUtc, "The date and time when the artist was created."); ResponseParam(r => r.UpdatedOnUtc, "The date and time when the artist was last updated, if applicable."); + ResponseParam(r => r.CoverPath, "The path of the image representing the artist, if available."); Response(200, "The paginated list of the artists of the media library is returned.", example: new PaginatedResponse diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointSummary.cs index d59bf629..6fe50088 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointSummary.cs @@ -39,12 +39,13 @@ public class GetArtistsLiteEndpointSummary : Summary r.PerPage, "The maximum number of artists to retrieve per page. Optional."); RequestParam(r => r.SearchTerm, "The search term used to filter the artists by name. Optional."); RequestParam(r => r.FilterAlphaKey, "The alpha key used to filter the artists by the first character of their name, for the alpha picker. Optional."); - RequestParam(r => r.ShouldIgnoreThePrefixForAlphaPicker, "Whether the leading \"The \" prefix of a name is ignored when computing the alpha key, or not."); + RequestParam(r => r.ShouldIgnoreThePrefixForAlphaPicker, "Whether the leading \"The \" prefix of a name is ignored when computing the alpha key, or not. Optional."); RequestParam(r => r.SortBy, "The name of the field by which to sort the results. Optional."); RequestParam(r => r.SortOrder, "The direction in which to sort the results. Optional."); ResponseParam(r => r.Id, "The Id of the artist."); ResponseParam(r => r.Name, "The name of the artist."); + ResponseParam(r => r.CoverPath, "The path of the image representing the artist, if available."); Response(200, "The paginated list of the lightweight read models of the artists is returned.", example: new PaginatedResponse diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointSummary.cs index 15272a36..07a978c1 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtist/UpdateArtistEndpointSummary.cs @@ -454,6 +454,8 @@ public class UpdateArtistEndpointSummary : Summary(r => r.Albums![0].Contributors, "The list of references to the media contributors that performed on the album, each with the role they played."); ResponseParam(r => r.Albums![0].Ratings, "The list of ratings for the album."); ResponseParam(r => r.Albums![0].Tracks, "The list of tracks of the album."); + ResponseParam(r => r.Albums![0].CoverPath, "The path of the image representing the album, if available."); + ResponseParam(r => r.Albums![0].Artwork, "The stored artwork of the album, in display order, if applicable."); ResponseParam(r => r.Albums![0].Tracks![0].Id, "The Id of the track."); ResponseParam(r => r.Albums![0].Tracks![0].AlbumId, "The Id of the album the track belongs to."); ResponseParam(r => r.Albums![0].Tracks![0].LibraryId, "The Id of the media library this track belongs to."); @@ -502,6 +504,7 @@ public class UpdateArtistEndpointSummary : Summary(r => r.Albums![0].Tracks![0].Ratings, "The list of ratings for the track."); ResponseParam(r => r.CreatedOnUtc, "The date and time when the artist was created."); ResponseParam(r => r.UpdatedOnUtc, "The date and time when the artist was last updated, if applicable."); + ResponseParam(r => r.CoverPath, "The path of the image representing the artist, if available."); Guid artistId = Guid.NewGuid(); Guid libraryId = Guid.NewGuid(); diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowFixture.cs index 1e717757..408dc94b 100644 --- a/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowFixture.cs +++ b/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowFixture.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using Bogus; using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Albums; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -15,6 +16,9 @@ namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.AudioLibrary.Music [ExcludeFromCodeCoverage] public class AlbumLiteRowFixture { + private const int MINIMUM_RELEASE_YEAR = 1900; + private const int MAXIMUM_RELEASE_YEAR = 2026; + private readonly Faker _faker = new(); /// @@ -23,17 +27,32 @@ public class AlbumLiteRowFixture /// Optional. The Id of the album. /// Optional. The title of the album. /// Optional. The number of tracks of the release. + /// Optional. The path of the image representing the album. + /// Optional. The release year of the album. + /// Optional. The set of types of the release. + /// Whether the cover path should be included, or forced to . + /// Whether the release year should be included, or forced to . + /// Whether the release types should be included, or forced to . /// The created . public AlbumLiteRow Create( Guid? id = null, string? title = null, - int? totalTracks = null) + int? totalTracks = null, + string? coverPath = null, + int? releaseYear = null, + List? releaseTypes = null, + bool includeCoverPath = true, + bool includeReleaseYear = true, + bool includeReleaseTypes = true) { return new AlbumLiteRow { Id = id ?? _faker.Random.Guid(), Title = title ?? _faker.Music.Genre(), - TotalTracks = totalTracks ?? _faker.Random.Int(1, 30) + TotalTracks = totalTracks ?? _faker.Random.Int(1, 30), + CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null, + ReleaseYear = includeReleaseYear ? (releaseYear ?? _faker.Random.Int(MINIMUM_RELEASE_YEAR, MAXIMUM_RELEASE_YEAR)) : null, + ReleaseTypes = includeReleaseTypes ? (releaseTypes ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 3)).Select(index => _faker.PickRandom())]) : null }; } diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowFixture.cs index 671ca538..708c4ac0 100644 --- a/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowFixture.cs +++ b/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowFixture.cs @@ -22,15 +22,20 @@ public class ArtistLiteRowFixture /// /// Optional. The Id of the artist. /// Optional. The name of the artist. + /// Optional. The path of the image representing the artist. + /// Whether the cover path should be included, or forced to . /// The created . public ArtistLiteRow Create( Guid? id = null, - string? name = null) + string? name = null, + string? coverPath = null, + bool includeCoverPath = true) { return new ArtistLiteRow { Id = id ?? _faker.Random.Guid(), - Name = name ?? _faker.Name.FullName() + Name = name ?? _faker.Name.FullName(), + CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null }; } diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowFixture.cs index d7414256..d942eac7 100644 --- a/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowFixture.cs +++ b/tests/Common/Lumina.Application.Fixtures/Common/DTO/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowFixture.cs @@ -25,20 +25,23 @@ public class TrackLiteRowFixture /// Optional. The number of the track on its disc. /// Optional. The number of the disc the track belongs to. /// Whether the disc number should be included, or forced to . + /// Optional. The duration of the track in seconds. /// The created . public TrackLiteRow Create( Guid? id = null, string? title = null, int? trackNumber = null, int? discNumber = null, - bool includeDiscNumber = true) + bool includeDiscNumber = true, + int? durationInSeconds = null) { return new TrackLiteRow { Id = id ?? _faker.Random.Guid(), Title = title ?? _faker.Lorem.Sentence(), TrackNumber = trackNumber ?? _faker.Random.Int(1, 30), - DiscNumber = includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null + DiscNumber = includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null, + DurationInSeconds = durationInSeconds ?? _faker.Random.Int(1, 600) }; } diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryFixture.cs index 7e6ddb02..265559df 100644 --- a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryFixture.cs +++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryFixture.cs @@ -3,6 +3,7 @@ using Bogus; using Lumina.Application.Common.DTO.Pagination; using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtistsLite; using Lumina.Application.Fixtures.Common.DTO.Pagination; +using Lumina.Domain.SharedKernel.Common.Enums.Common; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -26,6 +27,10 @@ public class GetArtistsLiteQueryFixture /// Optional. The Id of the media library whose artists are retrieved, taken from the route. /// Optional. The pagination data of the query. /// Optional. The search term used to filter the artists by name. + /// Optional. The alpha key used to filter the results by the first character of their name, for the alpha picker. + /// Optional. Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not. + /// Optional. The name of the field by which to sort the results. + /// Optional. The direction in which to sort the results. /// Whether the library Id should be included, or forced to . /// Whether the pagination data should be included, or forced to . /// Whether the search term should be included, or forced to . @@ -34,6 +39,10 @@ public class GetArtistsLiteQueryFixture string? libraryId = null, PaginationDataDto? paginationData = null, string? searchTerm = null, + string? filterAlphaKey = null, + bool shouldIgnoreThePrefixForAlphaPicker = false, + string? sortBy = null, + SortOrder? sortOrder = null, bool includeLibraryId = true, bool includePaginationData = true, bool includeSearchTerm = true) @@ -41,7 +50,11 @@ public class GetArtistsLiteQueryFixture return new GetArtistsLiteQuery( includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null, includePaginationData ? (paginationData ?? _paginationDataDtoFixture.Create()) : null, - includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null); + includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null, + filterAlphaKey, + shouldIgnoreThePrefixForAlphaPicker, + sortBy ?? _faker.Lorem.Word(), + sortOrder ?? _faker.PickRandom()); } /// diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/MediaArtworkDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/MediaArtworkDtoFixture.cs new file mode 100644 index 00000000..5fbe5a26 --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/MediaArtworkDtoFixture.cs @@ -0,0 +1,47 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Contracts.DTO.Common; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Contracts.Fixtures.Core.DTO.Common; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class MediaArtworkDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a random valid . + /// + /// Optional. The type of the artwork. + /// Optional. The ordinal of the artwork within its type. + /// Optional. The relative path of the stored artwork file. + /// The created . + public MediaArtworkDto Create( + ArtworkType? type = null, + int? ordinal = null, + string? path = null) + { + return new MediaArtworkDto( + type ?? _faker.PickRandom(), + ordinal ?? _faker.Random.Int(0, 5), + path ?? _faker.System.FilePath()); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestFixture.cs index c513da38..f672225c 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestFixture.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using Bogus; using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using Lumina.Domain.SharedKernel.Common.Enums.Common; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -22,22 +23,40 @@ public class GetArtistsLiteRequestFixture /// Optional. The page of results to retrieve. /// Optional. The maximum number of artists to retrieve per page. /// Optional. The search term used to filter the artists by name. + /// Optional. The alpha key used to filter the results by the first character of their name, for the alpha picker. + /// Optional. Whether the leading "The " prefix of a name should be ignored when computing the alpha key, or not. + /// Optional. The name of the field by which to sort the results. + /// Optional. The direction in which to sort the results. /// Whether the current page should be included, or forced to . /// Whether the per page count should be included, or forced to . /// Whether the search term should be included, or forced to . + /// Whether the filter alpha key should be included, or forced to . + /// Whether the sort field should be included, or forced to . + /// Whether the sort order should be included, or forced to . /// The created request to get the lightweight read models of the artists of a media library. public GetArtistsLiteRequest Create( int? currentPage = null, int? perPage = null, string? searchTerm = null, + string? filterAlphaKey = null, + bool shouldIgnoreThePrefixForAlphaPicker = false, + string? sortBy = null, + SortOrder? sortOrder = null, bool includeCurrentPage = true, bool includePerPage = true, - bool includeSearchTerm = true) + bool includeSearchTerm = true, + bool includeFilterAlphaKey = true, + bool includeSortBy = true, + bool includeSortOrder = true) { return new GetArtistsLiteRequest( includeCurrentPage ? (currentPage ?? _faker.Random.Number(1, 100)) : null, includePerPage ? (perPage ?? _faker.Random.Number(1, 200)) : null, - includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null); + includeSearchTerm ? (searchTerm ?? _faker.Name.FullName()) : null, + includeFilterAlphaKey ? (filterAlphaKey ?? CreateFilterAlphaKey()) : null, + shouldIgnoreThePrefixForAlphaPicker, + includeSortBy ? (sortBy ?? _faker.Lorem.Word()) : null, + includeSortOrder ? (sortOrder ?? _faker.PickRandom()) : null); } /// @@ -49,4 +68,15 @@ public class GetArtistsLiteRequestFixture { return [.. Enumerable.Range(0, count).Select(_ => Create())]; } + + /// + /// Creates a random valid alpha key: a single ASCII letter, "#" for names starting with a digit, or "*" for any other first character. + /// + /// The created alpha key. + private string CreateFilterAlphaKey() + { + return _faker.Random.Bool() + ? _faker.Random.Char('A', 'Z').ToString() + : _faker.Random.ListItem(new[] { "#", "*" }); + } } diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponseFixture.cs index 5fc48178..ff44ed55 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponseFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteResponseFixture.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using Bogus; using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -23,16 +24,35 @@ public class AlbumLiteResponseFixture /// Optional. The Id of the album. /// Optional. The title of the album. /// Optional. The number of tracks of the release. + /// Optional. The path of the image representing the album. + /// Optional. The release year of the album. + /// Optional. The set of types of the release. + /// Whether the cover path should be included, or forced to . + /// Whether the release year should be included, or forced to . + /// Whether the release types should be included, or forced to . /// The created . public AlbumLiteResponse Create( Guid? id = null, string? title = null, - int? totalTracks = null) + int? totalTracks = null, + string? coverPath = null, + int? releaseYear = null, + List? releaseTypes = null, + bool includeCoverPath = true, + bool includeReleaseYear = true, + bool includeReleaseTypes = true) { + List? resolvedReleaseTypes = includeReleaseTypes + ? (releaseTypes ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 3)).Select(_ => _faker.PickRandom())]) + : null; + return new AlbumLiteResponse( id ?? Guid.NewGuid(), title ?? _faker.Commerce.ProductName(), - totalTracks ?? _faker.Random.Int(1, 30)); + totalTracks ?? _faker.Random.Int(1, 30), + includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null, + includeReleaseYear ? (releaseYear ?? _faker.Random.Int(1900, 2026)) : null, + resolvedReleaseTypes); } /// diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponseFixture.cs index 653ec988..e66d1921 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponseFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponseFixture.cs @@ -1,8 +1,10 @@ #region ========================================================================= USING ===================================================================================== using Bogus; +using Lumina.Contracts.DTO.Common; using Lumina.Contracts.DTO.MediaContributors; using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary; using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Contracts.Fixtures.Core.DTO.Common; using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors; using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary; using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary; @@ -29,6 +31,7 @@ public class AlbumResponseFixture private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new(); private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new(); private readonly TrackResponseFixture _trackResponseFixture = new(); + private readonly MediaArtworkDtoFixture _mediaArtworkDtoFixture = new(); /// /// Creates a random valid . @@ -51,6 +54,8 @@ public class AlbumResponseFixture /// Optional. The list of contributor references of the album. /// Optional. The list of ratings of the album. /// Optional. The list of tracks of the album. + /// Optional. The path of the image representing the album. + /// Optional. The stored artwork of the album, in display order. /// Whether the media format should be included, or forced to . /// Whether the packaging should be included, or forced to . /// Whether the barcode should be included, or forced to . @@ -64,6 +69,8 @@ public class AlbumResponseFixture /// Whether the contributors should be included, or forced to . /// Whether the ratings should be included, or forced to . /// Whether the tracks should be included, or forced to . + /// Whether the cover path should be included, or forced to . + /// Whether the artwork should be included, or forced to an empty collection. /// The created . public AlbumResponse Create( Guid? id = null, @@ -84,6 +91,8 @@ public class AlbumResponseFixture List? contributors = null, List? ratings = null, List? tracks = null, + string? coverPath = null, + List? artwork = null, bool includeMediaFormat = true, bool includePackaging = true, bool includeBarcode = true, @@ -96,8 +105,14 @@ public class AlbumResponseFixture bool includeUpdatedOnUtc = true, bool includeContributors = true, bool includeRatings = true, - bool includeTracks = true) + bool includeTracks = true, + bool includeCoverPath = true, + bool includeArtwork = true) { + IReadOnlyList resolvedArtwork = includeArtwork + ? (artwork ?? _mediaArtworkDtoFixture.CreateMany(1)) + : []; + return new AlbumResponse( id ?? Guid.NewGuid(), artistId ?? Guid.NewGuid(), @@ -116,7 +131,9 @@ public class AlbumResponseFixture includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent().ToUniversalTime()) : null, includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(1)) : null, includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(1)) : null, - includeTracks ? (tracks ?? _trackResponseFixture.CreateMany(1)) : null); + includeTracks ? (tracks ?? _trackResponseFixture.CreateMany(1)) : null, + includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null, + resolvedArtwork); } /// diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponseFixture.cs index 5bbde1f8..d490c429 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponseFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteResponseFixture.cs @@ -22,14 +22,19 @@ public class ArtistLiteResponseFixture /// /// Optional. The Id of the artist. /// Optional. The name of the artist. + /// Optional. The path of the image representing the artist. + /// Whether the cover path should be included, or forced to . /// The created . public ArtistLiteResponse Create( Guid? id = null, - string? name = null) + string? name = null, + string? coverPath = null, + bool includeCoverPath = true) { return new ArtistLiteResponse( id ?? Guid.NewGuid(), - name ?? _faker.Name.FullName()); + name ?? _faker.Name.FullName(), + includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null); } /// diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponseFixture.cs index f22f8359..3f0d94aa 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponseFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponseFixture.cs @@ -44,6 +44,7 @@ public class ArtistResponseFixture /// Optional. The list of albums of the artist. /// Optional. The date and time when the artist was created. /// Optional. The date and time when the artist was updated. + /// Optional. The path of the image representing the artist. /// Whether the website should be included, or forced to . /// Whether the MusicBrainz artist Id should be included, or forced to . /// Whether the IPI codes should be included, or forced to . @@ -52,6 +53,7 @@ public class ArtistResponseFixture /// Whether the contributors should be included, or forced to . /// Whether the ratings should be included, or forced to . /// Whether the albums should be included, or forced to . + /// Whether the cover path should be included, or forced to . /// The created . public ArtistResponse Create( Guid? id = null, @@ -66,6 +68,7 @@ public class ArtistResponseFixture List? albums = null, DateTime? createdOnUtc = null, DateTime? updatedOnUtc = null, + string? coverPath = null, bool includeWebsite = true, bool includeMusicBrainzArtistId = true, bool includeIpis = true, @@ -73,7 +76,8 @@ public class ArtistResponseFixture bool includeUpdatedOnUtc = true, bool includeContributors = true, bool includeRatings = true, - bool includeAlbums = true) + bool includeAlbums = true, + bool includeCoverPath = true) { return new ArtistResponse( id ?? Guid.NewGuid(), @@ -87,7 +91,8 @@ public class ArtistResponseFixture includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent().ToUniversalTime()) : null, includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(1)) : null, includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(1)) : null, - includeAlbums ? (albums ?? _albumResponseFixture.CreateMany(1)) : null); + includeAlbums ? (albums ?? _albumResponseFixture.CreateMany(1)) : null, + includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null); } /// diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponseFixture.cs index 4118f4ec..d997e06d 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponseFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteResponseFixture.cs @@ -25,19 +25,22 @@ public class TrackLiteResponseFixture /// Optional. The number of the track on its disc. /// Optional. The number of the disc the track belongs to. /// Whether the disc number should be included, or forced to . + /// Optional. The duration of the track in seconds. /// The created . public TrackLiteResponse Create( Guid? id = null, string? title = null, int? trackNumber = null, int? discNumber = null, - bool includeDiscNumber = true) + bool includeDiscNumber = true, + int? durationInSeconds = null) { return new TrackLiteResponse( id ?? _faker.Random.Guid(), title ?? _faker.Lorem.Sentence(), trackNumber ?? _faker.Random.Int(1, 30), - includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null); + includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null, + durationInSeconds ?? _faker.Random.Int(1, 600)); } /// diff --git a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/AlbumRepositoryTests.cs b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/AlbumRepositoryTests.cs index a6cdd694..e65ef9a3 100644 --- a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/AlbumRepositoryTests.cs +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/AlbumRepositoryTests.cs @@ -15,6 +15,7 @@ using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using NSubstitute; @@ -44,6 +45,7 @@ public class AlbumRepositoryTests private readonly TagEntityFixture _tagEntityFixture = new(); private readonly GenreEntityFixture _genreEntityFixture = new(); private readonly ArtistEntityFixture _artistEntityFixture = new(); + private readonly MusicArtworkEntityFixture _musicArtworkEntityFixture = new(); private readonly PaginationDataDtoFixture _paginationDataDtoFixture = new(); [Fact] @@ -601,6 +603,112 @@ public class AlbumRepositoryTests Assert.Equal(expectedRowCount, result.Value.Data.Count); } + [Fact] + public async Task GetAlbumsLiteByArtistIdAsync_WhenReReleaseYearIsSet_ShouldProjectItAsReleaseYear() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-albumrepo-lite-releaseyear-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + AlbumRepository sut = CreateAlbumRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity artist = await SeedArtistAsync(context, libraryId); + AlbumEntity album = _albumEntityFixture.Create( + artistId: artist.Id, libraryId: libraryId, originalReleaseYear: 1975, reReleaseYear: 2011, includeTracks: false, includeMetadata: false); + context.Albums.Add(album); + await context.SaveChangesAsync(); + + // Act + Result> result = await sut.GetAlbumsLiteByArtistIdAsync(artist.Id, null, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + AlbumLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal(2011, row.ReleaseYear); + } + + [Fact] + public async Task GetAlbumsLiteByArtistIdAsync_WhenReReleaseYearIsNull_ShouldFallBackToOriginalReleaseYear() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-albumrepo-lite-originalyear-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + AlbumRepository sut = CreateAlbumRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity artist = await SeedArtistAsync(context, libraryId); + AlbumEntity album = _albumEntityFixture.Create( + artistId: artist.Id, libraryId: libraryId, originalReleaseYear: 1975, includeReReleaseYear: false, includeTracks: false, includeMetadata: false); + context.Albums.Add(album); + await context.SaveChangesAsync(); + + // Act + Result> result = await sut.GetAlbumsLiteByArtistIdAsync(artist.Id, null, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + AlbumLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal(1975, row.ReleaseYear); + } + + [Fact] + public async Task GetAlbumsLiteByArtistIdAsync_WhenTheReleaseHasTypes_ShouldProjectThem() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-albumrepo-lite-releasetypes-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + AlbumRepository sut = CreateAlbumRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity artist = await SeedArtistAsync(context, libraryId); + AlbumEntity album = _albumEntityFixture.Create( + artistId: artist.Id, libraryId: libraryId, releaseType: MusicReleaseType.Single, includeTracks: false, includeMetadata: false); + context.Albums.Add(album); + await context.SaveChangesAsync(); + + // Act + Result> result = await sut.GetAlbumsLiteByArtistIdAsync(artist.Id, null, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + AlbumLiteRow row = Assert.Single(result.Value.Data); + Assert.NotNull(row.ReleaseTypes); + Assert.Equal(MusicReleaseType.Single, Assert.Single(row.ReleaseTypes)); + } + + [Fact] + public async Task GetAlbumsLiteByArtistIdAsync_WhenCoverArtworkExists_ShouldProjectTheCoverPath() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-albumrepo-lite-cover-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + AlbumRepository sut = CreateAlbumRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity artist = await SeedArtistAsync(context, libraryId); + AlbumEntity album = _albumEntityFixture.Create(artistId: artist.Id, libraryId: libraryId, includeTracks: false, includeMetadata: false); + context.Albums.Add(album); + context.MusicArtwork.Add( + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: album.Id, artworkType: ArtworkType.Cover, fileName: "covers/opera.jpg")); + await context.SaveChangesAsync(); + + // Act + Result> result = await sut.GetAlbumsLiteByArtistIdAsync(artist.Id, null, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + AlbumLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal("covers/opera.jpg", row.CoverPath); + } + /// /// Creates an album repository backed by the provided context, wiring the real track repository. /// diff --git a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs index 3aae0a38..7baeee66 100644 --- a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs @@ -17,6 +17,7 @@ using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; @@ -51,6 +52,7 @@ public class ArtistRepositoryTests private readonly GenreEntityFixture _genreEntityFixture = new(); private readonly PaginationDataDtoFixture _paginationDataDtoFixture = new(); private readonly LibraryFilterDtoFixture _libraryFilterDtoFixture = new(); + private readonly MusicArtworkEntityFixture _musicArtworkEntityFixture = new(); [Fact] public async Task InsertAsync_WhenCalledWithAValidArtist_ShouldPersistTheArtistAndItsAggregate() @@ -1079,6 +1081,257 @@ public class ArtistRepositoryTests Assert.Equal(keptTrackContributor.Id, Assert.Single(storedTrack.Contributors).Id); } + [Fact] + public async Task DeleteByLibraryIdAsync_WhenCalled_ShouldDeleteOnlyTheLibraryArtistsAndTheirChildren() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-artistrepo-deletebylibrary-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + ArtistRepository sut = CreateArtistRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity targetArtist = await SeedArtistAsync(context, libraryId, "Queen"); + AlbumEntity targetAlbum = await SeedAlbumAsync(context, libraryId, targetArtist.Id); + context.Tracks.Add(_trackEntityFixture.Create(albumId: targetAlbum.Id, libraryId: libraryId, includeMetadata: false)); + ArtistEntity artistOfAnotherLibrary = await SeedArtistAsync(context, Guid.NewGuid(), "Pink Floyd"); + await context.SaveChangesAsync(); + + // Act + Result result = await sut.DeleteByLibraryIdAsync(libraryId, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(Result.Deleted, result.Value); + context.ChangeTracker.Clear(); + // Only the artists of the target library are deleted, and the database cascade removes their albums and tracks. + ArtistEntity survivor = Assert.Single(await context.Artists.AsNoTracking().ToListAsync()); + Assert.Equal(artistOfAnotherLibrary.Id, survivor.Id); + Assert.Empty(await context.Albums.AsNoTracking().Where(candidate => candidate.LibraryId == libraryId).ToListAsync()); + Assert.Empty(await context.Tracks.AsNoTracking().Where(candidate => candidate.LibraryId == libraryId).ToListAsync()); + } + + [Fact] + public async Task GetAllLiteAsync_WhenAlphaKeyIsTheNumberKey_ShouldMatchOnlyNamesStartingWithADigit() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-artistrepo-lite-alpha-number-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + ArtistRepository sut = CreateArtistRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity numericArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "1984", includeAlbums: false, includeContributors: false); + ArtistEntity letterArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "Alpha", includeAlbums: false, includeContributors: false); + ArtistEntity symbolArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "!Voyager", includeAlbums: false, includeContributors: false); + context.Artists.AddRange(numericArtist, letterArtist, symbolArtist); + await context.SaveChangesAsync(); + + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId, filterAlphaKey: LibraryItemAlphaKeys.NUMBER); + + // Act + Result> result = await sut.GetAllLiteAsync(null, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + ArtistLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal("1984", row.Name); + } + + [Fact] + public async Task GetAllLiteAsync_WhenAlphaKeyIsTheSymbolKey_ShouldMatchOnlyNamesStartingWithASymbol() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-artistrepo-lite-alpha-symbol-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + ArtistRepository sut = CreateArtistRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity symbolArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "!Voyager", includeAlbums: false, includeContributors: false); + ArtistEntity numericArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "1984", includeAlbums: false, includeContributors: false); + ArtistEntity letterArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "Alpha", includeAlbums: false, includeContributors: false); + context.Artists.AddRange(symbolArtist, numericArtist, letterArtist); + await context.SaveChangesAsync(); + + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId, filterAlphaKey: LibraryItemAlphaKeys.SYMBOL); + + // Act + Result> result = await sut.GetAllLiteAsync(null, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + ArtistLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal("!Voyager", row.Name); + } + + [Fact] + public async Task GetAllLiteAsync_WhenAlphaKeyIsALetter_ShouldMatchOnlyNamesStartingWithIt() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-artistrepo-lite-alpha-letter-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + ArtistRepository sut = CreateArtistRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity alphaArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "Alpha", includeAlbums: false, includeContributors: false); + ArtistEntity bravoArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "Bravo", includeAlbums: false, includeContributors: false); + ArtistEntity charlieArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "Charlie", includeAlbums: false, includeContributors: false); + context.Artists.AddRange(alphaArtist, bravoArtist, charlieArtist); + await context.SaveChangesAsync(); + + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId, filterAlphaKey: "b"); + + // Act + Result> result = await sut.GetAllLiteAsync(null, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + ArtistLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal("Bravo", row.Name); + } + + [Fact] + public async Task GetAllLiteAsync_WhenSearchTermAndAlphaKeyAreProvided_ShouldCombineThemWithAnd() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-artistrepo-lite-search-alpha-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + ArtistRepository sut = CreateArtistRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity matchingArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "Alpha Band", includeAlbums: false, includeContributors: false); + ArtistEntity artistMatchingOnlyTheAlphaKey = _artistEntityFixture.Create(libraryId: libraryId, name: "Adele", includeAlbums: false, includeContributors: false); + ArtistEntity artistMatchingOnlyTheSearchTerm = _artistEntityFixture.Create(libraryId: libraryId, name: "Beta Band", includeAlbums: false, includeContributors: false); + context.Artists.AddRange(matchingArtist, artistMatchingOnlyTheAlphaKey, artistMatchingOnlyTheSearchTerm); + await context.SaveChangesAsync(); + + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId, searchTerm: "Band", filterAlphaKey: "a"); + + // Act + Result> result = await sut.GetAllLiteAsync(null, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + ArtistLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal(matchingArtist.Id, row.Id); + } + + [Fact] + public async Task GetAllLiteAsync_WhenIgnoringThePrefix_ShouldFilterOnTheStrippedName() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-artistrepo-lite-alpha-the-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + ArtistRepository sut = CreateArtistRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity beatlesArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "The Beatles", includeAlbums: false, includeContributors: false); + ArtistEntity adeleArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "Adele", includeAlbums: false, includeContributors: false); + context.Artists.AddRange(beatlesArtist, adeleArtist); + await context.SaveChangesAsync(); + + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId, filterAlphaKey: "b", shouldIgnoreThePrefixForAlphaPicker: true); + + // Act + Result> result = await sut.GetAllLiteAsync(null, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + ArtistLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal("The Beatles", row.Name); + } + + [Fact] + public async Task GetAllLiteAsync_WhenNotIgnoringThePrefix_ShouldFilterOnTheFullName() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-artistrepo-lite-alpha-the-off-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + ArtistRepository sut = CreateArtistRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity beatlesArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "The Beatles", includeAlbums: false, includeContributors: false); + ArtistEntity adeleArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "Adele", includeAlbums: false, includeContributors: false); + context.Artists.AddRange(beatlesArtist, adeleArtist); + await context.SaveChangesAsync(); + + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId, filterAlphaKey: "b", shouldIgnoreThePrefixForAlphaPicker: false); + + // Act + Result> result = await sut.GetAllLiteAsync(null, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Empty(result.Value.Data); + } + + [Fact] + public async Task GetAllLiteAsync_WhenIgnoringThePrefixForSorting_ShouldSortByTheStrippedName() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-artistrepo-lite-sort-the-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + ArtistRepository sut = CreateArtistRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity beneathArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "Beneath the Surface", includeAlbums: false, includeContributors: false); + ArtistEntity beatlesArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "The Beatles", includeAlbums: false, includeContributors: false); + context.Artists.AddRange(beneathArtist, beatlesArtist); + await context.SaveChangesAsync(); + + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId, shouldIgnoreThePrefixForAlphaPicker: true); + + // Act + Result> result = await sut.GetAllLiteAsync(null, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + // With the prefix stripped, the sort key of "The Beatles" is "beatles", which sorts before "beneath". + Assert.Equal(["The Beatles", "Beneath the Surface"], result.Value.Data.Select(row => row.Name)); + } + + [Fact] + public async Task GetAllLiteAsync_WhenCoverArtworkExists_ShouldReturnItsPath() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-artistrepo-lite-cover-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + ArtistRepository sut = CreateArtistRepository(context); + + Guid libraryId = Guid.NewGuid(); + ArtistEntity artist = _artistEntityFixture.Create(libraryId: libraryId, name: "Queen", includeAlbums: false, includeContributors: false); + context.Artists.Add(artist); + context.MusicArtwork.Add( + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, ownerId: artist.Id, artworkType: ArtworkType.Cover, fileName: "covers/queen.jpg")); + await context.SaveChangesAsync(); + + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId); + + // Act + Result> result = await sut.GetAllLiteAsync(null, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + ArtistLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal("covers/queen.jpg", row.CoverPath); + } + /// /// Seeds an artist that owns the requested number of albums, each with the requested number of tracks, all of them with distinct shared reference names. /// diff --git a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecificationTests.cs b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecificationTests.cs new file mode 100644 index 00000000..52eaaf2d --- /dev/null +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/Specifications/ArtistAlphaFilterSpecificationTests.cs @@ -0,0 +1,235 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Common.DTO.Filtering; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.DataAccess.Core.Repositories.MusicLibrary.Specifications; +using Lumina.DataAccess.Core.UoW; +using Microsoft.Data.Sqlite; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.DataAccess.IntegrationTests.Core.Repositories.MusicLibrary.Specifications; + +/// +/// Contains integration tests for the class, exercising it against a real SQLite database. +/// +[ExcludeFromCodeCoverage] +public class ArtistAlphaFilterSpecificationTests : IDisposable +{ + private readonly SqliteConnection _connection; + private readonly LuminaDbContext _context; + private readonly ArtistEntityFixture _artistEntityFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public ArtistAlphaFilterSpecificationTests() + { + // The specification translates to the SQLite glob() function, so it can only be exercised against a real SQLite database. + _connection = new SqliteConnection("Data Source=:memory:"); + _connection.Open(); + _context = new LuminaDbContext(new DbContextOptionsBuilder().UseSqlite(_connection).Options); + _context.Database.EnsureCreated(); + } + + [Fact] + public void ToExpression_WhenAlphaKeyIsNull_ShouldMatchEveryArtist() + { + // Arrange + List artists = SeedArtists("Alpha", "Beta", "1984"); + ArtistAlphaFilterSpecification specification = new(null, false); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression())]; + + // Assert + Assert.Equal(artists.Count, result.Count); + } + + [Fact] + public void ToExpression_WhenAlphaKeyIsALowercaseLetter_ShouldMatchOnlyArtistsWhoseNameStartsWithIt() + { + // Arrange + SeedArtists("Foo Fighters", "Helloween", "The Beatles"); + ArtistAlphaFilterSpecification specification = new("f", false); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression()).Select(artist => artist.Name)]; + + // Assert + Assert.Equal(["Foo Fighters"], result); + } + + [Fact] + public void ToExpression_WhenAlphaKeyIsAnUppercaseLetter_ShouldMatchArtistsWhoseNameStartsWithItsLowercase() + { + // Arrange + SeedArtists("Foo Fighters", "Helloween"); + ArtistAlphaFilterSpecification specification = new("F", false); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression()).Select(artist => artist.Name)]; + + // Assert + Assert.Equal(["Foo Fighters"], result); + } + + [Fact] + public void ToExpression_WhenNoNameStartsWithTheAlphaKey_ShouldNotMatchAnyArtist() + { + // Arrange + SeedArtists("Foo Fighters", "Helloween"); + ArtistAlphaFilterSpecification specification = new("z", false); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression())]; + + // Assert + Assert.Empty(result); + } + + [Fact] + public void ToExpression_WhenAlphaKeyIsTheNumberKey_ShouldMatchOnlyArtistsWhoseNameStartsWithADigit() + { + // Arrange + SeedArtists("1984", "Alpha", "Beta"); + ArtistAlphaFilterSpecification specification = new(LibraryItemAlphaKeys.NUMBER, false); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression()).Select(artist => artist.Name)]; + + // Assert + Assert.Equal(["1984"], result); + } + + [Fact] + public void ToExpression_WhenAlphaKeyIsTheSymbolKey_ShouldMatchOnlyArtistsWhoseNameStartsWithASymbol() + { + // Arrange + SeedArtists("!Important", "1984", "Alpha"); + ArtistAlphaFilterSpecification specification = new(LibraryItemAlphaKeys.SYMBOL, false); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression()).Select(artist => artist.Name)]; + + // Assert + Assert.Equal(["!Important"], result); + } + + [Fact] + public void ToExpression_WhenIgnoringThePrefixAndNameStartsWithThe_ShouldMatchOnTheStrippedName() + { + // Arrange + SeedArtists("The Beatles", "Adele"); + ArtistAlphaFilterSpecification specification = new("b", true); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression()).Select(artist => artist.Name)]; + + // Assert + Assert.Equal(["The Beatles"], result); + } + + [Fact] + public void ToExpression_WhenNotIgnoringThePrefixAndNameStartsWithThe_ShouldNotMatchOnTheStrippedName() + { + // Arrange + SeedArtists("The Beatles", "Adele"); + ArtistAlphaFilterSpecification specification = new("b", false); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression())]; + + // Assert + Assert.Empty(result); + } + + [Fact] + public void ToExpression_WhenAlphaKeyIsTheNumberKeyAndNameStartsWithASymbol_ShouldNotMatchIt() + { + // Arrange + SeedArtists("!Voyager", "1984", "Alpha"); + ArtistAlphaFilterSpecification specification = new(LibraryItemAlphaKeys.NUMBER, false); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression()).Select(artist => artist.Name)]; + + // Assert + // Only the artist whose name starts with a digit matches; a symbol and a letter do not. + Assert.Equal(["1984"], result); + } + + [Fact] + public void ToExpression_WhenAlphaKeyIsTheSymbolKeyAndNameIsEmpty_ShouldMatchIt() + { + // Arrange + SeedArtists(string.Empty); + ArtistAlphaFilterSpecification specification = new(LibraryItemAlphaKeys.SYMBOL, false); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression())]; + + // Assert + // An empty effective name is neither a letter nor a digit, so it is categorized as a symbol. + Assert.Single(result); + } + + [Fact] + public void ToExpression_WhenAlphaKeyIsALetterAndNameIsEmpty_ShouldNotMatchAnyArtist() + { + // Arrange + SeedArtists(string.Empty); + ArtistAlphaFilterSpecification specification = new("a", false); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression())]; + + // Assert + Assert.Empty(result); + } + + [Theory] + [InlineData("a", "Alpha")] // the first letter of the alphabet + [InlineData("b", "Bravo")] // a letter in the middle of the alphabet + [InlineData("c", "Charlie")] // another letter in the middle of the alphabet + public void ToExpression_WhenAlphaKeyIsALetter_ShouldMatchOnlyTheNamesStartingWithIt(string alphaKey, string matchingName) + { + // Arrange + SeedArtists("Alpha", "Bravo", "Charlie"); + ArtistAlphaFilterSpecification specification = new(alphaKey, false); + + // Act + List result = [.. _context.Artists.Where(specification.ToExpression()).Select(artist => artist.Name)]; + + // Assert + Assert.Equal([matchingName], result); + } + + /// + /// Seeds artists with the provided names. + /// + /// The names of the artists to seed. + /// The seeded instances. + private List SeedArtists(params string[] names) + { + List entities = []; + foreach (string name in names) + entities.Add(_artistEntityFixture.Create(name: name, includeAlbums: false, includeContributors: false)); + _context.Artists.AddRange(entities); + _context.SaveChanges(); + return entities; + } + + /// + /// Disposes the database context and its underlying connection. + /// + public void Dispose() + { + _context.Dispose(); + _connection.Dispose(); + } +} diff --git a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/TrackRepositoryTests.cs b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/TrackRepositoryTests.cs index 0d0279c9..f329ae5d 100644 --- a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/TrackRepositoryTests.cs +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/TrackRepositoryTests.cs @@ -567,7 +567,7 @@ public class TrackRepositoryTests List albumTracks = [firstDiscFirstTrack, firstDiscSecondTrack, secondDiscTrack]; Guid[] expectedOrder = [.. albumTracks - .OrderBy(track => track.DiscNumber) + .OrderBy(track => track.DiscNumber ?? 1) .ThenBy(track => track.TrackNumber) .ThenBy(track => track.Id) .Select(track => track.Id)]; @@ -634,6 +634,34 @@ public class TrackRepositoryTests Assert.Equal(3, page.PerPage); Assert.Equal(1, page.NumberOfPages); Assert.DoesNotContain(page.Data, row => row.Id == trackOfAnotherAlbum.Id); + Assert.Equal(tracks.Select(track => track.DurationInSeconds), page.Data.Select(row => row.DurationInSeconds)); + } + + [Fact] + public async Task GetTracksLiteByAlbumIdAsync_WhenATrackHasNoDiscNumber_ShouldTreatItAsTheFirstDisc() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-trackrepo-lite-nodisc-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + TrackRepository sut = new(context); + + Guid libraryId = Guid.NewGuid(); + AlbumEntity album = await SeedAlbumAsync(context, libraryId); + TrackEntity secondTrackWithoutDiscNumber = _trackEntityFixture.Create(albumId: album.Id, libraryId: libraryId, path: "/music/queen/second.flac", trackNumber: 2, includeMetadata: false); + secondTrackWithoutDiscNumber.DiscNumber = null; + TrackEntity thirdTrack = _trackEntityFixture.Create(albumId: album.Id, libraryId: libraryId, path: "/music/queen/third.flac", trackNumber: 3, includeMetadata: false); + thirdTrack.DiscNumber = 1; + context.Tracks.AddRange(secondTrackWithoutDiscNumber, thirdTrack); + await context.SaveChangesAsync(); + + // Act + Result> result = await sut.GetTracksLiteByAlbumIdAsync(album.Id, null, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal([secondTrackWithoutDiscNumber.Id, thirdTrack.Id], result.Value.Data.Select(row => row.Id)); } [Theory] @@ -686,6 +714,60 @@ public class TrackRepositoryTests Assert.Equal(expectedRowCount, page.Data.Count); } + [Fact] + public async Task GetByAlbumIdAsync_WhenATrackHasNoDiscNumber_ShouldTreatItAsTheFirstDisc() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-trackrepo-nodisc-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + TrackRepository sut = new(context); + + Guid libraryId = Guid.NewGuid(); + AlbumEntity album = await SeedAlbumAsync(context, libraryId); + TrackEntity secondDiscTrack = _trackEntityFixture.Create(albumId: album.Id, libraryId: libraryId, path: "/music/queen/second-disc.flac", trackNumber: 1, includeMetadata: false); + secondDiscTrack.DiscNumber = 2; + TrackEntity trackWithoutDiscNumber = _trackEntityFixture.Create(albumId: album.Id, libraryId: libraryId, path: "/music/queen/first-disc.flac", trackNumber: 2, includeMetadata: false); + trackWithoutDiscNumber.DiscNumber = null; + context.Tracks.AddRange(secondDiscTrack, trackWithoutDiscNumber); + await context.SaveChangesAsync(); + + // Act + Result> result = await sut.GetByAlbumIdAsync(album.Id, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + // A track without a disc number belongs to the first disc, so it is ordered before the tracks of disc 2. + Assert.Equal([trackWithoutDiscNumber.Id, secondDiscTrack.Id], result.Value.Select(track => track.Id)); + } + + [Fact] + public async Task GetTracksLiteByAlbumIdAsync_WhenCalled_ShouldProjectTheDurationInSeconds() + { + // Arrange + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-trackrepo-lite-duration-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + TrackRepository sut = new(context); + + Guid libraryId = Guid.NewGuid(); + AlbumEntity album = await SeedAlbumAsync(context, libraryId); + TrackEntity track = _trackEntityFixture.Create(albumId: album.Id, libraryId: libraryId, path: "/music/queen/the-prophet-song.flac", includeMetadata: false); + track.DurationInSeconds = 367; + context.Tracks.Add(track); + await context.SaveChangesAsync(); + + // Act + Result> result = await sut.GetTracksLiteByAlbumIdAsync(album.Id, null, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + TrackLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal(367, row.DurationInSeconds); + } + /// /// Seeds an artist and the album that owns the tracks of the library identified by , so that the required foreign keys of a track are satisfied. /// diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointTests.cs index bd61749b..3549457c 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetAlbumTracksLite/GetAlbumTracksLiteEndpointTests.cs @@ -77,6 +77,7 @@ public class GetAlbumTracksLiteEndpointTests : IClassFixture 0); } [Fact] diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointTests.cs index 43ae7fdc..4f29f269 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistAlbumsLite/GetArtistAlbumsLiteEndpointTests.cs @@ -18,6 +18,7 @@ using System.Net; using System.Net.Http; using System.Net.Http.Json; using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading.Tasks; #endregion @@ -33,7 +34,8 @@ public class GetArtistAlbumsLiteEndpointTests : IClassFixture album.Title == "A Night at the Opera"); Assert.Contains(albums.Data, album => album.Title == "News of the World"); + // The release types and the release year are exposed by the read model, so the lite listing can group and order the releases of an artist. + Assert.All(albums.Data, album => Assert.NotEmpty(album.ReleaseTypes!)); } [Fact] diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointTests.cs index 418651dd..82ae0dd4 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetArtistsLite/GetArtistsLiteEndpointTests.cs @@ -97,6 +97,155 @@ public class GetArtistsLiteEndpointTests : IClassFixture? paginatedArtists = await response.Content.ReadFromJsonAsync>(_jsonOptions); + Assert.NotNull(paginatedArtists); + ArtistLiteResponse artist = Assert.Single(paginatedArtists!.Data); + Assert.Equal("Queen", artist.Name); + Assert.Equal(1, paginatedArtists.Count); + } + + [Fact] + public async Task GetArtistsLite_WhenCalledWithFilterAlphaKeyLetterAndIgnoreThePrefix_ShouldIncludeThePrefixedNames() + { + // Arrange + Guid userId = GetCurrentUserId(); + Guid libraryId = await SeedLibraryAsync(userId); + await SeedArtistAsync(libraryId, "Queen"); + await SeedArtistAsync(libraryId, "The Queen"); + await SeedArtistAsync(libraryId, "Radiohead"); + + // Act + HttpResponseMessage response = await _client.GetAsync($"/api/v1/libraries/{libraryId}/artists/lite?filterAlphaKey=q&shouldIgnoreThePrefixForAlphaPicker=true"); + + // Assert + response.EnsureSuccessStatusCode(); + PaginatedResponse? paginatedArtists = await response.Content.ReadFromJsonAsync>(_jsonOptions); + Assert.NotNull(paginatedArtists); + Assert.Equal(2, paginatedArtists!.Count); + Assert.Contains(paginatedArtists.Data, artist => artist.Name == "Queen"); + Assert.Contains(paginatedArtists.Data, artist => artist.Name == "The Queen"); + } + + [Fact] + public async Task GetArtistsLite_WhenCalledWithFilterAlphaKeyNumber_ShouldReturnOnlyArtistsStartingWithADigit() + { + // Arrange + Guid userId = GetCurrentUserId(); + Guid libraryId = await SeedLibraryAsync(userId); + await SeedArtistAsync(libraryId, "1984"); + await SeedArtistAsync(libraryId, "7th Sense"); + await SeedArtistAsync(libraryId, "Adele"); + + // Act + HttpResponseMessage response = await _client.GetAsync($"/api/v1/libraries/{libraryId}/artists/lite?filterAlphaKey=%23"); + + // Assert + response.EnsureSuccessStatusCode(); + PaginatedResponse? paginatedArtists = await response.Content.ReadFromJsonAsync>(_jsonOptions); + Assert.NotNull(paginatedArtists); + Assert.Equal(2, paginatedArtists!.Count); + Assert.Contains(paginatedArtists.Data, artist => artist.Name == "1984"); + Assert.Contains(paginatedArtists.Data, artist => artist.Name == "7th Sense"); + } + + [Fact] + public async Task GetArtistsLite_WhenCalledWithFilterAlphaKeySymbol_ShouldReturnOnlyArtistsStartingWithASymbol() + { + // Arrange + Guid userId = GetCurrentUserId(); + Guid libraryId = await SeedLibraryAsync(userId); + await SeedArtistAsync(libraryId, "!Important"); + await SeedArtistAsync(libraryId, "1984"); + await SeedArtistAsync(libraryId, "Adele"); + + // Act + HttpResponseMessage response = await _client.GetAsync($"/api/v1/libraries/{libraryId}/artists/lite?filterAlphaKey=%2A"); + + // Assert + response.EnsureSuccessStatusCode(); + PaginatedResponse? paginatedArtists = await response.Content.ReadFromJsonAsync>(_jsonOptions); + Assert.NotNull(paginatedArtists); + ArtistLiteResponse artist = Assert.Single(paginatedArtists!.Data); + Assert.Equal("!Important", artist.Name); + Assert.Equal(1, paginatedArtists.Count); + } + + [Fact] + public async Task GetArtistsLite_WhenCalledWithSearchTermAndFilterAlphaKey_ShouldReturnOnlyArtistsSatisfyingBothFilters() + { + // Arrange + Guid userId = GetCurrentUserId(); + Guid libraryId = await SeedLibraryAsync(userId); + // The search term matches only one artist, while the alpha key matches only the other, so no artist satisfies both filters at once. + await SeedArtistAsync(libraryId, "The Fellowship Band"); + await SeedArtistAsync(libraryId, "Zoo"); + + // Act + HttpResponseMessage response = await _client.GetAsync($"/api/v1/libraries/{libraryId}/artists/lite?searchTerm={Uri.EscapeDataString("Fellowship")}&filterAlphaKey=z"); + + // Assert + response.EnsureSuccessStatusCode(); + PaginatedResponse? paginatedArtists = await response.Content.ReadFromJsonAsync>(_jsonOptions); + Assert.NotNull(paginatedArtists); + Assert.Empty(paginatedArtists!.Data); + Assert.Equal(0, paginatedArtists.Count); + } + + [Fact] + public async Task GetArtistsLite_WhenSortedByNameAscending_ShouldReturnArtistsInAscendingOrder() + { + // Arrange + Guid userId = GetCurrentUserId(); + Guid libraryId = await SeedLibraryAsync(userId); + await SeedArtistAsync(libraryId, "Zulu"); + await SeedArtistAsync(libraryId, "Mike"); + await SeedArtistAsync(libraryId, "Alpha"); + + // Act + HttpResponseMessage response = await _client.GetAsync($"/api/v1/libraries/{libraryId}/artists/lite?sortBy=name&sortOrder=Ascending"); + + // Assert + response.EnsureSuccessStatusCode(); + PaginatedResponse? paginatedArtists = await response.Content.ReadFromJsonAsync>(_jsonOptions); + Assert.NotNull(paginatedArtists); + Assert.Equal(new[] { "Alpha", "Mike", "Zulu" }, paginatedArtists!.Data.Select(artist => artist.Name)); + } + + [Fact] + public async Task GetArtistsLite_WhenSortedByNameDescending_ShouldReturnArtistsInDescendingOrder() + { + // Arrange + Guid userId = GetCurrentUserId(); + Guid libraryId = await SeedLibraryAsync(userId); + await SeedArtistAsync(libraryId, "Zulu"); + await SeedArtistAsync(libraryId, "Mike"); + await SeedArtistAsync(libraryId, "Alpha"); + + // Act + HttpResponseMessage response = await _client.GetAsync($"/api/v1/libraries/{libraryId}/artists/lite?sortBy=name&sortOrder=Descending"); + + // Assert + response.EnsureSuccessStatusCode(); + PaginatedResponse? paginatedArtists = await response.Content.ReadFromJsonAsync>(_jsonOptions); + Assert.NotNull(paginatedArtists); + Assert.Equal(new[] { "Zulu", "Mike", "Alpha" }, paginatedArtists!.Data.Select(artist => artist.Name)); + } + [Fact] public async Task GetArtistsLite_WhenLibraryBelongsToAnotherUser_ShouldReturnForbidden() { diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMappingTests.cs index 7da1e576..35de8edf 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumEntityMappingTests.cs @@ -261,6 +261,8 @@ public class AlbumEntityMappingTests Assert.Equal(entity.Id, result.Id); Assert.Equal(entity.ArtistId, result.ArtistId); Assert.Equal(entity.LibraryId, result.LibraryId); + // No cover path is supplied by default, so the response exposes none. + Assert.Null(result.CoverPath); Assert.Equal(entity.Title, result.Metadata.Title); Assert.Equal(entity.OriginalTitle, result.Metadata.OriginalTitle); Assert.Equal(entity.Description, result.Metadata.Description); @@ -346,4 +348,19 @@ public class AlbumEntityMappingTests Assert.Equal(entities[i].Title, results[i].Metadata.Title); } } + + [Fact] + public void ToResponse_WhenCoverPathIsProvided_ShouldMapIt() + { + // Arrange + AlbumEntity entity = _albumEntityFixture.Create(); + string coverPath = "/media/albums/cover.jpg"; + + // Act + AlbumResponse result = entity.ToResponse(coverPath); + + // Assert + Assert.NotNull(result); + Assert.Equal(coverPath, result.CoverPath); + } } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMappingTests.cs index eb0cc111..731b0cd2 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumLiteRowMappingTests.cs @@ -36,6 +36,9 @@ public class AlbumLiteRowMappingTests Assert.Equal(readModel.Id, result.Id); Assert.Equal(readModel.Title, result.Title); Assert.Equal(readModel.TotalTracks, result.TotalTracks); + Assert.Equal(readModel.CoverPath, result.CoverPath); + Assert.Equal(readModel.ReleaseYear, result.ReleaseYear); + Assert.Equal(readModel.ReleaseTypes, result.ReleaseTypes); } [Fact] @@ -53,6 +56,9 @@ public class AlbumLiteRowMappingTests Assert.Equal(readModels.Select(readModel => readModel.Id), results.Select(response => response.Id)); Assert.Equal(readModels.Select(readModel => readModel.Title), results.Select(response => response.Title)); Assert.Equal(readModels.Select(readModel => readModel.TotalTracks), results.Select(response => response.TotalTracks)); + Assert.Equal(readModels.Select(readModel => readModel.CoverPath), results.Select(response => response.CoverPath)); + Assert.Equal(readModels.Select(readModel => readModel.ReleaseYear), results.Select(response => response.ReleaseYear)); + Assert.Equal(readModels.Select(readModel => readModel.ReleaseTypes), results.Select(response => response.ReleaseTypes)); } [Fact] diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMappingTests.cs index cec0e8fc..13b3da21 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistEntityMappingTests.cs @@ -113,6 +113,8 @@ public class ArtistEntityMappingTests Assert.NotNull(result); Assert.Equal(entity.Id, result.Id); Assert.Equal(entity.LibraryId, result.LibraryId); + // No cover path is supplied by default, so the response exposes none. + Assert.Null(result.CoverPath); Assert.Equal(entity.Name, result.Metadata.Name); Assert.Equal(entity.Website, result.Website); Assert.Equal(entity.MusicBrainzArtistId, result.MusicBrainzArtistId); @@ -186,4 +188,19 @@ public class ArtistEntityMappingTests Assert.Equal(paginatedEntities.Count, result.Count); Assert.Equal(paginatedEntities.NumberOfPages, result.NumberOfPages); } + + [Fact] + public void ToResponse_WhenCoverPathIsProvided_ShouldMapIt() + { + // Arrange + ArtistEntity entity = _artistEntityFixture.Create(); + string coverPath = "/media/artists/cover.jpg"; + + // Act + ArtistResponse result = entity.ToResponse(coverPath); + + // Assert + Assert.NotNull(result); + Assert.Equal(coverPath, result.CoverPath); + } } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMappingTests.cs index e630aa00..01a3b36b 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistLiteRowMappingTests.cs @@ -35,6 +35,7 @@ public class ArtistLiteRowMappingTests Assert.NotNull(result); Assert.Equal(readModel.Id, result.Id); Assert.Equal(readModel.Name, result.Name); + Assert.Equal(readModel.CoverPath, result.CoverPath); } [Fact] @@ -51,6 +52,7 @@ public class ArtistLiteRowMappingTests Assert.Equal(readModels.Count, results.Count); Assert.Equal(readModels.Select(readModel => readModel.Id), results.Select(response => response.Id)); Assert.Equal(readModels.Select(readModel => readModel.Name), results.Select(response => response.Name)); + Assert.Equal(readModels.Select(readModel => readModel.CoverPath), results.Select(response => response.CoverPath)); } [Fact] diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMappingTests.cs index 9f8c28df..e390f115 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/GetArtistsLiteRequestMappingTests.cs @@ -3,6 +3,7 @@ using Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.A using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtistsLite; using Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists; using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using Lumina.Domain.SharedKernel.Common.Enums.Common; using System.Diagnostics.CodeAnalysis; #endregion @@ -99,4 +100,24 @@ public class GetArtistsLiteRequestMappingTests Assert.Equal(2, result.PaginationData.CurrentPage); Assert.Equal(25, result.PaginationData.PerPage); } + + [Fact] + public void ToQuery_WhenAlphaAndSortingAreProvided_ShouldMapThem() + { + // Arrange + GetArtistsLiteRequest request = _getArtistsLiteRequestFixture.Create( + filterAlphaKey: "q", + shouldIgnoreThePrefixForAlphaPicker: true, + sortBy: "name", + sortOrder: SortOrder.Descending); + + // Act + GetArtistsLiteQuery result = request.ToQuery("library-route"); + + // Assert + Assert.Equal("q", result.FilterAlphaKey); + Assert.True(result.ShouldIgnoreThePrefixForAlphaPicker); + Assert.Equal("name", result.SortBy); + Assert.Equal(SortOrder.Descending, result.SortOrder); + } } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMappingTests.cs index b3f06a6f..56fd9ad8 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackLiteRowMappingTests.cs @@ -37,6 +37,7 @@ public class TrackLiteRowMappingTests Assert.Equal(readModel.Title, result.Title); Assert.Equal(readModel.TrackNumber, result.TrackNumber); Assert.Equal(readModel.DiscNumber, result.DiscNumber); + Assert.Equal(readModel.DurationInSeconds, result.DurationInSeconds); } [Fact] diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandlerTests.cs index 32e9b1a1..460f25ea 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Queries/GetAlbum/GetAlbumQueryHandlerTests.cs @@ -12,8 +12,11 @@ using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Al using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using NSubstitute; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -30,12 +33,14 @@ public class GetAlbumQueryHandlerTests { private readonly IUnitOfWork _mockUnitOfWork; private readonly IAlbumRepository _mockAlbumRepository; + private readonly IMusicArtworkRepository _mockMusicArtworkRepository; private readonly IAuthorizationService _mockAuthorizationService; private readonly ICurrentUserService _mockCurrentUserService; private readonly IValidator _mockValidator; private readonly GetAlbumQueryHandler _sut; private readonly Guid _userId; private readonly AlbumEntityFixture _albumEntityFixture = new(); + private readonly MusicArtworkEntityFixture _musicArtworkEntityFixture = new(); private readonly GetAlbumQueryFixture _getAlbumQueryFixture = new(); /// @@ -44,18 +49,22 @@ public class GetAlbumQueryHandlerTests public GetAlbumQueryHandlerTests() { _mockAlbumRepository = Substitute.For(); + _mockMusicArtworkRepository = Substitute.For(); _mockUnitOfWork = Substitute.For(); _mockUnitOfWork.AlbumRepository.Returns(_mockAlbumRepository); + _mockUnitOfWork.MusicArtworkRepository.Returns(_mockMusicArtworkRepository); _mockAuthorizationService = Substitute.For(); _mockCurrentUserService = Substitute.For(); _mockValidator = Substitute.For>(); _userId = Guid.NewGuid(); - // Default stubs: the current user is authenticated, the library ownership policy allows access and the validator passes. + // Default stubs: the current user is authenticated, the library ownership policy allows access, the validator passes, and the album has no stored artwork. _mockCurrentUserService.UserId.Returns(_userId); _mockAuthorizationService.EvaluatePolicyAsync(_userId, Arg.Any(), Arg.Any()) .Returns(true); _mockValidator.Validate(Arg.Any()).Returns([]); + _mockMusicArtworkRepository.GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From>([])); _sut = new GetAlbumQueryHandler(_mockUnitOfWork, _mockAuthorizationService, _mockCurrentUserService, _mockValidator); } @@ -70,6 +79,13 @@ public class GetAlbumQueryHandlerTests AlbumEntity album = _albumEntityFixture.Create(id: albumId, artistId: artistId, libraryId: libraryId, includeTracks: true, includeMetadata: true); _mockAlbumRepository.GetByIdAsync(albumId, shouldIncludeNavigationProperties: true, shouldTrackEntities: false, cancellationToken: Arg.Any()) .Returns(Result.From(album)); + List artwork = [ + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, artworkType: ArtworkType.Cover, ordinal: 0, fileName: "/media/cover.jpg"), + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, artworkType: ArtworkType.Back, ordinal: 0, fileName: "/media/back.jpg"), + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, artworkType: ArtworkType.Booklet, ordinal: 0, includeFileName: false) + ]; + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()) + .Returns(Result.From>(artwork)); GetAlbumQuery query = _getAlbumQueryFixture.Create(libraryId: libraryId.ToString(), artistId: artistId.ToString(), albumId: albumId.ToString()); // Act @@ -83,6 +99,13 @@ public class GetAlbumQueryHandlerTests Assert.Equal(album.Title, result.Value.Metadata.Title); Assert.NotNull(result.Value.Tracks); Assert.Equal(album.Tracks.Count, result.Value.Tracks!.Count); + // The cover is exposed on its own, and every stored piece of artwork is exposed in order, while the ones whose file is not stored yet are left out. + Assert.Equal("/media/cover.jpg", result.Value.CoverPath); + Assert.Equal(2, result.Value.Artwork.Count); + Assert.Equal(ArtworkType.Cover, result.Value.Artwork[0].Type); + Assert.Equal("/media/cover.jpg", result.Value.Artwork[0].Path); + Assert.Equal(ArtworkType.Back, result.Value.Artwork[1].Type); + Assert.Equal("/media/back.jpg", result.Value.Artwork[1].Path); await _mockAlbumRepository.Received(1).GetByIdAsync(albumId, shouldIncludeNavigationProperties: true, shouldTrackEntities: false, cancellationToken: Arg.Any()); await _mockAuthorizationService.Received(1).EvaluatePolicyAsync( _userId, Arg.Is(context => context.LibraryId == libraryId), Arg.Any()); @@ -220,4 +243,112 @@ public class GetAlbumQueryHandlerTests await _mockAlbumRepository.DidNotReceive().GetByIdAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); await _mockAuthorizationService.DidNotReceive().EvaluatePolicyAsync(Arg.Any(), Arg.Any(), Arg.Any()); } + + [Fact] + public async Task HandleAsync_WhenArtworkRepositoryFails_ShouldReturnFailureResult() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create(id: albumId, artistId: artistId, libraryId: libraryId); + GetAlbumQuery query = _getAlbumQueryFixture.Create(libraryId: libraryId.ToString(), artistId: artistId.ToString(), albumId: albumId.ToString()); + _mockAlbumRepository.GetByIdAsync(albumId, shouldIncludeNavigationProperties: true, shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(album)); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.HandleAsync(query, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + } + + [Fact] + public async Task HandleAsync_WhenAlbumHasNoArtwork_ShouldReturnNullCoverPathAndEmptyArtwork() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create(id: albumId, artistId: artistId, libraryId: libraryId); + GetAlbumQuery query = _getAlbumQueryFixture.Create(libraryId: libraryId.ToString(), artistId: artistId.ToString(), albumId: albumId.ToString()); + _mockAlbumRepository.GetByIdAsync(albumId, shouldIncludeNavigationProperties: true, shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(album)); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()) + .Returns(Result.From>([])); + + // Act + Result result = await _sut.HandleAsync(query, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Null(result.Value.CoverPath); + Assert.Empty(result.Value.Artwork); + } + + [Fact] + public async Task HandleAsync_WhenMultipleArtworkExist_ShouldMapEveryStoredArtworkAndExcludeUnstoredOnes() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create(id: albumId, artistId: artistId, libraryId: libraryId); + GetAlbumQuery query = _getAlbumQueryFixture.Create(libraryId: libraryId.ToString(), artistId: artistId.ToString(), albumId: albumId.ToString()); + _mockAlbumRepository.GetByIdAsync(albumId, shouldIncludeNavigationProperties: true, shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(album)); + List artwork = [ + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, artworkType: ArtworkType.Cover, ordinal: 0, fileName: "/media/cover.jpg"), + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, artworkType: ArtworkType.Booklet, ordinal: 1, includeFileName: false), + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, artworkType: ArtworkType.Booklet, ordinal: 2, fileName: string.Empty), + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, artworkType: ArtworkType.Booklet, ordinal: 3, fileName: " "), + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, artworkType: ArtworkType.Back, ordinal: 0, fileName: "/media/back.jpg") + ]; + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()) + .Returns(Result.From>(artwork)); + + // Act + Result result = await _sut.HandleAsync(query, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + // Artwork whose file has not been stored yet (null, empty or whitespace) is left out, and the stored ones keep their order, type and ordinal. + Assert.Equal(2, result.Value.Artwork.Count); + Assert.Equal(ArtworkType.Cover, result.Value.Artwork[0].Type); + Assert.Equal(0, result.Value.Artwork[0].Ordinal); + Assert.Equal("/media/cover.jpg", result.Value.Artwork[0].Path); + Assert.Equal(ArtworkType.Back, result.Value.Artwork[1].Type); + Assert.Equal(0, result.Value.Artwork[1].Ordinal); + Assert.Equal("/media/back.jpg", result.Value.Artwork[1].Path); + await _mockMusicArtworkRepository.Received(1).GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenMultipleCoversExist_ShouldUseTheFirstCoverFileName() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create(id: albumId, artistId: artistId, libraryId: libraryId); + GetAlbumQuery query = _getAlbumQueryFixture.Create(libraryId: libraryId.ToString(), artistId: artistId.ToString(), albumId: albumId.ToString()); + _mockAlbumRepository.GetByIdAsync(albumId, shouldIncludeNavigationProperties: true, shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(album)); + List artwork = [ + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, artworkType: ArtworkType.Cover, ordinal: 0, fileName: "/media/front.jpg"), + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, artworkType: ArtworkType.Cover, ordinal: 1, fileName: "/media/alternate.jpg") + ]; + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()) + .Returns(Result.From>(artwork)); + + // Act + Result result = await _sut.HandleAsync(query, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal("/media/front.jpg", result.Value.CoverPath); + } } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandlerTests.cs index bde4ff41..678b69e1 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtist/GetArtistQueryHandlerTests.cs @@ -12,8 +12,11 @@ using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Ar using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using NSubstitute; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -30,12 +33,14 @@ public class GetArtistQueryHandlerTests { private readonly IUnitOfWork _mockUnitOfWork; private readonly IArtistRepository _mockArtistRepository; + private readonly IMusicArtworkRepository _mockMusicArtworkRepository; private readonly IAuthorizationService _mockAuthorizationService; private readonly ICurrentUserService _mockCurrentUserService; private readonly IValidator _mockValidator; private readonly GetArtistQueryHandler _sut; private readonly Guid _userId; private readonly ArtistEntityFixture _artistEntityFixture = new(); + private readonly MusicArtworkEntityFixture _musicArtworkEntityFixture = new(); private readonly GetArtistQueryFixture _getArtistQueryFixture = new(); /// @@ -44,18 +49,22 @@ public class GetArtistQueryHandlerTests public GetArtistQueryHandlerTests() { _mockArtistRepository = Substitute.For(); + _mockMusicArtworkRepository = Substitute.For(); _mockUnitOfWork = Substitute.For(); _mockUnitOfWork.ArtistRepository.Returns(_mockArtistRepository); + _mockUnitOfWork.MusicArtworkRepository.Returns(_mockMusicArtworkRepository); _mockAuthorizationService = Substitute.For(); _mockCurrentUserService = Substitute.For(); _mockValidator = Substitute.For>(); _userId = Guid.NewGuid(); - // Default stubs: the current user is authenticated, the library ownership policy allows access and the validator passes. + // Default stubs: the current user is authenticated, the library ownership policy allows access, the validator passes, and the artist has no stored artwork. _mockCurrentUserService.UserId.Returns(_userId); _mockAuthorizationService.EvaluatePolicyAsync(_userId, Arg.Any(), Arg.Any()) .Returns(true); _mockValidator.Validate(Arg.Any()).Returns([]); + _mockMusicArtworkRepository.GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From>([])); _sut = new GetArtistQueryHandler(_mockUnitOfWork, _mockAuthorizationService, _mockCurrentUserService, _mockValidator); } @@ -199,4 +208,97 @@ public class GetArtistQueryHandlerTests await _mockArtistRepository.DidNotReceive().GetByIdAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); await _mockAuthorizationService.DidNotReceive().EvaluatePolicyAsync(Arg.Any(), Arg.Any(), Arg.Any()); } + + [Fact] + public async Task HandleAsync_WhenArtworkRepositoryFails_ShouldReturnFailureResult() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + ArtistEntity artist = _artistEntityFixture.Create(id: artistId, libraryId: libraryId); + GetArtistQuery query = _getArtistQueryFixture.Create(libraryId: libraryId.ToString(), artistId: artistId.ToString()); + _mockArtistRepository.GetByIdAsync(artistId, shouldIncludeNavigationProperties: true, shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(artist)); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Artist, artistId, Arg.Any()) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.HandleAsync(query, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + } + + [Fact] + public async Task HandleAsync_WhenArtistHasNoArtwork_ShouldReturnNullCoverPath() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + ArtistEntity artist = _artistEntityFixture.Create(id: artistId, libraryId: libraryId); + GetArtistQuery query = _getArtistQueryFixture.Create(libraryId: libraryId.ToString(), artistId: artistId.ToString()); + _mockArtistRepository.GetByIdAsync(artistId, shouldIncludeNavigationProperties: true, shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(artist)); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Artist, artistId, Arg.Any()) + .Returns(Result.From>([])); + + // Act + Result result = await _sut.HandleAsync(query, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Null(result.Value.CoverPath); + } + + [Fact] + public async Task HandleAsync_WhenArtistHasCoverArtwork_ShouldMapCoverPathAndRequestArtistArtwork() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + ArtistEntity artist = _artistEntityFixture.Create(id: artistId, libraryId: libraryId); + GetArtistQuery query = _getArtistQueryFixture.Create(libraryId: libraryId.ToString(), artistId: artistId.ToString()); + _mockArtistRepository.GetByIdAsync(artistId, shouldIncludeNavigationProperties: true, shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(artist)); + List artwork = [ + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, ownerId: artistId, artworkType: ArtworkType.Cover, ordinal: 0, fileName: "/media/artist.jpg") + ]; + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Artist, artistId, Arg.Any()) + .Returns(Result.From>(artwork)); + + // Act + Result result = await _sut.HandleAsync(query, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal("/media/artist.jpg", result.Value.CoverPath); + await _mockMusicArtworkRepository.Received(1).GetByOwnerAsync(MusicArtworkOwnerType.Artist, artistId, Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenTheCoverHasNoStoredFileName_ShouldReturnNullCoverPath() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + ArtistEntity artist = _artistEntityFixture.Create(id: artistId, libraryId: libraryId); + GetArtistQuery query = _getArtistQueryFixture.Create(libraryId: libraryId.ToString(), artistId: artistId.ToString()); + _mockArtistRepository.GetByIdAsync(artistId, shouldIncludeNavigationProperties: true, shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(artist)); + // A cover whose file has not been stored yet yields no cover path, even when another piece of artwork is already stored. + List artwork = [ + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, ownerId: artistId, artworkType: ArtworkType.Cover, ordinal: 0, includeFileName: false), + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, ownerId: artistId, artworkType: ArtworkType.Back, ordinal: 0, fileName: "/media/back.jpg") + ]; + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Artist, artistId, Arg.Any()) + .Returns(Result.From>(artwork)); + + // Act + Result result = await _sut.HandleAsync(query, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Null(result.Value.CoverPath); + } } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandlerTests.cs index 1b4f19bb..a95d1531 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryHandlerTests.cs @@ -247,4 +247,41 @@ public class GetArtistsLiteQueryHandlerTests await _mockAuthorizationService.DidNotReceive().EvaluatePolicyAsync(Arg.Any(), Arg.Any(), Arg.Any()); await _mockArtistRepository.DidNotReceive().GetAllLiteAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), cancellationToken: Arg.Any()); } + + [Fact] + public async Task HandleAsync_WhenQueryHasAlphaFilterAndSorting_ShouldPassThemToTheRepository() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + GetArtistsLiteQuery query = _getArtistsLiteQueryFixture.Create( + libraryId: libraryId.ToString(), + searchTerm: "Queen", + filterAlphaKey: "Q", + shouldIgnoreThePrefixForAlphaPicker: true, + sortBy: "name", + sortOrder: SortOrder.Descending); + PaginatedResultDto paginatedArtists = _paginatedResultDtoFixture.Create(data: [], currentPage: 1, perPage: 10, count: 0, numberOfPages: 0); + _mockArtistRepository.GetAllLiteAsync( + Arg.Any(), + Arg.Any(), + Arg.Any(), + Arg.Any(), + cancellationToken: Arg.Any()) + .Returns(Result.From(paginatedArtists)); + + // Act + await _sut.HandleAsync(query, CancellationToken.None); + + // Assert + await _mockArtistRepository.Received(1).GetAllLiteAsync( + Arg.Any(), + Arg.Is(sortBy => sortBy == "name"), + Arg.Is(sortOrder => sortOrder == SortOrder.Descending), + Arg.Is(filter => + filter.LibraryId == libraryId && + filter.SearchTerm == "Queen" && + filter.FilterAlphaKey == "Q" && + filter.ShouldIgnoreThePrefixForAlphaPicker), + cancellationToken: Arg.Any()); + } } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidatorTests.cs index a2335d28..3fd9bc1c 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidatorTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Queries/GetArtistsLite/GetArtistsLiteQueryValidatorTests.cs @@ -1,4 +1,5 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DTO.Filtering; using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtistsLite; using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Queries.GetArtistsLite; using Lumina.Application.UnitTests.Common.Setup; @@ -63,4 +64,155 @@ public class GetArtistsLiteQueryValidatorTests // Assert result.ShouldNotHaveAnyValidationErrors(); } + + [Theory] + [InlineData("AB")] // more than one character + [InlineData("1")] // a digit, which is not a letter, the number bucket, or the symbol bucket + public void Validate_WhenFilterAlphaKeyIsNotASingleLetterOrSpecialKey_ShouldHaveValidationError(string filterAlphaKey) + { + // Arrange + GetArtistsLiteQuery query = _getArtistsLiteQueryFixture.Create(filterAlphaKey: filterAlphaKey); + + // Act + List result = _validator.TestValidate(query); + + // Assert + result.ShouldHaveValidationError(Errors.Library.InvalidFilterAlphaKey); + } + + [Theory] + [InlineData("Q")] // a single letter + [InlineData("q")] // a single lower case letter + [InlineData("#")] // the number bucket + [InlineData("*")] // the symbol bucket + public void Validate_WhenFilterAlphaKeyIsASingleLetterOrSpecialKey_ShouldNotHaveValidationError(string filterAlphaKey) + { + // Arrange + GetArtistsLiteQuery query = _getArtistsLiteQueryFixture.Create(filterAlphaKey: filterAlphaKey); + + // Act + List result = _validator.TestValidate(query); + + // Assert + result.ShouldNotHaveAnyValidationErrors(); + } + + [Fact] + public void Validate_WhenFilterAlphaKeyIsNull_ShouldNotHaveValidationError() + { + // Arrange + GetArtistsLiteQuery query = _getArtistsLiteQueryFixture.Create(filterAlphaKey: null); + + // Act + List result = _validator.TestValidate(query); + + // Assert + result.ShouldNotHaveAnyValidationErrors(); + } + + [Theory] + [InlineData(LibraryItemAlphaKeys.NUMBER)] // the number bucket constant + [InlineData(LibraryItemAlphaKeys.SYMBOL)] // the symbol bucket constant + public void Validate_WhenFilterAlphaKeyIsTheSpecialConstant_ShouldNotHaveValidationError(string filterAlphaKey) + { + // Arrange + GetArtistsLiteQuery query = _getArtistsLiteQueryFixture.Create(filterAlphaKey: filterAlphaKey); + + // Act + List result = _validator.TestValidate(query); + + // Assert + result.ShouldNotHaveAnyValidationErrors(); + } + + [Theory] + [InlineData("A")] // upper case A + [InlineData("B")] // upper case B + [InlineData("C")] // upper case C + [InlineData("D")] // upper case D + [InlineData("E")] // upper case E + [InlineData("F")] // upper case F + [InlineData("G")] // upper case G + [InlineData("H")] // upper case H + [InlineData("I")] // upper case I + [InlineData("J")] // upper case J + [InlineData("K")] // upper case K + [InlineData("L")] // upper case L + [InlineData("M")] // upper case M + [InlineData("N")] // upper case N + [InlineData("O")] // upper case O + [InlineData("P")] // upper case P + [InlineData("Q")] // upper case Q + [InlineData("R")] // upper case R + [InlineData("S")] // upper case S + [InlineData("T")] // upper case T + [InlineData("U")] // upper case U + [InlineData("V")] // upper case V + [InlineData("W")] // upper case W + [InlineData("X")] // upper case X + [InlineData("Y")] // upper case Y + [InlineData("Z")] // upper case Z + [InlineData("a")] // lower case a + [InlineData("b")] // lower case b + [InlineData("c")] // lower case c + [InlineData("d")] // lower case d + [InlineData("e")] // lower case e + [InlineData("f")] // lower case f + [InlineData("g")] // lower case g + [InlineData("h")] // lower case h + [InlineData("i")] // lower case i + [InlineData("j")] // lower case j + [InlineData("k")] // lower case k + [InlineData("l")] // lower case l + [InlineData("m")] // lower case m + [InlineData("n")] // lower case n + [InlineData("o")] // lower case o + [InlineData("p")] // lower case p + [InlineData("q")] // lower case q + [InlineData("r")] // lower case r + [InlineData("s")] // lower case s + [InlineData("t")] // lower case t + [InlineData("u")] // lower case u + [InlineData("v")] // lower case v + [InlineData("w")] // lower case w + [InlineData("x")] // lower case x + [InlineData("y")] // lower case y + [InlineData("z")] // lower case z + public void Validate_WhenFilterAlphaKeyIsAnySingleAsciiLetter_ShouldNotHaveValidationError(string filterAlphaKey) + { + // Arrange + GetArtistsLiteQuery query = _getArtistsLiteQueryFixture.Create(filterAlphaKey: filterAlphaKey); + + // Act + List result = _validator.TestValidate(query); + + // Assert + result.ShouldNotHaveAnyValidationErrors(); + } + + [Theory] + [InlineData("")] // empty string, which is not a single letter or a special key + [InlineData("AB")] // two letters + [InlineData("ABC")] // several letters + [InlineData("1")] // a digit, which is not a letter, a number bucket or a symbol bucket + [InlineData("9")] // another digit + [InlineData("_")] // an underscore, which is not an ASCII letter + [InlineData("é")] // a non-ASCII letter + [InlineData("#!")] // the number bucket followed by another character + [InlineData("**")] // two symbol buckets, which is not the exact symbol constant + [InlineData("#A")] // the number bucket followed by a letter + [InlineData("*A")] // the symbol bucket followed by a letter + [InlineData(" A")] // a leading space followed by a letter + [InlineData("A ")] // a letter followed by a trailing space + public void Validate_WhenFilterAlphaKeyIsNotAValidAlphaKey_ShouldHaveValidationError(string filterAlphaKey) + { + // Arrange + GetArtistsLiteQuery query = _getArtistsLiteQueryFixture.Create(filterAlphaKey: filterAlphaKey); + + // Act + List result = _validator.TestValidate(query); + + // Assert + result.ShouldHaveValidationError(Errors.Library.InvalidFilterAlphaKey); + } } diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/AlbumRepositoryTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/AlbumRepositoryTests.cs index 0666fcf4..c015aae5 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/AlbumRepositoryTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/AlbumRepositoryTests.cs @@ -47,6 +47,7 @@ public class AlbumRepositoryTests private readonly TagEntityFixture _tagEntityFixture = new(); private readonly GenreEntityFixture _genreEntityFixture = new(); private readonly ArtistEntityFixture _artistEntityFixture = new(); + private readonly MusicArtworkEntityFixture _musicArtworkEntityFixture = new(); private readonly PaginationDataDtoFixture _paginationDataDtoFixture = new(); /// @@ -741,6 +742,112 @@ public class AlbumRepositoryTests Assert.Equal(12, row.TotalTracks); } + [Fact] + public async Task GetAlbumsLiteByArtistIdAsync_WhenReReleaseYearIsSet_ShouldProjectItAsReleaseYear() + { + // Arrange + Guid artistId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create( + artistId: artistId, originalReleaseYear: 1975, reReleaseYear: 2011, includeTracks: false, includeMetadata: false); + _mockContext.Albums.Add(album); + await _mockContext.SaveChangesAsync(); + + PaginationDataDto paginationData = _paginationDataDtoFixture.Create(currentPage: 1, perPage: 10); + + // Act + Result> result = await _sut.GetAlbumsLiteByArtistIdAsync(artistId, paginationData, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + AlbumLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal(2011, row.ReleaseYear); + } + + [Fact] + public async Task GetAlbumsLiteByArtistIdAsync_WhenReReleaseYearIsNull_ShouldFallBackToOriginalReleaseYear() + { + // Arrange + Guid artistId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create( + artistId: artistId, originalReleaseYear: 1975, includeReReleaseYear: false, includeTracks: false, includeMetadata: false); + _mockContext.Albums.Add(album); + await _mockContext.SaveChangesAsync(); + + PaginationDataDto paginationData = _paginationDataDtoFixture.Create(currentPage: 1, perPage: 10); + + // Act + Result> result = await _sut.GetAlbumsLiteByArtistIdAsync(artistId, paginationData, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + AlbumLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal(1975, row.ReleaseYear); + } + + [Fact] + public async Task GetAlbumsLiteByArtistIdAsync_WhenTheReleaseHasTypes_ShouldProjectThem() + { + // Arrange + Guid artistId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create( + artistId: artistId, releaseType: MusicReleaseType.Single, includeTracks: false, includeMetadata: false); + _mockContext.Albums.Add(album); + await _mockContext.SaveChangesAsync(); + + PaginationDataDto paginationData = _paginationDataDtoFixture.Create(currentPage: 1, perPage: 10); + + // Act + Result> result = await _sut.GetAlbumsLiteByArtistIdAsync(artistId, paginationData, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + AlbumLiteRow row = Assert.Single(result.Value.Data); + Assert.NotNull(row.ReleaseTypes); + Assert.Equal(MusicReleaseType.Single, Assert.Single(row.ReleaseTypes)); + } + + [Fact] + public async Task GetAlbumsLiteByArtistIdAsync_WhenCoverArtworkExists_ShouldProjectTheCoverPath() + { + // Arrange + Guid artistId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create(artistId: artistId, includeTracks: false, includeMetadata: false); + _mockContext.Albums.Add(album); + _mockContext.MusicArtwork.Add( + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: album.Id, artworkType: ArtworkType.Cover, fileName: "covers/opera.jpg")); + await _mockContext.SaveChangesAsync(); + + PaginationDataDto paginationData = _paginationDataDtoFixture.Create(currentPage: 1, perPage: 10); + + // Act + Result> result = await _sut.GetAlbumsLiteByArtistIdAsync(artistId, paginationData, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + AlbumLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal("covers/opera.jpg", row.CoverPath); + } + + [Fact] + public async Task GetAlbumsLiteByArtistIdAsync_WhenNoCoverArtworkExists_ShouldProjectNullCoverPath() + { + // Arrange + Guid artistId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create(artistId: artistId, includeTracks: false, includeMetadata: false); + _mockContext.Albums.Add(album); + await _mockContext.SaveChangesAsync(); + + PaginationDataDto paginationData = _paginationDataDtoFixture.Create(currentPage: 1, perPage: 10); + + // Act + Result> result = await _sut.GetAlbumsLiteByArtistIdAsync(artistId, paginationData, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + AlbumLiteRow row = Assert.Single(result.Value.Data); + Assert.Null(row.CoverPath); + } + [Fact] public async Task GetAlbumsNeedingMetadataCountAsync_WhenAlbumsHaveMixedMetadataStatuses_ShouldCountOnlyTheNotEnrichedOnesOfTheLibrary() { diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs index 38dd1bf3..6b22bd1f 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/ArtistRepositoryTests.cs @@ -53,6 +53,7 @@ public class ArtistRepositoryTests private readonly PaginationDataDtoFixture _paginationDataDtoFixture = new(); private readonly LibraryFilterDtoFixture _libraryFilterDtoFixture = new(); private readonly BaseFilterDtoFixture _baseFilterDtoFixture = new(); + private readonly MusicArtworkEntityFixture _musicArtworkEntityFixture = new(); /// /// Initializes a new instance of the class. @@ -1041,6 +1042,28 @@ public class ArtistRepositoryTests Assert.Equal([betaArtist.Id, alphaArtist.Id], result.Value.Data.Select(artist => artist.Id)); } + [Fact] + public async Task GetAllLiteAsync_WhenIgnoringTheNamePrefixForSorting_ShouldSortByNameStrippedOfItsPrefix() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + ArtistEntity beneathArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "Beneath the Surface", includeAlbums: false, includeContributors: false); + ArtistEntity beatlesArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "The Beatles", includeAlbums: false, includeContributors: false); + _mockContext.Artists.AddRange(beneathArtist, beatlesArtist); + await _mockContext.SaveChangesAsync(); + + PaginationDataDto paginationData = _paginationDataDtoFixture.Create(currentPage: 1, perPage: 10); + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId, shouldIgnoreThePrefixForAlphaPicker: true); + + // Act + Result> result = await _sut.GetAllLiteAsync(paginationData, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + // Without stripping the prefix, "The Beatles" would be sorted after "Beneath the Surface", since its sort key would start with "the" instead of "beatles". + Assert.Equal(["The Beatles", "Beneath the Surface"], result.Value.Data.Select(row => row.Name)); + } + [Fact] public async Task GetAllLiteAsync_WhenCalled_ShouldProjectOnlyTheIdAndTheName() { @@ -1202,6 +1225,92 @@ public class ArtistRepositoryTests Assert.Equal(1, result.Value); } + [Fact] + public async Task GetAllLiteAsync_WhenCoverArtworkExists_ShouldReturnItsPath() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + ArtistEntity artist = _artistEntityFixture.Create(libraryId: libraryId, name: "Queen", includeAlbums: false, includeContributors: false); + _mockContext.Artists.Add(artist); + _mockContext.MusicArtwork.Add( + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, ownerId: artist.Id, artworkType: ArtworkType.Cover, fileName: "covers/queen.jpg")); + await _mockContext.SaveChangesAsync(); + + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId); + + // Act + Result> result = await _sut.GetAllLiteAsync(null, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + ArtistLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal("covers/queen.jpg", row.CoverPath); + } + + [Fact] + public async Task GetAllLiteAsync_WhenOnlyNonCoverArtworkExists_ShouldReturnNullCoverPath() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + ArtistEntity artist = _artistEntityFixture.Create(libraryId: libraryId, name: "Queen", includeAlbums: false, includeContributors: false); + _mockContext.Artists.Add(artist); + _mockContext.MusicArtwork.Add( + _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, ownerId: artist.Id, artworkType: ArtworkType.Front, fileName: "front/queen.jpg")); + await _mockContext.SaveChangesAsync(); + + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId); + + // Act + Result> result = await _sut.GetAllLiteAsync(null, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + ArtistLiteRow row = Assert.Single(result.Value.Data); + Assert.Null(row.CoverPath); + } + + [Fact] + public async Task GetAllLiteAsync_WhenNoCoverArtworkExists_ShouldReturnNullCoverPath() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + ArtistEntity artist = _artistEntityFixture.Create(libraryId: libraryId, name: "Queen", includeAlbums: false, includeContributors: false); + _mockContext.Artists.Add(artist); + await _mockContext.SaveChangesAsync(); + + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId); + + // Act + Result> result = await _sut.GetAllLiteAsync(null, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + ArtistLiteRow row = Assert.Single(result.Value.Data); + Assert.Null(row.CoverPath); + } + + [Fact] + public async Task GetAllLiteAsync_WhenNotIgnoringTheNamePrefixForSorting_ShouldKeepThePrefix() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + ArtistEntity beneathArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "Beneath the Surface", includeAlbums: false, includeContributors: false); + ArtistEntity beatlesArtist = _artistEntityFixture.Create(libraryId: libraryId, name: "The Beatles", includeAlbums: false, includeContributors: false); + _mockContext.Artists.AddRange(beneathArtist, beatlesArtist); + await _mockContext.SaveChangesAsync(); + + PaginationDataDto paginationData = _paginationDataDtoFixture.Create(currentPage: 1, perPage: 10); + LibraryFilterDto filter = _libraryFilterDtoFixture.Create(libraryId: libraryId, shouldIgnoreThePrefixForAlphaPicker: false); + + // Act + Result> result = await _sut.GetAllLiteAsync(paginationData, null, null, filter, cancellationToken: CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + // The prefix is not stripped, so the sort key of "The Beatles" starts with "the" and it sorts after "Beneath the Surface". + Assert.Equal(["Beneath the Surface", "The Beatles"], result.Value.Data.Select(row => row.Name)); + } + /// /// Marks the provided artist, its albums and its tracks as enriched. /// diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/TrackRepositoryTests.cs b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/TrackRepositoryTests.cs index 71a4ab0d..441f9a8d 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/TrackRepositoryTests.cs +++ b/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/TrackRepositoryTests.cs @@ -637,7 +637,7 @@ public class TrackRepositoryTests List albumTracks = [firstDiscFirstTrack, firstDiscFirstTieTrack, firstDiscSecondTrack, secondDiscTrack]; Guid[] expectedOrder = [.. albumTracks - .OrderBy(track => track.DiscNumber) + .OrderBy(track => track.DiscNumber ?? 1) .ThenBy(track => track.TrackNumber) .ThenBy(track => track.Id) .Select(track => track.Id)]; @@ -651,6 +651,27 @@ public class TrackRepositoryTests Assert.DoesNotContain(result.Value, track => track.Id == trackOfAnotherAlbum.Id); } + [Fact] + public async Task GetByAlbumIdAsync_WhenATrackHasNoDiscNumber_ShouldTreatItAsTheFirstDisc() + { + // Arrange + Guid albumId = Guid.NewGuid(); + TrackEntity secondDiscTrack = _trackEntityFixture.Create(albumId: albumId, path: "/music/queen/second-disc.flac", trackNumber: 1, includeMetadata: false); + secondDiscTrack.DiscNumber = 2; + TrackEntity firstDiscTrackWithoutDiscNumber = _trackEntityFixture.Create(albumId: albumId, path: "/music/queen/first-disc.flac", trackNumber: 2, includeMetadata: false); + firstDiscTrackWithoutDiscNumber.DiscNumber = null; + _mockContext.Tracks.AddRange(secondDiscTrack, firstDiscTrackWithoutDiscNumber); + await _mockContext.SaveChangesAsync(); + + // Act + Result> result = await _sut.GetByAlbumIdAsync(albumId, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + // A track without a disc number belongs to the first disc, so it is ordered before the tracks of disc 2. + Assert.Equal([firstDiscTrackWithoutDiscNumber.Id, secondDiscTrack.Id], result.Value.Select(track => track.Id)); + } + [Fact] public async Task GetByAlbumIdAsync_WhenCalled_ShouldIncludeTheRelatedCollections() { @@ -707,6 +728,26 @@ public class TrackRepositoryTests Assert.Equal([firstTrack.Id, secondTrack.Id], page.Data.Select(row => row.Id)); } + [Fact] + public async Task GetTracksLiteByAlbumIdAsync_WhenATrackHasNoDiscNumber_ShouldTreatItAsTheFirstDisc() + { + // Arrange + Guid albumId = Guid.NewGuid(); + TrackEntity thirdTrack = _trackEntityFixture.Create(albumId: albumId, path: "/music/queen/third.flac", trackNumber: 3, includeMetadata: false); + thirdTrack.DiscNumber = 1; + TrackEntity secondTrackWithoutDiscNumber = _trackEntityFixture.Create(albumId: albumId, path: "/music/queen/second.flac", trackNumber: 2, includeMetadata: false); + secondTrackWithoutDiscNumber.DiscNumber = null; + _mockContext.Tracks.AddRange(thirdTrack, secondTrackWithoutDiscNumber); + await _mockContext.SaveChangesAsync(); + + // Act + Result> result = await _sut.GetTracksLiteByAlbumIdAsync(albumId, null, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal([secondTrackWithoutDiscNumber.Id, thirdTrack.Id], result.Value.Data.Select(row => row.Id)); + } + [Theory] [InlineData(1, 2, 1, 2)] // The first page is fully returned. [InlineData(2, 2, 2, 2)] // A middle page is fully returned. @@ -792,6 +833,28 @@ public class TrackRepositoryTests Assert.Equal("Killer Queen", row.Title); Assert.Equal(9, row.TrackNumber); Assert.Equal(3, row.DiscNumber); + Assert.Equal(track.DurationInSeconds, row.DurationInSeconds); + } + + [Fact] + public async Task GetTracksLiteByAlbumIdAsync_WhenCalled_ShouldProjectTheDurationInSeconds() + { + // Arrange + Guid albumId = Guid.NewGuid(); + TrackEntity track = _trackEntityFixture.Create(albumId: albumId, path: "/music/queen/the-prophet-song.flac", includeMetadata: false); + track.DurationInSeconds = 367; + _mockContext.Tracks.Add(track); + await _mockContext.SaveChangesAsync(); + + PaginationDataDto paginationData = _paginationDataDtoFixture.Create(currentPage: 1, perPage: 10); + + // Act + Result> result = await _sut.GetTracksLiteByAlbumIdAsync(albumId, paginationData, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + TrackLiteRow row = Assert.Single(result.Value.Data); + Assert.Equal(367, row.DurationInSeconds); } [Fact] From 4f43bf352bb4772228e7a89f726735ba36a4ccab Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:26:26 +0300 Subject: [PATCH 07/19] Cleans up the artwork and the stored media of deleted music library items and libraries. --- .../BookLibrary/IBookRepository.cs | 8 + .../MusicLibrary/IArtistRepository.cs | 8 + .../MusicLibrary/IMusicArtworkRepository.cs | 19 + ...IMusicLibraryScanItemMetadataRepository.cs | 8 + .../ApplicationLayerServices.cs | 2 + .../DeleteAlbum/DeleteAlbumCommandHandler.cs | 12 +- .../DeleteArtistCommandHandler.cs | 12 +- .../Artwork/IMusicArtworkCleanupService.cs | 38 ++ .../Artwork/MusicArtworkCleanupService.cs | 119 +++++++ .../DeleteTrack/DeleteTrackCommandHandler.cs | 12 +- .../LibraryDeletedDomainEventHandler.cs | 99 ++++-- .../BookLibrary/BookRepository.cs | 15 + .../MusicLibrary/MusicArtworkRepository.cs | 93 ++++- .../MusicLibraryScanItemMetadataRepository.cs | 14 + .../BookLibrary/BookRepositoryTests.cs | 32 ++ .../DeleteAlbum/DeleteAlbumEndpointTests.cs | 93 +++++ .../DeleteArtist/DeleteArtistEndpointTests.cs | 87 +++++ .../DeleteTrack/DeleteTrackEndpointTests.cs | 68 +++- .../DeleteAlbumCommandHandlerTests.cs | 41 ++- .../DeleteArtistCommandHandlerTests.cs | 41 ++- .../MusicArtworkCleanupServiceTests.cs | 324 ++++++++++++++++++ .../DeleteTrackCommandHandlerTests.cs | 39 ++- .../LibraryDeletedDomainEventHandlerTests.cs | 280 ++++++++++++++- 23 files changed, 1390 insertions(+), 74 deletions(-) create mode 100644 src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkCleanupService.cs create mode 100644 src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkCleanupService.cs create mode 100644 tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkCleanupServiceTests.cs diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs index 56ebf0c6..d9516d0b 100644 --- a/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs +++ b/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs @@ -123,4 +123,12 @@ public interface IBookRepository : IRepository, /// Cancellation token that can be used to stop the execution. /// An containing either the display names of the authors of the books, keyed by book Id, or an error. Task>> GetAuthorsDisplayNamesByBookIdsAsync(IReadOnlyCollection bookIds, CancellationToken cancellationToken); + + /// + /// Deletes all the books of the media library identified by , together with their artwork and their related data. + /// + /// The Id of the media library whose books are deleted. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken); } diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs index 1cc604ac..b1aed090 100644 --- a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs +++ b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs @@ -78,4 +78,12 @@ public interface IArtistRepository : IRepository, /// Cancellation token that can be used to stop the execution. /// An representing either a successful operation, or an error. Task> ResetMetadataStatusForLibraryAsync(Guid libraryId, CancellationToken cancellationToken); + + /// + /// Deletes all the artists of the media library identified by , together with their albums and tracks and their related data. + /// + /// The Id of the media library whose artists are deleted. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken); } diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicArtworkRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicArtworkRepository.cs index 2d1686e8..dd5898c4 100644 --- a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicArtworkRepository.cs +++ b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicArtworkRepository.cs @@ -46,4 +46,23 @@ public interface IMusicArtworkRepository : IRepository, /// Cancellation token that can be used to stop the execution. /// An representing either a successful operation, or an error. Task> ResetStatusForLibraryAsync(Guid libraryId, CancellationToken cancellationToken); + + /// + /// Deletes all the pieces of artwork owned by the artists, albums and tracks of the media library identified by . + /// + /// The Id of the media library whose artwork is deleted. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken); + + /// + /// Stores the cover image of the music library item of the provided identified by , + /// replacing the file of its existing cover, or adding a new cover artwork when it has none. + /// + /// The type of the music library item that owns the artwork. + /// The Id of the music library item that owns the artwork. + /// The relative file name of the stored cover image. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + Task> UpsertCoverAsync(MusicArtworkOwnerType ownerType, Guid ownerId, string fileName, CancellationToken cancellationToken); } diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicLibraryScanItemMetadataRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicLibraryScanItemMetadataRepository.cs index 488c0d9c..073d8c6e 100644 --- a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicLibraryScanItemMetadataRepository.cs +++ b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicLibraryScanItemMetadataRepository.cs @@ -32,4 +32,12 @@ public interface IMusicLibraryScanItemMetadataRepository : IRepositoryCancellation token that can be used to stop the execution. /// An representing either a successful operation, or an error. Task> DeleteByScanIdAsync(Guid scanId, CancellationToken cancellationToken); + + /// + /// Deletes all the staged music metadata items of the media library identified by . + /// + /// The Id of the media library whose staged music metadata is deleted. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken); } diff --git a/src/Lumina.Application/Common/DependencyInjection/ApplicationLayerServices.cs b/src/Lumina.Application/Common/DependencyInjection/ApplicationLayerServices.cs index 6ca6bec2..f85aabf0 100644 --- a/src/Lumina.Application/Common/DependencyInjection/ApplicationLayerServices.cs +++ b/src/Lumina.Application/Common/DependencyInjection/ApplicationLayerServices.cs @@ -1,5 +1,6 @@ #region ========================================================================= USING ===================================================================================== using Lumina.Application.Common.Telemetry; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; using Lumina.Application.Core.MediaLibrary.Management.Deletion; using Lumina.Domain.Common.Events; using Microsoft.Extensions.DependencyInjection; @@ -44,6 +45,7 @@ public static class ApplicationLayerServices services.AddScoped(); services.AddScoped(); + services.AddScoped(); foreach (var registration in handlerRegistrations) { diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandler.cs index 3c63ada0..173bbe3b 100644 --- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandler.cs @@ -8,6 +8,7 @@ using Lumina.Application.Common.Infrastructure.Authorization; using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership; using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; using Lumina.Domain.Common.Primitives; using Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLibraryAggregate; using Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLibraryAggregate.Entities; @@ -28,6 +29,7 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums. public class DeleteAlbumCommandHandler : ICommandHandler> { private readonly IUnitOfWork _unitOfWork; + private readonly IMusicArtworkCleanupService _musicArtworkCleanupService; private readonly IAuthorizationService _authorizationService; private readonly ICurrentUserService _currentUserService; private readonly IValidator _validator; @@ -36,12 +38,14 @@ public class DeleteAlbumCommandHandler : ICommandHandler class. /// /// Injected unit of work for interacting with the data access layer repositories. + /// Injected service for removing the artwork of a music library item and of its children. /// Injected service for authorization related functionality. /// Injected service to retrieve the current user information. /// Injected validator for application validation rules. - public DeleteAlbumCommandHandler(IUnitOfWork unitOfWork, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator) + public DeleteAlbumCommandHandler(IUnitOfWork unitOfWork, IMusicArtworkCleanupService musicArtworkCleanupService, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator) { _unitOfWork = unitOfWork; + _musicArtworkCleanupService = musicArtworkCleanupService; _authorizationService = authorizationService; _currentUserService = currentUserService; _validator = validator; @@ -115,6 +119,12 @@ public class DeleteAlbumCommandHandler : ICommandHandler deleteArtworkResult = await _musicArtworkCleanupService.DeleteAlbumArtworkAsync(albumId, cancellationToken).ConfigureAwait(false); + if (deleteArtworkResult.IsFailure) + return deleteArtworkResult.Errors; + Result updateResult = await _unitOfWork.ArtistRepository .UpdateAsync(artistResult.Value.ToRepositoryEntity(), cancellationToken).ConfigureAwait(false); if (updateResult.IsFailure) diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandler.cs index 5a6d2fbb..ed03a91b 100644 --- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandler.cs @@ -7,6 +7,7 @@ using Lumina.Application.Common.Infrastructure.Authentication; using Lumina.Application.Common.Infrastructure.Authorization; using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership; using Lumina.Application.Common.Infrastructure.Validation; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; using Lumina.Domain.Common.Primitives; using System; using System.Collections.Generic; @@ -24,6 +25,7 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists public class DeleteArtistCommandHandler : ICommandHandler> { private readonly IUnitOfWork _unitOfWork; + private readonly IMusicArtworkCleanupService _musicArtworkCleanupService; private readonly IAuthorizationService _authorizationService; private readonly ICurrentUserService _currentUserService; private readonly IValidator _validator; @@ -32,12 +34,14 @@ public class DeleteArtistCommandHandler : ICommandHandler class. /// /// Injected unit of work for interacting with the data access layer repositories. + /// Injected service for removing the artwork of a music library item and of its children. /// Injected service for authorization related functionality. /// Injected service to retrieve the current user information. /// Injected validator for application validation rules. - public DeleteArtistCommandHandler(IUnitOfWork unitOfWork, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator) + public DeleteArtistCommandHandler(IUnitOfWork unitOfWork, IMusicArtworkCleanupService musicArtworkCleanupService, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator) { _unitOfWork = unitOfWork; + _musicArtworkCleanupService = musicArtworkCleanupService; _authorizationService = authorizationService; _currentUserService = currentUserService; _validator = validator; @@ -92,6 +96,12 @@ public class DeleteArtistCommandHandler : ICommandHandler deleteArtworkResult = await _musicArtworkCleanupService.DeleteArtistArtworkAsync(artistId, cancellationToken).ConfigureAwait(false); + if (deleteArtworkResult.IsFailure) + return deleteArtworkResult.Errors; + Result deleteArtistResult = await _unitOfWork.ArtistRepository.DeleteByIdAsync(artistId, cancellationToken).ConfigureAwait(false); if (deleteArtistResult.IsFailure) return deleteArtistResult.Errors; diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkCleanupService.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkCleanupService.cs new file mode 100644 index 00000000..7da9ca4f --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/IMusicArtworkCleanupService.cs @@ -0,0 +1,38 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Domain.Common.Primitives; +using System; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; + +/// +/// Interface for the service that removes the artwork records and the stored artwork files of a music library item, together with the artwork of its children. +/// +public interface IMusicArtworkCleanupService +{ + /// + /// Removes the artwork records and the stored artwork files of the artist identified by , together with the artwork of its albums and tracks. + /// + /// The Id of the artist whose artwork is removed. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + Task> DeleteArtistArtworkAsync(Guid artistId, CancellationToken cancellationToken); + + /// + /// Removes the artwork records and the stored artwork files of the album identified by , together with the artwork of its tracks. + /// + /// The Id of the album whose artwork is removed. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + Task> DeleteAlbumArtworkAsync(Guid albumId, CancellationToken cancellationToken); + + /// + /// Removes the artwork records and the stored artwork files of the track identified by . + /// + /// The Id of the track whose artwork is removed. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + Task> DeleteTrackArtworkAsync(Guid trackId, CancellationToken cancellationToken); +} diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkCleanupService.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkCleanupService.cs new file mode 100644 index 00000000..42864d01 --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkCleanupService.cs @@ -0,0 +1,119 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Common.DataAccess.UoW; +using Lumina.Domain.Common.Primitives; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; + +/// +/// Service that removes the artwork records and the stored artwork files of a music library item, together with the artwork of its children. +/// The artwork table is shared by all the music library item types and references its owners by a plain id, so the artwork of an item does not +/// cascade when the item is removed, and is removed explicitly instead, from the innermost children outwards. +/// +internal sealed class MusicArtworkCleanupService : IMusicArtworkCleanupService +{ + private readonly IUnitOfWork _unitOfWork; + private readonly IMusicArtworkService _musicArtworkService; + + /// + /// Initializes a new instance of the class. + /// + /// Injected unit of work for interacting with the data access layer repositories. + /// Injected service for removing the stored artwork files of a music library item. + public MusicArtworkCleanupService(IUnitOfWork unitOfWork, IMusicArtworkService musicArtworkService) + { + _unitOfWork = unitOfWork; + _musicArtworkService = musicArtworkService; + } + + /// + /// Removes the artwork records and the stored artwork files of the artist identified by , together with the artwork of its albums and tracks. + /// + /// The Id of the artist whose artwork is removed. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + public async Task> DeleteArtistArtworkAsync(Guid artistId, CancellationToken cancellationToken) + { + // The albums and the tracks of the artist are removed by the database through the cascading foreign keys, so only the artwork of the + // children has to be collected here, and it has to be removed before the artwork of the artist itself, from the innermost children outwards. + Result> getAlbumsResult = await _unitOfWork.AlbumRepository.GetByArtistIdAsync(artistId, cancellationToken).ConfigureAwait(false); + if (getAlbumsResult.IsFailure) + return getAlbumsResult.Errors; + + foreach (AlbumEntity album in getAlbumsResult.Value) + { + Result deleteAlbumArtworkResult = await DeleteAlbumArtworkAsync(album.Id, cancellationToken).ConfigureAwait(false); + if (deleteAlbumArtworkResult.IsFailure) + return deleteAlbumArtworkResult.Errors; + } + + return await DeleteOwnerArtworkAsync(MusicArtworkOwnerType.Artist, artistId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes the artwork records and the stored artwork files of the album identified by , together with the artwork of its tracks. + /// + /// The Id of the album whose artwork is removed. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + public async Task> DeleteAlbumArtworkAsync(Guid albumId, CancellationToken cancellationToken) + { + // The tracks of the album are removed by the database through the cascading foreign keys, so only their artwork has to be removed here, + // before the artwork of the album itself. + Result> getTracksResult = await _unitOfWork.TrackRepository.GetByAlbumIdAsync(albumId, cancellationToken).ConfigureAwait(false); + if (getTracksResult.IsFailure) + return getTracksResult.Errors; + + foreach (TrackEntity track in getTracksResult.Value) + { + Result deleteTrackArtworkResult = await DeleteTrackArtworkAsync(track.Id, cancellationToken).ConfigureAwait(false); + if (deleteTrackArtworkResult.IsFailure) + return deleteTrackArtworkResult.Errors; + } + + return await DeleteOwnerArtworkAsync(MusicArtworkOwnerType.Album, albumId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Removes the artwork records and the stored artwork files of the track identified by . + /// + /// The Id of the track whose artwork is removed. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + public Task> DeleteTrackArtworkAsync(Guid trackId, CancellationToken cancellationToken) + { + return DeleteOwnerArtworkAsync(MusicArtworkOwnerType.Track, trackId, cancellationToken); + } + + /// + /// Removes the artwork records and the stored artwork files of the single music library item identified by and . + /// + /// The type of the music library item whose artwork is removed. + /// The Id of the music library item whose artwork is removed. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + private async Task> DeleteOwnerArtworkAsync(MusicArtworkOwnerType ownerType, Guid ownerId, CancellationToken cancellationToken) + { + Result> getArtworkResult = await _unitOfWork.MusicArtworkRepository.GetByOwnerAsync(ownerType, ownerId, cancellationToken).ConfigureAwait(false); + if (getArtworkResult.IsFailure) + return getArtworkResult.Errors; + + // The stored files do not cascade from their records either, so every stored file is removed before its record is; the artwork whose file has not been resolved yet has no file to remove. + foreach (MusicArtworkEntity artwork in getArtworkResult.Value) + { + if (string.IsNullOrWhiteSpace(artwork.FileName)) + continue; + Result deleteStoredArtworkResult = _musicArtworkService.DeleteStoredArtwork(artwork.FileName); + if (deleteStoredArtworkResult.IsFailure) + return deleteStoredArtworkResult.Errors; + } + + return await _unitOfWork.MusicArtworkRepository.DeleteByOwnerAsync(ownerType, ownerId, cancellationToken).ConfigureAwait(false); + } +} diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandler.cs index 8237a549..5f7dfd3f 100644 --- a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandler.cs @@ -8,6 +8,7 @@ using Lumina.Application.Common.Infrastructure.Authorization; using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership; using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; using Lumina.Domain.Common.Primitives; using Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLibraryAggregate; using Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLibraryAggregate.Entities; @@ -28,6 +29,7 @@ namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks. public class DeleteTrackCommandHandler : ICommandHandler> { private readonly IUnitOfWork _unitOfWork; + private readonly IMusicArtworkCleanupService _musicArtworkCleanupService; private readonly IAuthorizationService _authorizationService; private readonly ICurrentUserService _currentUserService; private readonly IValidator _validator; @@ -36,12 +38,14 @@ public class DeleteTrackCommandHandler : ICommandHandler class. /// /// Injected unit of work for interacting with the data access layer repositories. + /// Injected service for removing the artwork of a music library item and of its children. /// Injected service for authorization related functionality. /// Injected service to retrieve the current user information. /// Injected validator for application validation rules. - public DeleteTrackCommandHandler(IUnitOfWork unitOfWork, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator) + public DeleteTrackCommandHandler(IUnitOfWork unitOfWork, IMusicArtworkCleanupService musicArtworkCleanupService, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator) { _unitOfWork = unitOfWork; + _musicArtworkCleanupService = musicArtworkCleanupService; _authorizationService = authorizationService; _currentUserService = currentUserService; _validator = validator; @@ -122,6 +126,12 @@ public class DeleteTrackCommandHandler : ICommandHandler deleteArtworkResult = await _musicArtworkCleanupService.DeleteTrackArtworkAsync(trackId, cancellationToken).ConfigureAwait(false); + if (deleteArtworkResult.IsFailure) + return deleteArtworkResult.Errors; + Result updateResult = await _unitOfWork.ArtistRepository.UpdateAsync(artistResult.Value.ToRepositoryEntity(), cancellationToken).ConfigureAwait(false); if (updateResult.IsFailure) return updateResult.Errors; diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandler.cs index 17beb518..571372f6 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandler.cs @@ -1,7 +1,8 @@ #region ========================================================================= USING ===================================================================================== -using Lumina.Domain.Common.Primitives; +using Lumina.Application.Common.DataAccess.UoW; using Lumina.Application.Common.Infrastructure.Models.DTO.Configuration; using Lumina.Domain.Common.Exceptions; +using Lumina.Domain.Common.Primitives; using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services; using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Strategies.Environment; using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects; @@ -20,6 +21,7 @@ namespace Lumina.Application.Core.MediaLibrary.Management.Events; /// public class LibraryDeletedDomainEventHandler : IDomainEventHandler { + private readonly IUnitOfWork _unitOfWork; private readonly IEnvironmentContext _environmentContext; private readonly IPathService _pathService; private readonly MediaSettingsDto _mediaSettingsModel; @@ -27,11 +29,13 @@ public class LibraryDeletedDomainEventHandler : IDomainEventHandler /// Initializes a new instance of the class. /// + /// Injected unit of work for interacting with the data access layer repositories. /// Injected facade service for environment contextual services. /// Injected service for handling file system paths. /// Injected service for retrieving . - public LibraryDeletedDomainEventHandler(IEnvironmentContext environmentContext, IPathService pathService, IOptions mediaSettingsModelOptions) + public LibraryDeletedDomainEventHandler(IUnitOfWork unitOfWork, IEnvironmentContext environmentContext, IPathService pathService, IOptions mediaSettingsModelOptions) { + _unitOfWork = unitOfWork; _environmentContext = environmentContext; _pathService = pathService; _mediaSettingsModel = mediaSettingsModelOptions.Value; @@ -42,47 +46,80 @@ public class LibraryDeletedDomainEventHandler : IDomainEventHandler /// The domain event to be handled. /// Cancellation token that can be used to stop the execution. - public ValueTask HandleAsync(LibraryDeletedDomainEvent domainEvent, CancellationToken cancellationToken) + public async ValueTask HandleAsync(LibraryDeletedDomainEvent domainEvent, CancellationToken cancellationToken) { - // delete the media library directory in the internal location for media library files - Result libraryPathResult = GetLibraryPath(domainEvent.Library.Id.Value); - if (libraryPathResult.IsFailure) - throw new EventualConsistencyException(libraryPathResult.FirstError, libraryPathResult.Errors); + Guid libraryId = domainEvent.Library.Id.Value; - Result newLibraryPathIdResult = FileSystemPathId.Create(libraryPathResult.Value); - if (newLibraryPathIdResult.IsFailure) - throw new EventualConsistencyException(newLibraryPathIdResult.FirstError, newLibraryPathIdResult.Errors); + // The media items of the library and their artwork do not cascade from the library row, because they reference it by a plain id, + // so they are removed first, otherwise they would be orphaned in the database. The artwork is removed before its owners, so that + // its owners are still present when the artwork is looked up. + Result deleteMusicArtworkResult = await _unitOfWork.MusicArtworkRepository.DeleteByLibraryIdAsync(libraryId, cancellationToken).ConfigureAwait(false); + if (deleteMusicArtworkResult.IsFailure) + throw new EventualConsistencyException(deleteMusicArtworkResult.FirstError, deleteMusicArtworkResult.Errors); - Result deleteLibraryDirectoryResult = _environmentContext.DirectoryProviderService.DeleteDirectory(newLibraryPathIdResult.Value); - if (deleteLibraryDirectoryResult.IsFailure) - throw new EventualConsistencyException(deleteLibraryDirectoryResult.FirstError, deleteLibraryDirectoryResult.Errors); - - return ValueTask.CompletedTask; + // Deleting the artists removes their albums, tracks and their related data, through the cascading foreign keys. + Result deleteArtistsResult = await _unitOfWork.ArtistRepository.DeleteByLibraryIdAsync(libraryId, cancellationToken).ConfigureAwait(false); + if (deleteArtistsResult.IsFailure) + throw new EventualConsistencyException(deleteArtistsResult.FirstError, deleteArtistsResult.Errors); + + // Deleting the books removes their artwork and their related data, through the cascading foreign keys. + Result deleteBooksResult = await _unitOfWork.BookRepository.DeleteByLibraryIdAsync(libraryId, cancellationToken).ConfigureAwait(false); + if (deleteBooksResult.IsFailure) + throw new EventualConsistencyException(deleteBooksResult.FirstError, deleteBooksResult.Errors); + + // The staged music metadata of the library does not cascade from the library row either, so it is removed as well. + Result deleteStagedMusicMetadataResult = await _unitOfWork.MusicLibraryScanItemMetadataRepository.DeleteByLibraryIdAsync(libraryId, cancellationToken).ConfigureAwait(false); + if (deleteStagedMusicMetadataResult.IsFailure) + throw new EventualConsistencyException(deleteStagedMusicMetadataResult.FirstError, deleteStagedMusicMetadataResult.Errors); + + // The cover image of the library is stored under the libraries directory, under a directory named after the library id, + // while the artwork of the media items of the library is stored under the per-media-type directories, under directories + // named after the library, so all of them must be removed when the library is deleted. All the media item files of a library + // live inside these directories, so removing them removes the library's stored media without touching the user's own files. + DeleteLibraryDirectory(_mediaSettingsModel.LibrariesDirectory, libraryId.ToString()); + + Result librarySegmentResult = _pathService.SanitizeSegment($"{domainEvent.Library.Title}-{libraryId}"); + if (librarySegmentResult.IsFailure) + throw new EventualConsistencyException(librarySegmentResult.FirstError, librarySegmentResult.Errors); + DeleteLibraryDirectory(_mediaSettingsModel.BooksDirectory, librarySegmentResult.Value.Name); + DeleteLibraryDirectory(_mediaSettingsModel.MusicDirectory, librarySegmentResult.Value.Name); } /// - /// Gets the file system path of a media library identified by . + /// Deletes the directory of a media library from the internal media location of the provided media type. /// - /// The id of the media library for which to regtrieve the file system path. - /// - /// An containing either the file system path of the media library, or an error message. - /// - private Result GetLibraryPath(Guid libraryId) + /// The name of the media type subdirectory the library directory is stored under. + /// The name of the directory of the media library. + private void DeleteLibraryDirectory(string mediaTypeDirectory, string libraryDirectoryName) { - // root directory for media + // Root directory for media. Result rootPathResult = _pathService.CombinePath(AppContext.BaseDirectory, _mediaSettingsModel.RootDirectory); if (rootPathResult.IsFailure) - return rootPathResult.Errors; + throw new EventualConsistencyException(rootPathResult.FirstError, rootPathResult.Errors); - // libraries directory - Result librariesPathResult = _pathService.CombinePath(rootPathResult.Value, _mediaSettingsModel.LibrariesDirectory); - if (librariesPathResult.IsFailure) - return librariesPathResult.Errors; + // Media type directory. + Result mediaTypePathResult = _pathService.CombinePath(rootPathResult.Value, mediaTypeDirectory); + if (mediaTypePathResult.IsFailure) + throw new EventualConsistencyException(mediaTypePathResult.FirstError, mediaTypePathResult.Errors); - // this new particular library' directory - Result libraryPathResult = _pathService.CombinePath(librariesPathResult.Value, libraryId.ToString()); + // This particular library's directory. + Result libraryPathResult = _pathService.CombinePath(mediaTypePathResult.Value, libraryDirectoryName); if (libraryPathResult.IsFailure) - return libraryPathResult.Errors; - return libraryPathResult.Value; + throw new EventualConsistencyException(libraryPathResult.FirstError, libraryPathResult.Errors); + + Result libraryPathIdResult = FileSystemPathId.Create(libraryPathResult.Value); + if (libraryPathIdResult.IsFailure) + throw new EventualConsistencyException(libraryPathIdResult.FirstError, libraryPathIdResult.Errors); + + // The directory only exists when the library actually stored something under this media type, so a missing directory is not an error. + Result directoryExistsResult = _environmentContext.DirectoryProviderService.DirectoryExists(libraryPathIdResult.Value); + if (directoryExistsResult.IsFailure) + throw new EventualConsistencyException(directoryExistsResult.FirstError, directoryExistsResult.Errors); + if (!directoryExistsResult.Value) + return; + + Result deleteLibraryDirectoryResult = _environmentContext.DirectoryProviderService.DeleteDirectory(libraryPathIdResult.Value); + if (deleteLibraryDirectoryResult.IsFailure) + throw new EventualConsistencyException(deleteLibraryDirectoryResult.FirstError, deleteLibraryDirectoryResult.Errors); } } diff --git a/src/Lumina.DataAccess/Core/Repositories/BookLibrary/BookRepository.cs b/src/Lumina.DataAccess/Core/Repositories/BookLibrary/BookRepository.cs index b1490003..9269db51 100644 --- a/src/Lumina.DataAccess/Core/Repositories/BookLibrary/BookRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/BookLibrary/BookRepository.cs @@ -462,6 +462,21 @@ internal sealed class BookRepository : IBookRepository return Result.Updated; } + /// + /// Deletes all the books of the media library identified by , together with their artwork and their related data. + /// + /// The Id of the media library whose books are deleted. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + public async Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken) + { + // The artwork and the related data of the books are removed by the database, through the cascading foreign keys. + await _luminaDbContext.Books + .Where(book => book.LibraryId == libraryId) + .ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + return Result.Deleted; + } + /// /// Gets the display names of the author of the books identified by the provided , /// keyed by the Id of the book, or when a book has no author. diff --git a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicArtworkRepository.cs b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicArtworkRepository.cs index ceb8f38e..f9f56768 100644 --- a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicArtworkRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicArtworkRepository.cs @@ -85,25 +85,84 @@ internal sealed class MusicArtworkRepository : IMusicArtworkRepository /// An representing either a successful operation, or an error. public async Task> ResetStatusForLibraryAsync(Guid libraryId, CancellationToken cancellationToken) { - // The artwork table is shared by all the music library item types, so the owners of the artwork of this library are collected per type. - List artistIds = await _luminaDbContext.Artists - .Where(artist => artist.LibraryId == libraryId) - .Select(artist => artist.Id) - .ToListAsync(cancellationToken).ConfigureAwait(false); - List albumIds = await _luminaDbContext.Albums - .Where(album => album.LibraryId == libraryId) - .Select(album => album.Id) - .ToListAsync(cancellationToken).ConfigureAwait(false); - List trackIds = await _luminaDbContext.Tracks - .Where(track => track.LibraryId == libraryId) - .Select(track => track.Id) - .ToListAsync(cancellationToken).ConfigureAwait(false); - + // The artwork table is shared by all the music library item types, so the owner of a piece of artwork is matched by its type against the + // corresponding table, and the database resolves the membership of the owner in the library by a correlated subquery. Collecting the ids + // of every artist, album and track of the library in memory first would make the cost of the operation grow with the size of the library. await _luminaDbContext.MusicArtwork - .Where(musicArtwork => (musicArtwork.OwnerType == MusicArtworkOwnerType.Artist && artistIds.Contains(musicArtwork.OwnerId)) - || (musicArtwork.OwnerType == MusicArtworkOwnerType.Album && albumIds.Contains(musicArtwork.OwnerId)) - || (musicArtwork.OwnerType == MusicArtworkOwnerType.Track && trackIds.Contains(musicArtwork.OwnerId))) + .Where(musicArtwork => (musicArtwork.OwnerType == MusicArtworkOwnerType.Artist + && _luminaDbContext.Artists.Any(artist => artist.Id == musicArtwork.OwnerId && artist.LibraryId == libraryId)) + || (musicArtwork.OwnerType == MusicArtworkOwnerType.Album + && _luminaDbContext.Albums.Any(album => album.Id == musicArtwork.OwnerId && album.LibraryId == libraryId)) + || (musicArtwork.OwnerType == MusicArtworkOwnerType.Track + && _luminaDbContext.Tracks.Any(track => track.Id == musicArtwork.OwnerId && track.LibraryId == libraryId))) .ExecuteUpdateAsync(setters => setters.SetProperty(musicArtwork => musicArtwork.Status, ArtworkStatus.Pending), cancellationToken).ConfigureAwait(false); return Result.Updated; } + + /// + /// Deletes all the pieces of artwork owned by the artists, albums and tracks of the media library identified by . + /// + /// The Id of the media library whose artwork is deleted. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + public async Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken) + { + // The artwork table is shared by all the music library item types, so the owner of a piece of artwork is matched by its type against the + // corresponding table, and the database resolves the membership of the owner in the library by a correlated subquery. Collecting the ids + // of every artist, album and track of the library in memory first would make the cost of the operation grow with the size of the library. + await _luminaDbContext.MusicArtwork + .Where(musicArtwork => (musicArtwork.OwnerType == MusicArtworkOwnerType.Artist + && _luminaDbContext.Artists.Any(artist => artist.Id == musicArtwork.OwnerId && artist.LibraryId == libraryId)) + || (musicArtwork.OwnerType == MusicArtworkOwnerType.Album + && _luminaDbContext.Albums.Any(album => album.Id == musicArtwork.OwnerId && album.LibraryId == libraryId)) + || (musicArtwork.OwnerType == MusicArtworkOwnerType.Track + && _luminaDbContext.Tracks.Any(track => track.Id == musicArtwork.OwnerId && track.LibraryId == libraryId))) + .ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + return Result.Deleted; + } + + /// + /// Stores the cover image of the music library item of the provided identified by . + /// + /// The type of the music library item that owns the artwork. + /// The Id of the music library item that owns the artwork. + /// The relative file name of the stored cover image. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + public async Task> UpsertCoverAsync(MusicArtworkOwnerType ownerType, Guid ownerId, string fileName, CancellationToken cancellationToken) + { + // The existing cover is matched the same way the callers that resolve it do, by owner and artwork type only, so that a cover stored + // with an ordinal other than zero is replaced in place instead of a second cover row being inserted next to it. + MusicArtworkEntity? existingCover = await _luminaDbContext.MusicArtwork + .FirstOrDefaultAsync(musicArtwork => musicArtwork.OwnerType == ownerType + && musicArtwork.OwnerId == ownerId + && musicArtwork.ArtworkType == ArtworkType.Cover, cancellationToken).ConfigureAwait(false); + + DateTime now = DateTime.UtcNow; + if (existingCover is null) + { + _luminaDbContext.MusicArtwork.Add(new MusicArtworkEntity + { + Id = Guid.NewGuid(), + OwnerType = ownerType, + OwnerId = ownerId, + ArtworkType = ArtworkType.Cover, + Ordinal = 0, + FileName = fileName, + Status = ArtworkStatus.Enriched, + CreatedOnUtc = now, + CreatedBy = Guid.Empty, + // The audit columns are owned by the auditing interceptor, which stamps only the rows that actually changed, so they are never mapped here. + UpdatedOnUtc = null, + UpdatedBy = null + }); + } + else + { + existingCover.FileName = fileName; + existingCover.Status = ArtworkStatus.Enriched; + existingCover.LastUpdateUtc = now; + } + return Result.Updated; + } } diff --git a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepository.cs b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepository.cs index f2810e93..9ca1d53d 100644 --- a/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepository.cs +++ b/src/Lumina.DataAccess/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepository.cs @@ -71,4 +71,18 @@ internal sealed class MusicLibraryScanItemMetadataRepository : IMusicLibraryScan .ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); return Result.Deleted; } + + /// + /// Deletes all the staged music metadata items of the media library identified by . + /// + /// The Id of the media library whose staged music metadata is deleted. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + public async Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken) + { + await _luminaDbContext.MusicLibraryScanItemMetadata + .Where(musicMetadata => musicMetadata.LibraryId == libraryId) + .ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false); + return Result.Deleted; + } } diff --git a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/BookLibrary/BookRepositoryTests.cs b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/BookLibrary/BookRepositoryTests.cs index 2c235bef..b83c9adb 100644 --- a/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/BookLibrary/BookRepositoryTests.cs +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/BookLibrary/BookRepositoryTests.cs @@ -442,6 +442,38 @@ public class BookRepositoryTests Assert.Equal(keptContributor.Id, Assert.Single(storedBook.Contributors).Id); } + [Fact] + public async Task DeleteByLibraryIdAsync_WhenCalled_ShouldDeleteOnlyThatLibrariesBooks() + { + // Arrange + // The delete uses ExecuteDeleteAsync, which is not supported by the in-memory provider, so a real SQLite database is used. + using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-bookrepo-deletebylibrary-{Guid.NewGuid()};Mode=Memory;Cache=Shared"); + anchorConnection.Open(); + using LuminaDbContext context = new(new DbContextOptionsBuilder().UseSqlite(anchorConnection.ConnectionString).Options); + context.Database.EnsureCreated(); + BookRepository sut = new(context); + + Guid libraryId = Guid.NewGuid(); + BookEntity bookOfLibrary = _bookEntityFixture.Create(); + bookOfLibrary.LibraryId = libraryId; + bookOfLibrary.Path = "/books/library.epub"; + BookEntity bookOfAnotherLibrary = _bookEntityFixture.Create(); + bookOfAnotherLibrary.LibraryId = Guid.NewGuid(); + bookOfAnotherLibrary.Path = "/books/other.epub"; + context.Books.AddRange(bookOfLibrary, bookOfAnotherLibrary); + await context.SaveChangesAsync(); + + // Act + Result result = await sut.DeleteByLibraryIdAsync(libraryId, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(Result.Deleted, result.Value); + context.ChangeTracker.Clear(); + BookEntity survivor = Assert.Single(await context.Books.AsNoTracking().ToListAsync()); + Assert.Equal(bookOfAnotherLibrary.Id, survivor.Id); + } + /// /// Creates a real SQLite backed context with the auditing interceptor attached, so that audit columns behave exactly like in production. /// diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteAlbum/DeleteAlbumEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteAlbum/DeleteAlbumEndpointTests.cs index e8b9119e..2749e900 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteAlbum/DeleteAlbumEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteAlbum/DeleteAlbumEndpointTests.cs @@ -5,6 +5,7 @@ using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioL using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; using Lumina.Application.Fixtures.Common.DataAccess.Entities.UsersManagement; using Lumina.DataAccess.Core.UoW; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.DeleteAlbum; using Lumina.Presentation.Api.IntegrationTests.Common.Setup; @@ -37,6 +38,8 @@ public class DeleteAlbumEndpointTests : IClassFixture @@ -77,6 +80,28 @@ public class DeleteAlbumEndpointTests : IClassFixture album.Id == otherAlbumId)); } + [Fact] + public async Task DeleteAlbum_WhenAlbumHasStoredArtwork_ShouldRemoveTheArtworkOfTheAlbumAndOfItsTracks() + { + // Arrange + Guid userId = GetCurrentUserId(); + (Guid libraryId, Guid artistId, Guid albumId, Guid trackId) = await SeedLibraryArtistAlbumAndTrackAsync(userId); + await SeedArtworkAsync(MusicArtworkOwnerType.Album, albumId, "media/music/queen/album.jpg"); + await SeedArtworkAsync(MusicArtworkOwnerType.Track, trackId, "media/music/queen/track.jpg"); + + // Act + HttpResponseMessage response = await _client.DeleteAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/albums/{albumId}"); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + // The artwork of the album and of its tracks does not cascade from the album row, so it is removed together with the album. + Assert.Null(await dbContext.MusicArtwork.FirstOrDefaultAsync(artwork => artwork.OwnerType == MusicArtworkOwnerType.Album && artwork.OwnerId == albumId)); + Assert.Null(await dbContext.MusicArtwork.FirstOrDefaultAsync(artwork => artwork.OwnerType == MusicArtworkOwnerType.Track && artwork.OwnerId == trackId)); + } + [Fact] public async Task DeleteAlbum_WhenArtistDoesNotExist_ShouldReturnArtistNotFoundProblem() { @@ -184,6 +209,74 @@ public class DeleteAlbumEndpointTests : IClassFixture /// The Id of the user that owns the library. /// The Id of the seeded library. + /// + /// Seeds a library owned by , an artist of that library, an album of that artist and a track of that album. + /// + /// The Id of the user that owns the library. + /// The Ids of the seeded library, artist, album and track. + private async Task<(Guid libraryId, Guid artistId, Guid albumId, Guid trackId)> SeedLibraryArtistAlbumAndTrackAsync(Guid userId) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + TrackEntity track = _trackEntityFixture.Create( + id: trackId, + albumId: albumId, + libraryId: libraryId, + includeMetadata: false, + includeOriginalReleaseDate: false, + includeOriginalReleaseYear: false, + includeReReleaseDate: false, + includeReReleaseYear: false); + AlbumEntity album = _albumEntityFixture.Create( + id: albumId, + artistId: artistId, + libraryId: libraryId, + title: "A Night at the Opera", + tracks: [track], + includeMetadata: false, + includeBarcode: false, + includeOriginalReleaseDate: false, + includeOriginalReleaseYear: false, + includeReReleaseDate: false, + includeReReleaseYear: false); + // An artist must keep at least one album, so a sibling album is seeded alongside the deleted one. + AlbumEntity otherAlbum = _albumEntityFixture.Create( + id: Guid.NewGuid(), + artistId: artistId, + libraryId: libraryId, + title: "News of the World", + includeTracks: false, + includeMetadata: false, + includeBarcode: false, + includeOriginalReleaseDate: false, + includeOriginalReleaseYear: false, + includeReReleaseDate: false, + includeReReleaseYear: false); + dbContext.Libraries.Add(_libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Queen Library", libraryType: LibraryType.Music, contentLocations: [])); + dbContext.Artists.Add(_artistEntityFixture.Create(id: artistId, libraryId: libraryId, name: "Queen", albums: [album, otherAlbum], includeContributors: false)); + await dbContext.SaveChangesAsync(); + return (libraryId, artistId, albumId, trackId); + } + + /// + /// Seeds a piece of stored artwork owned by the music library item identified by . + /// + /// The type of the music library item that owns the artwork. + /// The Id of the music library item that owns the artwork. + /// The relative file name of the stored artwork. + /// A task representing the asynchronous operation. + private async Task SeedArtworkAsync(MusicArtworkOwnerType ownerType, Guid ownerId, string fileName) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + dbContext.MusicArtwork.Add(_musicArtworkEntityFixture.Create(ownerType: ownerType, ownerId: ownerId, fileName: fileName)); + await dbContext.SaveChangesAsync(); + } + private async Task SeedLibraryAsync(Guid userId) { using IServiceScope scope = _apiFactory.Services.CreateScope(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteArtist/DeleteArtistEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteArtist/DeleteArtistEndpointTests.cs index c9d6ba48..2d6c3dbd 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteArtist/DeleteArtistEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteArtist/DeleteArtistEndpointTests.cs @@ -1,9 +1,11 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; using Lumina.Application.Common.DataAccess.Entities.UsersManagement; using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; using Lumina.Application.Fixtures.Common.DataAccess.Entities.UsersManagement; using Lumina.DataAccess.Core.UoW; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.DeleteArtist; using Lumina.Presentation.Api.IntegrationTests.Common.Setup; @@ -35,6 +37,9 @@ public class DeleteArtistEndpointTests : IClassFixture @@ -73,6 +78,33 @@ public class DeleteArtistEndpointTests : IClassFixture artist.Id == artistId)); } + [Fact] + public async Task DeleteArtist_WhenArtistHasStoredArtwork_ShouldRemoveTheArtworkOfTheArtistAndOfItsChildren() + { + // Arrange + Guid userId = GetCurrentUserId(); + (Guid libraryId, Guid artistId, Guid albumId, Guid trackId) = await SeedLibraryArtistAlbumAndTrackAsync(userId); + await SeedArtworkAsync(MusicArtworkOwnerType.Artist, artistId, "media/music/queen/artist.jpg"); + await SeedArtworkAsync(MusicArtworkOwnerType.Album, albumId, "media/music/queen/album.jpg"); + await SeedArtworkAsync(MusicArtworkOwnerType.Track, trackId, "media/music/queen/track.jpg"); + + // Act + HttpResponseMessage response = await _client.DeleteAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}"); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + // The artist takes its albums and their tracks with it, and the artwork of all of them does not cascade, so it is removed together with the artist. + Assert.Null(await dbContext.Artists.FirstOrDefaultAsync(artist => artist.Id == artistId)); + Assert.Null(await dbContext.Albums.FirstOrDefaultAsync(album => album.Id == albumId)); + Assert.Null(await dbContext.Tracks.FirstOrDefaultAsync(track => track.Id == trackId)); + Assert.Null(await dbContext.MusicArtwork.FirstOrDefaultAsync(artwork => artwork.OwnerType == MusicArtworkOwnerType.Artist && artwork.OwnerId == artistId)); + Assert.Null(await dbContext.MusicArtwork.FirstOrDefaultAsync(artwork => artwork.OwnerType == MusicArtworkOwnerType.Album && artwork.OwnerId == albumId)); + Assert.Null(await dbContext.MusicArtwork.FirstOrDefaultAsync(artwork => artwork.OwnerType == MusicArtworkOwnerType.Track && artwork.OwnerId == trackId)); + } + [Fact] public async Task DeleteArtist_WhenArtistDoesNotExist_ShouldReturnArtistNotFoundProblem() { @@ -163,6 +195,61 @@ public class DeleteArtistEndpointTests : IClassFixture /// The Id of the user that owns the library. /// The Id of the seeded library. + /// + /// Seeds a library owned by , an artist of that library, an album of that artist and a track of that album. + /// + /// The Id of the user that owns the library. + /// The Ids of the seeded library, artist, album and track. + private async Task<(Guid libraryId, Guid artistId, Guid albumId, Guid trackId)> SeedLibraryArtistAlbumAndTrackAsync(Guid userId) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + TrackEntity track = _trackEntityFixture.Create( + id: trackId, + albumId: albumId, + libraryId: libraryId, + includeMetadata: false, + includeOriginalReleaseDate: false, + includeOriginalReleaseYear: false, + includeReReleaseDate: false, + includeReReleaseYear: false); + AlbumEntity album = _albumEntityFixture.Create( + id: albumId, + artistId: artistId, + libraryId: libraryId, + title: "A Night at the Opera", + tracks: [track], + includeMetadata: false, + includeBarcode: false, + includeOriginalReleaseDate: false, + includeOriginalReleaseYear: false, + includeReReleaseDate: false, + includeReReleaseYear: false); + dbContext.Libraries.Add(_libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Queen Library", libraryType: LibraryType.Music, contentLocations: [])); + dbContext.Artists.Add(_artistEntityFixture.Create(id: artistId, libraryId: libraryId, name: "Queen", albums: [album], includeContributors: false)); + await dbContext.SaveChangesAsync(); + return (libraryId, artistId, albumId, trackId); + } + + /// + /// Seeds a piece of stored artwork owned by the music library item identified by . + /// + /// The type of the music library item that owns the artwork. + /// The Id of the music library item that owns the artwork. + /// The relative file name of the stored artwork. + /// A task representing the asynchronous operation. + private async Task SeedArtworkAsync(MusicArtworkOwnerType ownerType, Guid ownerId, string fileName) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + dbContext.MusicArtwork.Add(_musicArtworkEntityFixture.Create(ownerType: ownerType, ownerId: ownerId, fileName: fileName)); + await dbContext.SaveChangesAsync(); + } + private async Task SeedLibraryAsync(Guid userId) { using IServiceScope scope = _apiFactory.Services.CreateScope(); diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteTrack/DeleteTrackEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteTrack/DeleteTrackEndpointTests.cs index 61f3eca3..6133c9c9 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteTrack/DeleteTrackEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteTrack/DeleteTrackEndpointTests.cs @@ -6,12 +6,14 @@ using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioL using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; using Lumina.Application.Fixtures.Common.DataAccess.Entities.UsersManagement; using Lumina.DataAccess.Core.UoW; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.DeleteTrack; using Lumina.Presentation.Api.IntegrationTests.Common.Setup; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; @@ -40,6 +42,7 @@ public class DeleteTrackEndpointTests : IClassFixture @@ -81,6 +84,26 @@ public class DeleteTrackEndpointTests : IClassFixture artist.Id == artistId)); } + [Fact] + public async Task DeleteTrack_WhenTrackHasStoredArtwork_ShouldRemoveItsArtworkRecords() + { + // Arrange + Guid userId = GetCurrentUserId(); + (Guid libraryId, Guid artistId, Guid albumId, Guid trackId) = await SeedLibraryArtistAlbumAndTrackAsync(userId, "Bohemian Rhapsody", "/music/queen/bohemian-rhapsody.flac"); + await SeedArtworkAsync(MusicArtworkOwnerType.Track, trackId, "media/music/queen/bohemian-rhapsody.jpg"); + + // Act + HttpResponseMessage response = await _client.DeleteAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}"); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + // The artwork of the track does not cascade from the track row, so it is removed together with the track. + Assert.Null(await dbContext.MusicArtwork.FirstOrDefaultAsync(artwork => artwork.OwnerType == MusicArtworkOwnerType.Track && artwork.OwnerId == trackId)); + } + [Fact] public async Task DeleteTrack_WhenArtistDoesNotExist_ShouldReturnArtistNotFoundProblem() { @@ -229,10 +252,12 @@ public class DeleteTrackEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Unauthorized", problemDetails!["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); + Assert.DoesNotContain("Exception", content, StringComparison.Ordinal); } [Fact] @@ -258,8 +283,9 @@ public class DeleteTrackEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("LibraryIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } @@ -272,8 +298,9 @@ public class DeleteTrackEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("ArtistIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } @@ -286,8 +313,9 @@ public class DeleteTrackEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("AlbumIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } @@ -300,11 +328,27 @@ public class DeleteTrackEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("TrackIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } + /// + /// Seeds a piece of stored artwork owned by the music library item identified by . + /// + /// The type of the music library item that owns the artwork. + /// The Id of the music library item that owns the artwork. + /// The relative file name of the stored artwork. + /// A task representing the asynchronous operation. + private async Task SeedArtworkAsync(MusicArtworkOwnerType ownerType, Guid ownerId, string fileName) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + dbContext.MusicArtwork.Add(_musicArtworkEntityFixture.Create(ownerType: ownerType, ownerId: ownerId, fileName: fileName)); + await dbContext.SaveChangesAsync(); + } + /// /// Seeds a library owned by , an artist of that library, an album of that artist and a track of that album. /// diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandlerTests.cs index 927ca97b..30a809ea 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/DeleteAlbum/DeleteAlbumCommandHandlerTests.cs @@ -9,6 +9,7 @@ using Lumina.Application.Common.Infrastructure.Authorization; using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership; using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.DeleteAlbum; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.DeleteAlbum; @@ -35,6 +36,7 @@ public class DeleteAlbumCommandHandlerTests private readonly IUnitOfWork _mockUnitOfWork; private readonly IArtistRepository _mockArtistRepository; private readonly ILibraryRepository _mockLibraryRepository; + private readonly IMusicArtworkCleanupService _mockMusicArtworkCleanupService; private readonly IAuthorizationService _mockAuthorizationService; private readonly ICurrentUserService _mockCurrentUserService; private readonly IValidator _mockValidator; @@ -55,24 +57,27 @@ public class DeleteAlbumCommandHandlerTests _mockLibraryRepository = Substitute.For(); _mockUnitOfWork.ArtistRepository.Returns(_mockArtistRepository); _mockUnitOfWork.LibraryRepository.Returns(_mockLibraryRepository); + _mockMusicArtworkCleanupService = Substitute.For(); _mockAuthorizationService = Substitute.For(); _mockCurrentUserService = Substitute.For(); _mockValidator = Substitute.For>(); _userId = Guid.NewGuid(); - // Default stubs: the command is valid, the current user is authenticated, the ownership policy allows the deletion, the library exists, the artist update succeeds and saving changes succeeds. + // Default stubs: the command is valid, the current user is authenticated, the ownership policy allows the deletion, the library exists, the artist update succeeds, the artwork cleanup succeeds and saving changes succeeds. _mockValidator.Validate(Arg.Any()).Returns([]); _mockCurrentUserService.UserId.Returns(_userId); _mockAuthorizationService.EvaluatePolicyAsync(_userId, Arg.Any(), Arg.Any()) .Returns(true); _mockLibraryRepository.GetByIdAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) .Returns(_ => Result.From(_libraryEntityFixture.Create())); + _mockMusicArtworkCleanupService.DeleteAlbumArtworkAsync(Arg.Any(), Arg.Any()) + .Returns(Result.Deleted); _mockArtistRepository.UpdateAsync(Arg.Any(), Arg.Any()) .Returns(Result.Updated); _mockUnitOfWork.SaveChangesAsync(Arg.Any()) .Returns(Result.Success); - _sut = new DeleteAlbumCommandHandler(_mockUnitOfWork, _mockAuthorizationService, _mockCurrentUserService, _mockValidator); + _sut = new DeleteAlbumCommandHandler(_mockUnitOfWork, _mockMusicArtworkCleanupService, _mockAuthorizationService, _mockCurrentUserService, _mockValidator); } [Fact] @@ -92,6 +97,13 @@ public class DeleteAlbumCommandHandlerTests // Assert Assert.False(result.IsFailure); Assert.Equal(Result.Deleted, result.Value); + // The artwork of the album and of its tracks is removed before the album is removed from the artist aggregate, so that no artwork is orphaned. + await _mockMusicArtworkCleanupService.Received(1).DeleteAlbumArtworkAsync(albumId, Arg.Any()); + Received.InOrder(() => + { + _mockMusicArtworkCleanupService.DeleteAlbumArtworkAsync(albumId, Arg.Any()); + _mockArtistRepository.UpdateAsync(Arg.Any(), Arg.Any()); + }); await _mockArtistRepository.Received(1).UpdateAsync( Arg.Is(updatedArtist => updatedArtist.Id == artistId && @@ -117,6 +129,7 @@ public class DeleteAlbumCommandHandlerTests Assert.True(result.IsFailure); Assert.Equal(DomainErrors.Music.AlbumIdCannotBeEmpty, result.FirstError); await _mockArtistRepository.DidNotReceive().GetByIdAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkCleanupService.DidNotReceive().DeleteAlbumArtworkAsync(Arg.Any(), Arg.Any()); await _mockArtistRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); } @@ -323,6 +336,30 @@ public class DeleteAlbumCommandHandlerTests // Assert Assert.True(result.IsFailure); Assert.Equal(DomainErrors.Music.ArtistMustHaveAtLeastOneAlbum, result.FirstError); + await _mockMusicArtworkCleanupService.DidNotReceive().DeleteAlbumArtworkAsync(Arg.Any(), Arg.Any()); + await _mockArtistRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenArtworkCleanupFails_ShouldReturnErrorWithoutUpdatingTheArtist() + { + // Arrange + DeleteAlbumCommand command = _deleteAlbumCommandFixture.Create(); + Guid libraryId = Guid.Parse(command.LibraryId!); + Guid artistId = Guid.Parse(command.ArtistId!); + Guid albumId = Guid.Parse(command.AlbumId!); + StubExistingArtist(CreateArtistWithAlbums(libraryId, artistId, albumId, Guid.NewGuid())); + Error error = Error.Failure(description: "Failed to delete the artwork"); + _mockMusicArtworkCleanupService.DeleteAlbumArtworkAsync(albumId, Arg.Any()) + .Returns(error); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(error, result.FirstError); await _mockArtistRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandlerTests.cs index 19f1198a..c387ff71 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/DeleteArtist/DeleteArtistCommandHandlerTests.cs @@ -9,6 +9,7 @@ using Lumina.Application.Common.Infrastructure.Authorization; using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership; using Lumina.Application.Common.Infrastructure.Validation; using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.DeleteArtist; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.DeleteArtist; @@ -33,6 +34,7 @@ public class DeleteArtistCommandHandlerTests private readonly IUnitOfWork _mockUnitOfWork; private readonly IArtistRepository _mockArtistRepository; private readonly ILibraryRepository _mockLibraryRepository; + private readonly IMusicArtworkCleanupService _mockMusicArtworkCleanupService; private readonly IAuthorizationService _mockAuthorizationService; private readonly ICurrentUserService _mockCurrentUserService; private readonly IValidator _mockValidator; @@ -52,24 +54,27 @@ public class DeleteArtistCommandHandlerTests _mockLibraryRepository = Substitute.For(); _mockUnitOfWork.ArtistRepository.Returns(_mockArtistRepository); _mockUnitOfWork.LibraryRepository.Returns(_mockLibraryRepository); + _mockMusicArtworkCleanupService = Substitute.For(); _mockAuthorizationService = Substitute.For(); _mockCurrentUserService = Substitute.For(); _mockValidator = Substitute.For>(); _userId = Guid.NewGuid(); - // Default stubs: the command is valid, the current user is authenticated, the ownership policy allows the deletion, the library exists, the artist deletion succeeds and saving changes succeeds. + // Default stubs: the command is valid, the current user is authenticated, the ownership policy allows the deletion, the library exists, the artist deletion succeeds, the artwork cleanup succeeds and saving changes succeeds. _mockValidator.Validate(Arg.Any()).Returns([]); _mockCurrentUserService.UserId.Returns(_userId); _mockAuthorizationService.EvaluatePolicyAsync(_userId, Arg.Any(), Arg.Any()) .Returns(true); _mockLibraryRepository.GetByIdAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) .Returns(_ => Result.From(_libraryEntityFixture.Create())); + _mockMusicArtworkCleanupService.DeleteArtistArtworkAsync(Arg.Any(), Arg.Any()) + .Returns(Result.Deleted); _mockArtistRepository.DeleteByIdAsync(Arg.Any(), Arg.Any()) .Returns(Result.Deleted); _mockUnitOfWork.SaveChangesAsync(Arg.Any()) .Returns(Result.Success); - _sut = new DeleteArtistCommandHandler(_mockUnitOfWork, _mockAuthorizationService, _mockCurrentUserService, _mockValidator); + _sut = new DeleteArtistCommandHandler(_mockUnitOfWork, _mockMusicArtworkCleanupService, _mockAuthorizationService, _mockCurrentUserService, _mockValidator); } [Fact] @@ -89,6 +94,13 @@ public class DeleteArtistCommandHandlerTests // Assert Assert.False(result.IsFailure); Assert.Equal(Result.Deleted, result.Value); + // The artwork of the artist and of its albums and tracks is removed before the artist row, so that no artwork is orphaned. + await _mockMusicArtworkCleanupService.Received(1).DeleteArtistArtworkAsync(artistId, Arg.Any()); + Received.InOrder(() => + { + _mockMusicArtworkCleanupService.DeleteArtistArtworkAsync(artistId, Arg.Any()); + _mockArtistRepository.DeleteByIdAsync(artistId, Arg.Any()); + }); await _mockArtistRepository.Received(1).DeleteByIdAsync(artistId, Arg.Any()); await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any()); await _mockAuthorizationService.Received(1).EvaluatePolicyAsync( @@ -110,6 +122,7 @@ public class DeleteArtistCommandHandlerTests Assert.True(result.IsFailure); Assert.Equal(DomainErrors.Music.ArtistIdCannotBeEmpty, result.FirstError); await _mockArtistRepository.DidNotReceive().GetByIdAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkCleanupService.DidNotReceive().DeleteArtistArtworkAsync(Arg.Any(), Arg.Any()); await _mockArtistRepository.DidNotReceive().DeleteByIdAsync(Arg.Any(), Arg.Any()); await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); } @@ -259,6 +272,30 @@ public class DeleteArtistCommandHandlerTests await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); } + [Fact] + public async Task HandleAsync_WhenArtworkCleanupFails_ShouldReturnErrorWithoutDeletingTheArtist() + { + // Arrange + DeleteArtistCommand command = _deleteArtistCommandFixture.Create(); + Guid libraryId = Guid.Parse(command.LibraryId!); + Guid artistId = Guid.Parse(command.ArtistId!); + ArtistEntity artist = _artistEntityFixture.Create(id: artistId, libraryId: libraryId, includeAlbums: false, includeContributors: false); + _mockArtistRepository.GetByIdAsync(artistId, shouldIncludeNavigationProperties: false, shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(artist)); + Error error = Error.Failure(description: "Failed to delete the artwork"); + _mockMusicArtworkCleanupService.DeleteArtistArtworkAsync(artistId, Arg.Any()) + .Returns(error); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(error, result.FirstError); + await _mockArtistRepository.DidNotReceive().DeleteByIdAsync(Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + [Fact] public async Task HandleAsync_WhenDeleteArtistFails_ShouldReturnErrorWithoutSaving() { diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkCleanupServiceTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkCleanupServiceTests.cs new file mode 100644 index 00000000..a6beb96e --- /dev/null +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artwork/MusicArtworkCleanupServiceTests.cs @@ -0,0 +1,324 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Common.DataAccess.Repositories.MusicLibrary; +using Lumina.Application.Common.DataAccess.UoW; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Domain.Common.Primitives; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using NSubstitute; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Threading; +using System.Threading.Tasks; +using ApplicationErrors = Lumina.Application.Common.Errors.Errors; +#endregion + +namespace Lumina.Application.UnitTests.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicArtworkCleanupServiceTests +{ + private readonly IUnitOfWork _mockUnitOfWork; + private readonly IAlbumRepository _mockAlbumRepository; + private readonly ITrackRepository _mockTrackRepository; + private readonly IMusicArtworkRepository _mockMusicArtworkRepository; + private readonly IMusicArtworkService _mockMusicArtworkService; + private readonly MusicArtworkCleanupService _sut; + private readonly AlbumEntityFixture _albumEntityFixture = new(); + private readonly TrackEntityFixture _trackEntityFixture = new(); + private readonly MusicArtworkEntityFixture _musicArtworkEntityFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public MusicArtworkCleanupServiceTests() + { + _mockUnitOfWork = Substitute.For(); + _mockAlbumRepository = Substitute.For(); + _mockTrackRepository = Substitute.For(); + _mockMusicArtworkRepository = Substitute.For(); + _mockMusicArtworkService = Substitute.For(); + _mockUnitOfWork.AlbumRepository.Returns(_mockAlbumRepository); + _mockUnitOfWork.TrackRepository.Returns(_mockTrackRepository); + _mockUnitOfWork.MusicArtworkRepository.Returns(_mockMusicArtworkRepository); + + // Default stubs: every owner has no artwork, deleting the records succeeds, deleting a stored file succeeds. + _mockAlbumRepository.GetByArtistIdAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From>([])); + _mockTrackRepository.GetByAlbumIdAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From>([])); + _mockMusicArtworkRepository.GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From>([])); + _mockMusicArtworkRepository.DeleteByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.Deleted); + _mockMusicArtworkService.DeleteStoredArtwork(Arg.Any()).Returns(Result.Deleted); + + _sut = new MusicArtworkCleanupService(_mockUnitOfWork, _mockMusicArtworkService); + } + + [Fact] + public async Task DeleteArtistArtworkAsync_WhenArtistHasAlbumsAndTracks_ShouldRemoveTheArtworkOfTheChildrenBeforeTheArtistArtwork() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid firstAlbumId = Guid.NewGuid(); + Guid secondAlbumId = Guid.NewGuid(); + Guid firstTrackId = Guid.NewGuid(); + Guid secondTrackId = Guid.NewGuid(); + Guid thirdTrackId = Guid.NewGuid(); + AlbumEntity firstAlbum = _albumEntityFixture.Create(id: firstAlbumId, includeTracks: false); + AlbumEntity secondAlbum = _albumEntityFixture.Create(id: secondAlbumId, includeTracks: false); + TrackEntity firstTrack = _trackEntityFixture.Create(id: firstTrackId, albumId: firstAlbumId); + TrackEntity secondTrack = _trackEntityFixture.Create(id: secondTrackId, albumId: firstAlbumId); + TrackEntity thirdTrack = _trackEntityFixture.Create(id: thirdTrackId, albumId: secondAlbumId); + MusicArtworkEntity firstTrackArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Track, ownerId: firstTrackId, fileName: "/media/music/first-track.jpg"); + MusicArtworkEntity secondTrackArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Track, ownerId: secondTrackId, fileName: "/media/music/second-track.jpg"); + MusicArtworkEntity thirdTrackArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Track, ownerId: thirdTrackId, fileName: "/media/music/third-track.jpg"); + MusicArtworkEntity firstAlbumArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: firstAlbumId, fileName: "/media/music/first-album.jpg"); + MusicArtworkEntity secondAlbumArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: secondAlbumId, fileName: "/media/music/second-album.jpg"); + MusicArtworkEntity artistArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, ownerId: artistId, fileName: "/media/music/artist.jpg"); + _mockAlbumRepository.GetByArtistIdAsync(artistId, Arg.Any()) + .Returns(Result.From>([firstAlbum, secondAlbum])); + _mockTrackRepository.GetByAlbumIdAsync(firstAlbumId, Arg.Any()) + .Returns(Result.From>([firstTrack, secondTrack])); + _mockTrackRepository.GetByAlbumIdAsync(secondAlbumId, Arg.Any()) + .Returns(Result.From>([thirdTrack])); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Track, firstTrackId, Arg.Any()) + .Returns(Result.From>([firstTrackArtwork])); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Track, secondTrackId, Arg.Any()) + .Returns(Result.From>([secondTrackArtwork])); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Track, thirdTrackId, Arg.Any()) + .Returns(Result.From>([thirdTrackArtwork])); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, firstAlbumId, Arg.Any()) + .Returns(Result.From>([firstAlbumArtwork])); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, secondAlbumId, Arg.Any()) + .Returns(Result.From>([secondAlbumArtwork])); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Artist, artistId, Arg.Any()) + .Returns(Result.From>([artistArtwork])); + + // Act + Result result = await _sut.DeleteArtistArtworkAsync(artistId, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork(firstTrackArtwork.FileName!); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork(secondTrackArtwork.FileName!); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork(thirdTrackArtwork.FileName!); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork(firstAlbumArtwork.FileName!); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork(secondAlbumArtwork.FileName!); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork(artistArtwork.FileName!); + // Every owner of the artwork is removed from the innermost children outwards, so that no artwork is orphaned. + Received.InOrder(() => + { + _mockMusicArtworkRepository.DeleteByOwnerAsync(MusicArtworkOwnerType.Track, firstTrackId, Arg.Any()); + _mockMusicArtworkRepository.DeleteByOwnerAsync(MusicArtworkOwnerType.Track, secondTrackId, Arg.Any()); + _mockMusicArtworkRepository.DeleteByOwnerAsync(MusicArtworkOwnerType.Album, firstAlbumId, Arg.Any()); + _mockMusicArtworkRepository.DeleteByOwnerAsync(MusicArtworkOwnerType.Track, thirdTrackId, Arg.Any()); + _mockMusicArtworkRepository.DeleteByOwnerAsync(MusicArtworkOwnerType.Album, secondAlbumId, Arg.Any()); + _mockMusicArtworkRepository.DeleteByOwnerAsync(MusicArtworkOwnerType.Artist, artistId, Arg.Any()); + }); + } + + [Fact] + public async Task DeleteArtistArtworkAsync_WhenGetAlbumsFails_ShouldReturnTheErrorWithoutDeletingAnyArtwork() + { + // Arrange + Guid artistId = Guid.NewGuid(); + _mockAlbumRepository.GetByArtistIdAsync(artistId, Arg.Any()) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.DeleteArtistArtworkAsync(artistId, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + await _mockMusicArtworkRepository.DidNotReceive().DeleteByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()); + _mockMusicArtworkService.DidNotReceive().DeleteStoredArtwork(Arg.Any()); + } + + [Fact] + public async Task DeleteArtistArtworkAsync_WhenAChildArtworkCleanupFails_ShouldReturnTheErrorWithoutDeletingTheArtistArtwork() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create(id: albumId, includeTracks: false); + _mockAlbumRepository.GetByArtistIdAsync(artistId, Arg.Any()) + .Returns(Result.From>([album])); + _mockMusicArtworkRepository.DeleteByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.DeleteArtistArtworkAsync(artistId, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + await _mockMusicArtworkRepository.DidNotReceive().DeleteByOwnerAsync(MusicArtworkOwnerType.Artist, Arg.Any(), Arg.Any()); + } + + [Fact] + public async Task DeleteAlbumArtworkAsync_WhenAlbumHasTracks_ShouldRemoveTheArtworkOfTheTracksBeforeTheAlbumArtwork() + { + // Arrange + Guid albumId = Guid.NewGuid(); + Guid firstTrackId = Guid.NewGuid(); + Guid secondTrackId = Guid.NewGuid(); + TrackEntity firstTrack = _trackEntityFixture.Create(id: firstTrackId, albumId: albumId); + TrackEntity secondTrack = _trackEntityFixture.Create(id: secondTrackId, albumId: albumId); + MusicArtworkEntity firstTrackArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Track, ownerId: firstTrackId, fileName: "/media/music/first-track.jpg"); + MusicArtworkEntity secondTrackArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Track, ownerId: secondTrackId, fileName: "/media/music/second-track.jpg"); + MusicArtworkEntity albumArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, fileName: "/media/music/album.jpg"); + _mockTrackRepository.GetByAlbumIdAsync(albumId, Arg.Any()) + .Returns(Result.From>([firstTrack, secondTrack])); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Track, firstTrackId, Arg.Any()) + .Returns(Result.From>([firstTrackArtwork])); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Track, secondTrackId, Arg.Any()) + .Returns(Result.From>([secondTrackArtwork])); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()) + .Returns(Result.From>([albumArtwork])); + + // Act + Result result = await _sut.DeleteAlbumArtworkAsync(albumId, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork(firstTrackArtwork.FileName!); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork(secondTrackArtwork.FileName!); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork(albumArtwork.FileName!); + Received.InOrder(() => + { + _mockMusicArtworkRepository.DeleteByOwnerAsync(MusicArtworkOwnerType.Track, firstTrackId, Arg.Any()); + _mockMusicArtworkRepository.DeleteByOwnerAsync(MusicArtworkOwnerType.Track, secondTrackId, Arg.Any()); + _mockMusicArtworkRepository.DeleteByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()); + }); + } + + [Fact] + public async Task DeleteAlbumArtworkAsync_WhenGetTracksFails_ShouldReturnTheErrorWithoutDeletingAnyArtwork() + { + // Arrange + Guid albumId = Guid.NewGuid(); + _mockTrackRepository.GetByAlbumIdAsync(albumId, Arg.Any()) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.DeleteAlbumArtworkAsync(albumId, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + await _mockMusicArtworkRepository.DidNotReceive().DeleteByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()); + } + + [Fact] + public async Task DeleteAlbumArtworkAsync_WhenGetArtworkFails_ShouldReturnTheErrorWithoutDeletingTheRecords() + { + // Arrange + Guid albumId = Guid.NewGuid(); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.DeleteAlbumArtworkAsync(albumId, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + await _mockMusicArtworkRepository.DidNotReceive().DeleteByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()); + } + + [Fact] + public async Task DeleteAlbumArtworkAsync_WhenDeletingTheArtworkRecordsFails_ShouldReturnTheError() + { + // Arrange + Guid albumId = Guid.NewGuid(); + _mockMusicArtworkRepository.DeleteByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.DeleteAlbumArtworkAsync(albumId, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + } + + [Fact] + public async Task DeleteAlbumArtworkAsync_WhenDeletingAStoredArtworkFileFails_ShouldReturnTheErrorWithoutDeletingTheRecords() + { + // Arrange + Guid albumId = Guid.NewGuid(); + MusicArtworkEntity albumArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, fileName: "/media/music/album.jpg"); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()) + .Returns(Result.From>([albumArtwork])); + _mockMusicArtworkService.DeleteStoredArtwork(albumArtwork.FileName!) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.DeleteAlbumArtworkAsync(albumId, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + await _mockMusicArtworkRepository.DidNotReceive().DeleteByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()); + } + + [Fact] + public async Task DeleteAlbumArtworkAsync_WhenArtworkHasNoStoredFile_ShouldSkipTheFileDeletionButDeleteTheRecords() + { + // Arrange + Guid albumId = Guid.NewGuid(); + // An artwork whose file has not been resolved yet has no file to remove, but its record still has to be removed. + MusicArtworkEntity unresolvedArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, includeFileName: false); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()) + .Returns(Result.From>([unresolvedArtwork])); + + // Act + Result result = await _sut.DeleteAlbumArtworkAsync(albumId, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockMusicArtworkService.DidNotReceive().DeleteStoredArtwork(Arg.Any()); + await _mockMusicArtworkRepository.Received(1).DeleteByOwnerAsync(MusicArtworkOwnerType.Album, albumId, Arg.Any()); + } + + [Fact] + public async Task DeleteTrackArtworkAsync_WhenArtworkExists_ShouldDeleteTheStoredFilesAndTheRecords() + { + // Arrange + Guid trackId = Guid.NewGuid(); + MusicArtworkEntity trackArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Track, ownerId: trackId, fileName: "/media/music/track.jpg"); + _mockMusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Track, trackId, Arg.Any()) + .Returns(Result.From>([trackArtwork])); + + // Act + Result result = await _sut.DeleteTrackArtworkAsync(trackId, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork(trackArtwork.FileName!); + await _mockMusicArtworkRepository.Received(1).DeleteByOwnerAsync(MusicArtworkOwnerType.Track, trackId, Arg.Any()); + } + + [Fact] + public async Task DeleteTrackArtworkAsync_WhenNoArtworkExists_ShouldStillDeleteTheRecords() + { + // Arrange + Guid trackId = Guid.NewGuid(); + + // Act + Result result = await _sut.DeleteTrackArtworkAsync(trackId, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockMusicArtworkService.DidNotReceive().DeleteStoredArtwork(Arg.Any()); + await _mockMusicArtworkRepository.Received(1).DeleteByOwnerAsync(MusicArtworkOwnerType.Track, trackId, Arg.Any()); + } +} diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandlerTests.cs index 4c37e1db..4a6bb5f3 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/Commands/DeleteTrack/DeleteTrackCommandHandlerTests.cs @@ -8,6 +8,7 @@ using Lumina.Application.Common.Infrastructure.Authentication; using Lumina.Application.Common.Infrastructure.Authorization; using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership; using Lumina.Application.Common.Infrastructure.Validation; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Commands.DeleteTrack; using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; @@ -33,6 +34,7 @@ public class DeleteTrackCommandHandlerTests private readonly IUnitOfWork _mockUnitOfWork; private readonly IArtistRepository _mockArtistRepository; private readonly ILibraryRepository _mockLibraryRepository; + private readonly IMusicArtworkCleanupService _mockMusicArtworkCleanupService; private readonly IAuthorizationService _mockAuthorizationService; private readonly ICurrentUserService _mockCurrentUserService; private readonly IValidator _mockValidator; @@ -54,22 +56,25 @@ public class DeleteTrackCommandHandlerTests _mockLibraryRepository = Substitute.For(); _mockUnitOfWork.ArtistRepository.Returns(_mockArtistRepository); _mockUnitOfWork.LibraryRepository.Returns(_mockLibraryRepository); + _mockMusicArtworkCleanupService = Substitute.For(); _mockAuthorizationService = Substitute.For(); _mockCurrentUserService = Substitute.For(); _mockValidator = Substitute.For>(); _userId = Guid.NewGuid(); - // Default stubs: the command is valid, the current user is authenticated, the ownership policy allows the deletion, the artist update succeeds and saving changes succeeds. + // Default stubs: the command is valid, the current user is authenticated, the ownership policy allows the deletion, the artist update succeeds, the artwork cleanup succeeds and saving changes succeeds. _mockValidator.Validate(Arg.Any()).Returns([]); _mockCurrentUserService.UserId.Returns(_userId); _mockAuthorizationService.EvaluatePolicyAsync(_userId, Arg.Any(), Arg.Any()) .Returns(true); + _mockMusicArtworkCleanupService.DeleteTrackArtworkAsync(Arg.Any(), Arg.Any()) + .Returns(Result.Deleted); _mockArtistRepository.UpdateAsync(Arg.Any(), Arg.Any()) .Returns(Result.Updated); _mockUnitOfWork.SaveChangesAsync(Arg.Any()) .Returns(Result.Success); - _sut = new DeleteTrackCommandHandler(_mockUnitOfWork, _mockAuthorizationService, _mockCurrentUserService, _mockValidator); + _sut = new DeleteTrackCommandHandler(_mockUnitOfWork, _mockMusicArtworkCleanupService, _mockAuthorizationService, _mockCurrentUserService, _mockValidator); } [Fact] @@ -87,6 +92,13 @@ public class DeleteTrackCommandHandlerTests // Assert Assert.False(result.IsFailure); Assert.Equal(Result.Deleted, result.Value); + // The artwork of the track is removed before the track is removed from the artist aggregate, so that no artwork is orphaned. + await _mockMusicArtworkCleanupService.Received(1).DeleteTrackArtworkAsync(trackId, Arg.Any()); + Received.InOrder(() => + { + _mockMusicArtworkCleanupService.DeleteTrackArtworkAsync(trackId, Arg.Any()); + _mockArtistRepository.UpdateAsync(Arg.Any(), Arg.Any()); + }); await _mockArtistRepository.Received(1).UpdateAsync( Arg.Is(updatedArtist => updatedArtist.Id == artistId && @@ -141,6 +153,7 @@ public class DeleteTrackCommandHandlerTests Assert.Equal(DomainErrors.Music.TrackIdCannotBeEmpty, result.FirstError); await _mockArtistRepository.DidNotReceive().GetByIdAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); await _mockLibraryRepository.DidNotReceive().GetByIdAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkCleanupService.DidNotReceive().DeleteTrackArtworkAsync(Arg.Any(), Arg.Any()); await _mockArtistRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); } @@ -360,6 +373,28 @@ public class DeleteTrackCommandHandlerTests await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); } + [Fact] + public async Task HandleAsync_WhenArtworkCleanupFails_ShouldReturnErrorWithoutUpdatingTheArtist() + { + // Arrange + DeleteTrackCommand command = _deleteTrackCommandFixture.Create(); + (Guid libraryId, Guid artistId, Guid albumId, Guid trackId) = GetCommandIds(command); + ArtistEntity artist = CreateArtistWithAlbumAndTrack(libraryId, artistId, albumId, trackId); + StubArtistAndLibrary(artist, libraryId); + Error error = Error.Failure(description: "Failed to delete the artwork"); + _mockMusicArtworkCleanupService.DeleteTrackArtworkAsync(trackId, Arg.Any()) + .Returns(error); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(error, result.FirstError); + await _mockArtistRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + [Fact] public async Task HandleAsync_WhenUpdateArtistFails_ShouldReturnErrorWithoutSaving() { diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandlerTests.cs index 293a41b1..9513bdcd 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/Management/Events/LibraryDeletedDomainEventHandlerTests.cs @@ -1,4 +1,7 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Repositories.BookLibrary; +using Lumina.Application.Common.DataAccess.Repositories.MusicLibrary; +using Lumina.Application.Common.DataAccess.UoW; using Lumina.Application.Common.Infrastructure.Models.DTO.Configuration; using Lumina.Application.Core.MediaLibrary.Management.Events; using Lumina.Application.Fixtures.Common.Infrastructure.Models.DTO.Configuration; @@ -17,6 +20,7 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; +using DomainErrors = Lumina.Domain.Common.Errors.Errors; #endregion namespace Lumina.Application.UnitTests.Core.MediaLibrary.Management.Events; @@ -27,6 +31,11 @@ namespace Lumina.Application.UnitTests.Core.MediaLibrary.Management.Events; [ExcludeFromCodeCoverage] public class LibraryDeletedDomainEventHandlerTests { + private readonly IUnitOfWork _mockUnitOfWork; + private readonly IMusicArtworkRepository _mockMusicArtworkRepository; + private readonly IArtistRepository _mockArtistRepository; + private readonly IBookRepository _mockBookRepository; + private readonly IMusicLibraryScanItemMetadataRepository _mockMusicLibraryScanItemMetadataRepository; private readonly IEnvironmentContext _mockEnvironmentContext; private readonly IDirectoryProviderService _mockDirectoryProviderService; private readonly IPathService _mockPathService; @@ -40,6 +49,20 @@ public class LibraryDeletedDomainEventHandlerTests /// public LibraryDeletedDomainEventHandlerTests() { + _mockUnitOfWork = Substitute.For(); + _mockMusicArtworkRepository = Substitute.For(); + _mockArtistRepository = Substitute.For(); + _mockBookRepository = Substitute.For(); + _mockMusicLibraryScanItemMetadataRepository = Substitute.For(); + _mockUnitOfWork.MusicArtworkRepository.Returns(_mockMusicArtworkRepository); + _mockUnitOfWork.ArtistRepository.Returns(_mockArtistRepository); + _mockUnitOfWork.BookRepository.Returns(_mockBookRepository); + _mockUnitOfWork.MusicLibraryScanItemMetadataRepository.Returns(_mockMusicLibraryScanItemMetadataRepository); + _mockMusicArtworkRepository.DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()).Returns(Result.Deleted); + _mockArtistRepository.DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()).Returns(Result.Deleted); + _mockBookRepository.DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()).Returns(Result.Deleted); + _mockMusicLibraryScanItemMetadataRepository.DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()).Returns(Result.Deleted); + _mockEnvironmentContext = Substitute.For(); _mockDirectoryProviderService = Substitute.For(); _mockEnvironmentContext.DirectoryProviderService.Returns(_mockDirectoryProviderService); @@ -48,20 +71,24 @@ public class LibraryDeletedDomainEventHandlerTests MediaSettingsDto mediaSettings = _mediaSettingsDtoFixture.Create( rootDirectory: "Media", librariesDirectory: "Libraries", - booksDirectory: "Books"); + booksDirectory: "Books", + musicDirectory: "Music"); IOptions mediaSettingsOptions = Substitute.For>(); mediaSettingsOptions.Value.Returns(mediaSettings); - // default stubs: all path combinations succeed and the directory is deleted successfully + // default stubs: all path combinations succeed, segments are sanitized to their input, the library directories exist and they are deleted successfully _mockPathService.CombinePath(Arg.Any(), Arg.Any()) .Returns(callInfo => Result.From(string.Concat(callInfo.ArgAt(0), callInfo.ArgAt(1)))); + _mockPathService.SanitizeSegment(Arg.Any()) + .Returns(callInfo => PathSegment.Create(callInfo.ArgAt(0), isDirectory: false, isDrive: false)); + _mockDirectoryProviderService.DirectoryExists(Arg.Any()).Returns(Result.From(true)); _mockDirectoryProviderService.DeleteDirectory(Arg.Any()).Returns(Result.Deleted); - _sut = new LibraryDeletedDomainEventHandler(_mockEnvironmentContext, _mockPathService, mediaSettingsOptions); + _sut = new LibraryDeletedDomainEventHandler(_mockUnitOfWork, _mockEnvironmentContext, _mockPathService, mediaSettingsOptions); } [Fact] - public async Task HandleAsync_WhenLibraryIsDeleted_ShouldDeleteLibraryDirectory() + public async Task HandleAsync_WhenLibraryIsDeleted_ShouldDeleteMediaItemsAndLibraryDirectory() { // Arrange Guid libraryId = Guid.NewGuid(); @@ -72,7 +99,11 @@ public class LibraryDeletedDomainEventHandlerTests await _sut.HandleAsync(domainEvent, CancellationToken.None); // Assert - _mockDirectoryProviderService.Received(1).DeleteDirectory( + await _mockMusicArtworkRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockArtistRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockBookRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockMusicLibraryScanItemMetadataRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + _mockDirectoryProviderService.Received(3).DeleteDirectory( Arg.Is(path => path.Path.EndsWith(libraryId.ToString(), StringComparison.Ordinal))); } @@ -112,4 +143,243 @@ public class LibraryDeletedDomainEventHandlerTests Assert.Equal(error, exception.EventualConsistencyError); _mockDirectoryProviderService.DidNotReceive().DeleteDirectory(Arg.Any()); } + + [Fact] + public async Task HandleAsync_WhenDeleteMusicArtworkFails_ShouldThrowEventualConsistencyExceptionWithoutDeletingAnythingElse() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Library library = _libraryFixture.Create(id: libraryId); + LibraryDeletedDomainEvent domainEvent = _libraryDeletedDomainEventFixture.Create(library: library); + Error error = Error.Failure(description: "Failed to delete music artwork"); + _mockMusicArtworkRepository.DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()).Returns(error); + + // Act + EventualConsistencyException exception = await Assert.ThrowsAsync( + () => _sut.HandleAsync(domainEvent, CancellationToken.None).AsTask()); + + // Assert + Assert.Equal(error, exception.EventualConsistencyError); + await _mockArtistRepository.DidNotReceive().DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()); + await _mockBookRepository.DidNotReceive().DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()); + await _mockMusicLibraryScanItemMetadataRepository.DidNotReceive().DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()); + _mockDirectoryProviderService.DidNotReceive().DeleteDirectory(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenDeleteArtistsFails_ShouldThrowEventualConsistencyExceptionWithoutDeletingAnythingElse() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Library library = _libraryFixture.Create(id: libraryId); + LibraryDeletedDomainEvent domainEvent = _libraryDeletedDomainEventFixture.Create(library: library); + Error error = Error.Failure(description: "Failed to delete artists"); + _mockArtistRepository.DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()).Returns(error); + + // Act + EventualConsistencyException exception = await Assert.ThrowsAsync( + () => _sut.HandleAsync(domainEvent, CancellationToken.None).AsTask()); + + // Assert + Assert.Equal(error, exception.EventualConsistencyError); + // The artwork is deleted before its owners, so that its owners are still present when the artwork is looked up. + await _mockMusicArtworkRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockBookRepository.DidNotReceive().DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()); + await _mockMusicLibraryScanItemMetadataRepository.DidNotReceive().DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()); + _mockDirectoryProviderService.DidNotReceive().DeleteDirectory(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenDeleteBooksFails_ShouldThrowEventualConsistencyExceptionWithoutDeletingAnythingElse() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Library library = _libraryFixture.Create(id: libraryId); + LibraryDeletedDomainEvent domainEvent = _libraryDeletedDomainEventFixture.Create(library: library); + Error error = Error.Failure(description: "Failed to delete books"); + _mockBookRepository.DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()).Returns(error); + + // Act + EventualConsistencyException exception = await Assert.ThrowsAsync( + () => _sut.HandleAsync(domainEvent, CancellationToken.None).AsTask()); + + // Assert + Assert.Equal(error, exception.EventualConsistencyError); + await _mockMusicArtworkRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockArtistRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockMusicLibraryScanItemMetadataRepository.DidNotReceive().DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()); + _mockDirectoryProviderService.DidNotReceive().DeleteDirectory(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenDeleteStagedMusicMetadataFails_ShouldThrowEventualConsistencyExceptionWithoutDeletingAnythingElse() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Library library = _libraryFixture.Create(id: libraryId); + LibraryDeletedDomainEvent domainEvent = _libraryDeletedDomainEventFixture.Create(library: library); + Error error = Error.Failure(description: "Failed to delete staged music metadata"); + _mockMusicLibraryScanItemMetadataRepository.DeleteByLibraryIdAsync(Arg.Any(), Arg.Any()).Returns(error); + + // Act + EventualConsistencyException exception = await Assert.ThrowsAsync( + () => _sut.HandleAsync(domainEvent, CancellationToken.None).AsTask()); + + // Assert + Assert.Equal(error, exception.EventualConsistencyError); + await _mockMusicArtworkRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockArtistRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockBookRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + _mockDirectoryProviderService.DidNotReceive().DeleteDirectory(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenSanitizeSegmentFails_ShouldThrowEventualConsistencyExceptionWithoutDeletingItemDirectories() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Library library = _libraryFixture.Create(id: libraryId); + LibraryDeletedDomainEvent domainEvent = _libraryDeletedDomainEventFixture.Create(library: library); + Error error = Error.Failure(description: "Failed to sanitize segment"); + _mockPathService.SanitizeSegment(Arg.Any()).Returns(error); + + // Act + EventualConsistencyException exception = await Assert.ThrowsAsync( + () => _sut.HandleAsync(domainEvent, CancellationToken.None).AsTask()); + + // Assert + Assert.Equal(error, exception.EventualConsistencyError); + await _mockMusicArtworkRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockArtistRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockBookRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockMusicLibraryScanItemMetadataRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + // Only the libraries directory, deleted before the segment is sanitized, was removed. + _mockDirectoryProviderService.Received(1).DeleteDirectory(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenLibraryIsDeleted_ShouldDeleteEachMediaTypeDirectoryAtItsExactPath() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + string libraryTitle = "My Library"; + Library library = _libraryFixture.Create(id: libraryId, title: libraryTitle); + LibraryDeletedDomainEvent domainEvent = _libraryDeletedDomainEventFixture.Create(library: library); + string librarySegment = $"{libraryTitle}-{libraryId}"; + string expectedLibrariesPath = string.Concat(AppContext.BaseDirectory, "Media", "Libraries", libraryId.ToString()); + string expectedBooksPath = string.Concat(AppContext.BaseDirectory, "Media", "Books", librarySegment); + string expectedMusicPath = string.Concat(AppContext.BaseDirectory, "Media", "Music", librarySegment); + + // Act + await _sut.HandleAsync(domainEvent, CancellationToken.None); + + // Assert + _mockPathService.Received(1).SanitizeSegment(librarySegment); + _mockDirectoryProviderService.Received(1).DeleteDirectory(Arg.Is(path => path.Path == expectedLibrariesPath)); + _mockDirectoryProviderService.Received(1).DeleteDirectory(Arg.Is(path => path.Path == expectedBooksPath)); + _mockDirectoryProviderService.Received(1).DeleteDirectory(Arg.Is(path => path.Path == expectedMusicPath)); + } + + [Fact] + public async Task HandleAsync_WhenLibraryDirectoryDoesNotExist_ShouldSkipDeletingIt() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Library library = _libraryFixture.Create(id: libraryId); + LibraryDeletedDomainEvent domainEvent = _libraryDeletedDomainEventFixture.Create(library: library); + _mockDirectoryProviderService.DirectoryExists(Arg.Any()).Returns(Result.From(false)); + + // Act + await _sut.HandleAsync(domainEvent, CancellationToken.None); + + // Assert + // The media items are still removed, but a directory that does not exist is not an error. + await _mockMusicArtworkRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockArtistRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockBookRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + await _mockMusicLibraryScanItemMetadataRepository.Received(1).DeleteByLibraryIdAsync(libraryId, Arg.Any()); + _mockDirectoryProviderService.DidNotReceive().DeleteDirectory(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenDirectoryExistsFails_ShouldThrowEventualConsistencyException() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Library library = _libraryFixture.Create(id: libraryId); + LibraryDeletedDomainEvent domainEvent = _libraryDeletedDomainEventFixture.Create(library: library); + Error error = Error.Failure(description: "Failed to check directory existence"); + _mockDirectoryProviderService.DirectoryExists(Arg.Any()).Returns(error); + + // Act + EventualConsistencyException exception = await Assert.ThrowsAsync( + () => _sut.HandleAsync(domainEvent, CancellationToken.None).AsTask()); + + // Assert + Assert.Equal(error, exception.EventualConsistencyError); + _mockDirectoryProviderService.DidNotReceive().DeleteDirectory(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenCombiningTheMediaTypeDirectoryPathFails_ShouldThrowEventualConsistencyException() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Library library = _libraryFixture.Create(id: libraryId, title: "My Library"); + LibraryDeletedDomainEvent domainEvent = _libraryDeletedDomainEventFixture.Create(library: library); + Error error = Error.Failure(description: "Failed to combine the media type directory path"); + // Only the combination of the media type segment of the books directory fails, after the libraries directory was already removed. + _mockPathService.CombinePath(Arg.Any(), "Books").Returns(error); + + // Act + EventualConsistencyException exception = await Assert.ThrowsAsync( + () => _sut.HandleAsync(domainEvent, CancellationToken.None).AsTask()); + + // Assert + Assert.Equal(error, exception.EventualConsistencyError); + // Only the libraries directory, whose path was combined before the failure, was removed. + _mockDirectoryProviderService.Received(1).DeleteDirectory(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenCombiningTheLibraryDirectoryPathFails_ShouldThrowEventualConsistencyException() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + string libraryTitle = "My Library"; + Library library = _libraryFixture.Create(id: libraryId, title: libraryTitle); + LibraryDeletedDomainEvent domainEvent = _libraryDeletedDomainEventFixture.Create(library: library); + string librarySegment = $"{libraryTitle}-{libraryId}"; + Error error = Error.Failure(description: "Failed to combine the library directory path"); + // Only the combination of the leaf library segment of the books directory fails. + _mockPathService.CombinePath(Arg.Is(path => path.EndsWith("Books", StringComparison.Ordinal)), librarySegment).Returns(error); + + // Act + EventualConsistencyException exception = await Assert.ThrowsAsync( + () => _sut.HandleAsync(domainEvent, CancellationToken.None).AsTask()); + + // Assert + Assert.Equal(error, exception.EventualConsistencyError); + // Only the libraries directory, whose path was combined before the failure, was removed. + _mockDirectoryProviderService.Received(1).DeleteDirectory(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenCreatingTheLibraryPathIdFails_ShouldThrowEventualConsistencyException() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Library library = _libraryFixture.Create(id: libraryId, title: "My Library"); + LibraryDeletedDomainEvent domainEvent = _libraryDeletedDomainEventFixture.Create(library: library); + // The combined leaf path of the libraries directory is blank, so the path value object cannot be created from it. + _mockPathService.CombinePath(Arg.Any(), Arg.Is(libraryId.ToString())).Returns(Result.From(" ")); + + // Act + EventualConsistencyException exception = await Assert.ThrowsAsync( + () => _sut.HandleAsync(domainEvent, CancellationToken.None).AsTask()); + + // Assert + Assert.Equal(DomainErrors.FileSystemManagement.InvalidPath, exception.EventualConsistencyError); + _mockDirectoryProviderService.DidNotReceive().DeleteDirectory(Arg.Any()); + } } From 4ceb8f7360bee053823244c7323f262fa687708c Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:26:41 +0300 Subject: [PATCH 08/19] Adds cover update endpoints for music artists and albums. --- .../albums/UpdateAlbumCover.http | 10 + .../artists/UpdateArtistCover.http | 10 + .../UpdateAlbumCoverCommand.cs | 24 + .../UpdateAlbumCoverCommandHandler.cs | 198 +++++ .../UpdateAlbumCoverCommandValidator.cs | 60 ++ .../UpdateArtistCoverCommand.cs | 22 + .../UpdateArtistCoverCommandHandler.cs | 144 ++++ .../UpdateArtistCoverCommandValidator.cs | 50 ++ .../Albums/UpdateAlbumCoverResponse.cs | 14 + .../Artists/UpdateArtistCoverResponse.cs | 14 + .../Common/Errors/Errors.Music.cs | 1 + .../MusicLibrary/ApiRoutes.Albums.cs | 1 + .../MusicLibrary/ApiRoutes.Artists.cs | 1 + .../UpdateAlbumCoverEndpoint.cs | 82 ++ .../UpdateAlbumCoverEndpointSummary.cs | 108 +++ .../UpdateArtistCoverEndpoint.cs | 81 ++ .../UpdateArtistCoverEndpointSummary.cs | 107 +++ src/Lumina.sln | 2 + .../UpdateAlbumCoverCommandFixture.cs | 72 ++ .../UpdateArtistCoverCommandFixture.cs | 67 ++ .../Albums/UpdateAlbumCoverResponseFixture.cs | 40 + .../UpdateArtistCoverResponseFixture.cs | 40 + .../UpdateAlbumCoverEndpointTests.cs | 382 +++++++++ .../UpdateArtistCoverEndpointTests.cs | 391 ++++++++++ .../UpdateAlbumCoverEndpointTests.cs | 320 ++++++++ .../UpdateArtistCoverEndpointTests.cs | 298 ++++++++ .../UpdateAlbumCoverCommandHandlerTests.cs | 722 ++++++++++++++++++ .../UpdateAlbumCoverCommandValidatorTests.cs | 282 +++++++ .../UpdateArtistCoverCommandHandlerTests.cs | 473 ++++++++++++ .../UpdateArtistCoverCommandValidatorTests.cs | 217 ++++++ .../UpdateAlbumCoverEndpointTests.cs | 340 +++++++++ .../UpdateArtistCoverEndpointTests.cs | 319 ++++++++ 32 files changed, 4892 insertions(+) create mode 100644 docs/technical/requests/library/audio-library/music-library/albums/UpdateAlbumCover.http create mode 100644 docs/technical/requests/library/audio-library/music-library/artists/UpdateArtistCover.http create mode 100644 src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommand.cs create mode 100644 src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandler.cs create mode 100644 src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandValidator.cs create mode 100644 src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommand.cs create mode 100644 src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandler.cs create mode 100644 src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandValidator.cs create mode 100644 src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCoverResponse.cs create mode 100644 src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCoverResponse.cs create mode 100644 src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpoint.cs create mode 100644 src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpoint.cs create mode 100644 src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointSummary.cs create mode 100644 tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandFixture.cs create mode 100644 tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandFixture.cs create mode 100644 tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCoverResponseFixture.cs create mode 100644 tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCoverResponseFixture.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandlerTests.cs create mode 100644 tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandValidatorTests.cs create mode 100644 tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandlerTests.cs create mode 100644 tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandValidatorTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs diff --git a/docs/technical/requests/library/audio-library/music-library/albums/UpdateAlbumCover.http b/docs/technical/requests/library/audio-library/music-library/albums/UpdateAlbumCover.http new file mode 100644 index 00000000..147a43cf --- /dev/null +++ b/docs/technical/requests/library/audio-library/music-library/albums/UpdateAlbumCover.http @@ -0,0 +1,10 @@ +PUT {{host}}/api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/d7c41e6a-9f2b-4b1c-9a3e-7f6e5d4c3b2a/albums/{{$guid}}/cover +Authorization: Bearer {{ACCESS_TOKEN}} +Content-Type: multipart/form-data; boundary=LuminaBoundary + +--LuminaBoundary +Content-Disposition: form-data; name="cover"; filename="cover.jpg" +Content-Type: image/jpeg + +< ./cover.jpg +--LuminaBoundary-- diff --git a/docs/technical/requests/library/audio-library/music-library/artists/UpdateArtistCover.http b/docs/technical/requests/library/audio-library/music-library/artists/UpdateArtistCover.http new file mode 100644 index 00000000..a83a3218 --- /dev/null +++ b/docs/technical/requests/library/audio-library/music-library/artists/UpdateArtistCover.http @@ -0,0 +1,10 @@ +PUT {{host}}/api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{{$guid}}/cover +Authorization: Bearer {{ACCESS_TOKEN}} +Content-Type: multipart/form-data; boundary=LuminaBoundary + +--LuminaBoundary +Content-Disposition: form-data; name="cover"; filename="cover.jpg" +Content-Type: image/jpeg + +< ./cover.jpg +--LuminaBoundary-- diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommand.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommand.cs new file mode 100644 index 00000000..69f8d7da --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommand.cs @@ -0,0 +1,24 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +using System.Diagnostics; +using System.IO; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; + +/// +/// Command for updating the cover image of an existing album. +/// +/// The unique identifier of the media library the album belongs to, taken from the route. +/// The unique identifier of the artist the album belongs to, taken from the route. +/// The unique identifier of the album whose cover image is updated, taken from the route. +/// The stream of the uploaded cover image file. +/// The name of the uploaded cover image file. +[DebuggerDisplay("AlbumId: {AlbumId} FileName: {FileName}")] +public record UpdateAlbumCoverCommand( + string? LibraryId, + string? ArtistId, + string? AlbumId, + Stream? Cover, + string? FileName +) : ICommand; diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandler.cs new file mode 100644 index 00000000..cc24503b --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandler.cs @@ -0,0 +1,198 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.Application.Common.DataAccess.UoW; +using Lumina.Application.Common.Infrastructure.Authentication; +using Lumina.Application.Common.Infrastructure.Authorization; +using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership; +using Lumina.Application.Common.Infrastructure.Validation; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; +using Lumina.Domain.Common.Primitives; +using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services; +using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using ApplicationErrors = Lumina.Application.Common.Errors.Errors; +using DomainErrors = Lumina.Domain.Common.Errors.Errors; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; + +/// +/// Handler for the command to update the cover image of an existing album. +/// +public class UpdateAlbumCoverCommandHandler : ICommandHandler> +{ + private readonly IUnitOfWork _unitOfWork; + private readonly IMusicArtworkService _musicArtworkService; + private readonly IPathService _pathService; + private readonly IAuthorizationService _authorizationService; + private readonly ICurrentUserService _currentUserService; + private readonly IValidator _validator; + + /// + /// Initializes a new instance of the class. + /// + /// Injected unit of work for interacting with the data access layer repositories. + /// Injected service for storing the artwork of a music library item. + /// Injected service for handling file system paths. + /// Injected service for authorization related functionality. + /// Injected service to retrieve the current user information. + /// Injected validator for application validation rules. + public UpdateAlbumCoverCommandHandler(IUnitOfWork unitOfWork, IMusicArtworkService musicArtworkService, IPathService pathService, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator) + { + _unitOfWork = unitOfWork; + _musicArtworkService = musicArtworkService; + _pathService = pathService; + _authorizationService = authorizationService; + _currentUserService = currentUserService; + _validator = validator; + } + + /// + /// Handles the command to update the cover image of an existing album. + /// + /// The command to be handled. + /// Cancellation token that can be used to stop the execution. + /// + /// An containing either the response carrying the relative path of the stored cover image, or an error message. + /// + public async Task> HandleAsync(UpdateAlbumCoverCommand command, CancellationToken cancellationToken) + { + List validationResult = _validator.Validate(command); + if (validationResult.Count > 0) + return validationResult; + + // An authenticated request must always carry a user identity. + Guid? currentUserId = _currentUserService.UserId; + if (currentUserId is null) + return ApplicationErrors.Authorization.NotAuthorized; + Guid userId = currentUserId.Value; + + // The validator guarantees that the route identifiers are non-empty Guids before this point. + Guid libraryId = Guid.Parse(command.LibraryId!); + Guid artistId = Guid.Parse(command.ArtistId!); + Guid albumId = Guid.Parse(command.AlbumId!); + + Result getAlbumResult = await _unitOfWork.AlbumRepository.GetByIdAsync(albumId, shouldTrackEntities: false, cancellationToken: cancellationToken).ConfigureAwait(false); + if (getAlbumResult.IsFailure) + return getAlbumResult.Errors; + if (getAlbumResult.Value is null) + return DomainErrors.Music.AlbumNotFound; + AlbumEntity existingAlbum = getAlbumResult.Value; + + // Resource scoping: the album must belong to the library and the artist named by the route, so that an album can never be edited through + // another library's or artist's route; the mismatch is reported as not found, without disclosing that the album exists elsewhere. + if (existingAlbum.LibraryId != libraryId || existingAlbum.ArtistId != artistId) + return DomainErrors.Music.AlbumNotFound; + + // Admins can update the albums of all libraries; for everyone else, only the albums of the libraries they own. + bool canAccessLibrary = await _authorizationService.EvaluatePolicyAsync( + userId, new LibraryOwnershipPolicyContext(existingAlbum.LibraryId), cancellationToken).ConfigureAwait(false); + if (!canAccessLibrary) + return ApplicationErrors.Authorization.NotAuthorized; + + // The artwork is stored under the library and artist segments, so their names are resolved to keep the location consistent with the scanned artwork. + Result getLibraryResult = await _unitOfWork.LibraryRepository.GetByIdAsync(existingAlbum.LibraryId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (getLibraryResult.IsFailure) + return getLibraryResult.Errors; + if (getLibraryResult.Value is null) + return DomainErrors.Library.LibraryNotFound; + string libraryName = getLibraryResult.Value.Title; + + Result getArtistResult = await _unitOfWork.ArtistRepository.GetByIdAsync(existingAlbum.ArtistId, shouldTrackEntities: false, cancellationToken: cancellationToken).ConfigureAwait(false); + if (getArtistResult.IsFailure) + return getArtistResult.Errors; + string artistName = getArtistResult.Value?.Name ?? string.Empty; + + // The artwork of the album is stored under the directory of its release type, mirroring the structure of the scanned files, so that a + // re-uploaded cover replaces the cover stored for the album at its standardized location instead of writing a second copy elsewhere. + Result> getArtworkResult = await _unitOfWork.MusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Album, albumId, cancellationToken).ConfigureAwait(false); + if (getArtworkResult.IsFailure) + return getArtworkResult.Errors; + string? existingCoverPath = getArtworkResult.Value + .Where(artwork => artwork.ArtworkType == ArtworkType.Cover) + .Select(artwork => artwork.FileName) + .FirstOrDefault(); + string? releaseTypeName = ExtractReleaseTypeDirectoryName(existingCoverPath, artistName) + ?? (existingAlbum.ReleaseTypes.Count > 0 ? existingAlbum.ReleaseTypes[0].ReleaseType.ToString() : null); + + Result storeArtworkResult = await _musicArtworkService.SaveAlbumArtworkAsync( + existingAlbum.LibraryId, + existingAlbum.Id, + libraryName, + artistName, + existingAlbum.Title, + command.Cover!, + command.FileName!, + releaseTypeName, + cancellationToken).ConfigureAwait(false); + if (storeArtworkResult.IsFailure) + return storeArtworkResult.Errors; + + // The stored cover of the album is replaced as a whole: when the new cover is stored under a different name than the previous one + // (for example a png replacing a jpg), the previous file is removed, so that no orphaned artwork is left on disk without a reference. + if (!string.IsNullOrWhiteSpace(existingCoverPath) && existingCoverPath != storeArtworkResult.Value) + { + Result deleteResult = _musicArtworkService.DeleteStoredArtwork(existingCoverPath); + if (deleteResult.IsFailure) + return deleteResult.Errors; + } + + // Map the newly stored cover image onto the artwork of the album, replacing the existing cover or adding a new one. + Result upsertResult = await _unitOfWork.MusicArtworkRepository.UpsertCoverAsync( + MusicArtworkOwnerType.Album, albumId, storeArtworkResult.Value, cancellationToken).ConfigureAwait(false); + if (upsertResult.IsFailure) + return upsertResult.Errors; + + Result saveChangesResult = await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false); + if (saveChangesResult.IsFailure) + return saveChangesResult.Errors; + + return new UpdateAlbumCoverResponse(storeArtworkResult.Value); + } + + /// + /// Resolves the name of the release type directory the artwork of an album is stored under, from the relative path of its existing cover. + /// + /// The relative path of the existing cover image of the album, or when the album has no cover. + /// The name of the artist of the album. + /// The name of the on-disk release type directory, or when the album does not use one. + private string? ExtractReleaseTypeDirectoryName(string? coverRelativePath, string artistName) + { + if (string.IsNullOrWhiteSpace(coverRelativePath)) + return null; + // The path is media/music/{library}/{artist}[/{releaseType}]/{album}/{file}, so the segment right before the album directory is the release + // type directory when the album uses one, and the artist directory otherwise. An artist whose name happens to match a release type, like + // "Live", must not be mistaken for one, so the segment is only accepted as a release type when it is not the directory of the artist. + string[] segments = coverRelativePath.Split(_pathService.PathSeparator, StringSplitOptions.RemoveEmptyEntries); + if (segments.Length < 3) + return null; + string candidate = segments[^3]; + if (IsArtistDirectory(candidate, artistName)) + return null; + return Enum.TryParse(candidate, ignoreCase: true, out MusicReleaseType releaseType) && Enum.IsDefined(releaseType) ? candidate : null; + } + + /// + /// Checks whether the provided path segment is the artwork directory of the artist of the album. + /// + /// The path segment to be checked. + /// The name of the artist of the album. + /// when the segment is the artwork directory of the artist, otherwise. + private bool IsArtistDirectory(string pathSegment, string artistName) + { + if (string.IsNullOrWhiteSpace(artistName)) + return false; + Result artistSegmentResult = _pathService.SanitizeSegment(artistName); + return artistSegmentResult.IsSuccess + && string.Equals(pathSegment, artistSegmentResult.Value.Name, StringComparison.OrdinalIgnoreCase); + } +} diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandValidator.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandValidator.cs new file mode 100644 index 00000000..8d9792eb --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandValidator.cs @@ -0,0 +1,60 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.Infrastructure.Validation; +using Lumina.Application.Common.Utilities; +using Lumina.Domain.Common.Errors; +using System; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; + +/// +/// Validates the needed validation rules for . +/// +public class UpdateAlbumCoverCommandValidator : AbstractValidator +{ + /// + /// Initializes a new instance of the class. + /// + public UpdateAlbumCoverCommandValidator() + { + // Validates the identifier of the media library the album belongs to, taken from the route. + RuleFor(command => command.LibraryId) + .NotEmpty() + .WithError(Errors.Library.LibraryIdCannotBeEmpty); + + RuleFor(command => command.LibraryId) + .Must(libraryId => Guid.TryParse(libraryId, out Guid parsedLibraryId) && parsedLibraryId != Guid.Empty) + .When(command => command.LibraryId is not null && command.LibraryId.Length > 0) + .WithError(Errors.Library.LibraryIdCannotBeEmpty); + + // Validates the identifier of the artist the album belongs to, taken from the route. + RuleFor(command => command.ArtistId) + .NotEmpty() + .WithError(Errors.Music.ArtistIdCannotBeEmpty); + + RuleFor(command => command.ArtistId) + .Must(artistId => Guid.TryParse(artistId, out Guid parsedArtistId) && parsedArtistId != Guid.Empty) + .When(command => command.ArtistId is not null && command.ArtistId.Length > 0) + .WithError(Errors.Music.ArtistIdCannotBeEmpty); + + // Validates the identifier of the album whose cover image is updated, taken from the route. + RuleFor(command => command.AlbumId) + .NotEmpty() + .WithError(Errors.Music.AlbumIdCannotBeEmpty); + + RuleFor(command => command.AlbumId) + .Must(albumId => Guid.TryParse(albumId, out Guid parsedAlbumId) && parsedAlbumId != Guid.Empty) + .When(command => command.AlbumId is not null && command.AlbumId.Length > 0) + .WithError(Errors.Music.AlbumIdCannotBeEmpty); + + // Validates the uploaded cover image. + RuleFor(command => command.Cover) + .NotNull() + .WithError(Errors.Music.CoverCannotBeNull); + + RuleFor(command => command.FileName) + .NotEmpty() + .When(command => command.Cover is not null) + .WithError(Errors.FileSystemManagement.FileNameCannotBeEmpty); + } +} diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommand.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommand.cs new file mode 100644 index 00000000..98bb23f2 --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommand.cs @@ -0,0 +1,22 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +using System.Diagnostics; +using System.IO; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; + +/// +/// Command for updating the cover image of an existing artist. +/// +/// The unique identifier of the media library this artist belongs to, taken from the route. +/// The unique identifier of the artist whose cover image is updated, taken from the route. +/// The stream of the uploaded cover image file. +/// The name of the uploaded cover image file. +[DebuggerDisplay("ArtistId: {ArtistId} FileName: {FileName}")] +public record UpdateArtistCoverCommand( + string? LibraryId, + string? ArtistId, + Stream? Cover, + string? FileName +) : ICommand; diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandler.cs new file mode 100644 index 00000000..7b84738e --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandler.cs @@ -0,0 +1,144 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.Application.Common.DataAccess.UoW; +using Lumina.Application.Common.Infrastructure.Authentication; +using Lumina.Application.Common.Infrastructure.Authorization; +using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership; +using Lumina.Application.Common.Infrastructure.Validation; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using Lumina.Domain.Common.Primitives; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using ApplicationErrors = Lumina.Application.Common.Errors.Errors; +using DomainErrors = Lumina.Domain.Common.Errors.Errors; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; + +/// +/// Handler for the command to update the cover image of an existing artist. +/// +public class UpdateArtistCoverCommandHandler : ICommandHandler> +{ + private readonly IUnitOfWork _unitOfWork; + private readonly IMusicArtworkService _musicArtworkService; + private readonly IAuthorizationService _authorizationService; + private readonly ICurrentUserService _currentUserService; + private readonly IValidator _validator; + + /// + /// Initializes a new instance of the class. + /// + /// Injected unit of work for interacting with the data access layer repositories. + /// Injected service for storing the artwork of a music library item. + /// Injected service for authorization related functionality. + /// Injected service to retrieve the current user information. + /// Injected validator for application validation rules. + public UpdateArtistCoverCommandHandler(IUnitOfWork unitOfWork, IMusicArtworkService musicArtworkService, IAuthorizationService authorizationService, ICurrentUserService currentUserService, IValidator validator) + { + _unitOfWork = unitOfWork; + _musicArtworkService = musicArtworkService; + _authorizationService = authorizationService; + _currentUserService = currentUserService; + _validator = validator; + } + + /// + /// Handles the command to update the cover image of an existing artist. + /// + /// The command to be handled. + /// Cancellation token that can be used to stop the execution. + /// + /// An containing either the response carrying the relative path of the stored cover image, or an error message. + /// + public async Task> HandleAsync(UpdateArtistCoverCommand command, CancellationToken cancellationToken) + { + List validationResult = _validator.Validate(command); + if (validationResult.Count > 0) + return validationResult; + + // An authenticated request must always carry a user identity. + Guid? currentUserId = _currentUserService.UserId; + if (currentUserId is null) + return ApplicationErrors.Authorization.NotAuthorized; + Guid userId = currentUserId.Value; + + // The validator guarantees that the route identifiers are non-empty Guids before this point. + Guid libraryId = Guid.Parse(command.LibraryId!); + Guid artistId = Guid.Parse(command.ArtistId!); + + Result getArtistResult = await _unitOfWork.ArtistRepository.GetByIdAsync(artistId, shouldTrackEntities: false, cancellationToken: cancellationToken).ConfigureAwait(false); + if (getArtistResult.IsFailure) + return getArtistResult.Errors; + if (getArtistResult.Value is null) + return DomainErrors.Music.ArtistNotFound; + ArtistEntity existingArtist = getArtistResult.Value; + + // Resource scoping: the artist must belong to the library named by the route, so that an artist can never be edited through another + // library's route; the mismatch is reported as not found, without disclosing that the artist exists in another library. + if (existingArtist.LibraryId != libraryId) + return DomainErrors.Music.ArtistNotFound; + + // Admins can update the artists of all libraries; for everyone else, only the artists of the libraries they own. + bool canAccessLibrary = await _authorizationService.EvaluatePolicyAsync( + userId, new LibraryOwnershipPolicyContext(existingArtist.LibraryId), cancellationToken).ConfigureAwait(false); + if (!canAccessLibrary) + return ApplicationErrors.Authorization.NotAuthorized; + + // The artwork is stored under the library and artist segments, so their names are resolved to keep the location consistent with the scanned artwork. + Result getLibraryResult = await _unitOfWork.LibraryRepository.GetByIdAsync(existingArtist.LibraryId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (getLibraryResult.IsFailure) + return getLibraryResult.Errors; + if (getLibraryResult.Value is null) + return DomainErrors.Library.LibraryNotFound; + string libraryName = getLibraryResult.Value.Title; + + // The existing cover of the artist is looked up, so that the previous file can be replaced as a whole instead of being left orphaned on disk. + Result> getArtworkResult = await _unitOfWork.MusicArtworkRepository.GetByOwnerAsync(MusicArtworkOwnerType.Artist, artistId, cancellationToken).ConfigureAwait(false); + if (getArtworkResult.IsFailure) + return getArtworkResult.Errors; + string? existingCoverPath = getArtworkResult.Value + .Where(artwork => artwork.ArtworkType == ArtworkType.Cover) + .Select(artwork => artwork.FileName) + .FirstOrDefault(); + + Result storeArtworkResult = await _musicArtworkService.SaveArtistArtworkAsync( + existingArtist.LibraryId, + libraryName, + existingArtist.Name, + command.Cover!, + command.FileName!, + cancellationToken).ConfigureAwait(false); + if (storeArtworkResult.IsFailure) + return storeArtworkResult.Errors; + + // The stored cover of the artist is replaced as a whole: when the new cover is stored under a different name than the previous one + // (for example a png replacing a jpg), the previous file is removed, so that no orphaned artwork is left on disk without a reference. + if (!string.IsNullOrWhiteSpace(existingCoverPath) && existingCoverPath != storeArtworkResult.Value) + { + Result deleteResult = _musicArtworkService.DeleteStoredArtwork(existingCoverPath); + if (deleteResult.IsFailure) + return deleteResult.Errors; + } + + // Map the newly stored cover image onto the artwork of the artist, replacing the existing cover or adding a new one. + Result upsertResult = await _unitOfWork.MusicArtworkRepository.UpsertCoverAsync( + MusicArtworkOwnerType.Artist, artistId, storeArtworkResult.Value, cancellationToken).ConfigureAwait(false); + if (upsertResult.IsFailure) + return upsertResult.Errors; + + Result saveChangesResult = await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false); + if (saveChangesResult.IsFailure) + return saveChangesResult.Errors; + + return new UpdateArtistCoverResponse(storeArtworkResult.Value); + } +} diff --git a/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandValidator.cs b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandValidator.cs new file mode 100644 index 00000000..384522da --- /dev/null +++ b/src/Lumina.Application/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandValidator.cs @@ -0,0 +1,50 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.Infrastructure.Validation; +using Lumina.Application.Common.Utilities; +using Lumina.Domain.Common.Errors; +using System; +#endregion + +namespace Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; + +/// +/// Validates the needed validation rules for . +/// +public class UpdateArtistCoverCommandValidator : AbstractValidator +{ + /// + /// Initializes a new instance of the class. + /// + public UpdateArtistCoverCommandValidator() + { + // Validates the identifier of the media library the artist belongs to, taken from the route. + RuleFor(command => command.LibraryId) + .NotEmpty() + .WithError(Errors.Library.LibraryIdCannotBeEmpty); + + RuleFor(command => command.LibraryId) + .Must(libraryId => Guid.TryParse(libraryId, out Guid parsedLibraryId) && parsedLibraryId != Guid.Empty) + .When(command => command.LibraryId is not null && command.LibraryId.Length > 0) + .WithError(Errors.Library.LibraryIdCannotBeEmpty); + + // Validates the identifier of the artist whose cover image is updated, taken from the route. + RuleFor(command => command.ArtistId) + .NotEmpty() + .WithError(Errors.Music.ArtistIdCannotBeEmpty); + + RuleFor(command => command.ArtistId) + .Must(artistId => Guid.TryParse(artistId, out Guid parsedArtistId) && parsedArtistId != Guid.Empty) + .When(command => command.ArtistId is not null && command.ArtistId.Length > 0) + .WithError(Errors.Music.ArtistIdCannotBeEmpty); + + // Validates the uploaded cover image. + RuleFor(command => command.Cover) + .NotNull() + .WithError(Errors.Music.CoverCannotBeNull); + + RuleFor(command => command.FileName) + .NotEmpty() + .When(command => command.Cover is not null) + .WithError(Errors.FileSystemManagement.FileNameCannotBeEmpty); + } +} diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCoverResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCoverResponse.cs new file mode 100644 index 00000000..eb6ca6a4 --- /dev/null +++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCoverResponse.cs @@ -0,0 +1,14 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; + +/// +/// Represents a response of an update album cover operation. +/// +/// The relative path of the stored cover image. +[DebuggerDisplay("CoverPath: {CoverPath}")] +public record UpdateAlbumCoverResponse( + string CoverPath +); diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCoverResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCoverResponse.cs new file mode 100644 index 00000000..dc45d9f9 --- /dev/null +++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCoverResponse.cs @@ -0,0 +1,14 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; + +/// +/// Represents a response of an update artist cover operation. +/// +/// The relative path of the stored cover image. +[DebuggerDisplay("CoverPath: {CoverPath}")] +public record UpdateArtistCoverResponse( + string CoverPath +); diff --git a/src/Lumina.Domain/Common/Errors/Errors.Music.cs b/src/Lumina.Domain/Common/Errors/Errors.Music.cs index d4cca16a..b636930d 100644 --- a/src/Lumina.Domain/Common/Errors/Errors.Music.cs +++ b/src/Lumina.Domain/Common/Errors/Errors.Music.cs @@ -65,5 +65,6 @@ public static partial class Errors public static Error IsniValueCannotBeEmpty => Error.Validation(description: nameof(IsniValueCannotBeEmpty)); public static Error IsniValueMustBeMaximum20CharactersLong => Error.Validation(description: nameof(IsniValueMustBeMaximum20CharactersLong)); public static Error WorkTitleCannotBeEmpty => Error.Validation(description: nameof(WorkTitleCannotBeEmpty)); + public static Error CoverCannotBeNull => Error.Validation(description: nameof(CoverCannotBeNull)); } } diff --git a/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Albums.cs b/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Albums.cs index dd1fafd4..2933c8f6 100644 --- a/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Albums.cs +++ b/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Albums.cs @@ -15,6 +15,7 @@ public static partial class ApiRoutes public const string ADD_ALBUM = "/libraries/{libraryId}/artists/{artistId}/albums"; public const string GET_ALBUM_BY_ID = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}"; public const string UPDATE_ALBUM = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}"; + public const string UPDATE_ALBUM_COVER = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover"; public const string DELETE_ALBUM = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}"; public const string GET_ALBUM_TRACKS = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks"; public const string GET_ALBUM_TRACKS_LITE = "/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/lite"; diff --git a/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Artists.cs b/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Artists.cs index b3d50a4a..d8c1bd07 100644 --- a/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Artists.cs +++ b/src/Lumina.Presentation.Api/Common/Routes/Library/AudioLibrary/MusicLibrary/ApiRoutes.Artists.cs @@ -15,6 +15,7 @@ public static partial class ApiRoutes public const string GET_ARTISTS_LITE = "/libraries/{libraryId}/artists/lite"; public const string ADD_ARTIST = "/libraries/{libraryId}/artists"; public const string UPDATE_ARTIST = "/libraries/{libraryId}/artists/{artistId}"; + public const string UPDATE_ARTIST_COVER = "/libraries/{libraryId}/artists/{artistId}/cover"; public const string DELETE_ARTIST = "/libraries/{libraryId}/artists/{artistId}"; } } diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpoint.cs new file mode 100644 index 00000000..fc91b7ac --- /dev/null +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpoint.cs @@ -0,0 +1,82 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; +using Lumina.Domain.Common.Primitives; +using Lumina.Presentation.Api.Common.Routes.Library.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Api.Core.Endpoints.Common; +using Microsoft.AspNetCore.Http; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; + +/// +/// API endpoint for the /libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover route. +/// +public class UpdateAlbumCoverEndpoint : BaseEndpoint +{ + private readonly ICommandHandler> _updateAlbumCoverCommandHandler; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for handling update album cover commands. + public UpdateAlbumCoverEndpoint(ICommandHandler> updateAlbumCoverCommandHandler) + { + _updateAlbumCoverCommandHandler = updateAlbumCoverCommandHandler; + } + + /// + /// Configures the API endpoint. + /// + public override void Configure() + { + Verbs(FastEndpoints.Http.PUT); + Routes(ApiRoutes.Albums.UPDATE_ALBUM_COVER); + Version(1); + DontCatchExceptions(); + } + + /// + /// Updates the cover image of the album with the image uploaded in the multipart form of the request. + /// + /// The request object. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(FastEndpoints.EmptyRequest request, CancellationToken cancellationToken) + { + // Take the identifiers from the route. + string? libraryId = HttpContext.Request.RouteValues["libraryId"]?.ToString(); + string? artistId = HttpContext.Request.RouteValues["artistId"]?.ToString(); + string? albumId = HttpContext.Request.RouteValues["albumId"]?.ToString(); + + IFormFile? cover = null; + if (HttpContext.Request.HasFormContentType) + { + try + { + // The cover is the first file of the multipart form; a multipart body without any file cannot be parsed as a form, + // so a malformed upload is treated as a missing cover, which the command validator reports. + cover = HttpContext.Request.Form.Files.Count > 0 ? HttpContext.Request.Form.Files[0] : null; + } + catch (InvalidDataException) + { + cover = null; + } + } + + // The cover stream must stay open while the handler stores the image, and is disposed as soon as the handler returns. + UpdateAlbumCoverCommand command = new(libraryId, artistId, albumId, cover?.OpenReadStream(), cover?.FileName); + try + { + Result result = await _updateAlbumCoverCommandHandler.HandleAsync(command, cancellationToken).ConfigureAwait(false); + return result.Match(success => TypedResults.Ok(success), Problem); + } + finally + { + command.Cover?.Dispose(); + } + } +} diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs new file mode 100644 index 00000000..318c3267 --- /dev/null +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs @@ -0,0 +1,108 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; + +/// +/// Class used for providing a textual description for the API endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public UpdateAlbumCoverEndpointSummary() + { + Summary = "Updates the cover image of an album."; + Description = "Updates the cover image of the album identified by the route, with the image uploaded in the multipart form of the request."; + + Response(200, "The relative path of the stored cover image is returned.", + example: new UpdateAlbumCoverResponse( + CoverPath: "/media/music/music-3f2504e0-4f89-41d3-9a0c-0305e82c3301/Queen-2b0e5f5a-0b3f-4b7e-8f4a-8c9e3d2f5a6b/A Night at the Opera-7c1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f/cover.jpg" + ) + ); + + Response(401, "Authentication required.", "application/problem+json", + example: new[] + { + new + { + type = "https://tools.ietf.org/html/rfc7235#section-3.1", + status = 401, + title = "Unauthorized", + detail = "Authentication failed", + instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover" + } + } + ); + + Response(403, "The request failed because the user making the request is not an Admin, or the owner of the media library.", "application/problem+json", + example: new + { + type = "https://tools.ietf.org/html/rfc9110#section-15.5.4", + title = "General.Unauthorized", + status = 403, + detail = "NotAuthorized", + instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover", + traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-00" + } + ); + + Response(404, "The request failed because the album or its media library does not exist.", "application/problem+json", + example: new[] + { + new + { + type = "https://tools.ietf.org/html/rfc9110#section-15.5.5", + title = "General.NotFound", + status = 404, + detail = "AlbumNotFound", + instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover", + traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00" + }, + new + { + type = "https://tools.ietf.org/html/rfc9110#section-15.5.5", + title = "General.NotFound", + status = 404, + detail = "LibraryNotFound", + instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover", + traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00" + } + } + ); + + Response(422, "The request did not pass validation checks, either on the request itself or while storing the uploaded cover image.", "application/problem+json", + example: new + { + type = "https://tools.ietf.org/html/rfc4918#section-11.2", + title = "General.Validation", + status = 422, + detail = "OneOrMoreValidationErrorsOccurred", + instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover", + errors = new Dictionary + { + { + "General.Validation", new[] + { + "LibraryIdCannotBeEmpty", + "ArtistIdCannotBeEmpty", + "AlbumIdCannotBeEmpty", + "CoverCannotBeNull", + "FileNameCannotBeEmpty", + "FileTooLarge", + "CoverFileMustBeAnImage" + } + } + }, + traceId = "00-2470be4248a2a5a0c6f70579975a6954-b9c3ba9544a03500-00" + } + ); + } +} diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpoint.cs new file mode 100644 index 00000000..9439978d --- /dev/null +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpoint.cs @@ -0,0 +1,81 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using Lumina.Domain.Common.Primitives; +using Lumina.Presentation.Api.Common.Routes.Library.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Api.Core.Endpoints.Common; +using Microsoft.AspNetCore.Http; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; + +/// +/// API endpoint for the /libraries/{libraryId}/artists/{artistId}/cover route. +/// +public class UpdateArtistCoverEndpoint : BaseEndpoint +{ + private readonly ICommandHandler> _updateArtistCoverCommandHandler; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for handling update artist cover commands. + public UpdateArtistCoverEndpoint(ICommandHandler> updateArtistCoverCommandHandler) + { + _updateArtistCoverCommandHandler = updateArtistCoverCommandHandler; + } + + /// + /// Configures the API endpoint. + /// + public override void Configure() + { + Verbs(FastEndpoints.Http.PUT); + Routes(ApiRoutes.Artists.UPDATE_ARTIST_COVER); + Version(1); + DontCatchExceptions(); + } + + /// + /// Updates the cover image of the artist with the image uploaded in the multipart form of the request. + /// + /// The request object. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(FastEndpoints.EmptyRequest request, CancellationToken cancellationToken) + { + // Take the identifiers from the route. + string? libraryId = HttpContext.Request.RouteValues["libraryId"]?.ToString(); + string? artistId = HttpContext.Request.RouteValues["artistId"]?.ToString(); + + IFormFile? cover = null; + if (HttpContext.Request.HasFormContentType) + { + try + { + // The cover is the first file of the multipart form; a multipart body without any file cannot be parsed as a form, + // so a malformed upload is treated as a missing cover, which the command validator reports. + cover = HttpContext.Request.Form.Files.Count > 0 ? HttpContext.Request.Form.Files[0] : null; + } + catch (InvalidDataException) + { + cover = null; + } + } + + // The cover stream must stay open while the handler stores the image, and is disposed as soon as the handler returns. + UpdateArtistCoverCommand command = new(libraryId, artistId, cover?.OpenReadStream(), cover?.FileName); + try + { + Result result = await _updateArtistCoverCommandHandler.HandleAsync(command, cancellationToken).ConfigureAwait(false); + return result.Match(success => TypedResults.Ok(success), Problem); + } + finally + { + command.Cover?.Dispose(); + } + } +} diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointSummary.cs new file mode 100644 index 00000000..c3a39e0a --- /dev/null +++ b/src/Lumina.Presentation.Api/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointSummary.cs @@ -0,0 +1,107 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; + +/// +/// Class used for providing a textual description for the API endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public UpdateArtistCoverEndpointSummary() + { + Summary = "Updates the cover image of an artist."; + Description = "Updates the cover image of the artist identified by the route, with the image uploaded in the multipart form of the request."; + + Response(200, "The relative path of the stored cover image is returned.", + example: new UpdateArtistCoverResponse( + CoverPath: "/media/music/music-3f2504e0-4f89-41d3-9a0c-0305e82c3301/Queen-2b0e5f5a-0b3f-4b7e-8f4a-8c9e3d2f5a6b/cover.jpg" + ) + ); + + Response(401, "Authentication required.", "application/problem+json", + example: new[] + { + new + { + type = "https://tools.ietf.org/html/rfc7235#section-3.1", + status = 401, + title = "Unauthorized", + detail = "Authentication failed", + instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover" + } + } + ); + + Response(403, "The request failed because the user making the request is not an Admin, or the owner of the media library.", "application/problem+json", + example: new + { + type = "https://tools.ietf.org/html/rfc9110#section-15.5.4", + title = "General.Unauthorized", + status = 403, + detail = "NotAuthorized", + instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover", + traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-00" + } + ); + + Response(404, "The request failed because the artist or its media library does not exist.", "application/problem+json", + example: new[] + { + new + { + type = "https://tools.ietf.org/html/rfc9110#section-15.5.5", + title = "General.NotFound", + status = 404, + detail = "ArtistNotFound", + instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover", + traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00" + }, + new + { + type = "https://tools.ietf.org/html/rfc9110#section-15.5.5", + title = "General.NotFound", + status = 404, + detail = "LibraryNotFound", + instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover", + traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00" + } + } + ); + + Response(422, "The request did not pass validation checks, either on the request itself or while storing the uploaded cover image.", "application/problem+json", + example: new + { + type = "https://tools.ietf.org/html/rfc4918#section-11.2", + title = "General.Validation", + status = 422, + detail = "OneOrMoreValidationErrorsOccurred", + instance = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover", + errors = new Dictionary + { + { + "General.Validation", new[] + { + "LibraryIdCannotBeEmpty", + "ArtistIdCannotBeEmpty", + "CoverCannotBeNull", + "FileNameCannotBeEmpty", + "FileTooLarge", + "CoverFileMustBeAnImage" + } + } + }, + traceId = "00-2470be4248a2a5a0c6f70579975a6954-b9c3ba9544a03500-00" + } + ); + } +} diff --git a/src/Lumina.sln b/src/Lumina.sln index 23593842..2614a640 100644 --- a/src/Lumina.sln +++ b/src/Lumina.sln @@ -265,6 +265,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "albums", "albums", "{B4DF8E ..\docs\technical\requests\library\audio-library\music-library\albums\GetAlbumTracks.http = ..\docs\technical\requests\library\audio-library\music-library\albums\GetAlbumTracks.http ..\docs\technical\requests\library\audio-library\music-library\albums\GetAlbumTracksLite.http = ..\docs\technical\requests\library\audio-library\music-library\albums\GetAlbumTracksLite.http ..\docs\technical\requests\library\audio-library\music-library\albums\UpdateAlbum.http = ..\docs\technical\requests\library\audio-library\music-library\albums\UpdateAlbum.http + ..\docs\technical\requests\library\audio-library\music-library\albums\UpdateAlbumCover.http = ..\docs\technical\requests\library\audio-library\music-library\albums\UpdateAlbumCover.http EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "artists", "artists", "{F3818697-E304-491D-8BF3-4DAA1733B5F5}" @@ -277,6 +278,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "artists", "artists", "{F381 ..\docs\technical\requests\library\audio-library\music-library\artists\GetArtists.http = ..\docs\technical\requests\library\audio-library\music-library\artists\GetArtists.http ..\docs\technical\requests\library\audio-library\music-library\artists\GetArtistsLite.http = ..\docs\technical\requests\library\audio-library\music-library\artists\GetArtistsLite.http ..\docs\technical\requests\library\audio-library\music-library\artists\UpdateArtist.http = ..\docs\technical\requests\library\audio-library\music-library\artists\UpdateArtist.http + ..\docs\technical\requests\library\audio-library\music-library\artists\UpdateArtistCover.http = ..\docs\technical\requests\library\audio-library\music-library\artists\UpdateArtistCover.http EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tracks", "tracks", "{B1B657B1-60DC-4E22-89D2-6212154D6BA8}" diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandFixture.cs new file mode 100644 index 00000000..b242c423 --- /dev/null +++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandFixture.cs @@ -0,0 +1,72 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Linq; +using System.Text; +#endregion + +namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverCommandFixture +{ + /// + /// Creates a random valid . + /// + /// Optional. The Id of the media library the album belongs to. + /// Optional. The Id of the artist the album belongs to. + /// Optional. The Id of the album whose cover is updated. + /// Optional. The stream of the uploaded cover image file. + /// Optional. The name of the uploaded cover image file. + /// Whether the library Id should be included, or forced to . + /// Whether the artist Id should be included, or forced to . + /// Whether the album Id should be included, or forced to . + /// Whether the cover stream should be included, or forced to . + /// Whether the file name should be included, or forced to . + /// The created . + public UpdateAlbumCoverCommand Create( + string? libraryId = null, + string? artistId = null, + string? albumId = null, + Stream? cover = null, + string? fileName = null, + bool includeLibraryId = true, + bool includeArtistId = true, + bool includeAlbumId = true, + bool includeCover = true, + bool includeFileName = true) + { + return new UpdateAlbumCoverCommand( + includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null, + includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null, + includeAlbumId ? (albumId ?? Guid.NewGuid().ToString()) : null, + includeCover ? (cover ?? CreateCoverStream()) : null, + includeFileName ? (fileName ?? "cover.jpg") : null); + } + + /// + /// Creates a list of instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } + + /// + /// Creates an in-memory stream carrying a minimal file payload. + /// + /// A non-empty in-memory stream. + private static Stream CreateCoverStream() + { + byte[] payload = Encoding.UTF8.GetBytes("fake cover payload"); + return new MemoryStream(payload); + } +} diff --git a/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandFixture.cs new file mode 100644 index 00000000..6235be2d --- /dev/null +++ b/tests/Common/Lumina.Application.Fixtures/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandFixture.cs @@ -0,0 +1,67 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Linq; +using System.Text; +#endregion + +namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverCommandFixture +{ + /// + /// Creates a random valid . + /// + /// Optional. The Id of the media library the artist belongs to. + /// Optional. The Id of the artist whose cover is updated. + /// Optional. The stream of the uploaded cover image file. + /// Optional. The name of the uploaded cover image file. + /// Whether the library Id should be included, or forced to . + /// Whether the artist Id should be included, or forced to . + /// Whether the cover stream should be included, or forced to . + /// Whether the file name should be included, or forced to . + /// The created . + public UpdateArtistCoverCommand Create( + string? libraryId = null, + string? artistId = null, + Stream? cover = null, + string? fileName = null, + bool includeLibraryId = true, + bool includeArtistId = true, + bool includeCover = true, + bool includeFileName = true) + { + return new UpdateArtistCoverCommand( + includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null, + includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null, + includeCover ? (cover ?? CreateCoverStream()) : null, + includeFileName ? (fileName ?? "cover.jpg") : null); + } + + /// + /// Creates a list of instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } + + /// + /// Creates an in-memory stream carrying a minimal file payload. + /// + /// A non-empty in-memory stream. + private static Stream CreateCoverStream() + { + byte[] payload = Encoding.UTF8.GetBytes("fake cover payload"); + return new MemoryStream(payload); + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCoverResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCoverResponseFixture.cs new file mode 100644 index 00000000..1cd18954 --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCoverResponseFixture.cs @@ -0,0 +1,40 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverResponseFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a random valid . + /// + /// Optional. The relative path of the stored cover image. + /// The created . + public UpdateAlbumCoverResponse Create(string? coverPath = null) + { + return new UpdateAlbumCoverResponse( + coverPath ?? _faker.System.FilePath() + ); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCoverResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCoverResponseFixture.cs new file mode 100644 index 00000000..0bdb8166 --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCoverResponseFixture.cs @@ -0,0 +1,40 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverResponseFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a random valid . + /// + /// Optional. The relative path of the stored cover image. + /// The created . + public UpdateArtistCoverResponse Create(string? coverPath = null) + { + return new UpdateArtistCoverResponse( + coverPath ?? _faker.System.FilePath() + ); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs new file mode 100644 index 00000000..91ea5e92 --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs @@ -0,0 +1,382 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Common.DataAccess.Entities.UsersManagement; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.UsersManagement; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; +using Lumina.DataAccess.Core.UoW; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; +using Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; +using Lumina.Presentation.Api.IntegrationTests.Common.Setup; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverEndpointTests : IClassFixture, IAsyncLifetime +{ + private HttpClient _client; + private readonly AuthenticatedLuminaApiFactory _apiFactory; + private readonly JsonSerializerOptions _jsonOptions = new() + { + PropertyNameCaseInsensitive = true, + Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } + }; + private readonly LibraryEntityFixture _libraryEntityFixture = new(); + private readonly ArtistEntityFixture _artistEntityFixture = new(); + private readonly AlbumEntityFixture _albumEntityFixture = new(); + private readonly MusicArtworkEntityFixture _musicArtworkEntityFixture = new(); + private readonly UserEntityFixture _userEntityFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected in-memory API factory. + public UpdateAlbumCoverEndpointTests(AuthenticatedLuminaApiFactory apiFactory) + { + _client = apiFactory.CreateClient(); + _apiFactory = apiFactory; + } + + /// + /// Initializes authenticated API client. + /// + public async Task InitializeAsync() + { + _client = await _apiFactory.CreateAuthenticatedClientAsync(); + } + + [Fact] + public async Task UpdateAlbumCover_WhenCalledByOwnerWithValidImage_ShouldReplaceTheStoredCover() + { + // Arrange + Guid userId = GetCurrentUserId(); + (Guid libraryId, Guid artistId, Guid albumId) = await SeedLibraryArtistAndAlbumWithCoverAsync(userId, "/media/music/old-cover.jpg"); + + // Act + HttpResponseMessage response = await _client.PutAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover", CreateCoverForm("cover.png")); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + string storedPath = JsonSerializer.Deserialize(content, _jsonOptions)!.CoverPath; + Assert.False(string.IsNullOrWhiteSpace(storedPath)); + Assert.Contains("cover.png", storedPath, StringComparison.OrdinalIgnoreCase); + + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + MusicArtworkEntity coverArtwork = dbContext.MusicArtwork + .Single(artwork => artwork.OwnerType == MusicArtworkOwnerType.Album && artwork.OwnerId == albumId && artwork.ArtworkType == ArtworkType.Cover); + Assert.Equal(storedPath, coverArtwork.FileName); + Assert.Equal(ArtworkStatus.Enriched, coverArtwork.Status); + } + + [Fact] + public async Task UpdateAlbumCover_WhenAlbumHasNoExistingCover_ShouldCreateACoverArtwork() + { + // Arrange + Guid userId = GetCurrentUserId(); + (Guid libraryId, Guid artistId, Guid albumId) = await SeedLibraryArtistAndAlbumAsync(userId); + + // Act + HttpResponseMessage response = await _client.PutAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover", CreateCoverForm("cover.png")); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + string storedPath = JsonSerializer.Deserialize(content, _jsonOptions)!.CoverPath; + Assert.False(string.IsNullOrWhiteSpace(storedPath)); + + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + MusicArtworkEntity coverArtwork = dbContext.MusicArtwork + .Single(artwork => artwork.OwnerType == MusicArtworkOwnerType.Album && artwork.OwnerId == albumId && artwork.ArtworkType == ArtworkType.Cover); + Assert.Equal(storedPath, coverArtwork.FileName); + } + + [Fact] + public async Task UpdateAlbumCover_WhenAlbumDoesNotExist_ShouldReturnAlbumNotFoundProblem() + { + // Arrange + Guid userId = GetCurrentUserId(); + (Guid libraryId, Guid artistId, _) = await SeedLibraryArtistAndAlbumAsync(userId); + string url = $"/api/v1/libraries/{libraryId}/artists/{artistId}/albums/{Guid.NewGuid()}/cover"; + + // Act + HttpResponseMessage response = await _client.PutAsync(url, CreateCoverForm("cover.png")); + + // Assert + await AssertNotFoundAsync(response, "AlbumNotFound", url); + } + + [Fact] + public async Task UpdateAlbumCover_WhenAlbumBelongsToAnotherLibrary_ShouldReturnAlbumNotFoundProblem() + { + // Arrange + Guid userId = GetCurrentUserId(); + (_, Guid artistId, Guid albumId) = await SeedLibraryArtistAndAlbumAsync(userId); + Guid otherLibraryId = Guid.NewGuid(); + string url = $"/api/v1/libraries/{otherLibraryId}/artists/{artistId}/albums/{albumId}/cover"; + + // Act + HttpResponseMessage response = await _client.PutAsync(url, CreateCoverForm("cover.png")); + + // Assert + await AssertNotFoundAsync(response, "AlbumNotFound", url); + } + + [Fact] + public async Task UpdateAlbumCover_WhenAlbumBelongsToAnotherUserLibrary_ShouldReturnForbiddenProblem() + { + // Arrange + Guid otherUserId = await SeedOtherUserAsync(); + (Guid otherLibraryId, Guid otherArtistId, Guid otherAlbumId) = await SeedLibraryArtistAndAlbumAsync(otherUserId); + string url = $"/api/v1/libraries/{otherLibraryId}/artists/{otherArtistId}/albums/{otherAlbumId}/cover"; + + // Act + HttpResponseMessage response = await _client.PutAsync(url, CreateCoverForm("cover.png")); + + // Assert + await AssertProblemDetails(response, HttpStatusCode.Forbidden, "General.Unauthorized", "NotAuthorized", url, "https://tools.ietf.org/html/rfc9110#section-15.5.4"); + } + + [Fact] + public async Task UpdateAlbumCover_WhenUnauthorized_ShouldReturnUnauthorizedResult() + { + // Arrange + HttpClient unauthenticatedClient = _apiFactory.CreateClient(); + string url = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover"; + + // Act + HttpResponseMessage response = await unauthenticatedClient.PutAsync(url, CreateCoverForm("cover.png")); + + // Assert + await AssertUnauthorizedAsync(response, url); + } + + [Fact] + public async Task UpdateAlbumCover_WhenNoFileIsUploaded_ShouldReturnUnprocessableEntityWithCoverCannotBeNull() + { + // Arrange + MultipartFormDataContent form = []; + form.Add(new StringContent("unrelated-field"), "unrelated-field"); + string url = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover"; + + // Act + HttpResponseMessage response = await _client.PutAsync(url, form); + + // Assert + await AssertUnprocessableEntityWithValidationErrors(response, url, "CoverCannotBeNull"); + } + + [Fact] + public async Task UpdateAlbumCover_WhenAlbumIdIsNotParseable_ShouldReturnUnprocessableEntity() + { + // Arrange + string url = $"/api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/{Guid.NewGuid()}/albums/not-a-guid/cover"; + + // Act + HttpResponseMessage response = await _client.PutAsync(url, CreateCoverForm("cover.png")); + + // Assert + await AssertUnprocessableEntityWithValidationErrors(response, url, "AlbumIdCannotBeEmpty"); + } + + /// + /// Creates a multipart form carrying a minimal PNG-like payload. + /// + /// The name of the uploaded file. + /// A configured instance. + private static MultipartFormDataContent CreateCoverForm(string fileName) + { + // The payload only needs to carry the PNG signature in its first bytes and exceed the header detection buffer. + byte[] payload = new byte[100]; + payload[0] = 137; + payload[1] = 80; + payload[2] = 78; + payload[3] = 71; + payload[4] = 13; + payload[5] = 10; + payload[6] = 26; + payload[7] = 10; + MultipartFormDataContent form = []; + ByteArrayContent fileContent = new(payload); + fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + form.Add(fileContent, "cover", fileName); + return form; + } + + /// + /// Seeds a music library owned by , together with an artist and one of its albums that has no cover yet. + /// + /// The Id of the user that owns the library. + /// The Ids of the seeded library, artist and album. + private async Task<(Guid libraryId, Guid artistId, Guid albumId)> SeedLibraryArtistAndAlbumAsync(Guid userId) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create(id: albumId, artistId: artistId, libraryId: libraryId, title: "A Night at the Opera", includeTracks: false, includeMetadata: false, includeBarcode: false, includeOriginalReleaseDate: false, includeOriginalReleaseYear: false, includeReReleaseDate: false, includeReReleaseYear: false); + dbContext.Libraries.Add(_libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Queen Library", libraryType: LibraryType.Music, contentLocations: [])); + dbContext.Artists.Add(_artistEntityFixture.Create(id: artistId, libraryId: libraryId, name: "Queen", albums: [album], includeContributors: false)); + await dbContext.SaveChangesAsync(); + return (libraryId, artistId, albumId); + } + + /// + /// Seeds a music library owned by , together with an artist and one of its albums that already has a cover. + /// + /// The Id of the user that owns the library. + /// The relative path of the existing cover of the album. + /// The Ids of the seeded library, artist and album. + private async Task<(Guid libraryId, Guid artistId, Guid albumId)> SeedLibraryArtistAndAlbumWithCoverAsync(Guid userId, string existingCoverFileName) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create(id: albumId, artistId: artistId, libraryId: libraryId, title: "A Night at the Opera", includeTracks: false, includeMetadata: false, includeBarcode: false, includeOriginalReleaseDate: false, includeOriginalReleaseYear: false, includeReReleaseDate: false, includeReReleaseYear: false); + dbContext.Libraries.Add(_libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Queen Library", libraryType: LibraryType.Music, contentLocations: [])); + dbContext.Artists.Add(_artistEntityFixture.Create(id: artistId, libraryId: libraryId, name: "Queen", albums: [album], includeContributors: false)); + dbContext.MusicArtwork.Add(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: albumId, artworkType: ArtworkType.Cover, ordinal: 0, fileName: existingCoverFileName, status: ArtworkStatus.Enriched)); + await dbContext.SaveChangesAsync(); + return (libraryId, artistId, albumId); + } + + /// + /// Seeds a user distinct from the authenticated test user and returns its Id. + /// + /// The Id of the seeded user. + private async Task SeedOtherUserAsync() + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + Guid userId = Guid.NewGuid(); + dbContext.Users.Add(_userEntityFixture.Create(id: userId, username: $"otheruser_{Guid.NewGuid()}", password: "TestPass123!")); + await dbContext.SaveChangesAsync(); + return userId; + } + + /// + /// Gets the Id of the currently authenticated test user. + /// + /// The Id of the authenticated test user. + private Guid GetCurrentUserId() + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + UserEntity user = dbContext.Users.First(user => user.Username == _apiFactory.TestUsername); + return user.Id; + } + + /// + /// Asserts that the response is a not found problem details carrying the expected detail and request instance path. + /// + /// The HTTP response to assert on. + /// The expected problem detail. + /// The expected request instance path. + private async Task AssertNotFoundAsync(HttpResponseMessage response, string expectedDetail, string expectedInstance) + { + await AssertProblemDetails(response, HttpStatusCode.NotFound, "General.NotFound", expectedDetail, expectedInstance, "https://tools.ietf.org/html/rfc9110#section-15.5.5"); + } + + /// + /// Asserts the shape of a problem details response with the provided status, title, detail, instance and type. + /// + /// The HTTP response to assert on. + /// The expected HTTP status code. + /// The expected problem title. + /// The expected problem detail. + /// The expected request instance path. + /// The expected problem type URI. + private async Task AssertProblemDetails(HttpResponseMessage response, HttpStatusCode statusCode, string expectedTitle, string expectedDetail, string expectedInstance, string expectedType) + { + Assert.Equal(statusCode, response.StatusCode); + Assert.Equal("application/problem+json", response.Content.Headers.ContentType?.MediaType); + + string content = await response.Content.ReadAsStringAsync(); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal((int)statusCode, problemDetails!["status"].GetInt32()); + Assert.Equal(expectedType, problemDetails["type"].GetString()); + Assert.Equal(expectedTitle, problemDetails["title"].GetString()); + Assert.Equal(expectedDetail, problemDetails["detail"].GetString()); + Assert.Equal(expectedInstance, problemDetails["instance"].GetString()); + Assert.NotNull(problemDetails["traceId"].GetString()); + Assert.NotEmpty(problemDetails["traceId"].GetString()!); + } + + /// + /// Asserts that the response is an unauthorized problem details carrying the expected request instance path. + /// + /// The HTTP response to assert on. + /// The expected request instance path. + private async Task AssertUnauthorizedAsync(HttpResponseMessage response, string expectedInstance) + { + Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); + + string content = await response.Content.ReadAsStringAsync(); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal((int)HttpStatusCode.Unauthorized, problemDetails!["status"].GetInt32()); + Assert.Equal("https://tools.ietf.org/html/rfc7235#section-3.1", problemDetails["type"].GetString()); + Assert.Equal("Unauthorized", problemDetails["title"].GetString()); + Assert.Equal("Authentication failed", problemDetails["detail"].GetString()); + Assert.Equal(expectedInstance, problemDetails["instance"].GetProperty("value").GetString()); + } + + /// + /// Asserts that the response is an unprocessable entity problem details carrying the expected validation error codes. + /// + /// The HTTP response to assert on. + /// The expected request instance path. + /// The validation error codes that must all be present. + private async Task AssertUnprocessableEntityWithValidationErrors(HttpResponseMessage response, string expectedInstance, params string[] expectedErrorCodes) + { + Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode); + Assert.Equal("application/problem+json", response.Content.Headers.ContentType?.MediaType); + + string content = await response.Content.ReadAsStringAsync(); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal((int)HttpStatusCode.UnprocessableEntity, problemDetails!["status"].GetInt32()); + Assert.Equal("General.Validation", problemDetails["title"].GetString()); + Assert.Equal("OneOrMoreValidationErrorsOccurred", problemDetails["detail"].GetString()); + Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", problemDetails["type"].GetString()); + Assert.Equal(expectedInstance, problemDetails["instance"].GetString()); + Assert.NotNull(problemDetails["traceId"].GetString()); + Assert.NotEmpty(problemDetails["traceId"].GetString()!); + + Dictionary? errors = problemDetails["errors"].Deserialize>(); + Assert.NotNull(errors); + Assert.Contains("General.Validation", errors.Keys); + Assert.All(expectedErrorCodes, code => Assert.Contains(code, errors["General.Validation"])); + } + + /// + /// Disposes API factory resources. + /// + public async Task DisposeAsync() + { + await _apiFactory.RemoveTestUserAsync(); + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs new file mode 100644 index 00000000..ee8d938b --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs @@ -0,0 +1,391 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Common.DataAccess.Entities.UsersManagement; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.UsersManagement; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using Lumina.DataAccess.Core.UoW; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; +using Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; +using Lumina.Presentation.Api.IntegrationTests.Common.Setup; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Api.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverEndpointTests : IClassFixture, IAsyncLifetime +{ + private HttpClient _client; + private readonly AuthenticatedLuminaApiFactory _apiFactory; + private readonly JsonSerializerOptions _jsonOptions = new() + { + PropertyNameCaseInsensitive = true, + Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } + }; + private readonly LibraryEntityFixture _libraryEntityFixture = new(); + private readonly ArtistEntityFixture _artistEntityFixture = new(); + private readonly MusicArtworkEntityFixture _musicArtworkEntityFixture = new(); + private readonly UserEntityFixture _userEntityFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected in-memory API factory. + public UpdateArtistCoverEndpointTests(AuthenticatedLuminaApiFactory apiFactory) + { + _client = apiFactory.CreateClient(); + _apiFactory = apiFactory; + } + + /// + /// Initializes authenticated API client. + /// + public async Task InitializeAsync() + { + _client = await _apiFactory.CreateAuthenticatedClientAsync(); + } + + [Fact] + public async Task UpdateArtistCover_WhenCalledByOwnerWithValidImage_ShouldReplaceTheStoredCover() + { + // Arrange + Guid userId = GetCurrentUserId(); + (Guid libraryId, Guid artistId) = await SeedLibraryAndArtistWithCoverAsync(userId, "/media/music/old-artist-cover.jpg"); + + // Act + HttpResponseMessage response = await _client.PutAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/cover", CreateCoverForm("cover.png")); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + string storedPath = JsonSerializer.Deserialize(content, _jsonOptions)!.CoverPath; + Assert.False(string.IsNullOrWhiteSpace(storedPath)); + Assert.Contains("cover.png", storedPath, StringComparison.OrdinalIgnoreCase); + + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + MusicArtworkEntity coverArtwork = dbContext.MusicArtwork + .Single(artwork => artwork.OwnerType == MusicArtworkOwnerType.Artist && artwork.OwnerId == artistId && artwork.ArtworkType == ArtworkType.Cover); + Assert.Equal(storedPath, coverArtwork.FileName); + Assert.Equal(ArtworkStatus.Enriched, coverArtwork.Status); + } + + [Fact] + public async Task UpdateArtistCover_WhenArtistHasNoExistingCover_ShouldCreateACoverArtwork() + { + // Arrange + Guid userId = GetCurrentUserId(); + (Guid libraryId, Guid artistId) = await SeedLibraryAndArtistAsync(userId); + + // Act + HttpResponseMessage response = await _client.PutAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/cover", CreateCoverForm("cover.png")); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + string storedPath = JsonSerializer.Deserialize(content, _jsonOptions)!.CoverPath; + Assert.False(string.IsNullOrWhiteSpace(storedPath)); + + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + MusicArtworkEntity coverArtwork = dbContext.MusicArtwork + .Single(artwork => artwork.OwnerType == MusicArtworkOwnerType.Artist && artwork.OwnerId == artistId && artwork.ArtworkType == ArtworkType.Cover); + Assert.Equal(storedPath, coverArtwork.FileName); + } + + [Fact] + public async Task UpdateArtistCover_WhenArtistDoesNotExist_ShouldReturnArtistNotFoundProblem() + { + // Arrange + Guid userId = GetCurrentUserId(); + Guid libraryId = await SeedLibraryAsync(userId); + string url = $"/api/v1/libraries/{libraryId}/artists/{Guid.NewGuid()}/cover"; + + // Act + HttpResponseMessage response = await _client.PutAsync(url, CreateCoverForm("cover.png")); + + // Assert + await AssertNotFoundAsync(response, "ArtistNotFound", url); + } + + [Fact] + public async Task UpdateArtistCover_WhenArtistRequestedThroughDifferentLibrary_ShouldReturnArtistNotFoundProblem() + { + // Arrange + Guid userId = GetCurrentUserId(); + (_, Guid artistId) = await SeedLibraryAndArtistAsync(userId); + string url = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{artistId}/cover"; + + // Act + HttpResponseMessage response = await _client.PutAsync(url, CreateCoverForm("cover.png")); + + // Assert + await AssertNotFoundAsync(response, "ArtistNotFound", url); + } + + [Fact] + public async Task UpdateArtistCover_WhenArtistBelongsToAnotherUserLibrary_ShouldReturnForbiddenProblem() + { + // Arrange + Guid otherUserId = await SeedOtherUserAsync(); + (Guid otherLibraryId, Guid otherArtistId) = await SeedLibraryAndArtistAsync(otherUserId); + string url = $"/api/v1/libraries/{otherLibraryId}/artists/{otherArtistId}/cover"; + + // Act + HttpResponseMessage response = await _client.PutAsync(url, CreateCoverForm("cover.png")); + + // Assert + await AssertProblemDetails(response, HttpStatusCode.Forbidden, "General.Unauthorized", "NotAuthorized", url, "https://tools.ietf.org/html/rfc9110#section-15.5.4"); + } + + [Fact] + public async Task UpdateArtistCover_WhenUnauthorized_ShouldReturnUnauthorizedResult() + { + // Arrange + HttpClient unauthenticatedClient = _apiFactory.CreateClient(); + string url = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover"; + + // Act + HttpResponseMessage response = await unauthenticatedClient.PutAsync(url, CreateCoverForm("cover.png")); + + // Assert + await AssertUnauthorizedAsync(response, url); + } + + [Fact] + public async Task UpdateArtistCover_WhenNoFileIsUploaded_ShouldReturnUnprocessableEntityWithCoverCannotBeNull() + { + // Arrange + MultipartFormDataContent form = []; + form.Add(new StringContent("unrelated-field"), "unrelated-field"); + string url = $"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover"; + + // Act + HttpResponseMessage response = await _client.PutAsync(url, form); + + // Assert + await AssertUnprocessableEntityWithValidationErrors(response, url, "CoverCannotBeNull"); + } + + [Fact] + public async Task UpdateArtistCover_WhenArtistIdIsNotParseable_ShouldReturnUnprocessableEntity() + { + // Arrange + string url = $"/api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/artists/not-a-guid/cover"; + + // Act + HttpResponseMessage response = await _client.PutAsync(url, CreateCoverForm("cover.png")); + + // Assert + await AssertUnprocessableEntityWithValidationErrors(response, url, "ArtistIdCannotBeEmpty"); + } + + /// + /// Creates a multipart form carrying a minimal PNG-like payload. + /// + /// The name of the uploaded file. + /// A configured instance. + private static MultipartFormDataContent CreateCoverForm(string fileName) + { + // The payload only needs to carry the PNG signature in its first bytes and exceed the header detection buffer. + byte[] payload = new byte[100]; + payload[0] = 137; + payload[1] = 80; + payload[2] = 78; + payload[3] = 71; + payload[4] = 13; + payload[5] = 10; + payload[6] = 26; + payload[7] = 10; + MultipartFormDataContent form = []; + ByteArrayContent fileContent = new(payload); + fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + form.Add(fileContent, "cover", fileName); + return form; + } + + /// + /// Seeds a music library owned by . + /// + /// The Id of the user that owns the library. + /// The Id of the seeded library. + private async Task SeedLibraryAsync(Guid userId) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + Guid libraryId = Guid.NewGuid(); + dbContext.Libraries.Add(_libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Queen Library", libraryType: LibraryType.Music, contentLocations: [])); + await dbContext.SaveChangesAsync(); + return libraryId; + } + + /// + /// Seeds a music library owned by , together with an artist that has no cover yet. + /// + /// The Id of the user that owns the library. + /// The Ids of the seeded library and artist. + private async Task<(Guid libraryId, Guid artistId)> SeedLibraryAndArtistAsync(Guid userId) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + dbContext.Libraries.Add(_libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Queen Library", libraryType: LibraryType.Music, contentLocations: [])); + dbContext.Artists.Add(_artistEntityFixture.Create(id: artistId, libraryId: libraryId, name: "Queen", includeAlbums: false, includeContributors: false)); + await dbContext.SaveChangesAsync(); + return (libraryId, artistId); + } + + /// + /// Seeds a music library owned by , together with an artist that already has a cover. + /// + /// The Id of the user that owns the library. + /// The relative path of the existing cover of the artist. + /// The Ids of the seeded library and artist. + private async Task<(Guid libraryId, Guid artistId)> SeedLibraryAndArtistWithCoverAsync(Guid userId, string existingCoverFileName) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + dbContext.Libraries.Add(_libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Queen Library", libraryType: LibraryType.Music, contentLocations: [])); + dbContext.Artists.Add(_artistEntityFixture.Create(id: artistId, libraryId: libraryId, name: "Queen", includeAlbums: false, includeContributors: false)); + dbContext.MusicArtwork.Add(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, ownerId: artistId, artworkType: ArtworkType.Cover, ordinal: 0, fileName: existingCoverFileName, status: ArtworkStatus.Enriched)); + await dbContext.SaveChangesAsync(); + return (libraryId, artistId); + } + + /// + /// Seeds a user distinct from the authenticated test user and returns its Id. + /// + /// The Id of the seeded user. + private async Task SeedOtherUserAsync() + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + Guid userId = Guid.NewGuid(); + dbContext.Users.Add(_userEntityFixture.Create(id: userId, username: $"otheruser_{Guid.NewGuid()}", password: "TestPass123!")); + await dbContext.SaveChangesAsync(); + return userId; + } + + /// + /// Gets the Id of the currently authenticated test user. + /// + /// The Id of the authenticated test user. + private Guid GetCurrentUserId() + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + UserEntity user = dbContext.Users.First(user => user.Username == _apiFactory.TestUsername); + return user.Id; + } + + /// + /// Asserts that the response is a not found problem details carrying the expected detail and request instance path. + /// + /// The HTTP response to assert on. + /// The expected problem detail. + /// The expected request instance path. + private async Task AssertNotFoundAsync(HttpResponseMessage response, string expectedDetail, string expectedInstance) + { + await AssertProblemDetails(response, HttpStatusCode.NotFound, "General.NotFound", expectedDetail, expectedInstance, "https://tools.ietf.org/html/rfc9110#section-15.5.5"); + } + + /// + /// Asserts the shape of a problem details response with the provided status, title, detail, instance and type. + /// + /// The HTTP response to assert on. + /// The expected HTTP status code. + /// The expected problem title. + /// The expected problem detail. + /// The expected request instance path. + /// The expected problem type URI. + private async Task AssertProblemDetails(HttpResponseMessage response, HttpStatusCode statusCode, string expectedTitle, string expectedDetail, string expectedInstance, string expectedType) + { + Assert.Equal(statusCode, response.StatusCode); + Assert.Equal("application/problem+json", response.Content.Headers.ContentType?.MediaType); + + string content = await response.Content.ReadAsStringAsync(); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal((int)statusCode, problemDetails!["status"].GetInt32()); + Assert.Equal(expectedType, problemDetails["type"].GetString()); + Assert.Equal(expectedTitle, problemDetails["title"].GetString()); + Assert.Equal(expectedDetail, problemDetails["detail"].GetString()); + Assert.Equal(expectedInstance, problemDetails["instance"].GetString()); + Assert.NotNull(problemDetails["traceId"].GetString()); + Assert.NotEmpty(problemDetails["traceId"].GetString()!); + } + + /// + /// Asserts that the response is an unauthorized problem details carrying the expected request instance path. + /// + /// The HTTP response to assert on. + /// The expected request instance path. + private async Task AssertUnauthorizedAsync(HttpResponseMessage response, string expectedInstance) + { + Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); + + string content = await response.Content.ReadAsStringAsync(); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal((int)HttpStatusCode.Unauthorized, problemDetails!["status"].GetInt32()); + Assert.Equal("https://tools.ietf.org/html/rfc7235#section-3.1", problemDetails["type"].GetString()); + Assert.Equal("Unauthorized", problemDetails["title"].GetString()); + Assert.Equal("Authentication failed", problemDetails["detail"].GetString()); + Assert.Equal(expectedInstance, problemDetails["instance"].GetProperty("value").GetString()); + } + + /// + /// Asserts that the response is an unprocessable entity problem details carrying the expected validation error codes. + /// + /// The HTTP response to assert on. + /// The expected request instance path. + /// The validation error codes that must all be present. + private async Task AssertUnprocessableEntityWithValidationErrors(HttpResponseMessage response, string expectedInstance, params string[] expectedErrorCodes) + { + Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode); + Assert.Equal("application/problem+json", response.Content.Headers.ContentType?.MediaType); + + string content = await response.Content.ReadAsStringAsync(); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal((int)HttpStatusCode.UnprocessableEntity, problemDetails!["status"].GetInt32()); + Assert.Equal("General.Validation", problemDetails["title"].GetString()); + Assert.Equal("OneOrMoreValidationErrorsOccurred", problemDetails["detail"].GetString()); + Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", problemDetails["type"].GetString()); + Assert.Equal(expectedInstance, problemDetails["instance"].GetString()); + Assert.NotNull(problemDetails["traceId"].GetString()); + Assert.NotEmpty(problemDetails["traceId"].GetString()!); + + Dictionary? errors = problemDetails["errors"].Deserialize>(); + Assert.NotNull(errors); + Assert.Contains("General.Validation", errors.Keys); + Assert.All(expectedErrorCodes, code => Assert.Contains(code, errors["General.Validation"])); + } + + /// + /// Disposes API factory resources. + /// + public async Task DisposeAsync() + { + await _apiFactory.RemoveTestUserAsync(); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs new file mode 100644 index 00000000..9f30b955 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs @@ -0,0 +1,320 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.DataAccess.Core.UoW; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; +using Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; +using Lumina.Presentation.Api.SecurityTests.Common.Setup; +using Microsoft.AspNetCore.Http; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Api.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverEndpointTests : IClassFixture, IDisposable +{ + private readonly LuminaApiFactory _apiFactory; + private readonly LibraryEntityFixture _libraryEntityFixture = new(); + private readonly ArtistEntityFixture _artistEntityFixture = new(); + private readonly AlbumEntityFixture _albumEntityFixture = new(); + private readonly List _seededUsernames = []; + + /// + /// Initializes a new instance of the class. + /// + /// Injected in-memory API factory. + public UpdateAlbumCoverEndpointTests(LuminaApiFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task UpdateAlbumCover_WhenUnauthorized_ShouldReturnUnauthorizedResult() + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + client.DefaultRequestHeaders.Add("X-Forwarded-For", LuminaApiFactory.GetUniqueTestIp()); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover", form); + + // Assert + Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content); + Assert.NotNull(problemDetails); + Assert.Equal(StatusCodes.Status401Unauthorized, problemDetails!["status"].GetInt32()); + Assert.Equal("https://tools.ietf.org/html/rfc7235#section-3.1", problemDetails["type"].GetString()); + Assert.Equal("Unauthorized", problemDetails["title"].GetString()); + Assert.Equal("Authentication failed", problemDetails["detail"].GetString()); + Assert.Equal($"/api/v1/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover", problemDetails["instance"].GetProperty("value").GetString()); + } + + [Fact] + public async Task UpdateAlbumCover_WhenUnauthorized_ShouldNotLeakSensitiveData() + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + client.DefaultRequestHeaders.Add("X-Forwarded-For", LuminaApiFactory.GetUniqueTestIp()); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover", form); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); + Assert.DoesNotContain("password", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("hash", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("salt", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + } + + [Theory] + [InlineData("'; DROP TABLE Albums; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task UpdateAlbumCover_WithSQLInjectionInLibraryRouteId_ShouldRemainSecure(string maliciousLibraryId) + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + (Guid _, string username) = await _apiFactory.CreateAndAuthenticateUserAsync(client); + _seededUsernames.Add(username); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{Uri.EscapeDataString(maliciousLibraryId)}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover", form); + + // Assert + await AssertCleanValidationErrorAsync(response, maliciousLibraryId, "LibraryIdCannotBeEmpty"); + } + + [Theory] + [InlineData("'; DROP TABLE Albums; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task UpdateAlbumCover_WithSQLInjectionInArtistRouteId_ShouldRemainSecure(string maliciousArtistId) + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + (Guid _, string username) = await _apiFactory.CreateAndAuthenticateUserAsync(client); + _seededUsernames.Add(username); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{Guid.NewGuid()}/artists/{Uri.EscapeDataString(maliciousArtistId)}/albums/{Guid.NewGuid()}/cover", form); + + // Assert + await AssertCleanValidationErrorAsync(response, maliciousArtistId, "ArtistIdCannotBeEmpty"); + } + + [Theory] + [InlineData("'; DROP TABLE Albums; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task UpdateAlbumCover_WithSQLInjectionInAlbumRouteId_ShouldRemainSecure(string maliciousAlbumId) + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + (Guid _, string username) = await _apiFactory.CreateAndAuthenticateUserAsync(client); + _seededUsernames.Add(username); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Uri.EscapeDataString(maliciousAlbumId)}/cover", form); + + // Assert + await AssertCleanValidationErrorAsync(response, maliciousAlbumId, "AlbumIdCannotBeEmpty"); + } + + [Fact] + public async Task UpdateAlbumCover_WhenAlbumDoesNotExist_ShouldReturnNotFoundWithoutLeakingInternals() + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + (Guid _, string username) = await _apiFactory.CreateAndAuthenticateUserAsync(client); + _seededUsernames.Add(username); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover", form); + + // Assert + Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("password", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("hash", content, StringComparison.OrdinalIgnoreCase); + using JsonDocument problemDetails = JsonDocument.Parse(content); + Assert.Equal("General.NotFound", problemDetails.RootElement.GetProperty("title").GetString()); + Assert.Equal("AlbumNotFound", problemDetails.RootElement.GetProperty("detail").GetString()); + } + + [Fact] + public async Task UpdateAlbumCover_WithMaliciousFileName_ShouldNotCorruptOrLeakData() + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + (Guid _, string username) = await _apiFactory.CreateAndAuthenticateUserAsync(client); + _seededUsernames.Add(username); + MultipartFormDataContent form = CreateCoverForm("..\\..\\evil.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/cover", form); + + // Assert + // The album does not exist, so the handler returns a clean not found response before the uploaded file name is used. + Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + } + + [Fact] + public async Task UpdateAlbumCover_WhenUserDoesNotOwnTheLibrary_ShouldReturnForbidden() + { + // Arrange + HttpClient ownerClient = _apiFactory.CreateClient(); + (Guid ownerId, string ownerUsername) = await _apiFactory.CreateAndAuthenticateUserAsync(ownerClient); + _seededUsernames.Add(ownerUsername); + (Guid libraryId, Guid artistId, Guid albumId) = await SeedLibraryArtistAndAlbumAsync(ownerId); + + HttpClient requesterClient = _apiFactory.CreateClient(); + (Guid _, string requesterUsername) = await _apiFactory.CreateAndAuthenticateUserAsync(requesterClient); + _seededUsernames.Add(requesterUsername); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await requesterClient.PutAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover", form); + + // Assert + Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("password", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("hash", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("salt", content, StringComparison.OrdinalIgnoreCase); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content); + Assert.NotNull(problemDetails); + Assert.Equal(StatusCodes.Status403Forbidden, problemDetails!["status"].GetInt32()); + Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.4", problemDetails["type"].GetString()); + Assert.Equal("General.Unauthorized", problemDetails["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); + } + + [Fact] + public async Task UpdateAlbumCover_WhenResourceBelongsToAnotherUsersLibrary_ShouldReturnNotFoundWithoutLeakingOrModifyingIt() + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + (Guid actingUserId, string actingUsername) = await _apiFactory.CreateAndAuthenticateUserAsync(client); + _seededUsernames.Add(actingUsername); + (Guid ownLibraryId, _, _) = await SeedLibraryArtistAndAlbumAsync(actingUserId); + + // The resource lives in a library owned by another user, and is referenced through the acting user's own library route. + HttpClient victimClient = _apiFactory.CreateClient(); + (Guid victimUserId, string victimUsername) = await _apiFactory.CreateAndAuthenticateUserAsync(victimClient); + _seededUsernames.Add(victimUsername); + (_, Guid victimArtistId, Guid victimAlbumId) = await SeedLibraryArtistAndAlbumAsync(victimUserId); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{ownLibraryId}/artists/{victimArtistId}/albums/{victimAlbumId}/cover", form); + + // Assert + Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("password", content, StringComparison.OrdinalIgnoreCase); + using JsonDocument problemDetails = JsonDocument.Parse(content); + Assert.Equal("General.NotFound", problemDetails.RootElement.GetProperty("title").GetString()); + Assert.Equal("AlbumNotFound", problemDetails.RootElement.GetProperty("detail").GetString()); + + // The other user's album is untouched. + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + AlbumEntity? storedAlbum = await dbContext.Albums.FirstOrDefaultAsync(album => album.Id == victimAlbumId); + Assert.NotNull(storedAlbum); + Assert.Equal("News of the World", storedAlbum.Title); + } + + /// + /// Asserts that the response is a clean validation problem details that neither leaks internals nor echoes the injected payload. + /// + /// The HTTP response to assert. + /// The injected payload that must never be echoed back. + /// The validation error code expected in the response. + private static async Task AssertCleanValidationErrorAsync(HttpResponseMessage response, string injectedPayload, string expectedErrorCode) + { + Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(injectedPayload, content, StringComparison.Ordinal); + using JsonDocument problemDetails = JsonDocument.Parse(content); + Assert.Equal("General.Validation", problemDetails.RootElement.GetProperty("title").GetString()); + Assert.Contains(expectedErrorCode, content, StringComparison.Ordinal); + } + + /// + /// Creates a multipart form carrying a minimal cover payload with the specified file name. + /// + /// The name of the uploaded file. + /// A configured instance. + private static MultipartFormDataContent CreateCoverForm(string fileName) + { + MultipartFormDataContent form = []; + ByteArrayContent fileContent = new(Encoding.UTF8.GetBytes("fake cover payload")); + fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + form.Add(fileContent, "cover", fileName); + return form; + } + + /// + /// Seeds a music library owned by , together with an artist and one of its albums. + /// + /// The Id of the user that owns the library. + /// The Ids of the seeded library, artist and album. + private async Task<(Guid libraryId, Guid artistId, Guid albumId)> SeedLibraryArtistAndAlbumAsync(Guid userId) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AlbumEntity album = _albumEntityFixture.Create(id: albumId, artistId: artistId, libraryId: libraryId, title: "News of the World", includeTracks: false, includeMetadata: false, includeBarcode: false, includeOriginalReleaseDate: false, includeOriginalReleaseYear: false, includeReReleaseDate: false, includeReReleaseYear: false); + dbContext.Libraries.Add(_libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Security Audio Library", libraryType: LibraryType.Music, contentLocations: [])); + dbContext.Artists.Add(_artistEntityFixture.Create(id: artistId, libraryId: libraryId, name: "Queen", albums: [album], includeContributors: false)); + await dbContext.SaveChangesAsync(); + return (libraryId, artistId, albumId); + } + + /// + /// Disposes API factory resources. + /// + public void Dispose() + { + foreach (string username in _seededUsernames) + _apiFactory.RemoveTestUser(username); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs new file mode 100644 index 00000000..dab067a8 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Api.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs @@ -0,0 +1,298 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.DataAccess.Core.UoW; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; +using Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; +using Lumina.Presentation.Api.SecurityTests.Common.Setup; +using Microsoft.AspNetCore.Http; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Api.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverEndpointTests : IClassFixture, IDisposable +{ + private readonly LuminaApiFactory _apiFactory; + private readonly LibraryEntityFixture _libraryEntityFixture = new(); + private readonly ArtistEntityFixture _artistEntityFixture = new(); + private readonly List _seededUsernames = []; + + /// + /// Initializes a new instance of the class. + /// + /// Injected in-memory API factory. + public UpdateArtistCoverEndpointTests(LuminaApiFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task UpdateArtistCover_WhenUnauthorized_ShouldReturnUnauthorizedResult() + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + client.DefaultRequestHeaders.Add("X-Forwarded-For", LuminaApiFactory.GetUniqueTestIp()); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/cover", form); + + // Assert + Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content); + Assert.NotNull(problemDetails); + Assert.Equal(StatusCodes.Status401Unauthorized, problemDetails!["status"].GetInt32()); + Assert.Equal("https://tools.ietf.org/html/rfc7235#section-3.1", problemDetails["type"].GetString()); + Assert.Equal("Unauthorized", problemDetails["title"].GetString()); + Assert.Equal("Authentication failed", problemDetails["detail"].GetString()); + Assert.Equal($"/api/v1/libraries/{libraryId}/artists/{artistId}/cover", problemDetails["instance"].GetProperty("value").GetString()); + } + + [Fact] + public async Task UpdateArtistCover_WhenUnauthorized_ShouldNotLeakSensitiveData() + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + client.DefaultRequestHeaders.Add("X-Forwarded-For", LuminaApiFactory.GetUniqueTestIp()); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover", form); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); + Assert.DoesNotContain("password", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("hash", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("salt", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + } + + [Theory] + [InlineData("'; DROP TABLE Artists; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task UpdateArtistCover_WithSQLInjectionInLibraryRouteId_ShouldRemainSecure(string maliciousLibraryId) + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + (Guid _, string username) = await _apiFactory.CreateAndAuthenticateUserAsync(client); + _seededUsernames.Add(username); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{Uri.EscapeDataString(maliciousLibraryId)}/artists/{Guid.NewGuid()}/cover", form); + + // Assert + await AssertCleanValidationErrorAsync(response, maliciousLibraryId, "LibraryIdCannotBeEmpty"); + } + + [Theory] + [InlineData("'; DROP TABLE Artists; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task UpdateArtistCover_WithSQLInjectionInArtistRouteId_ShouldRemainSecure(string maliciousArtistId) + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + (Guid _, string username) = await _apiFactory.CreateAndAuthenticateUserAsync(client); + _seededUsernames.Add(username); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{Guid.NewGuid()}/artists/{Uri.EscapeDataString(maliciousArtistId)}/cover", form); + + // Assert + await AssertCleanValidationErrorAsync(response, maliciousArtistId, "ArtistIdCannotBeEmpty"); + } + + [Fact] + public async Task UpdateArtistCover_WhenArtistDoesNotExist_ShouldReturnNotFoundWithoutLeakingInternals() + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + (Guid _, string username) = await _apiFactory.CreateAndAuthenticateUserAsync(client); + _seededUsernames.Add(username); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover", form); + + // Assert + Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("password", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("hash", content, StringComparison.OrdinalIgnoreCase); + using JsonDocument problemDetails = JsonDocument.Parse(content); + Assert.Equal("General.NotFound", problemDetails.RootElement.GetProperty("title").GetString()); + Assert.Equal("ArtistNotFound", problemDetails.RootElement.GetProperty("detail").GetString()); + } + + [Fact] + public async Task UpdateArtistCover_WithMaliciousFileName_ShouldNotCorruptOrLeakData() + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + (Guid _, string username) = await _apiFactory.CreateAndAuthenticateUserAsync(client); + _seededUsernames.Add(username); + MultipartFormDataContent form = CreateCoverForm("..\\..\\evil.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{Guid.NewGuid()}/artists/{Guid.NewGuid()}/cover", form); + + // Assert + // The artist does not exist, so the handler returns a clean not found response before the uploaded file name is used. + Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + } + + [Fact] + public async Task UpdateArtistCover_WhenUserDoesNotOwnTheLibrary_ShouldReturnForbidden() + { + // Arrange + HttpClient ownerClient = _apiFactory.CreateClient(); + (Guid ownerId, string ownerUsername) = await _apiFactory.CreateAndAuthenticateUserAsync(ownerClient); + _seededUsernames.Add(ownerUsername); + (Guid libraryId, Guid artistId) = await SeedLibraryAndArtistAsync(ownerId); + + HttpClient requesterClient = _apiFactory.CreateClient(); + (Guid _, string requesterUsername) = await _apiFactory.CreateAndAuthenticateUserAsync(requesterClient); + _seededUsernames.Add(requesterUsername); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await requesterClient.PutAsync($"/api/v1/libraries/{libraryId}/artists/{artistId}/cover", form); + + // Assert + Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("password", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("hash", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("salt", content, StringComparison.OrdinalIgnoreCase); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content); + Assert.NotNull(problemDetails); + Assert.Equal(StatusCodes.Status403Forbidden, problemDetails!["status"].GetInt32()); + Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.4", problemDetails["type"].GetString()); + Assert.Equal("General.Unauthorized", problemDetails["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); + } + + [Fact] + public async Task UpdateArtistCover_WhenArtistBelongsToAnotherUsersLibrary_ShouldReturnNotFoundWithoutLeakingOrModifyingIt() + { + // Arrange + HttpClient client = _apiFactory.CreateClient(); + (Guid actingUserId, string actingUsername) = await _apiFactory.CreateAndAuthenticateUserAsync(client); + _seededUsernames.Add(actingUsername); + (Guid ownLibraryId, _) = await SeedLibraryAndArtistAsync(actingUserId); + + // The artist lives in a library owned by another user, and is referenced through the acting user's own library route. + HttpClient victimClient = _apiFactory.CreateClient(); + (Guid victimUserId, string victimUsername) = await _apiFactory.CreateAndAuthenticateUserAsync(victimClient); + _seededUsernames.Add(victimUsername); + (_, Guid victimArtistId) = await SeedLibraryAndArtistAsync(victimUserId); + MultipartFormDataContent form = CreateCoverForm("cover.jpg"); + + // Act + HttpResponseMessage response = await client.PutAsync($"/api/v1/libraries/{ownLibraryId}/artists/{victimArtistId}/cover", form); + + // Assert + Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("password", content, StringComparison.OrdinalIgnoreCase); + using JsonDocument problemDetails = JsonDocument.Parse(content); + Assert.Equal("General.NotFound", problemDetails.RootElement.GetProperty("title").GetString()); + Assert.Equal("ArtistNotFound", problemDetails.RootElement.GetProperty("detail").GetString()); + + // The other user's artist is untouched. + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + ArtistEntity? storedArtist = await dbContext.Artists.FirstOrDefaultAsync(artist => artist.Id == victimArtistId); + Assert.NotNull(storedArtist); + Assert.Equal("Queen", storedArtist.Name); + } + + /// + /// Asserts that the response is a clean validation problem details that neither leaks internals nor echoes the injected payload. + /// + /// The HTTP response to assert. + /// The injected payload that must never be echoed back. + /// The validation error code expected in the response. + private static async Task AssertCleanValidationErrorAsync(HttpResponseMessage response, string injectedPayload, string expectedErrorCode) + { + Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode); + string content = await response.Content.ReadAsStringAsync(); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(injectedPayload, content, StringComparison.Ordinal); + using JsonDocument problemDetails = JsonDocument.Parse(content); + Assert.Equal("General.Validation", problemDetails.RootElement.GetProperty("title").GetString()); + Assert.Contains(expectedErrorCode, content, StringComparison.Ordinal); + } + + /// + /// Creates a multipart form carrying a minimal cover payload with the specified file name. + /// + /// The name of the uploaded file. + /// A configured instance. + private static MultipartFormDataContent CreateCoverForm(string fileName) + { + MultipartFormDataContent form = []; + ByteArrayContent fileContent = new(Encoding.UTF8.GetBytes("fake cover payload")); + fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + form.Add(fileContent, "cover", fileName); + return form; + } + + /// + /// Seeds a music library owned by , together with an artist. + /// + /// The Id of the user that owns the library. + /// The Ids of the seeded library and artist. + private async Task<(Guid libraryId, Guid artistId)> SeedLibraryAndArtistAsync(Guid userId) + { + using IServiceScope scope = _apiFactory.Services.CreateScope(); + LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + dbContext.Libraries.Add(_libraryEntityFixture.Create(id: libraryId, userId: userId, title: "Security Audio Library", libraryType: LibraryType.Music, contentLocations: [])); + dbContext.Artists.Add(_artistEntityFixture.Create(id: artistId, libraryId: libraryId, name: "Queen", includeAlbums: false, includeContributors: false)); + await dbContext.SaveChangesAsync(); + return (libraryId, artistId); + } + + /// + /// Disposes API factory resources. + /// + public void Dispose() + { + foreach (string username in _seededUsernames) + _apiFactory.RemoveTestUser(username); + } +} diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandlerTests.cs new file mode 100644 index 00000000..72575f3d --- /dev/null +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandHandlerTests.cs @@ -0,0 +1,722 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary; +using Lumina.Application.Common.DataAccess.Repositories.MusicLibrary; +using Lumina.Application.Common.DataAccess.UoW; +using Lumina.Application.Common.Infrastructure.Authentication; +using Lumina.Application.Common.Infrastructure.Authorization; +using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership; +using Lumina.Application.Common.Infrastructure.Validation; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; +using Lumina.Domain.Common.Errors; +using Lumina.Domain.Common.Primitives; +using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services; +using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; +using NSubstitute; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using ApplicationErrors = Lumina.Application.Common.Errors.Errors; +#endregion + +namespace Lumina.Application.UnitTests.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverCommandHandlerTests +{ + private const string STORED_COVER_PATH = "/media/music/library/artist/Album/album/cover.jpg"; + + private readonly IUnitOfWork _mockUnitOfWork; + private readonly IAlbumRepository _mockAlbumRepository; + private readonly IArtistRepository _mockArtistRepository; + private readonly ILibraryRepository _mockLibraryRepository; + private readonly IMusicArtworkRepository _mockMusicArtworkRepository; + private readonly IMusicArtworkService _mockMusicArtworkService; + private readonly IPathService _mockPathService; + private readonly IAuthorizationService _mockAuthorizationService; + private readonly ICurrentUserService _mockCurrentUserService; + private readonly IValidator _mockValidator; + private readonly UpdateAlbumCoverCommandHandler _sut; + private readonly Guid _userId; + private readonly UpdateAlbumCoverCommandFixture _updateAlbumCoverCommandFixture = new(); + private readonly AlbumEntityFixture _albumEntityFixture = new(); + private readonly ArtistEntityFixture _artistEntityFixture = new(); + private readonly MusicArtworkEntityFixture _musicArtworkEntityFixture = new(); + private readonly LibraryEntityFixture _libraryEntityFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public UpdateAlbumCoverCommandHandlerTests() + { + _mockAlbumRepository = Substitute.For(); + _mockArtistRepository = Substitute.For(); + _mockLibraryRepository = Substitute.For(); + _mockMusicArtworkRepository = Substitute.For(); + _mockUnitOfWork = Substitute.For(); + _mockUnitOfWork.SaveChangesAsync(Arg.Any()).Returns(Result.Success); + _mockUnitOfWork.AlbumRepository.Returns(_mockAlbumRepository); + _mockUnitOfWork.ArtistRepository.Returns(_mockArtistRepository); + _mockUnitOfWork.LibraryRepository.Returns(_mockLibraryRepository); + _mockUnitOfWork.MusicArtworkRepository.Returns(_mockMusicArtworkRepository); + _mockMusicArtworkService = Substitute.For(); + _mockPathService = Substitute.For(); + _mockAuthorizationService = Substitute.For(); + _mockCurrentUserService = Substitute.For(); + _mockValidator = Substitute.For>(); + _userId = Guid.NewGuid(); + + // Default stubs: the current user is authenticated, the library ownership policy allows access, the validator passes, the album has no artwork yet, and the artwork storage succeeds. + _mockCurrentUserService.UserId.Returns(_userId); + _mockAuthorizationService.EvaluatePolicyAsync(_userId, Arg.Any(), Arg.Any()) + .Returns(true); + _mockValidator.Validate(Arg.Any()).Returns([]); + // The stored artwork paths used by the tests are Unix separated, and sanitizing a name keeps it unchanged, as the real service does for valid names. + _mockPathService.PathSeparator.Returns('/'); + _mockPathService.SanitizeSegment(Arg.Any()) + .Returns(callInfo => PathSegment.Create(callInfo.Arg(), isDirectory: true, isDrive: false)); + _mockMusicArtworkRepository.GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From>([])); + _mockMusicArtworkRepository.UpsertCoverAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From(Result.Updated)); + _mockMusicArtworkService.SaveAlbumArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From(STORED_COVER_PATH)); + _mockMusicArtworkService.DeleteStoredArtwork(Arg.Any()).Returns(Result.From(Result.Deleted)); + + _sut = new UpdateAlbumCoverCommandHandler(_mockUnitOfWork, _mockMusicArtworkService, _mockPathService, _mockAuthorizationService, _mockCurrentUserService, _mockValidator); + } + + [Fact] + public async Task HandleAsync_WhenValidatorFails_ShouldReturnValidationErrorsWithoutStoringArtwork() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + _mockValidator.Validate(Arg.Any()).Returns([Errors.Music.CoverCannotBeNull]); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Music.CoverCannotBeNull, result.FirstError); + await _mockAlbumRepository.DidNotReceive().GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()); + await _mockArtistRepository.DidNotReceive().GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()); + await _mockLibraryRepository.DidNotReceive().GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()); + await _mockMusicArtworkRepository.DidNotReceive().GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenUserIsNotAuthenticated_ShouldReturnNotAuthorizedError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + _mockCurrentUserService.UserId.Returns((Guid?)null); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Authorization.NotAuthorized, result.FirstError); + await _mockAlbumRepository.DidNotReceive().GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenAlbumRepositoryReturnsError_ShouldReturnFailureResult() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + _mockAlbumRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Errors.Library.LibraryIdCannotBeEmpty); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Library.LibraryIdCannotBeEmpty, result.FirstError); + await _mockLibraryRepository.DidNotReceive().GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenAlbumDoesNotExist_ShouldReturnAlbumNotFoundError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + _mockAlbumRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(null)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Music.AlbumNotFound, result.FirstError); + await _mockLibraryRepository.DidNotReceive().GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenAlbumBelongsToAnotherLibrary_ShouldReturnAlbumNotFoundError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + // The stored album belongs to a different library than the one named by the route. + AlbumEntity existingAlbum = _albumEntityFixture.Create(id: Guid.Parse(command.AlbumId!), artistId: Guid.Parse(command.ArtistId!), libraryId: Guid.NewGuid()); + _mockAlbumRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(existingAlbum)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Music.AlbumNotFound, result.FirstError); + await _mockAuthorizationService.DidNotReceive().EvaluatePolicyAsync(Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenAlbumBelongsToAnotherArtist_ShouldReturnAlbumNotFoundError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + // The stored album belongs to a different artist than the one named by the route. + AlbumEntity existingAlbum = _albumEntityFixture.Create(id: Guid.Parse(command.AlbumId!), artistId: Guid.NewGuid(), libraryId: Guid.Parse(command.LibraryId!)); + _mockAlbumRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(existingAlbum)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Music.AlbumNotFound, result.FirstError); + await _mockAuthorizationService.DidNotReceive().EvaluatePolicyAsync(Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenPolicyDeniesAccess_ShouldReturnNotAuthorizedErrorWithoutStoringArtwork() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + _mockAuthorizationService.EvaluatePolicyAsync(_userId, Arg.Any(), Arg.Any()) + .Returns(false); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Authorization.NotAuthorized, result.FirstError); + await _mockLibraryRepository.DidNotReceive().GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenLibraryRepositoryReturnsError_ShouldReturnFailureResult() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + _mockLibraryRepository.GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()) + .Returns(Errors.Library.LibraryIdCannotBeEmpty); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Library.LibraryIdCannotBeEmpty, result.FirstError); + await _mockArtistRepository.DidNotReceive().GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenLibraryDoesNotExist_ShouldReturnLibraryNotFoundError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + _mockLibraryRepository.GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()) + .Returns(Result.From(null)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Library.LibraryNotFound, result.FirstError); + await _mockMusicArtworkService.DidNotReceive().SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenArtistRepositoryReturnsError_ShouldReturnFailureResult() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + SetupExistingLibrary(command); + _mockArtistRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Errors.Library.LibraryIdCannotBeEmpty); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Library.LibraryIdCannotBeEmpty, result.FirstError); + await _mockMusicArtworkRepository.DidNotReceive().GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenArtistDoesNotExist_ShouldPassEmptyArtistNameToArtworkService() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + SetupExistingLibrary(command); + _mockArtistRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(null)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + await _mockMusicArtworkService.Received(1).SaveAlbumArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), string.Empty, Arg.Any(), + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenArtworkLookupFails_ShouldReturnFailureResultWithoutStoringArtwork() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + SetupExistingLibrary(command); + SetupExistingArtist(command); + _mockMusicArtworkRepository.GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Errors.Library.LibraryIdCannotBeEmpty); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Library.LibraryIdCannotBeEmpty, result.FirstError); + await _mockMusicArtworkService.DidNotReceive().SaveAlbumArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkRepository.DidNotReceive().UpsertCoverAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenArtworkStorageFails_ShouldReturnFailureResultWithoutUpsertingOrSaving() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + SetupExistingLibrary(command); + SetupExistingArtist(command); + _mockMusicArtworkService.SaveAlbumArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Errors.FileSystemManagement.FileTooLarge); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.FileSystemManagement.FileTooLarge, result.FirstError); + await _mockMusicArtworkRepository.DidNotReceive().UpsertCoverAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenExistingCoverPathHasParseableReleaseType_ShouldPassThatReleaseTypeToArtworkService() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + // The album's release type is Album, but its stored cover already lives under an Ep directory, which wins. + SetupExistingAlbum(command, releaseType: MusicReleaseType.Album); + SetupExistingLibrary(command); + SetupExistingArtist(command); + SetupExistingArtwork(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, artworkType: ArtworkType.Cover, fileName: "/media/music/library/artist/Ep/album/cover.jpg")); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + await _mockMusicArtworkService.Received(1).SaveAlbumArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), + Arg.Any(), Arg.Any(), "Ep", Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenTheSegmentBeforeTheAlbumDirectoryIsTheArtistDirectoryNamedLikeAReleaseType_ShouldNotTreatItAsAReleaseType() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + // The artist is named "Live", which is also a release type name, but the album uses no release type, so the segment right before the album + // directory is the artist directory and must not be mistaken for a release type directory. + SetupExistingAlbum(command, includeReleaseType: false); + SetupExistingLibrary(command); + SetupExistingArtist(command, name: "Live"); + SetupExistingArtwork(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, artworkType: ArtworkType.Cover, fileName: "/media/music/library/Live/album/cover.jpg")); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + await _mockMusicArtworkService.Received(1).SaveAlbumArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), "Live", Arg.Any(), + Arg.Any(), Arg.Any(), Arg.Is(releaseTypeName => releaseTypeName == null), Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenTheSegmentBeforeTheAlbumDirectoryIsAReleaseTypeOfAnArtistNamedLikeAReleaseType_ShouldKeepIt() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + // The artist is named "Album" and its cover is stored under an "Ep" release type directory, which differs from the artist directory, so it is kept. + SetupExistingAlbum(command); + SetupExistingLibrary(command); + SetupExistingArtist(command, name: "Album"); + SetupExistingArtwork(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, artworkType: ArtworkType.Cover, fileName: "/media/music/library/Album/Ep/album/cover.jpg")); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + await _mockMusicArtworkService.Received(1).SaveAlbumArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), "Album", Arg.Any(), + Arg.Any(), Arg.Any(), "Ep", Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenExistingCoverPathHasNonParseableReleaseType_ShouldFallBackToFirstReleaseType() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command, releaseType: MusicReleaseType.Single); + SetupExistingLibrary(command); + SetupExistingArtist(command); + SetupExistingArtwork(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, artworkType: ArtworkType.Cover, fileName: "/media/music/library/artist/NotAReleaseType/album/cover.jpg")); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + await _mockMusicArtworkService.Received(1).SaveAlbumArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), + Arg.Any(), Arg.Any(), "Single", Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenExistingCoverPathHasTooFewSegments_ShouldFallBackToFirstReleaseType() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command, releaseType: MusicReleaseType.Single); + SetupExistingLibrary(command); + SetupExistingArtist(command); + // The stored cover path carries fewer than three segments, so it does not expose a release type directory. + SetupExistingArtwork(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, artworkType: ArtworkType.Cover, fileName: "cover.jpg")); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + await _mockMusicArtworkService.Received(1).SaveAlbumArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), + Arg.Any(), Arg.Any(), "Single", Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenAlbumHasNoExistingCover_ShouldUseFirstReleaseType() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command, releaseType: MusicReleaseType.Single); + SetupExistingLibrary(command); + SetupExistingArtist(command); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + await _mockMusicArtworkService.Received(1).SaveAlbumArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), + Arg.Any(), Arg.Any(), "Single", Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenAlbumHasNoExistingCoverAndNoReleaseTypes_ShouldPassNullReleaseTypeToArtworkService() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command, includeReleaseType: false); + SetupExistingLibrary(command); + SetupExistingArtist(command); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + await _mockMusicArtworkService.Received(1).SaveAlbumArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), + Arg.Any(), Arg.Any(), Arg.Is(releaseTypeName => releaseTypeName == null), Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenExistingCoverPathDiffersFromStoredPath_ShouldDeletePreviousArtwork() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + SetupExistingLibrary(command); + SetupExistingArtist(command); + SetupExistingArtwork(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, artworkType: ArtworkType.Cover, fileName: "/media/music/library/artist/Ep/album/old-cover.jpg")); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork("/media/music/library/artist/Ep/album/old-cover.jpg"); + } + + [Fact] + public async Task HandleAsync_WhenExistingCoverPathEqualsStoredPath_ShouldNotDeletePreviousArtwork() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + SetupExistingLibrary(command); + SetupExistingArtist(command); + SetupExistingArtwork(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, artworkType: ArtworkType.Cover, fileName: STORED_COVER_PATH)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockMusicArtworkService.DidNotReceive().DeleteStoredArtwork(Arg.Any()); + } + + [Theory] + [InlineData(null)] // no file name at all + [InlineData("")] // empty file name + [InlineData(" ")] // whitespace file name + public async Task HandleAsync_WhenExistingCoverPathIsEmpty_ShouldNotDeletePreviousArtwork(string? existingCoverPath) + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + SetupExistingLibrary(command); + SetupExistingArtist(command); + SetupExistingArtwork(_musicArtworkEntityFixture.Create( + ownerType: MusicArtworkOwnerType.Album, artworkType: ArtworkType.Cover, fileName: existingCoverPath, includeFileName: existingCoverPath is not null)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockMusicArtworkService.DidNotReceive().DeleteStoredArtwork(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenDeletingPreviousArtworkFails_ShouldReturnFailureResultWithoutUpsertingOrSaving() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + SetupExistingLibrary(command); + SetupExistingArtist(command); + SetupExistingArtwork(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, artworkType: ArtworkType.Cover, fileName: "/media/music/library/artist/Ep/album/old-cover.jpg")); + _mockMusicArtworkService.DeleteStoredArtwork(Arg.Any()).Returns(Errors.FileSystemManagement.FileTooLarge); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.FileSystemManagement.FileTooLarge, result.FirstError); + await _mockMusicArtworkRepository.DidNotReceive().UpsertCoverAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenUpsertCoverFails_ShouldReturnFailureResultWithoutSaving() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + SetupExistingLibrary(command); + SetupExistingArtist(command); + _mockMusicArtworkRepository.UpsertCoverAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenSaveChangesFails_ShouldReturnFailureResult() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + SetupExistingAlbum(command); + SetupExistingLibrary(command); + SetupExistingArtist(command); + _mockUnitOfWork.SaveChangesAsync(Arg.Any()) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + await _mockMusicArtworkRepository.Received(1).UpsertCoverAsync( + MusicArtworkOwnerType.Album, Guid.Parse(command.AlbumId!), STORED_COVER_PATH, Arg.Any()); + await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenSuccessful_ShouldReturnUpdateAlbumCoverResponseAndStoreArtwork() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + AlbumEntity existingAlbum = SetupExistingAlbum(command, releaseType: MusicReleaseType.Album); + LibraryEntity library = SetupExistingLibrary(command); + ArtistEntity artist = SetupExistingArtist(command); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + UpdateAlbumCoverResponse response = Assert.IsType(result.Value); + Assert.Equal(STORED_COVER_PATH, response.CoverPath); + await _mockMusicArtworkService.Received(1).SaveAlbumArtworkAsync( + existingAlbum.LibraryId, + existingAlbum.Id, + library.Title, + artist.Name, + existingAlbum.Title, + Arg.Any(), + command.FileName!, + "Album", + Arg.Any()); + await _mockMusicArtworkRepository.Received(1).UpsertCoverAsync( + MusicArtworkOwnerType.Album, + existingAlbum.Id, + STORED_COVER_PATH, + Arg.Any()); + await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any()); + } + + /// + /// Sets up a stored album that matches the library, artist and album identifiers of the command. + /// + /// The command whose route identifiers the stored album must match. + /// Optional. The release type of the stored album. + /// Whether the stored album should carry a release type, or an empty collection. + /// The created . + private AlbumEntity SetupExistingAlbum(UpdateAlbumCoverCommand command, MusicReleaseType? releaseType = MusicReleaseType.Album, bool includeReleaseType = true) + { + AlbumEntity existingAlbum = _albumEntityFixture.Create( + id: Guid.Parse(command.AlbumId!), + artistId: Guid.Parse(command.ArtistId!), + libraryId: Guid.Parse(command.LibraryId!), + releaseType: releaseType, + includeReleaseType: includeReleaseType); + _mockAlbumRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(existingAlbum)); + return existingAlbum; + } + + /// + /// Sets up a stored media library that matches the library of the command. + /// + /// The command whose library identifier the stored library must match. + /// The created . + private LibraryEntity SetupExistingLibrary(UpdateAlbumCoverCommand command) + { + LibraryEntity library = _libraryEntityFixture.Create(id: Guid.Parse(command.LibraryId!)); + _mockLibraryRepository.GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()) + .Returns(Result.From(library)); + return library; + } + + /// + /// Sets up a stored artist that matches the artist of the command. + /// + /// The command whose artist identifier the stored artist must match. + /// Optional. The name of the stored artist. + /// The created . + private ArtistEntity SetupExistingArtist(UpdateAlbumCoverCommand command, string? name = null) + { + ArtistEntity artist = _artistEntityFixture.Create(id: Guid.Parse(command.ArtistId!), libraryId: Guid.Parse(command.LibraryId!), name: name); + _mockArtistRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(artist)); + return artist; + } + + /// + /// Sets up the artwork owned by the album. + /// + /// The pieces of artwork owned by the album. + private void SetupExistingArtwork(params MusicArtworkEntity[] artworks) + { + _mockMusicArtworkRepository.GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From>(artworks)); + } +} diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandValidatorTests.cs new file mode 100644 index 00000000..dc034fc4 --- /dev/null +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Albums/Commands/UpdateAlbumCover/UpdateAlbumCoverCommandValidatorTests.cs @@ -0,0 +1,282 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; +using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; +using Lumina.Application.UnitTests.Common.Setup; +using Lumina.Domain.Common.Errors; +using Lumina.Domain.Common.Primitives; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Application.UnitTests.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverCommandValidatorTests +{ + private readonly UpdateAlbumCoverCommandFixture _updateAlbumCoverCommandFixture = new(); + private readonly UpdateAlbumCoverCommandValidator _validator = new(); + + [Fact] + public void Validate_WhenCommandIsValid_ShouldNotHaveValidationErrors() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(); + + // Act + List result = _validator.TestValidate(command); + + // Assert + Assert.Empty(result); + } + + [Fact] + public void Validate_WhenLibraryIdIsNull_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(includeLibraryId: false); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenLibraryIdIsEmpty_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(libraryId: Guid.Empty.ToString()); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenLibraryIdIsWhitespace_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(libraryId: " "); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenLibraryIdIsNotAGuid_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(libraryId: "not-a-guid"); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenLibraryIdIsValid_ShouldNotHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(libraryId: Guid.NewGuid().ToString()); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldNotHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenArtistIdIsNull_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(includeArtistId: false); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.ArtistIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenArtistIdIsEmpty_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(artistId: Guid.Empty.ToString()); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.ArtistIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenArtistIdIsWhitespace_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(artistId: " "); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.ArtistIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenArtistIdIsNotAGuid_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(artistId: "not-a-guid"); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.ArtistIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenArtistIdIsValid_ShouldNotHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(artistId: Guid.NewGuid().ToString()); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldNotHaveValidationError(Errors.Music.ArtistIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenAlbumIdIsNull_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(includeAlbumId: false); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.AlbumIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenAlbumIdIsEmpty_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(albumId: Guid.Empty.ToString()); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.AlbumIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenAlbumIdIsWhitespace_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(albumId: " "); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.AlbumIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenAlbumIdIsNotAGuid_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(albumId: "not-a-guid"); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.AlbumIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenAlbumIdIsValid_ShouldNotHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(albumId: Guid.NewGuid().ToString()); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldNotHaveValidationError(Errors.Music.AlbumIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenCoverIsNull_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(includeCover: false); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.CoverCannotBeNull); + } + + [Fact] + public void Validate_WhenCoverIsPresentAndFileNameIsEmpty_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(fileName: string.Empty); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.FileSystemManagement.FileNameCannotBeEmpty); + } + + [Fact] + public void Validate_WhenCoverIsPresentAndFileNameIsNull_ShouldHaveValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(includeFileName: false); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.FileSystemManagement.FileNameCannotBeEmpty); + } + + [Fact] + public void Validate_WhenCoverIsMissingAndFileNameIsEmpty_ShouldNotHaveFileNameValidationError() + { + // Arrange + UpdateAlbumCoverCommand command = _updateAlbumCoverCommandFixture.Create(fileName: string.Empty, includeCover: false); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldNotHaveValidationError(Errors.FileSystemManagement.FileNameCannotBeEmpty); + } +} diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandlerTests.cs new file mode 100644 index 00000000..4de61fa1 --- /dev/null +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandHandlerTests.cs @@ -0,0 +1,473 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary; +using Lumina.Application.Common.DataAccess.Repositories.MusicLibrary; +using Lumina.Application.Common.DataAccess.UoW; +using Lumina.Application.Common.Infrastructure.Authentication; +using Lumina.Application.Common.Infrastructure.Authorization; +using Lumina.Application.Common.Infrastructure.Authorization.Policies.LibraryOwnership; +using Lumina.Application.Common.Infrastructure.Validation; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artwork; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary; +using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management; +using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using Lumina.Domain.Common.Errors; +using Lumina.Domain.Common.Primitives; +using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; +using NSubstitute; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using ApplicationErrors = Lumina.Application.Common.Errors.Errors; +#endregion + +namespace Lumina.Application.UnitTests.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverCommandHandlerTests +{ + private const string STORED_COVER_PATH = "/media/music/library/artist/cover.jpg"; + + private readonly IUnitOfWork _mockUnitOfWork; + private readonly IArtistRepository _mockArtistRepository; + private readonly ILibraryRepository _mockLibraryRepository; + private readonly IMusicArtworkRepository _mockMusicArtworkRepository; + private readonly IMusicArtworkService _mockMusicArtworkService; + private readonly IAuthorizationService _mockAuthorizationService; + private readonly ICurrentUserService _mockCurrentUserService; + private readonly IValidator _mockValidator; + private readonly UpdateArtistCoverCommandHandler _sut; + private readonly Guid _userId; + private readonly UpdateArtistCoverCommandFixture _updateArtistCoverCommandFixture = new(); + private readonly ArtistEntityFixture _artistEntityFixture = new(); + private readonly MusicArtworkEntityFixture _musicArtworkEntityFixture = new(); + private readonly LibraryEntityFixture _libraryEntityFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public UpdateArtistCoverCommandHandlerTests() + { + _mockArtistRepository = Substitute.For(); + _mockLibraryRepository = Substitute.For(); + _mockMusicArtworkRepository = Substitute.For(); + _mockUnitOfWork = Substitute.For(); + _mockUnitOfWork.SaveChangesAsync(Arg.Any()).Returns(Result.Success); + _mockUnitOfWork.ArtistRepository.Returns(_mockArtistRepository); + _mockUnitOfWork.LibraryRepository.Returns(_mockLibraryRepository); + _mockUnitOfWork.MusicArtworkRepository.Returns(_mockMusicArtworkRepository); + _mockMusicArtworkService = Substitute.For(); + _mockAuthorizationService = Substitute.For(); + _mockCurrentUserService = Substitute.For(); + _mockValidator = Substitute.For>(); + _userId = Guid.NewGuid(); + + // Default stubs: the current user is authenticated, the library ownership policy allows access, the validator passes, the artist has no artwork yet, and the artwork storage succeeds. + _mockCurrentUserService.UserId.Returns(_userId); + _mockAuthorizationService.EvaluatePolicyAsync(_userId, Arg.Any(), Arg.Any()) + .Returns(true); + _mockValidator.Validate(Arg.Any()).Returns([]); + _mockMusicArtworkRepository.GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From>([])); + _mockMusicArtworkRepository.UpsertCoverAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From(Result.Updated)); + _mockMusicArtworkService.SaveArtistArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), + Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From(STORED_COVER_PATH)); + _mockMusicArtworkService.DeleteStoredArtwork(Arg.Any()).Returns(Result.From(Result.Deleted)); + + _sut = new UpdateArtistCoverCommandHandler(_mockUnitOfWork, _mockMusicArtworkService, _mockAuthorizationService, _mockCurrentUserService, _mockValidator); + } + + [Fact] + public async Task HandleAsync_WhenValidatorFails_ShouldReturnValidationErrorsWithoutStoringArtwork() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + _mockValidator.Validate(Arg.Any()).Returns([Errors.Music.CoverCannotBeNull]); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Music.CoverCannotBeNull, result.FirstError); + await _mockArtistRepository.DidNotReceive().GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()); + await _mockLibraryRepository.DidNotReceive().GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()); + await _mockMusicArtworkRepository.DidNotReceive().GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveArtistArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenUserIsNotAuthenticated_ShouldReturnNotAuthorizedError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + _mockCurrentUserService.UserId.Returns((Guid?)null); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Authorization.NotAuthorized, result.FirstError); + await _mockArtistRepository.DidNotReceive().GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveArtistArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenArtistRepositoryReturnsError_ShouldReturnFailureResult() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + _mockArtistRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Errors.Library.LibraryIdCannotBeEmpty); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Library.LibraryIdCannotBeEmpty, result.FirstError); + await _mockLibraryRepository.DidNotReceive().GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveArtistArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenArtistDoesNotExist_ShouldReturnArtistNotFoundError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + _mockArtistRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(null)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Music.ArtistNotFound, result.FirstError); + await _mockLibraryRepository.DidNotReceive().GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenArtistBelongsToAnotherLibrary_ShouldReturnArtistNotFoundError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + // The stored artist belongs to a different library than the one named by the route. + ArtistEntity existingArtist = _artistEntityFixture.Create(id: Guid.Parse(command.ArtistId!), libraryId: Guid.NewGuid()); + _mockArtistRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(existingArtist)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Music.ArtistNotFound, result.FirstError); + await _mockAuthorizationService.DidNotReceive().EvaluatePolicyAsync(Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveArtistArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenPolicyDeniesAccess_ShouldReturnNotAuthorizedErrorWithoutStoringArtwork() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + SetupExistingArtist(command); + _mockAuthorizationService.EvaluatePolicyAsync(_userId, Arg.Any(), Arg.Any()) + .Returns(false); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Authorization.NotAuthorized, result.FirstError); + await _mockLibraryRepository.DidNotReceive().GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveArtistArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenLibraryRepositoryReturnsError_ShouldReturnFailureResult() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + SetupExistingArtist(command); + _mockLibraryRepository.GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()) + .Returns(Errors.Library.LibraryIdCannotBeEmpty); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Library.LibraryIdCannotBeEmpty, result.FirstError); + await _mockMusicArtworkRepository.DidNotReceive().GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkService.DidNotReceive().SaveArtistArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenLibraryDoesNotExist_ShouldReturnLibraryNotFoundError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + SetupExistingArtist(command); + _mockLibraryRepository.GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()) + .Returns(Result.From(null)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Library.LibraryNotFound, result.FirstError); + await _mockMusicArtworkService.DidNotReceive().SaveArtistArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenArtworkLookupFails_ShouldReturnFailureResultWithoutStoringArtwork() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + SetupExistingArtist(command); + SetupExistingLibrary(command); + _mockMusicArtworkRepository.GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Errors.Library.LibraryIdCannotBeEmpty); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.Library.LibraryIdCannotBeEmpty, result.FirstError); + await _mockMusicArtworkService.DidNotReceive().SaveArtistArtworkAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockMusicArtworkRepository.DidNotReceive().UpsertCoverAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenArtworkStorageFails_ShouldReturnFailureResultWithoutUpsertingOrSaving() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + SetupExistingArtist(command); + SetupExistingLibrary(command); + _mockMusicArtworkService.SaveArtistArtworkAsync( + Arg.Any(), Arg.Any(), Arg.Any(), + Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Errors.FileSystemManagement.FileTooLarge); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.FileSystemManagement.FileTooLarge, result.FirstError); + await _mockMusicArtworkRepository.DidNotReceive().UpsertCoverAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenExistingCoverPathDiffersFromStoredPath_ShouldDeletePreviousArtwork() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + SetupExistingArtist(command); + SetupExistingLibrary(command); + SetupExistingArtwork(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, artworkType: ArtworkType.Cover, fileName: "/media/music/library/artist/old-cover.jpg")); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockMusicArtworkService.Received(1).DeleteStoredArtwork("/media/music/library/artist/old-cover.jpg"); + } + + [Fact] + public async Task HandleAsync_WhenExistingCoverPathEqualsStoredPath_ShouldNotDeletePreviousArtwork() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + SetupExistingArtist(command); + SetupExistingLibrary(command); + SetupExistingArtwork(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, artworkType: ArtworkType.Cover, fileName: STORED_COVER_PATH)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockMusicArtworkService.DidNotReceive().DeleteStoredArtwork(Arg.Any()); + } + + [Theory] + [InlineData(null)] // no file name at all + [InlineData("")] // empty file name + [InlineData(" ")] // whitespace file name + public async Task HandleAsync_WhenExistingCoverPathIsEmpty_ShouldNotDeletePreviousArtwork(string? existingCoverPath) + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + SetupExistingArtist(command); + SetupExistingLibrary(command); + SetupExistingArtwork(_musicArtworkEntityFixture.Create( + ownerType: MusicArtworkOwnerType.Artist, artworkType: ArtworkType.Cover, fileName: existingCoverPath, includeFileName: existingCoverPath is not null)); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + _mockMusicArtworkService.DidNotReceive().DeleteStoredArtwork(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenDeletingPreviousArtworkFails_ShouldReturnFailureResultWithoutUpsertingOrSaving() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + SetupExistingArtist(command); + SetupExistingLibrary(command); + SetupExistingArtwork(_musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, artworkType: ArtworkType.Cover, fileName: "/media/music/library/artist/old-cover.jpg")); + _mockMusicArtworkService.DeleteStoredArtwork(Arg.Any()).Returns(Errors.FileSystemManagement.FileTooLarge); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(Errors.FileSystemManagement.FileTooLarge, result.FirstError); + await _mockMusicArtworkRepository.DidNotReceive().UpsertCoverAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenUpsertCoverFails_ShouldReturnFailureResultWithoutSaving() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + SetupExistingArtist(command); + SetupExistingLibrary(command); + _mockMusicArtworkRepository.UpsertCoverAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenSaveChangesFails_ShouldReturnFailureResult() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + SetupExistingArtist(command); + SetupExistingLibrary(command); + _mockUnitOfWork.SaveChangesAsync(Arg.Any()) + .Returns(ApplicationErrors.Persistence.UniqueConstraintViolation); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.True(result.IsFailure); + Assert.Equal(ApplicationErrors.Persistence.UniqueConstraintViolation, result.FirstError); + await _mockMusicArtworkRepository.Received(1).UpsertCoverAsync( + MusicArtworkOwnerType.Artist, Guid.Parse(command.ArtistId!), STORED_COVER_PATH, Arg.Any()); + await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any()); + } + + [Fact] + public async Task HandleAsync_WhenSuccessful_ShouldReturnUpdateArtistCoverResponseAndStoreArtwork() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + ArtistEntity existingArtist = SetupExistingArtist(command); + LibraryEntity library = SetupExistingLibrary(command); + + // Act + Result result = await _sut.HandleAsync(command, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + UpdateArtistCoverResponse response = Assert.IsType(result.Value); + Assert.Equal(STORED_COVER_PATH, response.CoverPath); + await _mockMusicArtworkService.Received(1).SaveArtistArtworkAsync( + existingArtist.LibraryId, + library.Title, + existingArtist.Name, + Arg.Any(), + command.FileName!, + Arg.Any()); + await _mockMusicArtworkRepository.Received(1).UpsertCoverAsync( + MusicArtworkOwnerType.Artist, + existingArtist.Id, + STORED_COVER_PATH, + Arg.Any()); + await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any()); + } + + /// + /// Sets up a stored artist that matches the library and artist identifiers of the command. + /// + /// The command whose route identifiers the stored artist must match. + /// The created . + private ArtistEntity SetupExistingArtist(UpdateArtistCoverCommand command) + { + ArtistEntity existingArtist = _artistEntityFixture.Create( + id: Guid.Parse(command.ArtistId!), + libraryId: Guid.Parse(command.LibraryId!)); + _mockArtistRepository.GetByIdAsync(Arg.Any(), shouldTrackEntities: false, cancellationToken: Arg.Any()) + .Returns(Result.From(existingArtist)); + return existingArtist; + } + + /// + /// Sets up a stored media library that matches the library of the command. + /// + /// The command whose library identifier the stored library must match. + /// The created . + private LibraryEntity SetupExistingLibrary(UpdateArtistCoverCommand command) + { + LibraryEntity library = _libraryEntityFixture.Create(id: Guid.Parse(command.LibraryId!)); + _mockLibraryRepository.GetByIdAsync(Arg.Any(), cancellationToken: Arg.Any()) + .Returns(Result.From(library)); + return library; + } + + /// + /// Sets up the artwork owned by the artist. + /// + /// The pieces of artwork owned by the artist. + private void SetupExistingArtwork(params MusicArtworkEntity[] artworks) + { + _mockMusicArtworkRepository.GetByOwnerAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From>(artworks)); + } +} diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandValidatorTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandValidatorTests.cs new file mode 100644 index 00000000..f01475fe --- /dev/null +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/MediaLibrary/AudioLibrary/MusicLibrary/Artists/Commands/UpdateArtistCover/UpdateArtistCoverCommandValidatorTests.cs @@ -0,0 +1,217 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; +using Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; +using Lumina.Application.UnitTests.Common.Setup; +using Lumina.Domain.Common.Errors; +using Lumina.Domain.Common.Primitives; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Application.UnitTests.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverCommandValidatorTests +{ + private readonly UpdateArtistCoverCommandFixture _updateArtistCoverCommandFixture = new(); + private readonly UpdateArtistCoverCommandValidator _validator = new(); + + [Fact] + public void Validate_WhenCommandIsValid_ShouldNotHaveValidationErrors() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(); + + // Act + List result = _validator.TestValidate(command); + + // Assert + Assert.Empty(result); + } + + [Fact] + public void Validate_WhenLibraryIdIsNull_ShouldHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(includeLibraryId: false); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenLibraryIdIsEmpty_ShouldHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(libraryId: Guid.Empty.ToString()); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenLibraryIdIsWhitespace_ShouldHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(libraryId: " "); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenLibraryIdIsNotAGuid_ShouldHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(libraryId: "not-a-guid"); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenLibraryIdIsValid_ShouldNotHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(libraryId: Guid.NewGuid().ToString()); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldNotHaveValidationError(Errors.Library.LibraryIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenArtistIdIsNull_ShouldHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(includeArtistId: false); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.ArtistIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenArtistIdIsEmpty_ShouldHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(artistId: Guid.Empty.ToString()); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.ArtistIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenArtistIdIsWhitespace_ShouldHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(artistId: " "); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.ArtistIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenArtistIdIsNotAGuid_ShouldHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(artistId: "not-a-guid"); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.ArtistIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenArtistIdIsValid_ShouldNotHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(artistId: Guid.NewGuid().ToString()); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldNotHaveValidationError(Errors.Music.ArtistIdCannotBeEmpty); + } + + [Fact] + public void Validate_WhenCoverIsNull_ShouldHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(includeCover: false); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.Music.CoverCannotBeNull); + } + + [Fact] + public void Validate_WhenCoverIsPresentAndFileNameIsEmpty_ShouldHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(fileName: string.Empty); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.FileSystemManagement.FileNameCannotBeEmpty); + } + + [Fact] + public void Validate_WhenCoverIsPresentAndFileNameIsNull_ShouldHaveValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(includeFileName: false); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldHaveValidationError(Errors.FileSystemManagement.FileNameCannotBeEmpty); + } + + [Fact] + public void Validate_WhenCoverIsMissingAndFileNameIsEmpty_ShouldNotHaveFileNameValidationError() + { + // Arrange + UpdateArtistCoverCommand command = _updateArtistCoverCommandFixture.Create(fileName: string.Empty, includeCover: false); + + // Act + List result = _validator.TestValidate(command); + + // Assert + result.ShouldNotHaveValidationError(Errors.FileSystemManagement.FileNameCannotBeEmpty); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs new file mode 100644 index 00000000..14c22b42 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs @@ -0,0 +1,340 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Albums.Commands.UpdateAlbumCover; +using Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums; +using Lumina.Domain.Common.Errors; +using Lumina.Domain.Common.Primitives; +using Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Http.HttpResults; +using Microsoft.AspNetCore.Mvc; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Api.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverEndpointTests +{ + private readonly ICommandHandler> _mockHandler; + private readonly UpdateAlbumCoverEndpoint _sut; + private readonly UpdateAlbumCoverResponseFixture _updateAlbumCoverResponseFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public UpdateAlbumCoverEndpointTests() + { + _mockHandler = Substitute.For>>(); + _sut = FastEndpoints.Factory.Create(_mockHandler); + } + + [Fact] + public async Task ExecuteAsync_WhenSuccessful_ShouldReturnOkResultWithCoverPath() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + string expectedPath = "/media/music/cover.jpg"; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateAlbumCoverResponseFixture.Create(coverPath: expectedPath))); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.RouteValues["albumId"] = albumId.ToString(); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + Ok okResult = Assert.IsType>(result); + Assert.Equal(expectedPath, okResult?.Value?.CoverPath); + } + + [Fact] + public async Task ExecuteAsync_WhenCalledWithValidRouteIdsAndFile_ShouldSendUpdateAlbumCoverCommandToSender() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateAlbumCoverResponseFixture.Create(coverPath: "/media/music/cover.jpg"))); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.RouteValues["albumId"] = albumId.ToString(); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => + command.LibraryId == libraryId.ToString() && + command.ArtistId == artistId.ToString() && + command.AlbumId == albumId.ToString() && + command.Cover != null && + command.FileName == "cover.jpg"), + Arg.Is(cancellationToken)); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteValuesAreNotParseable_ShouldSendCommandWithRawRouteValues() + { + // Arrange + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateAlbumCoverResponseFixture.Create(coverPath: "/media/music/cover.jpg"))); + _sut.HttpContext.Request.RouteValues["libraryId"] = "not-a-library-guid"; + _sut.HttpContext.Request.RouteValues["artistId"] = "not-an-artist-guid"; + _sut.HttpContext.Request.RouteValues["albumId"] = "not-an-album-guid"; + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => + command.LibraryId == "not-a-library-guid" && + command.ArtistId == "not-an-artist-guid" && + command.AlbumId == "not-an-album-guid"), + Arg.Is(cancellationToken)); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteValuesAreMissing_ShouldSendCommandWithNullIds() + { + // Arrange + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateAlbumCoverResponseFixture.Create(coverPath: "/media/music/cover.jpg"))); + _sut.HttpContext.Request.RouteValues.Remove("libraryId"); + _sut.HttpContext.Request.RouteValues.Remove("artistId"); + _sut.HttpContext.Request.RouteValues.Remove("albumId"); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => + command.LibraryId == null && + command.ArtistId == null && + command.AlbumId == null), + Arg.Is(cancellationToken)); + } + + [Fact] + public async Task ExecuteAsync_WhenFormHasNoFiles_ShouldSendCommandWithNullCover() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateAlbumCoverResponseFixture.Create(coverPath: "/media/music/cover.jpg"))); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.RouteValues["albumId"] = albumId.ToString(); + IFormCollection form = new FormCollection([]); + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + _sut.HttpContext.Features.Set(new FormFeature(form)); + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + Assert.IsType>(result); + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => + command.AlbumId == albumId.ToString() && + command.Cover == null && + command.FileName == null), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRequestIsNotMultipart_ShouldSendCommandWithNullCover() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateAlbumCoverResponseFixture.Create(coverPath: "/media/music/cover.jpg"))); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.RouteValues["albumId"] = albumId.ToString(); + _sut.HttpContext.Request.ContentType = "application/json"; + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + Assert.IsType>(result); + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => command.Cover == null && command.FileName == null), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenTheFormIsMalformed_ShouldSendCommandWithNullCover() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateAlbumCoverResponseFixture.Create(coverPath: "/media/music/cover.jpg"))); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.RouteValues["albumId"] = albumId.ToString(); + ConfigureMalformedForm(); + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + Assert.IsType>(result); + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => command.Cover == null && command.FileName == null), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenHandlerReturnsValidationErrors_ShouldReturnValidationProblemResult() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + Error validationError = Errors.Music.CoverCannotBeNull; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(validationError); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.RouteValues["albumId"] = albumId.ToString(); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + ProblemHttpResult problemDetails = Assert.IsType(result); + Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails.StatusCode); + Assert.Equal("application/problem+json", problemDetails.ContentType); + HttpValidationProblemDetails validationProblemDetails = Assert.IsType(problemDetails.ProblemDetails); + Assert.Equal(StatusCodes.Status422UnprocessableEntity, validationProblemDetails.Status); + Assert.Equal("General.Validation", validationProblemDetails.Title); + Assert.Equal("OneOrMoreValidationErrorsOccurred", validationProblemDetails.Detail); + Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", validationProblemDetails.Type); + Assert.Single(validationProblemDetails.Errors); + Assert.Equal(new[] { "CoverCannotBeNull" }, validationProblemDetails.Errors["General.Validation"]); + } + + [Fact] + public async Task ExecuteAsync_WhenHandlerReturnsNotFoundError_ShouldReturnProblemResult() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + Error expectedError = Errors.Music.AlbumNotFound; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(expectedError); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.RouteValues["albumId"] = albumId.ToString(); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + ProblemHttpResult problemDetails = Assert.IsType(result); + Assert.Equal(StatusCodes.Status404NotFound, problemDetails.StatusCode); + Assert.Equal("application/problem+json", problemDetails.ContentType); + ProblemDetails problemDetailsBody = Assert.IsType(problemDetails.ProblemDetails); + Assert.Equal(StatusCodes.Status404NotFound, problemDetailsBody.Status); + Assert.Equal("General.NotFound", problemDetailsBody.Title); + Assert.Equal("AlbumNotFound", problemDetailsBody.Detail); + Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.5", problemDetailsBody.Type); + Assert.NotNull(problemDetailsBody.Extensions["traceId"]); + } + + [Fact] + public async Task ExecuteAsync_WhenCancellationRequested_ShouldCancelOperation() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + CancellationTokenSource cts = new(); + TaskCompletionSource operationStarted = new(); + TaskCompletionSource cancellationRequested = new(); + + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(callInfo => Task.Run(async () => + { + operationStarted.SetResult(true); + await cancellationRequested.Task; + callInfo.Arg().ThrowIfCancellationRequested(); + return Result.From(_updateAlbumCoverResponseFixture.Create(coverPath: "/media/music/cover.jpg")); + }, callInfo.Arg())); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.RouteValues["albumId"] = albumId.ToString(); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + Task operationTask = _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cts.Token); + await operationStarted.Task; + cts.Cancel(); + cancellationRequested.SetResult(true); + + // Assert + await Assert.ThrowsAnyAsync(() => operationTask); + } + + private void ConfigureForm(byte[] content, string fileName) + { + MemoryStream coverStream = new(content); + IFormFile formFile = new FormFile(coverStream, 0, content.Length, "cover", fileName); + FormFileCollection files = [formFile]; + IFormCollection form = new FormCollection([], files); + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + _sut.HttpContext.Features.Set(new FormFeature(form)); + } + + /// + /// Configures a multipart form request whose body cannot be parsed. + /// + private void ConfigureMalformedForm() + { + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + IFormCollection malformedForm = Substitute.For(); + malformedForm.Files.Returns(_ => throw new InvalidDataException("Malformed multipart body.")); + _sut.HttpContext.Features.Set(new FormFeature(malformedForm)); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs new file mode 100644 index 00000000..0d5bc840 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Api.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs @@ -0,0 +1,319 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Artists.Commands.UpdateArtistCover; +using Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists; +using Lumina.Domain.Common.Errors; +using Lumina.Domain.Common.Primitives; +using Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Http.HttpResults; +using Microsoft.AspNetCore.Mvc; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Api.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverEndpointTests +{ + private readonly ICommandHandler> _mockHandler; + private readonly UpdateArtistCoverEndpoint _sut; + private readonly UpdateArtistCoverResponseFixture _updateArtistCoverResponseFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public UpdateArtistCoverEndpointTests() + { + _mockHandler = Substitute.For>>(); + _sut = FastEndpoints.Factory.Create(_mockHandler); + } + + [Fact] + public async Task ExecuteAsync_WhenSuccessful_ShouldReturnOkResultWithCoverPath() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + string expectedPath = "/media/music/artist-cover.jpg"; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateArtistCoverResponseFixture.Create(coverPath: expectedPath))); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + Ok okResult = Assert.IsType>(result); + Assert.Equal(expectedPath, okResult?.Value?.CoverPath); + } + + [Fact] + public async Task ExecuteAsync_WhenCalledWithValidRouteIdsAndFile_ShouldSendUpdateArtistCoverCommandToSender() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateArtistCoverResponseFixture.Create(coverPath: "/media/music/artist-cover.jpg"))); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => + command.LibraryId == libraryId.ToString() && + command.ArtistId == artistId.ToString() && + command.Cover != null && + command.FileName == "cover.jpg"), + Arg.Is(cancellationToken)); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteValuesAreNotParseable_ShouldSendCommandWithRawRouteValues() + { + // Arrange + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateArtistCoverResponseFixture.Create(coverPath: "/media/music/artist-cover.jpg"))); + _sut.HttpContext.Request.RouteValues["libraryId"] = "not-a-library-guid"; + _sut.HttpContext.Request.RouteValues["artistId"] = "not-an-artist-guid"; + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => + command.LibraryId == "not-a-library-guid" && + command.ArtistId == "not-an-artist-guid"), + Arg.Is(cancellationToken)); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteValuesAreMissing_ShouldSendCommandWithNullIds() + { + // Arrange + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateArtistCoverResponseFixture.Create(coverPath: "/media/music/artist-cover.jpg"))); + _sut.HttpContext.Request.RouteValues.Remove("libraryId"); + _sut.HttpContext.Request.RouteValues.Remove("artistId"); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => + command.LibraryId == null && + command.ArtistId == null), + Arg.Is(cancellationToken)); + } + + [Fact] + public async Task ExecuteAsync_WhenFormHasNoFiles_ShouldSendCommandWithNullCover() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateArtistCoverResponseFixture.Create(coverPath: "/media/music/artist-cover.jpg"))); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + IFormCollection form = new FormCollection([]); + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + _sut.HttpContext.Features.Set(new FormFeature(form)); + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + Assert.IsType>(result); + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => + command.ArtistId == artistId.ToString() && + command.Cover == null && + command.FileName == null), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRequestIsNotMultipart_ShouldSendCommandWithNullCover() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateArtistCoverResponseFixture.Create(coverPath: "/media/music/artist-cover.jpg"))); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.ContentType = "application/json"; + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + Assert.IsType>(result); + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => command.Cover == null && command.FileName == null), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenTheFormIsMalformed_ShouldSendCommandWithNullCover() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(Result.From(_updateArtistCoverResponseFixture.Create(coverPath: "/media/music/artist-cover.jpg"))); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + ConfigureMalformedForm(); + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + Assert.IsType>(result); + await _mockHandler.Received(1).HandleAsync( + Arg.Is(command => command.Cover == null && command.FileName == null), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenHandlerReturnsValidationErrors_ShouldReturnValidationProblemResult() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + Error validationError = Errors.Music.CoverCannotBeNull; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(validationError); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + ProblemHttpResult problemDetails = Assert.IsType(result); + Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails.StatusCode); + Assert.Equal("application/problem+json", problemDetails.ContentType); + HttpValidationProblemDetails validationProblemDetails = Assert.IsType(problemDetails.ProblemDetails); + Assert.Equal(StatusCodes.Status422UnprocessableEntity, validationProblemDetails.Status); + Assert.Equal("General.Validation", validationProblemDetails.Title); + Assert.Equal("OneOrMoreValidationErrorsOccurred", validationProblemDetails.Detail); + Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", validationProblemDetails.Type); + Assert.Single(validationProblemDetails.Errors); + Assert.Equal(new[] { "CoverCannotBeNull" }, validationProblemDetails.Errors["General.Validation"]); + } + + [Fact] + public async Task ExecuteAsync_WhenHandlerReturnsNotFoundError_ShouldReturnProblemResult() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + CancellationToken cancellationToken = CancellationToken.None; + Error expectedError = Errors.Music.ArtistNotFound; + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(expectedError); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + IResult result = await _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cancellationToken); + + // Assert + ProblemHttpResult problemDetails = Assert.IsType(result); + Assert.Equal(StatusCodes.Status404NotFound, problemDetails.StatusCode); + Assert.Equal("application/problem+json", problemDetails.ContentType); + ProblemDetails problemDetailsBody = Assert.IsType(problemDetails.ProblemDetails); + Assert.Equal(StatusCodes.Status404NotFound, problemDetailsBody.Status); + Assert.Equal("General.NotFound", problemDetailsBody.Title); + Assert.Equal("ArtistNotFound", problemDetailsBody.Detail); + Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.5", problemDetailsBody.Type); + Assert.NotNull(problemDetailsBody.Extensions["traceId"]); + } + + [Fact] + public async Task ExecuteAsync_WhenCancellationRequested_ShouldCancelOperation() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + CancellationTokenSource cts = new(); + TaskCompletionSource operationStarted = new(); + TaskCompletionSource cancellationRequested = new(); + + _mockHandler.HandleAsync(Arg.Any(), Arg.Any()) + .Returns(callInfo => Task.Run(async () => + { + operationStarted.SetResult(true); + await cancellationRequested.Task; + callInfo.Arg().ThrowIfCancellationRequested(); + return Result.From(_updateArtistCoverResponseFixture.Create(coverPath: "/media/music/artist-cover.jpg")); + }, callInfo.Arg())); + _sut.HttpContext.Request.RouteValues["libraryId"] = libraryId.ToString(); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + ConfigureForm([1, 2, 3], "cover.jpg"); + + // Act + Task operationTask = _sut.ExecuteAsync(FastEndpoints.EmptyRequest.Instance, cts.Token); + await operationStarted.Task; + cts.Cancel(); + cancellationRequested.SetResult(true); + + // Assert + await Assert.ThrowsAnyAsync(() => operationTask); + } + + private void ConfigureForm(byte[] content, string fileName) + { + MemoryStream coverStream = new(content); + IFormFile formFile = new FormFile(coverStream, 0, content.Length, "cover", fileName); + FormFileCollection files = [formFile]; + IFormCollection form = new FormCollection([], files); + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + _sut.HttpContext.Features.Set(new FormFeature(form)); + } + + /// + /// Configures a multipart form request whose body cannot be parsed. + /// + private void ConfigureMalformedForm() + { + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + IFormCollection malformedForm = Substitute.For(); + malformedForm.Files.Returns(_ => throw new InvalidDataException("Malformed multipart body.")); + _sut.HttpContext.Features.Set(new FormFeature(malformedForm)); + } +} From 27c6c40b39ab56b0aca255947abf0a6df84e4716 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:26:51 +0300 Subject: [PATCH 09/19] Persists the disambiguation comment of music tracks. --- .../Artists/UpdateArtistCommandMapping.cs | 1 + .../Tracks/AudioMetadataDtoMapping.cs | 30 ++++++++++-- .../Tracks/UpdateTrackCommandMapping.cs | 1 + .../MusicLibraryAggregate/Artist.cs | 3 ++ .../MusicLibraryAggregate/Entities/Track.cs | 3 ++ .../UpdateArtistCommandMappingTests.cs | 27 +++++++++++ .../Tracks/AudioMetadataDtoMappingTests.cs | 41 ++++++++++++++++- .../Tracks/UpdateTrackCommandMappingTests.cs | 46 +++++++++++++++++++ .../MusicLibraryAggregate/ArtistTests.cs | 5 ++ .../Entities/TrackTests.cs | 5 ++ 10 files changed, 155 insertions(+), 7 deletions(-) diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMapping.cs index 8b877823..076e5672 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMapping.cs @@ -160,6 +160,7 @@ public static class UpdateArtistCommandMapping existingTrack, domainTrack.Path, domainTrack.Metadata, + domainTrack.Disambiguation, domainTrack.TrackNumber, domainTrack.DiscNumber, domainTrack.Script, diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMapping.cs index c8c6da37..76393ef8 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMapping.cs @@ -94,6 +94,9 @@ public static class AudioMetadataDtoMapping Optional bpm = Optional.FromNullable(dto.Bpm); if (!bpm.HasValue) bpm = track.Bpm; + Optional disambiguation = Optional.FromNullable(dto.Disambiguation); + if (!disambiguation.HasValue) + disambiguation = track.Disambiguation; Optional musicBrainzRecordingId = Optional.None(); if (dto.MusicBrainzRecordingId is not null) musicBrainzRecordingId = MusicBrainzId.Create(dto.MusicBrainzRecordingId.Value); @@ -110,6 +113,7 @@ public static class AudioMetadataDtoMapping track, track.Path, metadataResult.Value, + disambiguation, track.TrackNumber, track.DiscNumber, script, @@ -187,21 +191,37 @@ public static class AudioMetadataDtoMapping if (dto.OriginalLanguage is not null && dto.OriginalLanguage.LanguageCode is not null && dto.OriginalLanguage.LanguageName is not null) originalLanguage = LanguageInfo.Create(dto.OriginalLanguage.LanguageCode, dto.OriginalLanguage.LanguageName, Optional.FromNullable(dto.OriginalLanguage.NativeName)); + Optional originalTitle = Optional.FromNullable(dto.OriginalTitle); + if (!originalTitle.HasValue) + originalTitle = track.Metadata.OriginalTitle; + Optional description = Optional.FromNullable(dto.Description); + if (!description.HasValue) + description = track.Metadata.Description; + Optional bitDepth = Optional.FromNullable(dto.BitDepth); + if (!bitDepth.HasValue) + bitDepth = track.Metadata.BitDepth; + Optional audioCodec = Optional.FromNullable(dto.AudioCodec); + if (!audioCodec.HasValue) + audioCodec = track.Metadata.AudioCodec; + Optional bitrate = Optional.FromNullable(dto.Bitrate); + if (!bitrate.HasValue) + bitrate = track.Metadata.Bitrate; + return AudioMetadata.Create( string.IsNullOrWhiteSpace(dto.Title) ? track.Metadata.Title : dto.Title, - Optional.FromNullable(dto.OriginalTitle).HasValue ? Optional.FromNullable(dto.OriginalTitle) : track.Metadata.OriginalTitle, + originalTitle, dto.DurationInSeconds is > 0 ? dto.DurationInSeconds.Value : track.Metadata.DurationInSeconds, dto.SampleRate is > 0 ? dto.SampleRate.Value : track.Metadata.SampleRate, dto.Channels is > 0 ? dto.Channels.Value : track.Metadata.Channels, releaseInfoResult.Value, - Optional.FromNullable(dto.Description).HasValue ? Optional.FromNullable(dto.Description) : track.Metadata.Description, + description, genres, tags, language, originalLanguage, - Optional.FromNullable(dto.BitDepth).HasValue ? Optional.FromNullable(dto.BitDepth) : track.Metadata.BitDepth, - Optional.FromNullable(dto.AudioCodec).HasValue ? Optional.FromNullable(dto.AudioCodec) : track.Metadata.AudioCodec, - Optional.FromNullable(dto.Bitrate).HasValue ? Optional.FromNullable(dto.Bitrate) : track.Metadata.Bitrate, + bitDepth, + audioCodec, + bitrate, track.Metadata.AcoustId, track.Metadata.ReplayGainTrackGain, track.Metadata.ReplayGainTrackPeak, diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMapping.cs index 143a6ba9..c7ff1519 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMapping.cs @@ -87,6 +87,7 @@ public static class UpdateTrackCommandMapping track, command.Path!, metadataResult.Value, + Optional.FromNullable(metadata.Disambiguation), command.TrackNumber!.Value, Optional.FromNullable(command.DiscNumber), Optional.FromNullable(command.Script), diff --git a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Artist.cs b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Artist.cs index 62baa2ee..5a5043f2 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Artist.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Artist.cs @@ -644,6 +644,7 @@ public sealed class Artist : AggregateRoot /// The track to update. /// The file system path of the track. /// The audio metadata of the track. + /// The optional disambiguation comment of the track. /// The number of the track on its disc. /// The optional number of the disc the track belongs to. /// The optional script used by the language of the track. @@ -663,6 +664,7 @@ public sealed class Artist : AggregateRoot Track track, string path, AudioMetadata metadata, + Optional disambiguation, int trackNumber, Optional discNumber, Optional script, @@ -686,6 +688,7 @@ public sealed class Artist : AggregateRoot track.UpdateDetails( path, metadata, + disambiguation, trackNumber, discNumber, script, diff --git a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs index 09c42e2c..0f3842a4 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/Track.cs @@ -347,6 +347,7 @@ public sealed class Track : Entity /// /// The file system path of the track. /// The audio metadata of the track. + /// The optional disambiguation comment of the track. /// The number of the track on its disc. /// The optional number of the disc the track belongs to. /// The optional script used by the language of the track. @@ -360,6 +361,7 @@ public sealed class Track : Entity internal Result UpdateDetails( string path, AudioMetadata metadata, + Optional disambiguation, int trackNumber, Optional discNumber, Optional script, @@ -372,6 +374,7 @@ public sealed class Track : Entity { Path = path; Metadata = metadata; + Disambiguation = disambiguation; TrackNumber = trackNumber; DiscNumber = discNumber; Script = script; diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMappingTests.cs index a963e40a..4d78854a 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistCommandMappingTests.cs @@ -35,6 +35,7 @@ public class UpdateArtistCommandMappingTests private readonly TrackEntityFixture _trackEntityFixture = new(); private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new(); private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new(); + private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new(); private readonly GenreDtoFixture _genreDtoFixture = new(); [Fact] @@ -254,6 +255,32 @@ public class UpdateArtistCommandMappingTests Assert.Empty(updatedAlbum.Tracks); } + [Fact] + public void ToDomainEntity_WhenTrackHasDisambiguation_ShouldMapTheDisambiguationThrough() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + (Artist artist, Guid albumId, Guid trackId) = CreateDomainArtist(libraryId); + string disambiguation = "live at Wembley"; + AddTrackCommand trackCommand = _addTrackCommandFixture.Create( + trackId: trackId, + metadata: _musicTrackMetadataDtoFixture.Create(disambiguation: disambiguation)); + AddAlbumCommand albumCommand = _addAlbumCommandFixture.Create(albumId: albumId, tracks: [trackCommand]); + UpdateArtistCommand command = _updateArtistCommandFixture.Create( + libraryId: libraryId.ToString(), + artistId: artist.Id.Value.ToString(), + albums: [albumCommand]); + + // Act + Result result = command.ToDomainEntity(artist); + + // Assert + Assert.False(result.IsFailure); + Track updatedTrack = result.Value.Albums.First(album => album.Id.Value == albumId).Tracks.First(track => track.Id.Value == trackId); + Assert.True(updatedTrack.Disambiguation.HasValue); + Assert.Equal(disambiguation, updatedTrack.Disambiguation.Value); + } + /// /// Creates a domain artist that owns a single album, which in turn owns a single track, all belonging to . /// diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMappingTests.cs index a0f88af7..bebae835 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AudioMetadataDtoMappingTests.cs @@ -119,18 +119,55 @@ public class AudioMetadataDtoMappingTests Assert.Equal(Errors.Music.TrackNotFound, result.FirstError); } + [Fact] + public void ApplyTo_WhenDtoHasDisambiguation_ShouldUseTheDtoDisambiguation() + { + // Arrange + (Artist artist, Album album, Track track) = CreateDomainArtist(); + string disambiguation = "album version"; + AudioMetadataDto dto = _audioMetadataDtoFixture.Create(disambiguation: disambiguation); + + // Act + Result result = dto.ApplyTo(artist, album, track, []); + + // Assert + Assert.False(result.IsFailure); + Assert.True(track.Disambiguation.HasValue); + Assert.Equal(disambiguation, track.Disambiguation.Value); + } + + [Fact] + public void ApplyTo_WhenDtoHasNoDisambiguation_ShouldKeepTheTrackDisambiguation() + { + // Arrange + string trackDisambiguation = "single version"; + (Artist artist, Album album, Track track) = CreateDomainArtist(trackDisambiguation); + AudioMetadataDto dto = _audioMetadataDtoFixture.Create(includeDisambiguation: false); + + // Act + Result result = dto.ApplyTo(artist, album, track, []); + + // Assert + Assert.False(result.IsFailure); + Assert.True(track.Disambiguation.HasValue); + Assert.Equal(trackDisambiguation, track.Disambiguation.Value); + } + /// /// Creates a domain artist that owns a single album, which in turn owns a single track. /// + /// Optional. The disambiguation of the created track. /// The created domain artist, together with its album and track. - private (Artist artist, Album album, Track track) CreateDomainArtist() + private (Artist artist, Album album, Track track) CreateDomainArtist(string? trackDisambiguation = null) { Guid libraryId = Guid.NewGuid(); Guid albumId = Guid.NewGuid(); + TrackEntity trackEntity = _trackEntityFixture.Create(albumId: albumId, libraryId: libraryId); + trackEntity.Disambiguation = trackDisambiguation; AlbumEntity albumEntity = _albumEntityFixture.Create( id: albumId, libraryId: libraryId, - tracks: [_trackEntityFixture.Create(albumId: albumId, libraryId: libraryId)]); + tracks: [trackEntity]); ArtistEntity artistEntity = _artistEntityFixture.Create(libraryId: libraryId, albums: [albumEntity]); Artist artist = artistEntity.ToDomainEntity().Value; Album album = artist.Albums.First(); diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMappingTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMappingTests.cs index 8146c73d..f43c1870 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMappingTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Common/Mapping/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackCommandMappingTests.cs @@ -238,6 +238,52 @@ public class UpdateTrackCommandMappingTests Assert.Equal(Errors.Music.TrackNotFound, result.FirstError); } + [Fact] + public void ToDomainEntity_WhenMetadataHasDisambiguation_ShouldMapTheDisambiguationThrough() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + (Artist artist, Guid albumId, Guid trackId) = CreateDomainArtist(libraryId); + string disambiguation = "2011 remaster"; + UpdateTrackCommand command = _updateTrackCommandFixture.Create( + libraryId: libraryId.ToString(), + artistId: artist.Id.Value.ToString(), + albumId: albumId.ToString(), + trackId: trackId.ToString(), + metadata: _musicTrackMetadataDtoFixture.Create(disambiguation: disambiguation)); + + // Act + Result result = command.ToDomainEntity(artist); + + // Assert + Assert.False(result.IsFailure); + Track updatedTrack = result.Value.Albums.First(album => album.Id.Value == albumId).Tracks.First(track => track.Id.Value == trackId); + Assert.True(updatedTrack.Disambiguation.HasValue); + Assert.Equal(disambiguation, updatedTrack.Disambiguation.Value); + } + + [Fact] + public void ToDomainEntity_WhenMetadataHasNoDisambiguation_ShouldClearTheDisambiguation() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + (Artist artist, Guid albumId, Guid trackId) = CreateDomainArtist(libraryId); + UpdateTrackCommand command = _updateTrackCommandFixture.Create( + libraryId: libraryId.ToString(), + artistId: artist.Id.Value.ToString(), + albumId: albumId.ToString(), + trackId: trackId.ToString(), + metadata: _musicTrackMetadataDtoFixture.Create(includeDisambiguation: false)); + + // Act + Result result = command.ToDomainEntity(artist); + + // Assert + Assert.False(result.IsFailure); + Track updatedTrack = result.Value.Albums.First(album => album.Id.Value == albumId).Tracks.First(track => track.Id.Value == trackId); + Assert.False(updatedTrack.Disambiguation.HasValue); + } + /// /// Creates a domain artist that owns a single album, which in turn owns a single track, all belonging to . /// diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ArtistTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ArtistTests.cs index bb4608fd..7b557286 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ArtistTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/ArtistTests.cs @@ -663,6 +663,7 @@ public class ArtistTests Artist artist = _artistFixture.Create(albums: [album]); string path = "C:\\Music\\queen\\bohemian-rhapsody.flac"; AudioMetadata metadata = _audioMetadataFixture.Create(); + Optional disambiguation = Optional.Some("remastered"); Optional discNumber = Optional.Some(1); Optional script = Optional.Some("Latin"); Optional key = Optional.Some(MusicKey.BMajor); @@ -682,6 +683,7 @@ public class ArtistTests track, path, metadata, + disambiguation, 11, discNumber, script, @@ -700,6 +702,7 @@ public class ArtistTests Assert.False(result.IsFailure); Assert.Equal(path, track.Path); Assert.Equal(metadata, track.Metadata); + Assert.Equal(disambiguation, track.Disambiguation); Assert.Equal(11, track.TrackNumber); Assert.Equal(discNumber, track.DiscNumber); Assert.Equal(script, track.Script); @@ -734,6 +737,7 @@ public class ArtistTests track, "C:\\Music\\queen\\bohemian-rhapsody.flac", _audioMetadataFixture.Create(), + Optional.None(), 11, Optional.None(), Optional.None(), @@ -771,6 +775,7 @@ public class ArtistTests track, "C:\\Music\\queen\\bohemian-rhapsody.flac", _audioMetadataFixture.Create(), + Optional.None(), 11, Optional.None(), Optional.None(), diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/TrackTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/TrackTests.cs index 86fec38c..a9413b05 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/TrackTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/AudioLibraryBoundedContext/MusicLibraryAggregate/Entities/TrackTests.cs @@ -193,6 +193,7 @@ public class TrackTests List originalMoods = [.. track.Moods]; string path = "C:\\Music\\queen\\bohemian-rhapsody.flac"; AudioMetadata metadata = _audioMetadataFixture.Create(); + Optional disambiguation = Optional.Some("remastered"); Optional discNumber = Optional.Some(2); Optional script = Optional.Some("Latin"); Optional key = Optional.Some(MusicKey.DMajor); @@ -207,6 +208,7 @@ public class TrackTests Result result = track.UpdateDetails( path, metadata, + disambiguation, 7, discNumber, script, @@ -221,6 +223,7 @@ public class TrackTests Assert.False(result.IsFailure); Assert.Equal(path, track.Path); Assert.Equal(metadata, track.Metadata); + Assert.Equal(disambiguation, track.Disambiguation); Assert.Equal(7, track.TrackNumber); Assert.Equal(discNumber, track.DiscNumber); Assert.Equal(script, track.Script); @@ -375,6 +378,7 @@ public class TrackTests Result result = track.UpdateDetails( "C:\\Music\\queen\\bohemian-rhapsody.flac", _audioMetadataFixture.Create(), + Optional.None(), 11, Optional.None(), Optional.None(), @@ -388,6 +392,7 @@ public class TrackTests // Assert Assert.False(result.IsFailure); Assert.False(track.DiscNumber.HasValue); + Assert.False(track.Disambiguation.HasValue); Assert.False(track.Script.HasValue); Assert.False(track.Key.HasValue); Assert.False(track.Bpm.HasValue); From 443f4612f84a95f4ed7dedf1753f9439b840c33e Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:27:02 +0300 Subject: [PATCH 10/19] Fixes the release type detection of the music library path structure. --- .../Audio/Music/MusicLibraryPathStructure.cs | 19 +++++++--- .../MusicMediaLibraryScanArtworkEnricher.cs | 2 +- .../Music/MusicLibraryPathStructureTests.cs | 35 +++++++++++++++++++ 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructure.cs b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructure.cs index 714a60f4..da99d9f6 100644 --- a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructure.cs +++ b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructure.cs @@ -52,12 +52,14 @@ internal sealed class MusicLibraryPathStructure /// /// Gets the name of the on-disk release type directory of the track stored at , when the structure of the library - /// uses one. The directory is the parent of the album directory, and it is only used when its name is a known release type, so that the artist - /// directory of a flat library is not mistaken for a release type. + /// uses one. The directory is the parent of the album directory, and it is only used when its name is a known release type and it is not the + /// directory of , because the parent of the album directory of a library that has no release type directory is + /// the artist directory, which must not be mistaken for a release type. /// /// The file system path of the track whose release type directory is retrieved. + /// The name of the artist of the track, or when it is not known. /// The name of the on-disk release type directory, or when the library does not use one. - public string? GetReleaseTypeDirectoryName(string trackPath) + public string? GetReleaseTypeDirectoryName(string trackPath, string? artistName = null) { string albumDirectory = GetAlbumDirectory(trackPath); string? releaseTypeDirectory = GetParentDirectoryPath(albumDirectory); @@ -65,7 +67,16 @@ internal sealed class MusicLibraryPathStructure return null; string releaseTypeName = GetLastSegment(releaseTypeDirectory); - return Enum.TryParse(releaseTypeName, ignoreCase: true, out MusicReleaseType _) ? releaseTypeName : null; + // A numeric directory name parses to an enumeration member that is not defined, so it is rejected explicitly, together with any other + // name that is not a known release type. + if (!Enum.TryParse(releaseTypeName, ignoreCase: true, out MusicReleaseType releaseType) || !Enum.IsDefined(releaseType)) + return null; + + // The artist directory of a library that has no release type directory is the parent of the album directory, so it is not a release type. + if (!string.IsNullOrWhiteSpace(artistName) && string.Equals(releaseTypeName, artistName, StringComparison.OrdinalIgnoreCase)) + return null; + + return releaseTypeName; } /// diff --git a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs index 1a4e4c05..8697d40d 100644 --- a/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs +++ b/src/Lumina.Infrastructure/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicMediaLibraryScanArtworkEnricher.cs @@ -370,7 +370,7 @@ internal sealed class MusicMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr // The release type directory groups the artwork of the releases of the artist that share a title, so the album, the single and the live release of the same songs do not collide. // It is read from the file system, because the structure on disk is the source of truth of the release type of an album. - string? releaseTypeName = _musicLibraryPathStructure.GetReleaseTypeDirectoryName(firstTrackPath); + string? releaseTypeName = _musicLibraryPathStructure.GetReleaseTypeDirectoryName(firstTrackPath, albumEntity.Artist?.Name); return await EnrichArtworkAsync( artworkLookup, diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructureTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructureTests.cs index 032222b0..2ac6f06a 100644 --- a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructureTests.cs +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Core/MediaLibrary/Management/Scanning/Jobs/Audio/Music/MusicLibraryPathStructureTests.cs @@ -157,4 +157,39 @@ public class MusicLibraryPathStructureTests // Assert Assert.Null(result); } + + [Theory] + [InlineData('\\', "Live")] // release type name used as the artist directory name, Windows separated path + [InlineData('/', "Live")] // release type name used as the artist directory name, Unix separated path + [InlineData('\\', "42")] // numeric artist directory name, Windows separated path + [InlineData('/', "42")] // numeric artist directory name, Unix separated path + public void GetReleaseTypeDirectoryName_WhenTheArtistDirectoryIsNamedLikeAReleaseType_ShouldReturnNull(char separator, string artistName) + { + // Arrange + _mockPathService.PathSeparator.Returns(separator); + // The library uses no release type directory, so the parent of the album directory is the artist directory. + string trackPath = string.Join(separator, "music", artistName, "a-night-at-the-opera", "bohemian-rhapsody.flac"); + + // Act + string? result = _sut.GetReleaseTypeDirectoryName(trackPath, artistName); + + // Assert + Assert.Null(result); + } + + [Theory] + [InlineData('\\')] // Windows separated path + [InlineData('/')] // Unix separated path + public void GetReleaseTypeDirectoryName_WhenAReleaseTypeDirectoryDiffersFromTheArtistDirectory_ShouldReturnIt(char separator) + { + // Arrange + _mockPathService.PathSeparator.Returns(separator); + string trackPath = string.Join(separator, "music", "Queen", "Live", "a-night-at-the-opera", "bohemian-rhapsody.flac"); + + // Act + string? result = _sut.GetReleaseTypeDirectoryName(trackPath, "Queen"); + + // Assert + Assert.Equal("Live", result); + } } From b29803ac778a5fbf89a4d17eb853d799d56c876c Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:27:10 +0300 Subject: [PATCH 11/19] Refreshes the bundled themes whose shipped version changes. --- .../Core/Themes/ThemeSynchronizer.cs | 36 +++- .../Core/Themes/Bundled/editorial-paper.zip | Bin 337270 -> 373601 bytes .../Core/Themes/Bundled/lumina-default.zip | Bin 336733 -> 373064 bytes .../Core/Themes/ThemeSynchronizerTests.cs | 160 +++++++++++++++++- 4 files changed, 185 insertions(+), 11 deletions(-) diff --git a/src/Lumina.Infrastructure/Core/Themes/ThemeSynchronizer.cs b/src/Lumina.Infrastructure/Core/Themes/ThemeSynchronizer.cs index 278e3175..3ce050ad 100644 --- a/src/Lumina.Infrastructure/Core/Themes/ThemeSynchronizer.cs +++ b/src/Lumina.Infrastructure/Core/Themes/ThemeSynchronizer.cs @@ -53,9 +53,17 @@ internal static class ThemeSynchronizer ThemeEntity? existingTheme = themes.Where(theme => theme.ThemeId == manifestResult.Value.Id).FirstOrDefault(); - // A theme that was soft deleted by the user must not be reinstalled automatically; an installed bundled theme - // whose files are present is already in sync, so only a bundled theme whose files went missing gets its files reinstalled. - if (existingTheme is not null && (existingTheme.IsDeleted || existingTheme.InstallSource != ThemeInstallSource.Bundled || themeService.HasThemePack(existingTheme.ThemeId))) + // A theme that was soft deleted by the user must not be reinstalled automatically, and a theme installed from + // another source (like an uploaded pack) is never replaced by a bundled archive. + if (existingTheme is not null && (existingTheme.IsDeleted || existingTheme.InstallSource != ThemeInstallSource.Bundled)) + continue; + + // A bundled theme that is already installed is reinstalled when its files went missing, or when the shipped + // archive carries a new version, so that content updates of the bundled themes reach the installed packs. + bool isBundledThemeOutOfDate = existingTheme is not null + && (!themeService.HasThemePack(existingTheme.ThemeId) + || !string.Equals(existingTheme.Version, manifestResult.Value.Version, StringComparison.Ordinal)); + if (existingTheme is not null && !isBundledThemeOutOfDate) continue; // Installing a bundled theme at startup is best effort: a file system failure here must never crash the host, because the default @@ -70,9 +78,20 @@ internal static class ThemeSynchronizer continue; } - // A known theme only gets its missing files reinstalled, so no new row is inserted. + // A known theme is refreshed in place, so its row is updated with the shipped version instead of a new row being inserted. if (existingTheme is not null) + { + if (!string.Equals(existingTheme.Version, manifestResult.Value.Version, StringComparison.Ordinal)) + { + existingTheme.Version = manifestResult.Value.Version; + existingTheme.UpdatedOnUtc = DateTime.UtcNow; + existingTheme.UpdatedBy = default; + Result updateResult = await unitOfWork.ThemeRepository.UpdateAsync(existingTheme, cancellationToken).ConfigureAwait(false); + if (updateResult.IsFailure) + logger.LogWarning("Failed to update the version of theme '{ThemeId}': {Error}", existingTheme.ThemeId, updateResult.FirstError.Description); + } continue; + } ThemeEntity themeEntity = new() { @@ -107,7 +126,7 @@ internal static class ThemeSynchronizer } await CleanUpMissingThemePacksAsync(themeService, unitOfWork, themes, logger, cancellationToken).ConfigureAwait(false); - await EnsureCurrentThemeExistsAsync(themeService, unitOfWork, themes, cancellationToken).ConfigureAwait(false); + await EnsureCurrentThemeExistsAsync(themeService, unitOfWork, themes, logger, cancellationToken).ConfigureAwait(false); Result saveChangesResult = await unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false); if (saveChangesResult.IsFailure) @@ -189,8 +208,9 @@ internal static class ThemeSynchronizer /// Injected service for the server-side storage and serving of theme packs. /// The unit of work for interacting with the theme repository. /// The installed themes read from the storage medium. + /// Injected logger used for logging. /// Cancellation token that can be used to stop the execution. - private static async Task EnsureCurrentThemeExistsAsync(IThemeService themeService, IUnitOfWork unitOfWork, IReadOnlyList themes, CancellationToken cancellationToken) + private static async Task EnsureCurrentThemeExistsAsync(IThemeService themeService, IUnitOfWork unitOfWork, IReadOnlyList themes, ILogger logger, CancellationToken cancellationToken) { if (themes.Any(theme => !theme.IsDeleted && theme.IsCurrent == true)) return; @@ -209,6 +229,8 @@ internal static class ThemeSynchronizer defaultTheme.IsCurrent = true; defaultTheme.UpdatedOnUtc = DateTime.UtcNow; defaultTheme.UpdatedBy = default; - await unitOfWork.ThemeRepository.UpdateAsync(defaultTheme, cancellationToken).ConfigureAwait(false); + Result updateResult = await unitOfWork.ThemeRepository.UpdateAsync(defaultTheme, cancellationToken).ConfigureAwait(false); + if (updateResult.IsFailure) + logger.LogWarning("Failed to activate theme '{ThemeId}': {Error}", defaultTheme.ThemeId, updateResult.FirstError.Description); } } diff --git a/src/Lumina.Presentation.Api/Core/Themes/Bundled/editorial-paper.zip b/src/Lumina.Presentation.Api/Core/Themes/Bundled/editorial-paper.zip index d7b349d155f5668e3c7061cc2b42a95eacce5bc5..7fd8df7e1038f8cc438c5349992a03a783b47139 100644 GIT binary patch delta 62479 zcmV)AK*YcH$`s+|76edB0|b};2L&2~2LXo%0Re{x0Ro2y0Ry)O0R(P|m!%;E5VzE< z1o;=2wE^2dcZbgo}ZUZ3@ zMf;WV4$Gx)jwL z?KYh{+nx&6Nh*&0bLNbqt}1dsmmhaYpa0ULn&PsIS?ZmP2giR66|m)R56UH_BeiQ% zG{{2IzK0%dUSv+C7Y|Etkq2ELyQ!Ui)%%x$bHVEH(=pcysoNXTbv=!UAY{*i+Ct|B zt_vP{@z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@Ru6GCv~n%s@j5!a-s3KjPm2CV-QQ;FGd{bOxyi zo!94o%Eo)pfW!4(5LY1zGt=iI)cD0)_7Xqg>j<`qLy6DC_2*vfeZ(KZqL} z=+1yr0~F~9Af)~ap6Q67P4fSRg>@tKGX$t zP5W0jmJbyI|5gM864{9GaTY+iz(P9zq3{Aki;Q+aR{>NPZ0ZjNj#HsjfM_9<2MkI7 z59y?V{}W#RQZUZr|F(ly_8-MjA(R)q+w%_*0xyc7{9yTq|4>8`q6I@^pt}hA3gq$* zSS^O)1J8;Pt0u$zFPIfWxsknrm0~C%P*IGSq5{i51u~!^>%RhQYX~l&RDy`sg6&^R zLdIh2n4fBws& z3<>Gkf5U^wS%d-6RZtc{qa6AS)KCUgRv@OjD-;3+vJnozB5e?WDh2Ws*!@HC9T31h z4MG9%RUpW^3j(NQKq&tZ4iH~~Sl9*Ke;k;C;(Pw2^gw17Vt9&`h@Q-R{%cvuhF}5Z zl~7Fm|8)ZbGZGT^|LWK0UI>!0laraV6T6d@vl*MIlheOH?f#GRaQ~`)GYY6yL&X8I wYQ%&!S0YAMya{}-gi=xbAA1-6RZj;{sfH>LKvDkKbP(_Cr$|U$s89s`KlU3Da{vGU diff --git a/src/Lumina.Presentation.Api/Core/Themes/Bundled/lumina-default.zip b/src/Lumina.Presentation.Api/Core/Themes/Bundled/lumina-default.zip index 5d6dfbf4dee9dffb49ac66a3cba76f847fdf9800..8612792029e077e82666be117bdfa6048ae99a9e 100644 GIT binary patch delta 62527 zcmV)0K+eD2#uUin7J=7=*8zps0)^KDwbum1hqvmg1PB0HYIARHb&ov@!Y~v?_k#Z+WUi5lF5Lu2M{$2PR~kstlB88A z{qN=jq>E$;=iIz^vs8?6-}Nx`fb(jwyk$+DsFLx@^<omyL%wK^dJvCT}yC6!KrqB;=GwKd9Ma{o9yb)({JQX}T%nI*>3kWcy zrT`z&5<#v|`m`H+P*&n2`e1Z^m;RT?-%!k~)mrW1`2tW&0|XQR000O8uY^lozIf77 z2nqlIs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;`thmKzRXXEejph}QNq#ufCwN@Y{(%Kh!S=jYzsJvbVoK6_)Qy5#8 z^*)72u|nB4=+M_H49A$75}FCkv!+d?xCZRCsx~2;^*sFm`lbfOwW>B%26w0I&$ywu zqK?ajb2W%U-H}8?Klx=r&bW7(O&whSr7ipZYvl1+>|ONiamO5eiCr|b`g3Baeq69LYN5NS|_ z_HRH1EG9zuK(X)s0dY4rSb!`5GwJdFLooZJ0BOI8;lw}kJpd*rF8Om7T8sr~7QkYg z?fiFaSzUj$*+~#?5Yy5haFYb#0#)q&0jkLm0Z{MtpITV1F@VNo2oqQr10L`rho=UR zQy{!xVTykc4`7%L!3I92z_NM`WTZe0Kt)nOW(tHFpiG5ufZ1OEBclYIQz4w-mrj4t zP%1Pfv_?D(><`~|54BamDvzHAaV}oXyv!1?f$>{y*<#A-|1xnqk_PHE(oUA1d|Z_ z2jKzYIj~fc)BKxCqXuLDX%}5Z@W1_1DgBj2D1wmzidOxGa<=*J6EdK0Z-1BgzyeGFI2fvz?k4xa4Cnd03s!j zXW)fm1mGkcffn#Dfv|&3n-KtA0O2VxUII%~V=Dqsk&HkNJS~OA9@P#gltPriUpxM> zpaa@UAtK<$&cA3n4VDG&GML$I*FO{w%fD}s|FtCpGaMY&e}%Nu4G5M)o>Kmwm3aT9 zA|FNoRwohU0kjGTI*?fgc?KF;2Rh3jl$8HxTEu@D`t1H=C(cancellationToken: Arg.Any()).Returns(Result.From(_paginatedResultDtoFixture.Create(data: [installedTheme], currentPage: 1, perPage: 1, count: 1, numberOfPages: 1))); _mockThemeService.GetBundledThemeArchivePaths().Returns(["bundled.zip"]); _mockThemeService.ReadManifestFromArchiveAsync("bundled.zip", Arg.Any()).Returns(Result.From(manifest)); @@ -111,6 +111,28 @@ public class ThemeSynchronizerTests : IDisposable // Assert await _mockThemeService.DidNotReceive().InstallAsync(Arg.Any(), Arg.Any()); await _mockThemeRepository.DidNotReceive().InsertAsync(Arg.Any(), Arg.Any()); + await _mockThemeRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); + } + + [Fact] + public async Task SynchronizeAsync_WhenTheBundledThemeCarriesANewerVersion_ShouldReinstallItAndUpdateTheVersion() + { + // Arrange + ThemeManifestDto manifest = _themeManifestDtoFixture.Create(version: "2.0.0"); + ThemeEntity installedTheme = _themeEntityFixture.Create(themeId: manifest.Id, version: "1.0.0", installSource: ThemeInstallSource.Bundled, isDeleted: false, includeIsCurrent: true, isCurrent: true); + _mockThemeRepository.GetAllAsync(cancellationToken: Arg.Any()).Returns(Result.From(_paginatedResultDtoFixture.Create(data: [installedTheme], currentPage: 1, perPage: 1, count: 1, numberOfPages: 1))); + string archivePath = CreateArchiveFile(); + _mockThemeService.GetBundledThemeArchivePaths().Returns([archivePath]); + _mockThemeService.ReadManifestFromArchiveAsync(archivePath, Arg.Any()).Returns(Result.From(manifest)); + _mockThemeService.InstallAsync(Arg.Any(), Arg.Any()).Returns(Result.From(manifest)); + + // Act + await ThemeSynchronizer.SynchronizeAsync(_mockThemeService, _mockUnitOfWork, _mockLogger, CancellationToken.None); + + // Assert + await _mockThemeService.Received(1).InstallAsync(Arg.Any(), Arg.Any()); + await _mockThemeRepository.DidNotReceive().InsertAsync(Arg.Any(), Arg.Any()); + await _mockThemeRepository.Received(1).UpdateAsync(Arg.Is(theme => theme.ThemeId == manifest.Id && theme.Version == "2.0.0"), Arg.Any()); } [Fact] @@ -420,6 +442,112 @@ public class ThemeSynchronizerTests : IDisposable await Assert.ThrowsAsync(Act); } + [Fact] + public async Task SynchronizeAsync_WhenTheBundledThemeVersionDiffers_ShouldRefreshTheVersionTimestampAndUpdater() + { + // Arrange + ThemeManifestDto manifest = _themeManifestDtoFixture.Create(version: "3.0.0"); + ThemeEntity installedTheme = _themeEntityFixture.Create( + themeId: manifest.Id, + version: "1.0.0", + installSource: ThemeInstallSource.Bundled, + isDeleted: false, + includeIsCurrent: true, + isCurrent: true, + includeUpdatedOnUtc: true, + updatedOnUtc: DateTime.UtcNow.AddDays(-1), + includeUpdatedBy: true, + updatedBy: Guid.NewGuid()); + _mockThemeRepository.GetAllAsync(cancellationToken: Arg.Any()).Returns(Result.From(_paginatedResultDtoFixture.Create(data: [installedTheme], currentPage: 1, perPage: 1, count: 1, numberOfPages: 1))); + string archivePath = CreateArchiveFile(); + _mockThemeService.GetBundledThemeArchivePaths().Returns([archivePath]); + _mockThemeService.HasThemePack(installedTheme.ThemeId).Returns(true); + _mockThemeService.ReadManifestFromArchiveAsync(archivePath, Arg.Any()).Returns(Result.From(manifest)); + _mockThemeService.InstallAsync(Arg.Any(), Arg.Any()).Returns(Result.From(manifest)); + + // Act + await ThemeSynchronizer.SynchronizeAsync(_mockThemeService, _mockUnitOfWork, _mockLogger, CancellationToken.None); + + // Assert + Assert.Equal("3.0.0", installedTheme.Version); + Assert.NotNull(installedTheme.UpdatedOnUtc); + Assert.Null(installedTheme.UpdatedBy); + await _mockThemeRepository.Received(1).UpdateAsync( + Arg.Is(theme => theme.Id == installedTheme.Id && theme.Version == "3.0.0"), + Arg.Any()); + await _mockThemeRepository.DidNotReceive().InsertAsync(Arg.Any(), Arg.Any()); + } + + [Fact] + public async Task SynchronizeAsync_WhenRefreshingTheInstalledThemeVersionFails_ShouldLogAndContinueWithoutThrowing() + { + // Arrange + ThemeManifestDto manifest = _themeManifestDtoFixture.Create(version: "3.0.0"); + ThemeEntity installedTheme = _themeEntityFixture.Create(themeId: manifest.Id, version: "1.0.0", installSource: ThemeInstallSource.Bundled, isDeleted: false, includeIsCurrent: true, isCurrent: true); + _mockThemeRepository.GetAllAsync(cancellationToken: Arg.Any()).Returns(Result.From(_paginatedResultDtoFixture.Create(data: [installedTheme], currentPage: 1, perPage: 1, count: 1, numberOfPages: 1))); + string archivePath = CreateArchiveFile(); + _mockThemeService.GetBundledThemeArchivePaths().Returns([archivePath]); + _mockThemeService.HasThemePack(installedTheme.ThemeId).Returns(true); + _mockThemeService.ReadManifestFromArchiveAsync(archivePath, Arg.Any()).Returns(Result.From(manifest)); + _mockThemeService.InstallAsync(Arg.Any(), Arg.Any()).Returns(Result.From(manifest)); + _mockThemeRepository.UpdateAsync(Arg.Any(), Arg.Any()) + .Returns(Error.Failure("Themes.UpdateFailed", "Failed to update the theme")); + + // Act + await ThemeSynchronizer.SynchronizeAsync(_mockThemeService, _mockUnitOfWork, _mockLogger, CancellationToken.None); + + // Assert + _mockLogger.Received(1).Log( + LogLevel.Warning, + Arg.Any(), + Arg.Any(), + Arg.Any(), + Arg.Any>()); + await _mockThemeRepository.Received(1).UpdateAsync(Arg.Any(), Arg.Any()); + await _mockThemeRepository.DidNotReceive().InsertAsync(Arg.Any(), Arg.Any()); + } + + [Fact] + public async Task SynchronizeAsync_WhenAThemeWithTheSameIdWasInstalledFromAnotherSource_ShouldSkipTheBundledArchive() + { + // Arrange + ThemeManifestDto manifest = _themeManifestDtoFixture.Create(version: "2.0.0"); + ThemeEntity uploadedTheme = _themeEntityFixture.Create(themeId: manifest.Id, version: "1.0.0", installSource: ThemeInstallSource.Uploaded, isDeleted: false, includeIsCurrent: true, isCurrent: true); + _mockThemeRepository.GetAllAsync(cancellationToken: Arg.Any()).Returns(Result.From(_paginatedResultDtoFixture.Create(data: [uploadedTheme], currentPage: 1, perPage: 1, count: 1, numberOfPages: 1))); + _mockThemeService.GetBundledThemeArchivePaths().Returns(["bundled.zip"]); + _mockThemeService.HasThemePack(uploadedTheme.ThemeId).Returns(true); + _mockThemeService.ReadManifestFromArchiveAsync("bundled.zip", Arg.Any()).Returns(Result.From(manifest)); + + // Act + await ThemeSynchronizer.SynchronizeAsync(_mockThemeService, _mockUnitOfWork, _mockLogger, CancellationToken.None); + + // Assert + await _mockThemeService.DidNotReceive().InstallAsync(Arg.Any(), Arg.Any()); + await _mockThemeRepository.DidNotReceive().InsertAsync(Arg.Any(), Arg.Any()); + await _mockThemeRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); + } + + [Fact] + public async Task SynchronizeAsync_WhenABundledThemeIsAlreadyInstalledAndUpToDate_ShouldSkipIt() + { + // Arrange + ThemeManifestDto manifest = _themeManifestDtoFixture.Create(version: "1.5.0"); + ThemeEntity installedTheme = _themeEntityFixture.Create(themeId: manifest.Id, version: "1.5.0", installSource: ThemeInstallSource.Bundled, isDeleted: false, includeIsCurrent: true, isCurrent: true); + _mockThemeRepository.GetAllAsync(cancellationToken: Arg.Any()).Returns(Result.From(_paginatedResultDtoFixture.Create(data: [installedTheme], currentPage: 1, perPage: 1, count: 1, numberOfPages: 1))); + string archivePath = CreateArchiveFile(); + _mockThemeService.GetBundledThemeArchivePaths().Returns([archivePath]); + _mockThemeService.HasThemePack(installedTheme.ThemeId).Returns(true); + _mockThemeService.ReadManifestFromArchiveAsync(archivePath, Arg.Any()).Returns(Result.From(manifest)); + + // Act + await ThemeSynchronizer.SynchronizeAsync(_mockThemeService, _mockUnitOfWork, _mockLogger, CancellationToken.None); + + // Assert + await _mockThemeService.DidNotReceive().InstallAsync(Arg.Any(), Arg.Any()); + await _mockThemeRepository.DidNotReceive().InsertAsync(Arg.Any(), Arg.Any()); + await _mockThemeRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); + } + [Fact] public async Task EnsureCurrentThemeExistsAsync_WhenANonDeletedThemeIsCurrent_ShouldNotSelectAnotherTheme() { @@ -467,6 +595,30 @@ public class ThemeSynchronizerTests : IDisposable await _mockThemeRepository.Received(1).UpdateAsync(Arg.Is(theme => theme.Id == defaultTheme.Id), Arg.Any()); } + [Fact] + public async Task EnsureCurrentThemeExistsAsync_WhenActivatingTheDefaultThemeFails_ShouldLogAndNotThrow() + { + // Arrange + ThemeEntity defaultTheme = _themeEntityFixture.Create(themeId: "lumina-default", installSource: ThemeInstallSource.Bundled, isDeleted: false); + _mockThemeService.HasThemePack(defaultTheme.ThemeId).Returns(true); + _mockThemeRepository.UpdateAsync(Arg.Any(), Arg.Any()) + .Returns(Error.Failure("Themes.UpdateFailed", "Failed to activate the theme")); + + // Act + await InvokeEnsureCurrentThemeExistsAsync([defaultTheme]); + + // Assert + Assert.True(defaultTheme.IsCurrent); + await _mockThemeRepository.Received(1).UpdateAsync(Arg.Is(theme => theme.Id == defaultTheme.Id), Arg.Any()); + // A failed activation must not be silent, so it is logged instead of being discarded. + _mockLogger.Received(1).Log( + LogLevel.Warning, + Arg.Any(), + Arg.Any(), + Arg.Any(), + Arg.Any>()); + } + /// /// Creates a real archive file on disk so that can open it. /// @@ -487,7 +639,7 @@ public class ThemeSynchronizerTests : IDisposable { MethodInfo method = typeof(ThemeSynchronizer).GetMethod("EnsureCurrentThemeExistsAsync", BindingFlags.Static | BindingFlags.NonPublic) ?? throw new InvalidOperationException("The method 'EnsureCurrentThemeExistsAsync' was not found on the theme synchronizer."); - Task task = (Task)method.Invoke(null, [_mockThemeService, _mockUnitOfWork, themes, CancellationToken.None])!; + Task task = (Task)method.Invoke(null, [_mockThemeService, _mockUnitOfWork, themes, _mockLogger, CancellationToken.None])!; await task.ConfigureAwait(false); } From c7aab6355296bb5c0af452035aac3921993c0076 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:27:15 +0300 Subject: [PATCH 12/19] Filters the home page by library category from the navigation menu. --- .../Core/Themes/ThemeNavBuilder.cs | 7 ++- .../Core/Views/Home/Index.cshtml | 53 ++++++++++++++----- .../Core/Themes/ThemeNavBuilderTests.cs | 21 ++++++++ 3 files changed, 67 insertions(+), 14 deletions(-) diff --git a/src/Lumina.Presentation.Web/Core/Themes/ThemeNavBuilder.cs b/src/Lumina.Presentation.Web/Core/Themes/ThemeNavBuilder.cs index 90d9b55b..63cfb3ce 100644 --- a/src/Lumina.Presentation.Web/Core/Themes/ThemeNavBuilder.cs +++ b/src/Lumina.Presentation.Web/Core/Themes/ThemeNavBuilder.cs @@ -152,14 +152,17 @@ public sealed class ThemeNavBuilder ]; if (canCreateLibraries) items.Add(new ThemeNavEntryDto(Localize("AddNewLibrary"), _urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.ADD_LIBRARY), "nav-link", [])); + // The written content and audio entries open the home page filtered to the libraries of their category, so that browsing starts + // from the libraries the user owns (or from every library, for administrators), instead of from a single library picked upfront. + string librariesCatalogUrl = _urlService.GetAbsoluteUrl(WebRoutes.Home.INDEX_CULTURED) ?? string.Empty; items.Add(new ThemeNavEntryDto(Localize("WrittenContent"), Url: null, CssClass: null, [ - new ThemeNavEntryDto(Localize("Books"), "library/written-content-library/books-library/books", "nav-link", []), + new ThemeNavEntryDto(Localize("Books"), $"{librariesCatalogUrl}?category=books", "nav-link", []), new ThemeNavEntryDto(Localize("Magazines"), "library/written-content/magazines", "nav-link", []) ])); items.Add(new ThemeNavEntryDto(Localize("Audio"), Url: null, CssClass: null, [ - new ThemeNavEntryDto(Localize("Music"), "library/audio/music", "nav-link", []), + new ThemeNavEntryDto(Localize("Music"), $"{librariesCatalogUrl}?category=music", "nav-link", []), new ThemeNavEntryDto(Localize("Interviews"), "library/audio/interviews", "nav-link", []) ])); items.Add(new ThemeNavEntryDto(Localize("Video"), Url: null, CssClass: null, diff --git a/src/Lumina.Presentation.Web/Core/Views/Home/Index.cshtml b/src/Lumina.Presentation.Web/Core/Views/Home/Index.cshtml index a8d9cb21..25a7aee3 100644 --- a/src/Lumina.Presentation.Web/Core/Views/Home/Index.cshtml +++ b/src/Lumina.Presentation.Web/Core/Views/Home/Index.cshtml @@ -1,5 +1,6 @@ @* -/ + / + ?category=... (optional quick-navigation filter: lists only the libraries of the category) *@ @using Lumina.Presentation.Web.Common.DTO.Libraries @@ -9,6 +10,11 @@ @{ // Generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler. var scriptId = ScriptIdentifierHelper.GenerateScriptId(); + // The optional quick-navigation category the page is filtered to; empty when the page lists every enabled library. + // The value is restricted to the known categories, so that an arbitrary query value is never reflected back into the page. + var category = Context.Request.Query["category"].ToString().ToLowerInvariant(); + if (category != "books" && category != "music") + category = string.Empty; } @inject IViewLocalizer _localizer @@ -30,6 +36,25 @@ const cleanupFunctions = []; let isInitialized = false; + // The category the page is filtered to, empty when it lists every enabled library. + const libraryCategory = '@category'; + // Library types that have a browsing page in this application, mapped to it, so that the library cards link to their contents. + const libraryBrowseUrls = { + 'Book': '@_urlService.GetAbsoluteUrl(WebRoutes.Books.INDEX)', + 'EBook': '@_urlService.GetAbsoluteUrl(WebRoutes.Books.INDEX)', + 'ComicBook': '@_urlService.GetAbsoluteUrl(WebRoutes.Books.INDEX)', + 'Manga': '@_urlService.GetAbsoluteUrl(WebRoutes.Books.INDEX)', + 'GraphicNovel': '@_urlService.GetAbsoluteUrl(WebRoutes.Books.INDEX)', + 'AcademicPaper': '@_urlService.GetAbsoluteUrl(WebRoutes.Books.INDEX)', + 'SheetMusic': '@_urlService.GetAbsoluteUrl(WebRoutes.Books.INDEX)', + 'Music': '@_urlService.GetAbsoluteUrl(WebRoutes.Music.ARTISTS_INDEX)' + }; + // The quick-navigation categories of the navigation menu, mapped to the library types they list. + const libraryCategoryTypes = { + 'books': ['Book', 'EBook', 'ComicBook', 'Manga', 'GraphicNovel', 'AcademicPaper', 'SheetMusic'], + 'music': ['Music'] + }; + // The element references are captured once, so that the cleanup can unbind their listeners even after the AJAX navigator has swapped the content out of the document. const librariesContainer = document.getElementById('libraries-container'); const noLibrariesMessage = document.getElementById('no-libraries'); @@ -41,16 +66,19 @@ // Get the media libraries. // TODO: add setting check whether the user desires this feature or not. const data = await callApiGetAsync('@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.GET_ENABLED_LIBRARIES)'); - if (data && data.length > 0) { - noLibrariesMessage.classList.replace('block', 'hidden'); - librariesContainer.classList.replace('justify-center', 'justify-start'); + // When the page is filtered to a category, only the libraries of the types of that category are listed; otherwise, every enabled library is listed. + const categoryTypes = libraryCategory ? (libraryCategoryTypes[libraryCategory] || null) : null; + const libraries = data && categoryTypes ? data.filter((library) => categoryTypes.includes(library.libraryType)) : data; + if (libraries && libraries.length > 0) { + noLibrariesMessage.classList.add('hidden'); + librariesContainer.classList.remove('justify-center'); + librariesContainer.classList.add('justify-start'); // Populate media library items. - data.forEach((library) => { - // Book libraries are browsable, so their panel is rendered as a link to their browse page. - const isBrowsable = library.libraryType === 'Book'; - const browseUrl = isBrowsable - ? '@_urlService.GetAbsoluteUrl(WebRoutes.Books.INDEX)' + '?libraryId=' + library.id - : null; + libraries.forEach((library) => { + // Libraries that have a browsing page are rendered as a link to it; the others are rendered as a plain panel. + const browseBase = libraryBrowseUrls[library.libraryType] || null; + const browseUrl = browseBase ? browseBase + '?libraryId=' + library.id : null; + const isBrowsable = browseUrl !== null; const libraryElement = isBrowsable ? document.createElement('a') : document.createElement('div'); libraryElement.className = isBrowsable ? 'media-panel nav-link no-underline' : 'media-panel'; @@ -72,8 +100,9 @@ // Bind the AJAX navigation behavior to the library links, which were created after the initial navigation binding. bindNavigationLinks(); } else { - noLibrariesMessage.classList.replace('hidden', 'block'); - librariesContainer.classList.replace('justify-start', 'justify-center'); + noLibrariesMessage.classList.remove('hidden'); + librariesContainer.classList.remove('justify-start'); + librariesContainer.classList.add('justify-center'); } } diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeNavBuilderTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeNavBuilderTests.cs index bdfde3de..7001a8c9 100644 --- a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeNavBuilderTests.cs +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Themes/ThemeNavBuilderTests.cs @@ -107,6 +107,27 @@ public class ThemeNavBuilderTests Assert.DoesNotContain(librarySection.Items, entry => entry.Label == "Localized-AddNewLibrary"); } + [Fact] + public async Task BuildAsync_WhenUserIsAuthenticated_ShouldLinkWrittenContentAndAudioEntriesToTheFilteredLibraryCatalog() + { + // Arrange + _mockHttpContextAccessor.HttpContext.Returns(TestHttpContextFactory.Create(user: TestHttpContextFactory.CreateAuthenticatedUser())); + + // Act + ThemeNavMenuDto result = await _sut.BuildAsync(CancellationToken.None); + + // Assert + // The written content and audio entries open the home page filtered to the libraries of their category, so that browsing starts + // from the libraries of that category, instead of from a single library picked upfront. + ThemeNavSectionDto librarySection = FindSection(result, "Localized-Library")!; + ThemeNavEntryDto writtenContentEntry = librarySection.Items.First(entry => entry.Label == "Localized-WrittenContent"); + ThemeNavEntryDto audioEntry = librarySection.Items.First(entry => entry.Label == "Localized-Audio"); + Assert.Contains(writtenContentEntry.Children, entry => entry.Label == "Localized-Books" && entry.Url == "http://localhost/en-us?category=books"); + Assert.Contains(writtenContentEntry.Children, entry => entry.Label == "Localized-Magazines" && entry.Url == "library/written-content/magazines"); + Assert.Contains(audioEntry.Children, entry => entry.Label == "Localized-Music" && entry.Url == "http://localhost/en-us?category=music"); + Assert.Contains(audioEntry.Children, entry => entry.Label == "Localized-Interviews" && entry.Url == "library/audio/interviews"); + } + [Fact] public async Task BuildAsync_WhenUserIsAdmin_ShouldIncludeAdministratorSection() { From 5a2c6c2bd87c94402db3280a16325d56614eb3fe Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:27:28 +0300 Subject: [PATCH 13/19] Adds the music library browsing and editing pages to the web client. --- README.md | 1 + docs/manual/using-lumina/index.md | 13 +- .../Common/DTO/AudioLibrary/AudioRatingDto.cs | 19 + .../DTO/AudioLibrary/MusicLibrary/IsrcDto.cs | 17 + .../MusicLibrary/MusicAlbumDto.cs | 118 ++ .../MusicLibrary/MusicAlbumLiteDto.cs | 45 + .../MusicLibrary/MusicAlbumMetadataDto.cs | 90 + .../AudioLibrary/MusicLibrary/MusicAreaDto.cs | 43 + .../MusicLibrary/MusicArtistAliasDto.cs | 53 + .../MusicLibrary/MusicArtistDto.cs | 81 + .../MusicLibrary/MusicArtistLiteDto.cs | 28 + .../MusicLibrary/MusicArtistMetadataDto.cs | 91 + .../MusicLibrary/MusicTrackDto.cs | 113 ++ .../MusicLibrary/MusicTrackLiteDto.cs | 38 + .../MusicLibrary/MusicTrackMetadataDto.cs | 119 ++ .../AudioLibrary/MusicLibrary/MusicWorkDto.cs | 40 + .../PaginatedMusicAlbumLiteDto.cs | 38 + .../PaginatedMusicArtistLiteDto.cs | 38 + .../PaginatedMusicTrackLiteDto.cs | 38 + .../MusicLibrary/UpdateMusicCoverDto.cs | 17 + .../Common/DTO/Common/MediaArtworkDto.cs | 28 + .../Common/DTO/Common/MoodDto.cs | 17 + .../MediaContributorReferenceDto.cs | 24 + .../Enums/AudioLibrary/MusicArtistGender.cs | 32 + .../Enums/AudioLibrary/MusicArtistType.cs | 42 + .../Common/Enums/AudioLibrary/MusicKey.cs | 132 ++ .../Enums/AudioLibrary/MusicMediaFormat.cs | 577 +++++++ .../AudioLibrary/MusicReleasePackaging.cs | 132 ++ .../Enums/AudioLibrary/MusicReleaseStatus.cs | 47 + .../Enums/AudioLibrary/MusicReleaseType.cs | 97 ++ .../Common/Enums/MediaLibrary/ArtworkType.cs | 92 + .../Albums/GetArtistAlbumsLiteRequest.cs | 21 + .../Albums/GetMusicAlbumViewRequest.cs | 19 + .../Albums/UpdateMusicAlbumRequest.cs | 42 + .../Artists/GetMusicArtistViewRequest.cs | 17 + .../Artists/GetMusicArtistsLiteRequest.cs | 34 + .../Artists/GetMusicArtistsViewRequest.cs | 15 + .../Artists/UpdateMusicArtistAlbumRequest.cs | 46 + .../Artists/UpdateMusicArtistRequest.cs | 33 + .../Artists/UpdateMusicArtistTrackRequest.cs | 49 + .../Tracks/GetAlbumTracksLiteRequest.cs | 23 + .../Tracks/GetMusicTrackViewRequest.cs | 21 + .../Tracks/UpdateMusicTrackRequest.cs | 47 + .../Common/Routes/ApiRoutes.Music.cs | 28 + .../Common/Routes/WebRoutes.Music.cs | 32 + .../DeleteMusicAlbumEndpoint.cs | 64 + .../DeleteMusicAlbumEndpointSummary.cs | 24 + .../EditMusicAlbumViewEndpoint.cs | 133 ++ .../EditMusicAlbumViewEndpointSummary.cs | 29 + .../GetArtistAlbumsEndpoint.cs | 77 + .../GetArtistAlbumsEndpointSummary.cs | 38 + .../GetMusicAlbum/GetMusicAlbumEndpoint.cs | 60 + .../GetMusicAlbumEndpointSummary.cs | 29 + .../SaveMusicAlbum/SaveMusicAlbumEndpoint.cs | 67 + .../SaveMusicAlbumEndpointSummary.cs | 25 + .../UpdateAlbumCoverEndpoint.cs | 86 + .../UpdateAlbumCoverEndpointSummary.cs | 25 + .../DeleteMusicArtistEndpoint.cs | 61 + .../DeleteMusicArtistEndpointSummary.cs | 24 + .../EditMusicArtistViewEndpoint.cs | 132 ++ .../EditMusicArtistViewEndpointSummary.cs | 29 + .../GetMusicArtist/GetMusicArtistEndpoint.cs | 59 + .../GetMusicArtistEndpointSummary.cs | 29 + .../GetMusicArtistsEndpoint.cs | 83 + .../GetMusicArtistsEndpointSummary.cs | 46 + .../Index/MusicArtistsIndexViewEndpoint.cs | 112 ++ .../MusicArtistsIndexViewEndpointSummary.cs | 32 + .../SaveMusicArtistEndpoint.cs | 65 + .../SaveMusicArtistEndpointSummary.cs | 25 + .../UpdateArtistCoverEndpoint.cs | 85 + .../UpdateArtistCoverEndpointSummary.cs | 25 + .../DeleteMusicTrackEndpoint.cs | 65 + .../DeleteMusicTrackEndpointSummary.cs | 24 + .../EditMusicTrackViewEndpoint.cs | 140 ++ .../EditMusicTrackViewEndpointSummary.cs | 31 + .../GetAlbumTracks/GetAlbumTracksEndpoint.cs | 78 + .../GetAlbumTracksEndpointSummary.cs | 40 + .../GetMusicTrack/GetMusicTrackEndpoint.cs | 62 + .../GetMusicTrackEndpointSummary.cs | 31 + .../SaveMusicTrack/SaveMusicTrackEndpoint.cs | 69 + .../SaveMusicTrackEndpointSummary.cs | 25 + .../MusicLibrary/Albums/Item.ar-SA.resx | 1509 +++++++++++++++++ .../MusicLibrary/Albums/Item.de-DE.resx | 1509 +++++++++++++++++ .../MusicLibrary/Albums/Item.en-US.resx | 1509 +++++++++++++++++ .../MusicLibrary/Albums/Item.es-ES.resx | 1509 +++++++++++++++++ .../MusicLibrary/Albums/Item.fr-FR.resx | 1509 +++++++++++++++++ .../MusicLibrary/Albums/Item.it-IT.resx | 1509 +++++++++++++++++ .../MusicLibrary/Albums/Item.ja-JP.resx | 1509 +++++++++++++++++ .../MusicLibrary/Albums/Item.resx | 1509 +++++++++++++++++ .../MusicLibrary/Albums/Item.ro-RO.resx | 1509 +++++++++++++++++ .../MusicLibrary/Albums/Item.uk-UA.resx | 1509 +++++++++++++++++ .../MusicLibrary/Albums/Item.zh-CN.resx | 1509 +++++++++++++++++ .../MusicLibrary/Artists/Index.ar-SA.resx | 60 + .../MusicLibrary/Artists/Index.de-DE.resx | 60 + .../MusicLibrary/Artists/Index.en-US.resx | 60 + .../MusicLibrary/Artists/Index.es-ES.resx | 60 + .../MusicLibrary/Artists/Index.fr-FR.resx | 60 + .../MusicLibrary/Artists/Index.it-IT.resx | 60 + .../MusicLibrary/Artists/Index.ja-JP.resx | 60 + .../MusicLibrary/Artists/Index.resx | 60 + .../MusicLibrary/Artists/Index.ro-RO.resx | 60 + .../MusicLibrary/Artists/Index.uk-UA.resx | 60 + .../MusicLibrary/Artists/Index.zh-CN.resx | 60 + .../MusicLibrary/Artists/Item.ar-SA.resx | 1086 ++++++++++++ .../MusicLibrary/Artists/Item.de-DE.resx | 1086 ++++++++++++ .../MusicLibrary/Artists/Item.en-US.resx | 1086 ++++++++++++ .../MusicLibrary/Artists/Item.es-ES.resx | 1086 ++++++++++++ .../MusicLibrary/Artists/Item.fr-FR.resx | 1086 ++++++++++++ .../MusicLibrary/Artists/Item.it-IT.resx | 1086 ++++++++++++ .../MusicLibrary/Artists/Item.ja-JP.resx | 1086 ++++++++++++ .../MusicLibrary/Artists/Item.resx | 1086 ++++++++++++ .../MusicLibrary/Artists/Item.ro-RO.resx | 1086 ++++++++++++ .../MusicLibrary/Artists/Item.uk-UA.resx | 1086 ++++++++++++ .../MusicLibrary/Artists/Item.zh-CN.resx | 1086 ++++++++++++ .../MusicLibrary/Tracks/Item.ar-SA.resx | 1182 +++++++++++++ .../MusicLibrary/Tracks/Item.de-DE.resx | 1182 +++++++++++++ .../MusicLibrary/Tracks/Item.en-US.resx | 1182 +++++++++++++ .../MusicLibrary/Tracks/Item.es-ES.resx | 1182 +++++++++++++ .../MusicLibrary/Tracks/Item.fr-FR.resx | 1182 +++++++++++++ .../MusicLibrary/Tracks/Item.it-IT.resx | 1182 +++++++++++++ .../MusicLibrary/Tracks/Item.ja-JP.resx | 1182 +++++++++++++ .../MusicLibrary/Tracks/Item.resx | 1182 +++++++++++++ .../MusicLibrary/Tracks/Item.ro-RO.resx | 1182 +++++++++++++ .../MusicLibrary/Tracks/Item.uk-UA.resx | 1182 +++++++++++++ .../MusicLibrary/Tracks/Item.zh-CN.resx | 1182 +++++++++++++ .../MusicLibrary/Albums/Item.cshtml | 1120 ++++++++++++ .../MusicLibrary/Artists/Index.cshtml | 486 ++++++ .../MusicLibrary/Artists/Item.cshtml | 1325 +++++++++++++++ .../MusicLibrary/Tracks/Item.cshtml | 1059 ++++++++++++ .../wwwroot/css/site.css | 62 + .../wwwroot/images/ui/music-placeholder.svg | 9 + .../DTO/AudioLibrary/AudioRatingDtoFixture.cs | 60 + .../MusicLibrary/IsrcDtoFixture.cs | 44 + .../MusicLibrary/MusicAlbumDtoFixture.cs | 144 ++ .../MusicLibrary/MusicAlbumLiteDtoFixture.cs | 65 + .../MusicAlbumMetadataDtoFixture.cs | 121 ++ .../MusicLibrary/MusicAreaDtoFixture.cs | 70 + .../MusicArtistAliasDtoFixture.cs | 79 + .../MusicLibrary/MusicArtistDtoFixture.cs | 107 ++ .../MusicLibrary/MusicArtistLiteDtoFixture.cs | 51 + .../MusicArtistMetadataDtoFixture.cs | 120 ++ .../MusicLibrary/MusicTrackDtoFixture.cs | 136 ++ .../MusicLibrary/MusicTrackLiteDtoFixture.cs | 57 + .../MusicTrackMetadataDtoFixture.cs | 148 ++ .../MusicLibrary/MusicWorkDtoFixture.cs | 68 + .../PaginatedMusicAlbumLiteDtoFixture.cs | 55 + .../PaginatedMusicArtistLiteDtoFixture.cs | 55 + .../PaginatedMusicTrackLiteDtoFixture.cs | 55 + .../UpdateMusicCoverDtoFixture.cs | 44 + .../DTO/Common/MediaArtworkDtoFixture.cs | 49 + .../Common/DTO/Common/MoodDtoFixture.cs | 44 + .../MediaContributorReferenceDtoFixture.cs | 49 + .../GetArtistAlbumsLiteRequestFixture.cs | 48 + .../Albums/GetMusicAlbumViewRequestFixture.cs | 44 + .../Albums/UpdateMusicAlbumRequestFixture.cs | 109 ++ .../GetMusicArtistViewRequestFixture.cs | 41 + .../GetMusicArtistsLiteRequestFixture.cs | 76 + .../GetMusicArtistsViewRequestFixture.cs | 39 + .../UpdateMusicArtistAlbumRequestFixture.cs | 120 ++ .../UpdateMusicArtistRequestFixture.cs | 89 + .../UpdateMusicArtistTrackRequestFixture.cs | 129 ++ .../GetAlbumTracksLiteRequestFixture.cs | 51 + .../Tracks/GetMusicTrackViewRequestFixture.cs | 47 + .../Tracks/UpdateMusicTrackRequestFixture.cs | 124 ++ .../DeleteMusicAlbumEndpointTests.cs | 113 ++ .../EditMusicAlbumViewEndpointTests.cs | 54 + .../GetArtistAlbumsEndpointTests.cs | 78 + .../GetMusicAlbumEndpointTests.cs | 77 + .../SaveMusicAlbumEndpointTests.cs | 123 ++ .../UpdateAlbumCoverEndpointTests.cs | 154 ++ .../DeleteMusicArtistEndpointTests.cs | 110 ++ .../EditMusicArtistViewEndpointTests.cs | 69 + .../GetMusicArtistEndpointTests.cs | 76 + .../GetMusicArtistsEndpointTests.cs | 78 + .../MusicArtistsIndexViewEndpointTests.cs | 70 + .../SaveMusicArtistEndpointTests.cs | 120 ++ .../UpdateArtistCoverEndpointTests.cs | 141 ++ .../DeleteMusicTrackEndpointTests.cs | 116 ++ .../EditMusicTrackViewEndpointTests.cs | 78 + .../GetAlbumTracksEndpointTests.cs | 79 + .../GetMusicTrackEndpointTests.cs | 78 + .../SaveMusicTrackEndpointTests.cs | 126 ++ .../DeleteMusicAlbumEndpointTests.cs | 113 ++ .../EditMusicAlbumViewEndpointTests.cs | 43 + .../GetArtistAlbumsEndpointTests.cs | 75 + .../GetMusicAlbumEndpointTests.cs | 79 + .../SaveMusicAlbumEndpointTests.cs | 179 ++ .../UpdateAlbumCoverEndpointTests.cs | 162 ++ .../DeleteMusicArtistEndpointTests.cs | 111 ++ .../EditMusicArtistViewEndpointTests.cs | 44 + .../GetMusicArtistEndpointTests.cs | 79 + .../GetMusicArtistsEndpointTests.cs | 131 ++ .../MusicArtistsIndexViewEndpointTests.cs | 45 + .../SaveMusicArtistEndpointTests.cs | 174 ++ .../UpdateArtistCoverEndpointTests.cs | 158 ++ .../DeleteMusicTrackEndpointTests.cs | 142 ++ .../EditMusicTrackViewEndpointTests.cs | 78 + .../GetAlbumTracksEndpointTests.cs | 104 ++ .../GetMusicTrackEndpointTests.cs | 79 + .../SaveMusicTrackEndpointTests.cs | 182 ++ .../DeleteMusicAlbumEndpointTests.cs | 145 ++ .../GetArtistAlbumsEndpointTests.cs | 166 ++ .../GetMusicAlbumEndpointTests.cs | 127 ++ .../SaveMusicAlbumEndpointTests.cs | 212 +++ .../UpdateAlbumCoverEndpointTests.cs | 313 ++++ .../DeleteMusicArtistEndpointTests.cs | 128 ++ .../GetMusicArtistEndpointTests.cs | 143 ++ .../GetMusicArtistsEndpointTests.cs | 219 +++ .../MusicArtistsIndexViewEndpointTests.cs | 146 ++ .../SaveMusicArtistEndpointTests.cs | 181 ++ .../UpdateArtistCoverEndpointTests.cs | 297 ++++ .../DeleteMusicTrackEndpointTests.cs | 152 ++ .../GetAlbumTracksEndpointTests.cs | 202 +++ .../GetMusicTrackEndpointTests.cs | 129 ++ .../SaveMusicTrackEndpointTests.cs | 245 +++ 215 files changed, 60042 insertions(+), 3 deletions(-) create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/AudioRatingDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/IsrcDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumLiteDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumMetadataDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAreaDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistAliasDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistLiteDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistMetadataDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackLiteDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackMetadataDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicWorkDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicAlbumLiteDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicArtistLiteDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicTrackLiteDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/UpdateMusicCoverDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/Common/MediaArtworkDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/Common/MoodDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorReferenceDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistGender.cs create mode 100644 src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistType.cs create mode 100644 src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicKey.cs create mode 100644 src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicMediaFormat.cs create mode 100644 src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleasePackaging.cs create mode 100644 src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseStatus.cs create mode 100644 src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseType.cs create mode 100644 src/Lumina.Presentation.Web/Common/Enums/MediaLibrary/ArtworkType.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbumsLiteRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbumViewRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/UpdateMusicAlbumRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistViewRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsLiteRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsViewRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistAlbumRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistTrackRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracksLiteRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrackViewRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/UpdateMusicTrackRequest.cs create mode 100644 src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Music.cs create mode 100644 src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Music.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ar-SA.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.de-DE.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.en-US.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.es-ES.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.fr-FR.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.it-IT.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ja-JP.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ro-RO.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.uk-UA.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.zh-CN.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ar-SA.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.de-DE.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.en-US.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.es-ES.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.fr-FR.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.it-IT.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ja-JP.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ro-RO.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.uk-UA.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.zh-CN.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ar-SA.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.de-DE.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.en-US.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.es-ES.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.fr-FR.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.it-IT.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ja-JP.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ro-RO.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.uk-UA.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.zh-CN.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ar-SA.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.de-DE.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.en-US.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.es-ES.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.fr-FR.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.it-IT.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ja-JP.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ro-RO.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.uk-UA.resx create mode 100644 src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.zh-CN.resx create mode 100644 src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.cshtml create mode 100644 src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.cshtml create mode 100644 src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.cshtml create mode 100644 src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.cshtml create mode 100644 src/Lumina.Presentation.Web/wwwroot/images/ui/music-placeholder.svg create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/AudioRatingDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/IsrcDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumLiteDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumMetadataDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAreaDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistAliasDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistLiteDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistMetadataDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackLiteDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackMetadataDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicWorkDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicAlbumLiteDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicArtistLiteDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicTrackLiteDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/UpdateMusicCoverDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Common/MediaArtworkDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Common/MoodDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/MediaContributors/MediaContributorReferenceDtoFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbumsLiteRequestFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbumViewRequestFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/UpdateMusicAlbumRequestFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistViewRequestFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsLiteRequestFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsViewRequestFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistAlbumRequestFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistRequestFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistTrackRequestFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracksLiteRequestFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrackViewRequestFixture.cs create mode 100644 tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/UpdateMusicTrackRequestFixture.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs create mode 100644 tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs create mode 100644 tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs create mode 100644 tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs diff --git a/README.md b/README.md index c7d8a563..46c79f7a 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ Several icons used in this project were adapted from icons sourced from [svgrepo - [`error.svg`](https://www.svgrepo.com/svg/486408/error-filled) (MIT License) - [`trigger.svg`](https://www.svgrepo.com/svg/489497/lightning-1) (Public Domain License) - [`stop.svg`](https://www.svgrepo.com/svg/521862/stop) (CC Attribution License) +- [`music-placeholder.svg`](https://www.svgrepo.com/svg/446269/music) (CC Attribution License) **I greatly appreciate the creators and contributors for providing these assets.** diff --git a/docs/manual/using-lumina/index.md b/docs/manual/using-lumina/index.md index 60a693a3..62a45c37 100644 --- a/docs/manual/using-lumina/index.md +++ b/docs/manual/using-lumina/index.md @@ -62,13 +62,20 @@ A book opens only through an enabled reader for its format. The EPUB and PDF rea ## Browsing your music -Opening a music library shows a page with the library title, a search box, an item count, a grid of artist cards, and pagination. Search filters the artists by name. Each artist is a card; selecting it opens the artist's page, and the card's actions menu offers **View details** and **Delete**. +Opening a music library shows a page with the library title, a search box, a sort toggle, a count of items, a grid of artist cards, an alphabetical picker down the side, and pagination at the bottom. -The artist page is also where you edit the artist. It holds the artist's general information, areas, aliases, contributors and ratings, and it lists the artist's albums as cards, each leading to its own album page. The album page holds the album's information and its tracks, and the track page holds the track's details. Deleting an artist, album or track removes it from Lumina's catalogue; your files are not touched. +- **Search** filters the artists by name; press Enter or use the search button. +- **Sort** toggles between ascending and descending order. +- **The alpha picker** jumps to names starting with a chosen character. It offers All, then the number and symbol keys, then A to Z. You can also press a letter key to filter, and press Escape to clear the filter. +- **Pagination** splits the list into pages when you have it enabled, with previous and next buttons and a page indicator. When it is off, the whole list is shown and the count is the total. + +Each artist is a card; selecting it opens the artist's page, and the card's actions menu offers **View details** and **Delete**. + +The artist page is also where you edit the artist. It lists the artist's albums as cards, each leading to its own album page, followed by the artist's general information, contributors, ratings, genres, tags, aliases, areas and identifiers. The album page holds the album's information and its tracks, and the track page holds the track's details. The album page also shows the artwork Lumina stored for the album as a strip of thumbnails beside the main image, and selecting a thumbnail displays that image in place of the cover. Deleting an artist, album or track removes it from Lumina's catalogue; your files are not touched. ## Editing what is catalogued -Both book and music pages double as editors for the items that were scanned in. A book's details page groups its fields into general and release information, language and original language, genres, tags, identifiers, ISBNs, contributors and ratings, and lets you replace its cover. An artist's page groups its fields into general information, areas, aliases, contributors and ratings. Album and track pages follow the same shape for their own fields. Saving sends the changes back to the server, and a confirmation or an error is shown in the corner of the screen. +Both book and music pages double as editors for the items that were scanned in. A book's details page groups its fields into general and release information, language and original language, genres, tags, identifiers, ISBNs, contributors and ratings, and lets you replace its cover. An artist's page lists the artist's albums first, then groups its fields into general information, contributors, ratings, genres, tags, aliases, areas and identifiers, and lets you replace the artist's cover. An album page groups its fields into general information, contributors, ratings, genres, tags, release types, release information, language and original language, and identifiers, and lets you replace the album's cover. A track page groups its fields into general information, contributors, ratings, genres, tags, moods, release information, language and original language, work, ISRCs, identifiers and audio properties. Saving sends the changes back to the server, and a confirmation or an error is shown in the corner of the screen. Changes you make here live in Lumina's catalogue. diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/AudioRatingDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/AudioRatingDto.cs new file mode 100644 index 00000000..eab82d05 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/AudioRatingDto.cs @@ -0,0 +1,19 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary; + +/// +/// Data transfer object for the rating of an audio media element. +/// +[DebuggerDisplay("Value: {Value}, MaxValue: {MaxValue}")] +public class AudioRatingDto : RatingDto +{ + /// + /// Gets or sets the source of the audio rating (e.g., a specific website or platform). + /// + public AudioRatingSource? Source { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/IsrcDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/IsrcDto.cs new file mode 100644 index 00000000..feb21604 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/IsrcDto.cs @@ -0,0 +1,17 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for an ISRC (International Standard Recording Code) of a track. +/// +[DebuggerDisplay("Value: {Value}")] +public class IsrcDto +{ + /// + /// Gets or sets the value of the ISRC. + /// + public string? Value { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumDto.cs new file mode 100644 index 00000000..00e59bb0 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumDto.cs @@ -0,0 +1,118 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object carrying the full details of an album, as stored in the media library. +/// +[DebuggerDisplay("Title: {Metadata?.Title}")] +public class MusicAlbumDto +{ + /// + /// Gets or sets the Id of the album. + /// + public Guid Id { get; set; } + + /// + /// Gets or sets the Id of the artist the album belongs to. + /// + public Guid ArtistId { get; set; } + + /// + /// Gets or sets the Id of the media library this album belongs to. + /// + public Guid LibraryId { get; set; } + + /// + /// Gets or sets the path of the image representing the album, if available. + /// + public string? CoverPath { get; set; } + + /// + /// Gets or sets the stored artwork of the album, in display order, so that all of its pieces can be presented, not just the cover. + /// + public List? Artwork { get; set; } + + /// + /// Gets or sets the album metadata of the album. + /// + public MusicAlbumMetadataDto? Metadata { get; set; } + + /// + /// Gets or sets the physical or digital medium of the album, if applicable. + /// + public MusicMediaFormat? MediaFormat { get; set; } + + /// + /// Gets or sets the outermost physical packaging of the album, if applicable. + /// + public MusicReleasePackaging? Packaging { get; set; } + + /// + /// Gets or sets the barcode of the album, if applicable. + /// + public string? Barcode { get; set; } + + /// + /// Gets or sets the catalog numbers of the album, if applicable. + /// + public List? CatalogNumbers { get; set; } + + /// + /// Gets or sets the name of the label that issued the album, if applicable. + /// + public string? Label { get; set; } + + /// + /// Gets or sets the ASIN (Amazon Standard Identification Number) of the album, if applicable. + /// + public string? ASIN { get; set; } + + /// + /// Gets or sets the MusicBrainz identifier of the release, if applicable. + /// + public Guid? MusicBrainzReleaseId { get; set; } + + /// + /// Gets or sets the MusicBrainz identifier of the release group, if applicable. + /// + public Guid? MusicBrainzReleaseGroupId { get; set; } + + /// + /// Gets or sets the MusicBrainz identifier of the release artist, if applicable. + /// + public Guid? MusicBrainzReleaseArtistId { get; set; } + + /// + /// Gets or sets the date and time when the album was created. + /// + public DateTime CreatedOnUtc { get; set; } + + /// + /// Gets or sets the optional date and time when the album was updated. + /// + public DateTime? UpdatedOnUtc { get; set; } + + /// + /// Gets or sets the list of references to the media contributors that performed on the album, each with the role they played. + /// + public List? Contributors { get; set; } + + /// + /// Gets or sets the list of ratings for this album. + /// + public List? Ratings { get; set; } + + /// + /// Gets or sets the list of tracks of the album. + /// + public List? Tracks { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumLiteDto.cs new file mode 100644 index 00000000..2d9ec6a4 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumLiteDto.cs @@ -0,0 +1,45 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for a lightweight album element, containing only the properties needed by the client for card-style navigation. +/// +[DebuggerDisplay("Title: {Title}")] +public class MusicAlbumLiteDto +{ + /// + /// Gets or sets the Id of the album. + /// + public Guid Id { get; set; } + + /// + /// Gets or sets the title of the album. + /// + public string Title { get; set; } = string.Empty; + + /// + /// Gets or sets the number of tracks of the release. + /// + public int TotalTracks { get; set; } + + /// + /// Gets or sets the path of the image representing the album, if available. + /// + public string? CoverPath { get; set; } + + /// + /// Gets or sets the release year of the album (the re-release year, if available, or the original release year), if known. + /// + public int? ReleaseYear { get; set; } + + /// + /// Gets or sets the set of types of the release. + /// + public List? ReleaseTypes { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumMetadataDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumMetadataDto.cs new file mode 100644 index 00000000..216f9370 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumMetadataDto.cs @@ -0,0 +1,90 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for the metadata of an album. +/// +[DebuggerDisplay("Title: {Title}")] +public class MusicAlbumMetadataDto +{ + /// + /// Gets or sets the title of the album. + /// + public string? Title { get; set; } + + /// + /// Gets or sets the original title of the album, if different from the current title. + /// + public string? OriginalTitle { get; set; } + + /// + /// Gets or sets a brief description or summary of the album. + /// + public string? Description { get; set; } + + /// + /// Gets or sets the disambiguation comment of the album, used to distinguish albums with the same title. + /// + public string? Disambiguation { get; set; } + + /// + /// Gets or sets the release information, including release date and other relevant details. + /// + public ReleaseInfoDto? ReleaseInfo { get; set; } + + /// + /// Gets or sets the language of the album. + /// + public LanguageInfoDto? Language { get; set; } + + /// + /// Gets or sets the original language of the album, if it has been translated. + /// + public LanguageInfoDto? OriginalLanguage { get; set; } + + /// + /// Gets or sets the list of tags that further describe or categorize the album. + /// + public List? Tags { get; set; } + + /// + /// Gets or sets the list of genres associated with the album. + /// + public List? Genres { get; set; } + + /// + /// Gets or sets the script used by the language of the release of the album. + /// + public string? Script { get; set; } + + /// + /// Gets or sets the set of types of the release. + /// + public List? ReleaseTypes { get; set; } + + /// + /// Gets or sets the status of the release. + /// + public MusicReleaseStatus? ReleaseStatus { get; set; } + + /// + /// Gets or sets the number of discs of the release. + /// + public int? TotalDiscs { get; set; } + + /// + /// Gets or sets the number of tracks of the release. + /// + public int? TotalTracks { get; set; } + + /// + /// Gets or sets the title of the specific release (edition) the album files match, if different from the release group title. + /// + public string? ReleaseTitle { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAreaDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAreaDto.cs new file mode 100644 index 00000000..2db0c345 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicAreaDto.cs @@ -0,0 +1,43 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for a MusicBrainz area, the geographic area a music artist is associated with. +/// +[DebuggerDisplay("Name: {Name}")] +public class MusicAreaDto +{ + /// + /// Gets or sets the MusicBrainz identifier of the area. + /// + public Guid? MusicBrainzAreaId { get; set; } + + /// + /// Gets or sets the name of the area. + /// + public string? Name { get; set; } + + /// + /// Gets or sets the sort name of the area, if applicable. + /// + public string? SortName { get; set; } + + /// + /// Gets or sets the disambiguation comment of the area, if applicable. + /// + public string? Disambiguation { get; set; } + + /// + /// Gets or sets the MusicBrainz type of the area, if applicable. + /// + public string? Type { get; set; } + + /// + /// Gets or sets the ISO 3166 code of the area, if applicable. + /// + public string? Iso3166Code { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistAliasDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistAliasDto.cs new file mode 100644 index 00000000..05ae5a43 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistAliasDto.cs @@ -0,0 +1,53 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for an alternative name of a music artist. +/// +[DebuggerDisplay("Name: {Name}")] +public class MusicArtistAliasDto +{ + /// + /// Gets or sets the name of the alias. + /// + public string? Name { get; set; } + + /// + /// Gets or sets the sort name of the alias, if applicable. + /// + public string? SortName { get; set; } + + /// + /// Gets or sets the type of the alias, if applicable. + /// + public string? Type { get; set; } + + /// + /// Gets or sets the locale the alias is used in, if applicable. + /// + public string? Locale { get; set; } + + /// + /// Gets or sets whether this is the primary alias of the artist. + /// + public bool IsPrimary { get; set; } + + /// + /// Gets or sets the date the alias began being used, if applicable. + /// + public DateOnly? BeginDate { get; set; } + + /// + /// Gets or sets the date the alias stopped being used, if applicable. + /// + public DateOnly? EndDate { get; set; } + + /// + /// Gets or sets whether the alias is no longer used. + /// + public bool IsEnded { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistDto.cs new file mode 100644 index 00000000..edb8a763 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistDto.cs @@ -0,0 +1,81 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using System; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object carrying the full details of a music artist, as stored in the media library. +/// +[DebuggerDisplay("Name: {Metadata?.Name}")] +public class MusicArtistDto +{ + /// + /// Gets or sets the Id of the artist. + /// + public Guid Id { get; set; } + + /// + /// Gets or sets the Id of the media library this artist belongs to. + /// + public Guid LibraryId { get; set; } + + /// + /// Gets or sets the path of the image representing the artist, if available. + /// + public string? CoverPath { get; set; } + + /// + /// Gets or sets the metadata of the artist. + /// + public MusicArtistMetadataDto? Metadata { get; set; } + + /// + /// Gets or sets the website of the artist, if applicable. + /// + public string? Website { get; set; } + + /// + /// Gets or sets the MusicBrainz identifier of the artist, if applicable. + /// + public Guid? MusicBrainzArtistId { get; set; } + + /// + /// Gets or sets the list of IPI (Interested Party Information) codes of the artist. + /// + public List? Ipis { get; set; } + + /// + /// Gets or sets the list of ISNI (International Standard Name Identifier) codes of the artist. + /// + public List? Isnis { get; set; } + + /// + /// Gets or sets the date and time when the artist was created. + /// + public DateTime CreatedOnUtc { get; set; } + + /// + /// Gets or sets the optional date and time when the artist was updated. + /// + public DateTime? UpdatedOnUtc { get; set; } + + /// + /// Gets or sets the list of references to the media contributors that make up the artist, each with the role they played. + /// + public List? Contributors { get; set; } + + /// + /// Gets or sets the list of ratings for this artist. + /// + public List? Ratings { get; set; } + + /// + /// Gets or sets the list of albums of the artist, each with its own list of tracks. + /// + public List? Albums { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistLiteDto.cs new file mode 100644 index 00000000..06e69234 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistLiteDto.cs @@ -0,0 +1,28 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for a lightweight music artist element, containing only the properties needed by the client for card-style navigation. +/// +[DebuggerDisplay("Name: {Name}")] +public class MusicArtistLiteDto +{ + /// + /// Gets or sets the Id of the artist. + /// + public Guid Id { get; set; } + + /// + /// Gets or sets the name of the artist. + /// + public string Name { get; set; } = string.Empty; + + /// + /// Gets or sets the path of the image representing the artist, if available. + /// + public string? CoverPath { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistMetadataDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistMetadataDto.cs new file mode 100644 index 00000000..556f84d6 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistMetadataDto.cs @@ -0,0 +1,91 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for the metadata of a music artist. +/// +[DebuggerDisplay("Name: {Name}")] +public class MusicArtistMetadataDto +{ + /// + /// Gets or sets the name of the artist. + /// + public string? Name { get; set; } + + /// + /// Gets or sets the sort name of the artist, a variant of the name used when sorting artists, if applicable. + /// + public string? SortName { get; set; } + + /// + /// Gets or sets the disambiguation comment of the artist, used to distinguish artists with the same name, if applicable. + /// + public string? Disambiguation { get; set; } + + /// + /// Gets or sets the type of the artist, if applicable. + /// + public MusicArtistType? Type { get; set; } + + /// + /// Gets or sets the gender of the artist, applicable only to artists that are persons or characters, if applicable. + /// + public MusicArtistGender? Gender { get; set; } + + /// + /// Gets or sets the ISO 3166-1 alpha-2 code of the country the artist is associated with, if applicable. + /// + public string? Country { get; set; } + + /// + /// Gets or sets the area the artist is primarily identified with, if applicable. + /// + public MusicAreaDto? Area { get; set; } + + /// + /// Gets or sets the area the artist began in, if applicable. + /// + public MusicAreaDto? BeginArea { get; set; } + + /// + /// Gets or sets the area the artist ended in, if applicable. + /// + public MusicAreaDto? EndArea { get; set; } + + /// + /// Gets or sets the date the artist started existing, if applicable. + /// + public DateOnly? LifeSpanBegin { get; set; } + + /// + /// Gets or sets the date the artist stopped existing, if applicable. + /// + public DateOnly? LifeSpanEnd { get; set; } + + /// + /// Gets or sets whether the artist no longer exists. + /// + public bool IsEnded { get; set; } + + /// + /// Gets or sets the list of genres associated with the artist. + /// + public List? Genres { get; set; } + + /// + /// Gets or sets the list of tags that further describe or categorize the artist. + /// + public List? Tags { get; set; } + + /// + /// Gets or sets the list of alternative names of the artist. + /// + public List? Aliases { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackDto.cs new file mode 100644 index 00000000..d11657b9 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackDto.cs @@ -0,0 +1,113 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object carrying the full details of a track, as stored in the media library. +/// +[DebuggerDisplay("Title: {Metadata?.Title}")] +public class MusicTrackDto +{ + /// + /// Gets or sets the Id of the track. + /// + public Guid Id { get; set; } + + /// + /// Gets or sets the Id of the album the track belongs to. + /// + public Guid AlbumId { get; set; } + + /// + /// Gets or sets the Id of the media library this track belongs to. + /// + public Guid LibraryId { get; set; } + + /// + /// Gets or sets the file system path of the track. + /// + public string Path { get; set; } = string.Empty; + + /// + /// Gets or sets the audio metadata of the track. + /// + public MusicTrackMetadataDto? Metadata { get; set; } + + /// + /// Gets or sets the number of the track on its disc. + /// + public int TrackNumber { get; set; } + + /// + /// Gets or sets the number of the disc the track belongs to, if applicable. + /// + public int? DiscNumber { get; set; } + + /// + /// Gets or sets the script used by the language of the track, if applicable. + /// + public string? Script { get; set; } + + /// + /// Gets or sets the musical key of the track, if applicable. + /// + public MusicKey? Key { get; set; } + + /// + /// Gets or sets the tempo of the track in beats per minute, if applicable. + /// + public int? Bpm { get; set; } + + /// + /// Gets or sets the work the track is a recording of, if applicable. + /// + public MusicWorkDto? Work { get; set; } + + /// + /// Gets or sets the MusicBrainz identifier of the recording, if applicable. + /// + public Guid? MusicBrainzRecordingId { get; set; } + + /// + /// Gets or sets the MusicBrainz identifier of the track, if applicable. + /// + public Guid? MusicBrainzTrackId { get; set; } + + /// + /// Gets or sets the date and time when the track was created. + /// + public DateTime CreatedOnUtc { get; set; } + + /// + /// Gets or sets the optional date and time when the track was updated. + /// + public DateTime? UpdatedOnUtc { get; set; } + + /// + /// Gets or sets the list of moods of the track. + /// + public List? Moods { get; set; } + + /// + /// Gets or sets the list of ISRC (International Standard Recording Code) of the track. + /// + public List? Isrcs { get; set; } + + /// + /// Gets or sets the list of references to the media contributors that performed on the track, each with the role they played. + /// + public List? Contributors { get; set; } + + /// + /// Gets or sets the list of ratings for this track. + /// + public List? Ratings { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackLiteDto.cs new file mode 100644 index 00000000..9e4a95f3 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackLiteDto.cs @@ -0,0 +1,38 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for a lightweight track element, containing only the properties needed by the client to display the tracks of an album. +/// +[DebuggerDisplay("Title: {Title}")] +public class MusicTrackLiteDto +{ + /// + /// Gets or sets the Id of the track. + /// + public Guid Id { get; set; } + + /// + /// Gets or sets the title of the track. + /// + public string Title { get; set; } = string.Empty; + + /// + /// Gets or sets the number of the track on its disc. + /// + public int TrackNumber { get; set; } + + /// + /// Gets or sets the number of the disc the track belongs to, if applicable. + /// + public int? DiscNumber { get; set; } + + /// + /// Gets or sets the duration of the track in seconds. + /// + public int DurationInSeconds { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackMetadataDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackMetadataDto.cs new file mode 100644 index 00000000..cfd7f619 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackMetadataDto.cs @@ -0,0 +1,119 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.Common; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for the audio metadata of a track. +/// +[DebuggerDisplay("Title: {Title}")] +public class MusicTrackMetadataDto +{ + /// + /// Gets or sets the title of the track. + /// + public string? Title { get; set; } + + /// + /// Gets or sets the original title of the track, if different from the current title. + /// + public string? OriginalTitle { get; set; } + + /// + /// Gets or sets a brief description or summary of the track. + /// + public string? Description { get; set; } + + /// + /// Gets or sets the disambiguation comment of the track, used to distinguish tracks with the same title. + /// + public string? Disambiguation { get; set; } + + /// + /// Gets or sets the release information, including release date and other relevant details. + /// + public ReleaseInfoDto? ReleaseInfo { get; set; } + + /// + /// Gets or sets the language of the track. + /// + public LanguageInfoDto? Language { get; set; } + + /// + /// Gets or sets the original language of the track, if it has been translated. + /// + public LanguageInfoDto? OriginalLanguage { get; set; } + + /// + /// Gets or sets the list of tags that further describe or categorize the track. + /// + public List? Tags { get; set; } + + /// + /// Gets or sets the list of genres associated with the track. + /// + public List? Genres { get; set; } + + /// + /// Gets or sets whether the recording of the track is a video recording. + /// + public bool IsVideo { get; set; } + + /// + /// Gets or sets the duration of the audio of the track in seconds. + /// + public int? DurationInSeconds { get; set; } + + /// + /// Gets or sets the sample rate of the audio of the track in Hz. + /// + public int? SampleRate { get; set; } + + /// + /// Gets or sets the number of audio channels of the track. + /// + public int? Channels { get; set; } + + /// + /// Gets or sets the bit depth of the audio of the track. + /// + public int? BitDepth { get; set; } + + /// + /// Gets or sets the audio codec used by the track. + /// + public string? AudioCodec { get; set; } + + /// + /// Gets or sets the bitrate of the audio of the track in kbps. + /// + public int? Bitrate { get; set; } + + /// + /// Gets or sets the AcoustID fingerprint identifier of the audio file of the track. + /// + public string? AcoustId { get; set; } + + /// + /// Gets or sets the ReplayGain track gain of the track in decibels. + /// + public decimal? ReplayGainTrackGain { get; set; } + + /// + /// Gets or sets the ReplayGain track peak of the track. + /// + public decimal? ReplayGainTrackPeak { get; set; } + + /// + /// Gets or sets the ReplayGain album gain of the track in decibels. + /// + public decimal? ReplayGainAlbumGain { get; set; } + + /// + /// Gets or sets the ReplayGain album peak of the track. + /// + public decimal? ReplayGainAlbumPeak { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicWorkDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicWorkDto.cs new file mode 100644 index 00000000..deec7c85 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/MusicWorkDto.cs @@ -0,0 +1,40 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.Common; +using System; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for a MusicBrainz work, the musical composition a track is a recording of. +/// +[DebuggerDisplay("Title: {Title}")] +public class MusicWorkDto +{ + /// + /// Gets or sets the MusicBrainz identifier of the work. + /// + public Guid? MusicBrainzWorkId { get; set; } + + /// + /// Gets or sets the title of the work. + /// + public string? Title { get; set; } + + /// + /// Gets or sets the MusicBrainz type of the work, if applicable. + /// + public string? Type { get; set; } + + /// + /// Gets or sets the list of languages of the work. + /// + public List? Languages { get; set; } + + /// + /// Gets or sets the list of ISWC (International Standard Musical Work Code) of the work. + /// + public List? Iswcs { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicAlbumLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicAlbumLiteDto.cs new file mode 100644 index 00000000..19cfaa36 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicAlbumLiteDto.cs @@ -0,0 +1,38 @@ +#region ========================================================================= USING ===================================================================================== +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for a paginated collection of lightweight album elements, together with pagination metadata. +/// +[DebuggerDisplay("CurrentPage: {CurrentPage}; Count: {Count}")] +public class PaginatedMusicAlbumLiteDto +{ + /// + /// Gets or sets the collection of lightweight album elements associated with this instance. + /// + public IReadOnlyList Data { get; set; } = []; + + /// + /// Gets or sets the current page number in a paginated collection. + /// + public int CurrentPage { get; set; } + + /// + /// Gets or sets the number of items to include per page in paginated results. + /// + public int PerPage { get; set; } + + /// + /// Gets or sets the total number of elements available in the paginated result set. + /// + public int Count { get; set; } + + /// + /// Gets or sets the total number of pages based on elements available in the result set and per page. + /// + public int NumberOfPages { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicArtistLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicArtistLiteDto.cs new file mode 100644 index 00000000..780e6638 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicArtistLiteDto.cs @@ -0,0 +1,38 @@ +#region ========================================================================= USING ===================================================================================== +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for a paginated collection of lightweight music artist elements, together with pagination metadata. +/// +[DebuggerDisplay("CurrentPage: {CurrentPage}; Count: {Count}")] +public class PaginatedMusicArtistLiteDto +{ + /// + /// Gets or sets the collection of lightweight music artist elements associated with this instance. + /// + public IReadOnlyList Data { get; set; } = []; + + /// + /// Gets or sets the current page number in a paginated collection. + /// + public int CurrentPage { get; set; } + + /// + /// Gets or sets the number of items to include per page in paginated results. + /// + public int PerPage { get; set; } + + /// + /// Gets or sets the total number of elements available in the paginated result set. + /// + public int Count { get; set; } + + /// + /// Gets or sets the total number of pages based on elements available in the result set and per page. + /// + public int NumberOfPages { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicTrackLiteDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicTrackLiteDto.cs new file mode 100644 index 00000000..6c112daa --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicTrackLiteDto.cs @@ -0,0 +1,38 @@ +#region ========================================================================= USING ===================================================================================== +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for a paginated collection of lightweight track elements, together with pagination metadata. +/// +[DebuggerDisplay("CurrentPage: {CurrentPage}; Count: {Count}")] +public class PaginatedMusicTrackLiteDto +{ + /// + /// Gets or sets the collection of lightweight track elements associated with this instance. + /// + public IReadOnlyList Data { get; set; } = []; + + /// + /// Gets or sets the current page number in a paginated collection. + /// + public int CurrentPage { get; set; } + + /// + /// Gets or sets the number of items to include per page in paginated results. + /// + public int PerPage { get; set; } + + /// + /// Gets or sets the total number of elements available in the paginated result set. + /// + public int Count { get; set; } + + /// + /// Gets or sets the total number of pages based on elements available in the result set and per page. + /// + public int NumberOfPages { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/UpdateMusicCoverDto.cs b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/UpdateMusicCoverDto.cs new file mode 100644 index 00000000..2c47c06a --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/AudioLibrary/MusicLibrary/UpdateMusicCoverDto.cs @@ -0,0 +1,17 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for the response of an update music cover operation. +/// +[DebuggerDisplay("CoverPath: {CoverPath}")] +public class UpdateMusicCoverDto +{ + /// + /// Gets or sets the relative path of the stored cover image. + /// + public string? CoverPath { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/Common/MediaArtworkDto.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/MediaArtworkDto.cs new file mode 100644 index 00000000..6bb1ced8 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/Common/MediaArtworkDto.cs @@ -0,0 +1,28 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.Enums.MediaLibrary; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.Common; + +/// +/// Data transfer object for a stored piece of artwork of a media item. +/// +[DebuggerDisplay("Type: {Type}, Ordinal: {Ordinal}, Path: {Path}")] +public class MediaArtworkDto +{ + /// + /// Gets or sets the type of the artwork, like the cover or the back of the media item. + /// + public ArtworkType Type { get; set; } + + /// + /// Gets or sets the ordinal of the artwork within its type, so that multiple artworks of the same type can be ordered. + /// + public int Ordinal { get; set; } + + /// + /// Gets or sets the relative path of the stored artwork file. + /// + public string Path { get; set; } = string.Empty; +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/Common/MoodDto.cs b/src/Lumina.Presentation.Web/Common/DTO/Common/MoodDto.cs new file mode 100644 index 00000000..97bcce0b --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/Common/MoodDto.cs @@ -0,0 +1,17 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.Common; + +/// +/// Data transfer object for a mood of a media element. +/// +[DebuggerDisplay("Name: {Name}")] +public class MoodDto +{ + /// + /// Gets or sets the name of the mood. + /// + public string? Name { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorReferenceDto.cs b/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorReferenceDto.cs new file mode 100644 index 00000000..94f117ff --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/DTO/MediaContributors/MediaContributorReferenceDto.cs @@ -0,0 +1,24 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.Enums.MediaContributors; +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.DTO.MediaContributors; + +/// +/// Data transfer object for the reference to a media contributor in a media item, carrying the role the contributor played. +/// +[DebuggerDisplay("{ContributorId} - {Role}")] +public class MediaContributorReferenceDto +{ + /// + /// Gets or sets the unique identifier of the media contributor. + /// + public Guid ContributorId { get; set; } + + /// + /// Gets or sets the role the contributor played. + /// + public MediaContributorRole? Role { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistGender.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistGender.cs new file mode 100644 index 00000000..8339bc74 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistGender.cs @@ -0,0 +1,32 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary; + +/// +/// Enumeration for the gender of a music artist, applicable only to artists that are persons or characters. +/// +[DebuggerDisplay("{ToString()}")] +public enum MusicArtistGender +{ + /// + /// The artist identifies as male. + /// + Male, + + /// + /// The artist identifies as female. + /// + Female, + + /// + /// The artist identifies with a gender other than male or female. + /// + Other, + + /// + /// The gender of the artist is not applicable, or is deliberately not stated. + /// + NotApplicable +} diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistType.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistType.cs new file mode 100644 index 00000000..68d21f09 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicArtistType.cs @@ -0,0 +1,42 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary; + +/// +/// Enumeration for the type of a music artist, describing whether the artist is an individual, an ensemble, or something else. +/// +[DebuggerDisplay("{ToString()}")] +public enum MusicArtistType +{ + /// + /// The artist is an individual person. + /// + Person, + + /// + /// The artist is a group of people that may or may not have a distinctive name. + /// + Group, + + /// + /// The artist is an orchestra, a large instrumental ensemble. + /// + Orchestra, + + /// + /// The artist is a choir or chorus, a large vocal ensemble. + /// + Choir, + + /// + /// The artist is an individual fictional character. + /// + Character, + + /// + /// The type of the artist does not fit into any of the known categories. + /// + Other +} diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicKey.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicKey.cs new file mode 100644 index 00000000..14d0fbc4 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicKey.cs @@ -0,0 +1,132 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary; + +/// +/// Enumeration for the musical key of a track, describing the pitch and the major or minor mode of the key. +/// +[DebuggerDisplay("{ToString()}")] +public enum MusicKey +{ + /// + /// The musical key of C major. + /// + CMajor, + + /// + /// The musical key of C sharp major. + /// + CSharpMajor, + + /// + /// The musical key of D major. + /// + DMajor, + + /// + /// The musical key of D sharp major. + /// + DSharpMajor, + + /// + /// The musical key of E major. + /// + EMajor, + + /// + /// The musical key of F major. + /// + FMajor, + + /// + /// The musical key of F sharp major. + /// + FSharpMajor, + + /// + /// The musical key of G major. + /// + GMajor, + + /// + /// The musical key of G sharp major. + /// + GSharpMajor, + + /// + /// The musical key of A major. + /// + AMajor, + + /// + /// The musical key of A sharp major. + /// + ASharpMajor, + + /// + /// The musical key of B major. + /// + BMajor, + + /// + /// The musical key of C minor. + /// + CMinor, + + /// + /// The musical key of C sharp minor. + /// + CSharpMinor, + + /// + /// The musical key of D minor. + /// + DMinor, + + /// + /// The musical key of D sharp minor. + /// + DSharpMinor, + + /// + /// The musical key of E minor. + /// + EMinor, + + /// + /// The musical key of F minor. + /// + FMinor, + + /// + /// The musical key of F sharp minor. + /// + FSharpMinor, + + /// + /// The musical key of G minor. + /// + GMinor, + + /// + /// The musical key of G sharp minor. + /// + GSharpMinor, + + /// + /// The musical key of A minor. + /// + AMinor, + + /// + /// The musical key of A sharp minor. + /// + ASharpMinor, + + /// + /// The musical key of B minor. + /// + BMinor +} diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicMediaFormat.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicMediaFormat.cs new file mode 100644 index 00000000..6090c575 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicMediaFormat.cs @@ -0,0 +1,577 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary; + +/// +/// Enumeration for the physical or digital medium of a music release. +/// +[DebuggerDisplay("{ToString()}")] +public enum MusicMediaFormat +{ + /// + /// The release was distributed on a 10 inch acetate disc. + /// + Inch10Acetate, + + /// + /// The release was distributed on a 10 inch shellac disc. + /// + Inch10Shellac, + + /// + /// The release was distributed on a 10 inch vinyl record. + /// + Inch10Vinyl, + + /// + /// The release was distributed on a 12 inch acetate disc. + /// + Inch12Acetate, + + /// + /// The release was distributed on a 12 inch LaserDisc. + /// + Inch12LaserDisc, + + /// + /// The release was distributed on a 12 inch shellac disc. + /// + Inch12Shellac, + + /// + /// The release was distributed on a 12 inch vinyl record. + /// + Inch12Vinyl, + + /// + /// The release was distributed on a 3 inch vinyl record. + /// + Inch3Vinyl, + + /// + /// The release was distributed on a 3.5 inch floppy disk. + /// + Inch3_5FloppyDisk, + + /// + /// The release was distributed on a 5.25 inch floppy disk. + /// + Inch5_25FloppyDisk, + + /// + /// The release was distributed on a 7 inch acetate disc. + /// + Inch7Acetate, + + /// + /// The release was distributed on a 7 inch flexi disc. + /// + Inch7FlexiDisc, + + /// + /// The release was distributed on a 7 inch shellac disc. + /// + Inch7Shellac, + + /// + /// The release was distributed on a 7 inch vinyl record. + /// + Inch7Vinyl, + + /// + /// The release was distributed on an 8 inch LaserDisc. + /// + Inch8LaserDisc, + + /// + /// The release was distributed on an 8-track cartridge. + /// + EightTrackCartridge, + + /// + /// The release was distributed on an 8 cm compact disc. + /// + Cm8CD, + + /// + /// The release was distributed on an 8 cm compact disc with graphics. + /// + Cm8CDPlusG, + + /// + /// The release was distributed on an 8 cm recordable compact disc. + /// + Cm8CDMinusR, + + /// + /// The release was distributed on an acetate disc. + /// + Acetate, + + /// + /// The release was distributed on a Betacam SP videotape. + /// + BetacamSP, + + /// + /// The release was distributed on a Betamax videocassette. + /// + Betamax, + + /// + /// The release was distributed on a Blu-ray disc. + /// + BluRay, + + /// + /// The release was distributed on a recordable Blu-ray disc. + /// + BluRayMinusR, + + /// + /// The release was distributed on a Blu-spec compact disc. + /// + BluSpecCD, + + /// + /// The release was distributed on a cartridge. + /// + Cartridge, + + /// + /// The release was distributed on a compact cassette. + /// + Cassette, + + /// + /// The release was distributed on a compact disc. + /// + CD, + + /// + /// The release was distributed on a compact disc with graphics. + /// + CDPlusG, + + /// + /// The release was distributed on a CD-i (compact disc interactive). + /// + CDMinusi, + + /// + /// The release was distributed on a recordable compact disc. + /// + CDMinusR, + + /// + /// The release was distributed on a CD Video. + /// + CDV, + + /// + /// The release was distributed on a Capacitance Electronic Disc. + /// + CED, + + /// + /// The release was distributed on a copy-controlled compact disc. + /// + CopyControlCD, + + /// + /// The release was distributed on a Digital Audio Tape. + /// + DAT, + + /// + /// The release was distributed on a compact disc used for data storage. + /// + DataCD, + + /// + /// The release was distributed on a DVD used for data storage. + /// + DataDVD, + + /// + /// The release was distributed on a recordable DVD used for data storage. + /// + DataDVDMinusR, + + /// + /// The release was distributed on a DataPlay disc. + /// + DataPlay, + + /// + /// The release was distributed on a Digital Compact Cassette. + /// + DCC, + + /// + /// The release was distributed as a digital download or stream. + /// + DigitalMedia, + + /// + /// The release was distributed on a download card. + /// + DownloadCard, + + /// + /// The release was distributed on a DTS-compatible compact disc. + /// + DTSCD, + + /// + /// The release was distributed on a DualDisc. + /// + DualDisc, + + /// + /// The release was distributed on the CD side of a DualDisc. + /// + DualDiscCDSide, + + /// + /// The release was distributed on the DVD side of a DualDisc. + /// + DualDiscDVDSide, + + /// + /// The release was distributed on the DVD-audio side of a DualDisc. + /// + DualDiscDVDAudioSide, + + /// + /// The release was distributed on the DVD-video side of a DualDisc. + /// + DualDiscDVDVideoSide, + + /// + /// The release was distributed on a DVD. + /// + DVD, + + /// + /// The release was distributed on a DVD-Audio. + /// + DVDAudio, + + /// + /// The release was distributed on a recordable DVD used for video. + /// + DVDMinusRVideo, + + /// + /// The release was distributed on a DVD-Video. + /// + DVDVideo, + + /// + /// The release was distributed on a DVD+. + /// + DVDPlus, + + /// + /// The release was distributed on the CD side of a DVD+. + /// + DVDPlusCDSide, + + /// + /// The release was distributed on the DVD-audio side of a DVD+. + /// + DVDPlusDVDAudioSide, + + /// + /// The release was distributed on the DVD-video side of a DVD+. + /// + DVDPlusDVDVideoSide, + + /// + /// The release was distributed on an Edison Diamond Disc. + /// + EdisonDiamondDisc, + + /// + /// The release was distributed on an enhanced compact disc. + /// + EnhancedCD, + + /// + /// The release was distributed on a flexi disc. + /// + FlexiDisc, + + /// + /// The release was distributed on a floppy disk. + /// + FloppyDisk, + + /// + /// The release was distributed on an HD DVD. + /// + HDDVD, + + /// + /// The release was distributed on a High Definition Compatible Digital compact disc. + /// + HDCD, + + /// + /// The release was distributed on a HiPac. + /// + HiPac, + + /// + /// The release was distributed on a High Quality compact disc. + /// + HQCD, + + /// + /// The release was distributed on a hybrid Super Audio CD. + /// + HybridSACD, + + /// + /// The release was distributed on the CD layer of a hybrid Super Audio CD. + /// + HybridSACDCDLayer, + + /// + /// The release was distributed on the SACD layer of a hybrid Super Audio CD. + /// + HybridSACDSACDLayer, + + /// + /// The release was distributed on the stereo SACD layer of a hybrid Super Audio CD. + /// + HybridSACDSACDLayer2Channels, + + /// + /// The release was distributed on the multichannel SACD layer of a hybrid Super Audio CD. + /// + HybridSACDSACDLayerMultichannel, + + /// + /// The release was distributed on a KiT album. + /// + KiTAlbum, + + /// + /// The release was distributed on a LaserDisc. + /// + LaserDisc, + + /// + /// The release was distributed on a microcassette. + /// + Microcassette, + + /// + /// The release was distributed on a microSD card. + /// + MicroSD, + + /// + /// The release was distributed on a MiniDisc. + /// + MiniDisc, + + /// + /// The release was distributed on a mini DVD. + /// + MiniDVD, + + /// + /// The release was distributed on a mini DVD-Audio. + /// + MiniDVDAudio, + + /// + /// The release was distributed on a mini DVD-Video. + /// + MiniDVDVideo, + + /// + /// The release was distributed on a MiniMax compact disc. + /// + MinimaxCD, + + /// + /// The release was distributed on a MiniMax DVD. + /// + MinimaxDVD, + + /// + /// The release was distributed on a MiniMax DVD-Audio. + /// + MinimaxDVDAudio, + + /// + /// The release was distributed on a MiniMax DVD-Video. + /// + MinimaxDVDVideo, + + /// + /// The release was distributed on a mixed-mode compact disc. + /// + MixedModeCD, + + /// + /// The medium of the release does not fall into any of the known categories. + /// + Other, + + /// + /// The release was distributed on a Pathe disc. + /// + PatheDisc, + + /// + /// The release was distributed on a phonograph record. + /// + PhonographRecord, + + /// + /// The release was distributed on a piano roll. + /// + PianoRoll, + + /// + /// The release was distributed on a Playbutton. + /// + Playbutton, + + /// + /// The release was distributed on a PlayTape. + /// + PlayTape, + + /// + /// The release was distributed on a reel-to-reel tape. + /// + ReelToReel, + + /// + /// The release was distributed on a read-only memory cartridge. + /// + ROMCartridge, + + /// + /// The release was distributed on a Super Audio CD. + /// + SACD, + + /// + /// The release was distributed on a stereo Super Audio CD. + /// + SACD2Channels, + + /// + /// The release was distributed on a multichannel Super Audio CD. + /// + SACDMultichannel, + + /// + /// The release was distributed on an SD card. + /// + SDCard, + + /// + /// The release was distributed on a shellac disc. + /// + Shellac, + + /// + /// The release was distributed on a Super High Material compact disc. + /// + SHMCD, + + /// + /// The release was distributed on a Super High Material Super Audio CD. + /// + SHMSACD, + + /// + /// The release was distributed on a multichannel Super High Material Super Audio CD. + /// + SHMSACDMultichannel, + + /// + /// The release was distributed on a slotMusic card. + /// + SlotMusic, + + /// + /// The release was distributed on a Super Video CD. + /// + SVCD, + + /// + /// The release was distributed on a Tefifon cartridge. + /// + Tefifon, + + /// + /// The release was distributed on a Universal Media Disc. + /// + UMD, + + /// + /// The release was distributed on a USB flash drive. + /// + USBFlashDrive, + + /// + /// The release was distributed on a Video CD. + /// + VCD, + + /// + /// The release was distributed on a Video High Density disc. + /// + VHD, + + /// + /// The release was distributed on a VHS videocassette. + /// + VHS, + + /// + /// The release was distributed on a vinyl record. + /// + Vinyl, + + /// + /// The release was distributed on a VinylDisc. + /// + VinylDisc, + + /// + /// The release was distributed on the CD side of a VinylDisc. + /// + VinylDiscCDSide, + + /// + /// The release was distributed on the DVD side of a VinylDisc. + /// + VinylDiscDVDSide, + + /// + /// The release was distributed on the vinyl side of a VinylDisc. + /// + VinylDiscVinylSide, + + /// + /// The release was distributed on a wax cylinder. + /// + WaxCylinder, + + /// + /// The release was distributed on a Zip disk. + /// + ZipDisk +} diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleasePackaging.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleasePackaging.cs new file mode 100644 index 00000000..d111e3a9 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleasePackaging.cs @@ -0,0 +1,132 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary; + +/// +/// Enumeration for the outermost physical packaging of a music release. +/// +[DebuggerDisplay("{ToString()}")] +public enum MusicReleasePackaging +{ + /// + /// The release is a book with a sleeve containing a medium, usually a compact disc. + /// + Book, + + /// + /// The release is a box with a lid or an opening that contains the medium and other packaging, like posters and a booklet. + /// + Box, + + /// + /// The release is a sleeve made of paper, paperboard, or cardboard. + /// + CardboardPaperSleeve, + + /// + /// The release is a regular plastic case for a cassette. + /// + CassetteCase, + + /// + /// The release is a minimalistic plastic case where the back and the front are kept together by a small hinge. + /// + ClamshellCase, + + /// + /// The release is a bounded booklet, usually in hardcover, with a sleeve bound to its spine that houses a compact disc. + /// + Digibook, + + /// + /// The release is a folded cardboard compact disc packaging that has a small pocket on one side for the disc. + /// + Digifile, + + /// + /// The release is a folded case, typically made of coated paperboard, with one or more plastic trays glued into it. + /// + Digipak, + + /// + /// The release is a pouch-like package with an internal mechanism that pushes the contents out when the lid flap is opened. + /// + DiscboxSlider, + + /// + /// The release is a double-sided, double-width jewel case normally holding two to four compact discs. + /// + Fatbox, + + /// + /// The release is a cardboard sleeve that folds in halves, thirds, or more, and can hold multiple records, compact discs, booklets, or posters. + /// + GatefoldCover, + + /// + /// The release is the traditional compact disc case, made of hard, brittle plastic. + /// + JewelCase, + + /// + /// The release is the traditional DVD case, made of soft plastic with a thin transparent cover protecting the artwork. + /// + KeepCase, + + /// + /// The release is a large cardboard box, often used to sell compact discs in North America so that they would fit vinyl racks. + /// + Longbox, + + /// + /// The release is an often decorated metal tin containing one or more compact discs. + /// + MetalTin, + + /// + /// The release is a sleeve made entirely of plastic that holds the medium and the other parts of the album. + /// + PlasticSleeve, + + /// + /// The release is a box with openings at its two ends that contains a tray holding the medium. + /// + Slidepack, + + /// + /// The release is a thinner jewel case, commonly used for compact disc singles. + /// + SlimJewelCase, + + /// + /// The release is a four or five-sided box that surrounds a second inner package such as a jewel case. + /// + Slipcase, + + /// + /// The release is a digipak-like case held together with a snapping plastic closure. + /// + SnapCase, + + /// + /// The release is a cardboard jacket, commonly used for 8cm compact disc singles in Japan. + /// + SnapPack, + + /// + /// The release is a case similar to the regular jewel case, but with rounded corners and a latch closing mechanism. + /// + SuperJewelBox, + + /// + /// The packaging of the release does not fit into any of the known categories. + /// + Other, + + /// + /// The release has no packaging at all, which is common for digital media. + /// + None +} diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseStatus.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseStatus.cs new file mode 100644 index 00000000..f5b871f4 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseStatus.cs @@ -0,0 +1,47 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary; + +/// +/// Enumeration for the status of a music release, describing the officiality of the release. +/// +[DebuggerDisplay("{ToString()}")] +public enum MusicReleaseStatus +{ + /// + /// The release was distributed without the authorization of the artist or label. + /// + Bootleg, + + /// + /// The release was announced but never distributed. + /// + Cancelled, + + /// + /// The release was expunged from the catalog of the artist or label. + /// + Expunged, + + /// + /// The release was released through official channels. + /// + Official, + + /// + /// The release was distributed for promotional purposes only. + /// + Promotion, + + /// + /// The release is a pseudo-release, not an actual release by the artist. + /// + PseudoRelease, + + /// + /// The release was distributed but later withdrawn from circulation. + /// + Withdrawn +} diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseType.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseType.cs new file mode 100644 index 00000000..900d45fb --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/MusicReleaseType.cs @@ -0,0 +1,97 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary; + +/// +/// Enumeration for the type of a music release, describing the format of the release in terms of its content. +/// +[DebuggerDisplay("{ToString()}")] +public enum MusicReleaseType +{ + /// + /// A release consisting of a collection of tracks. + /// + Album, + + /// + /// A release that was aired as a broadcast. + /// + Broadcast, + + /// + /// A release that is longer than a single but shorter than an album. + /// + Ep, + + /// + /// The type of the release does not fall into any of the known categories. + /// + Other, + + /// + /// A release consisting of a small number of tracks. + /// + Single, + + /// + /// A release containing a dramatized audio performance. + /// + AudioDrama, + + /// + /// A release containing a recording of a book being read aloud. + /// + AudioBook, + + /// + /// A release that gathers tracks from various sources or artists. + /// + Compilation, + + /// + /// A release containing a continuous mix of tracks by a DJ. + /// + DjMix, + + /// + /// A release of demo recordings, typically distributed before the official release. + /// + Demo, + + /// + /// A release containing an audio recording made outside of a studio. + /// + FieldRecording, + + /// + /// A release containing a recorded interview. + /// + Interview, + + /// + /// A release recorded during a live performance. + /// + Live, + + /// + /// A release containing a compilation of tracks, typically distributed outside of official channels. + /// + Mixtape, + + /// + /// A release containing modified or reinterpreted versions of original recordings. + /// + Remix, + + /// + /// A release containing music written for a motion picture or television program. + /// + Soundtrack, + + /// + /// A release containing spoken word content. + /// + SpokenWord +} diff --git a/src/Lumina.Presentation.Web/Common/Enums/MediaLibrary/ArtworkType.cs b/src/Lumina.Presentation.Web/Common/Enums/MediaLibrary/ArtworkType.cs new file mode 100644 index 00000000..d152e291 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Enums/MediaLibrary/ArtworkType.cs @@ -0,0 +1,92 @@ +namespace Lumina.Presentation.Web.Common.Enums.MediaLibrary; + +/// +/// Enumeration for the type of artwork of a media library item. +/// +public enum ArtworkType +{ + /// + /// The main artwork of the media library item, like the cover of a book. + /// + Cover, + + /// + /// The front of the artwork of the media library item, when it is stored separately from the cover. + /// + Front, + + /// + /// The back of the artwork of the media library item. + /// + Back, + + /// + /// A page of the booklet of the media library item. + /// + Booklet, + + /// + /// The artwork printed on the medium of the media library item, like a disc label. + /// + Medium, + + /// + /// The artwork printed on the tray of the media library item. + /// + Tray, + + /// + /// The artwork printed on the spine of the media library item. + /// + Spine, + + /// + /// The obi strip of the media library item. + /// + Obi, + + /// + /// The sticker of the media library item. + /// + Sticker, + + /// + /// The poster of the media library item. + /// + Poster, + + /// + /// The liner notes of the media library item. + /// + Liner, + + /// + /// A watermark carried by the artwork of the media library item. + /// + Watermark, + + /// + /// The backdrop, or fanart, of the media library item. + /// + Backdrop, + + /// + /// The banner of the media library item. + /// + Banner, + + /// + /// The logo of the media library item. + /// + Logo, + + /// + /// The thumbnail of the media library item. + /// + Thumb, + + /// + /// Any other artwork of the media library item. + /// + Other, +} diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbumsLiteRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbumsLiteRequest.cs new file mode 100644 index 00000000..71b7b956 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbumsLiteRequest.cs @@ -0,0 +1,21 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; + +/// +/// Represents a request to get the lightweight details of the albums of a music artist. +/// +/// The unique identifier of the artist whose albums are retrieved, taken from the route. Required. +/// The unique identifier of the media library the artist belongs to. Required. +/// The page of results to retrieve. Optional. +/// The maximum number of albums to retrieve per page. Optional. +[DebuggerDisplay("ArtistId: {ArtistId}")] +public record GetArtistAlbumsLiteRequest( + string ArtistId, + Guid LibraryId, + int? CurrentPage, + int? PerPage +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbumViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbumViewRequest.cs new file mode 100644 index 00000000..dd8d1a95 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbumViewRequest.cs @@ -0,0 +1,19 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; + +/// +/// Represents a request for displaying the details of an album of a music artist. +/// +/// The unique identifier of the artist the album belongs to, taken from the route. Required. +/// The unique identifier of the album whose details are displayed, taken from the route. Required. +/// The Id of the media library the album belongs to. Required. +[DebuggerDisplay("AlbumId: {AlbumId}")] +public record GetMusicAlbumViewRequest( + string ArtistId, + string AlbumId, + Guid LibraryId +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/UpdateMusicAlbumRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/UpdateMusicAlbumRequest.cs new file mode 100644 index 00000000..b66ed2aa --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/UpdateMusicAlbumRequest.cs @@ -0,0 +1,42 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; + +/// +/// Represents a request to update an existing album of a music artist. +/// +/// The album metadata of the album. Required. +/// The physical or digital medium of the album. Optional. +/// The outermost physical packaging of the album. Optional. +/// The barcode of the album. Optional. +/// The catalog numbers of the album. Optional. +/// The name of the label that issued the album. Optional. +/// The ASIN (Amazon Standard Identification Number) of the album. Optional. +/// The MusicBrainz identifier of the release. Optional. +/// The MusicBrainz identifier of the release group. Optional. +/// The MusicBrainz identifier of the release artist. Optional. +/// The list of media contributors that performed on the album. Required. +/// The list of ratings for this album. Required. +[DebuggerDisplay("Title: {Metadata?.Title}")] +public record UpdateMusicAlbumRequest( + MusicAlbumMetadataDto? Metadata, + MusicMediaFormat? MediaFormat, + MusicReleasePackaging? Packaging, + string? Barcode, + List? CatalogNumbers, + string? Label, + string? ASIN, + Guid? MusicBrainzReleaseId, + Guid? MusicBrainzReleaseGroupId, + Guid? MusicBrainzReleaseArtistId, + List? Contributors, + List? Ratings +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistViewRequest.cs new file mode 100644 index 00000000..76277f04 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistViewRequest.cs @@ -0,0 +1,17 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Represents a request for displaying the details of a music artist. +/// +/// The unique identifier of the artist whose details are displayed, taken from the route. Required. +/// The Id of the media library the artist belongs to. Required. +[DebuggerDisplay("ArtistId: {ArtistId}")] +public record GetMusicArtistViewRequest( + string ArtistId, + Guid LibraryId +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsLiteRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsLiteRequest.cs new file mode 100644 index 00000000..3c4da161 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsLiteRequest.cs @@ -0,0 +1,34 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.Enums.Common; +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Represents a request to get the lightweight details of the artists of a media library. +/// +/// The unique identifier of the media library whose artists are retrieved. Required. +/// The page of results to retrieve. Optional. +/// The maximum number of artists to retrieve per page. Optional. +/// The search term used to filter the artists by name. Optional. +/// +/// The alpha key used to filter the results by the first character of their name, for the alpha picker. Optional. +/// Can be to disable alpha filtering, a single ASCII letter (case-insensitive) to filter by that letter, +/// "#" to filter by names whose first character is a digit, or "*" to filter by names whose first character is neither a letter nor a digit. +/// +/// Whether the leading "The " prefix of a name is ignored when computing the alpha key, or not. Optional. +/// The name of the field by which to sort the results. Optional. +/// The direction in which to sort the results. Optional. +[DebuggerDisplay("LibraryId: {LibraryId}")] +public record GetMusicArtistsLiteRequest( + Guid LibraryId, + int? CurrentPage, + int? PerPage, + string? SearchTerm, + string? FilterAlphaKey, + bool ShouldIgnoreThePrefixForAlphaPicker, + string? SortBy, + SortOrder? SortOrder +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsViewRequest.cs new file mode 100644 index 00000000..9a8efa54 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsViewRequest.cs @@ -0,0 +1,15 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Represents a request for displaying the music artists browsing view. +/// +/// The unique identifier of the media library whose artists are browsed. Optional. +[DebuggerDisplay("LibraryId: {LibraryId}")] +public record GetMusicArtistsViewRequest( + Guid? LibraryId +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistAlbumRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistAlbumRequest.cs new file mode 100644 index 00000000..4dbaaeaa --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistAlbumRequest.cs @@ -0,0 +1,46 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Represents a request to update an album of an artist, together with the tracks of the album, within an artist update. +/// +/// The Id of the album, when the album already exists. Optional. +/// The album metadata of the album. Required. +/// The physical or digital medium of the album. Optional. +/// The outermost physical packaging of the album. Optional. +/// The barcode of the album. Optional. +/// The catalog numbers of the album. Optional. +/// The name of the label that issued the album. Optional. +/// The ASIN (Amazon Standard Identification Number) of the album. Optional. +/// The MusicBrainz identifier of the release. Optional. +/// The MusicBrainz identifier of the release group. Optional. +/// The MusicBrainz identifier of the release artist. Optional. +/// The list of media contributors that performed on the album. Required. +/// The list of ratings for this album. Required. +/// The list of tracks of the album, each with the Id of the track when the track already exists. Required. +[DebuggerDisplay("Title: {Metadata?.Title}")] +public record UpdateMusicArtistAlbumRequest( + Guid? AlbumId, + MusicAlbumMetadataDto? Metadata, + MusicMediaFormat? MediaFormat, + MusicReleasePackaging? Packaging, + string? Barcode, + List? CatalogNumbers, + string? Label, + string? ASIN, + Guid? MusicBrainzReleaseId, + Guid? MusicBrainzReleaseGroupId, + Guid? MusicBrainzReleaseArtistId, + List? Contributors, + List? Ratings, + List? Tracks +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistRequest.cs new file mode 100644 index 00000000..6acce614 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistRequest.cs @@ -0,0 +1,33 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using System; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Represents a request to update a music artist, together with the albums of the artist and the tracks of those albums. +/// +/// The metadata of the artist. Required. +/// The website of the artist. Optional. +/// The MusicBrainz identifier of the artist. Optional. +/// The list of IPI (Interested Party Information) codes of the artist. Optional. +/// The list of ISNI (International Standard Name Identifier) codes of the artist. Optional. +/// The list of media contributors that make up the artist. Required. +/// The list of ratings for the artist. Required. +/// The list of albums of the artist, each with its own list of tracks. Required. +[DebuggerDisplay("Name: {Metadata?.Name}")] +public record UpdateMusicArtistRequest( + MusicArtistMetadataDto? Metadata, + string? Website, + Guid? MusicBrainzArtistId, + List? Ipis, + List? Isnis, + List? Contributors, + List? Ratings, + List? Albums +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistTrackRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistTrackRequest.cs new file mode 100644 index 00000000..b9e0c36f --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistTrackRequest.cs @@ -0,0 +1,49 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Represents a request to update a track of an album of an artist, within an artist update. +/// +/// The Id of the track, when the track already exists. Optional. +/// The file system path of the track. Required. +/// The audio metadata of the track. Required. +/// The number of the track on its disc. Required. +/// The number of the disc the track belongs to. Optional. +/// The script used by the language of the track. Optional. +/// The musical key of the track. Optional. +/// The tempo of the track in beats per minute. Optional. +/// The work the track is a recording of. Optional. +/// The MusicBrainz identifier of the recording. Optional. +/// The MusicBrainz identifier of the track. Optional. +/// The list of moods of the track. Optional. +/// The list of ISRC (International Standard Recording Code) of the track. Optional. +/// The list of media contributors that performed on the track. Required. +/// The list of ratings for this track. Required. +[DebuggerDisplay("Title: {Metadata?.Title}")] +public record UpdateMusicArtistTrackRequest( + Guid? TrackId, + string? Path, + MusicTrackMetadataDto? Metadata, + int? TrackNumber, + int? DiscNumber, + string? Script, + MusicKey? Key, + int? Bpm, + MusicWorkDto? Work, + Guid? MusicBrainzRecordingId, + Guid? MusicBrainzTrackId, + List? Moods, + List? Isrcs, + List? Contributors, + List? Ratings +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracksLiteRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracksLiteRequest.cs new file mode 100644 index 00000000..dbcaaf42 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracksLiteRequest.cs @@ -0,0 +1,23 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; + +/// +/// Represents a request to get the lightweight details of the tracks of an album. +/// +/// The unique identifier of the artist the album belongs to, taken from the route. Required. +/// The unique identifier of the album whose tracks are retrieved, taken from the route. Required. +/// The unique identifier of the media library the album belongs to. Required. +/// The page of results to retrieve. Optional. +/// The maximum number of tracks to retrieve per page. Optional. +[DebuggerDisplay("AlbumId: {AlbumId}")] +public record GetAlbumTracksLiteRequest( + string ArtistId, + string AlbumId, + Guid LibraryId, + int? CurrentPage, + int? PerPage +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrackViewRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrackViewRequest.cs new file mode 100644 index 00000000..8dd2341f --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrackViewRequest.cs @@ -0,0 +1,21 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; + +/// +/// Represents a request for displaying the details of a track of an album of a music artist. +/// +/// The unique identifier of the artist the album belongs to, taken from the route. Required. +/// The unique identifier of the album the track belongs to, taken from the route. Required. +/// The unique identifier of the track whose details are displayed, taken from the route. Required. +/// The Id of the media library the track belongs to. Required. +[DebuggerDisplay("TrackId: {TrackId}")] +public record GetMusicTrackViewRequest( + string ArtistId, + string AlbumId, + string TrackId, + Guid LibraryId +); diff --git a/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/UpdateMusicTrackRequest.cs b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/UpdateMusicTrackRequest.cs new file mode 100644 index 00000000..aa98dfed --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/UpdateMusicTrackRequest.cs @@ -0,0 +1,47 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; + +/// +/// Represents a request to update an existing track of an album of a music artist. +/// +/// The file system path of the track. Required. +/// The audio metadata of the track. Required. +/// The number of the track on its disc. Required. +/// The number of the disc the track belongs to. Optional. +/// The script used by the language of the track. Optional. +/// The musical key of the track. Optional. +/// The tempo of the track in beats per minute. Optional. +/// The work the track is a recording of. Optional. +/// The MusicBrainz identifier of the recording. Optional. +/// The MusicBrainz identifier of the track. Optional. +/// The list of moods of the track. Optional. +/// The list of ISRC (International Standard Recording Code) of the track. Optional. +/// The list of media contributors that performed on the track. Required. +/// The list of ratings for this track. Required. +[DebuggerDisplay("Title: {Metadata?.Title}")] +public record UpdateMusicTrackRequest( + string? Path, + MusicTrackMetadataDto? Metadata, + int? TrackNumber, + int? DiscNumber, + string? Script, + MusicKey? Key, + int? Bpm, + MusicWorkDto? Work, + Guid? MusicBrainzRecordingId, + Guid? MusicBrainzTrackId, + List? Moods, + List? Isrcs, + List? Contributors, + List? Ratings +); diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Music.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Music.cs new file mode 100644 index 00000000..e1778db2 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Music.cs @@ -0,0 +1,28 @@ +namespace Lumina.Presentation.Web.Common.Routes; + +/// +/// Class for the collection of remote API routes called by this Web application. +/// +public static partial class ApiRoutes +{ + /// + /// Routes for the music library endpoints of the remote API. + /// + public static class Music + { + public const string GET_ARTISTS_LITE = "libraries/{libraryId}/artists/lite"; + public const string GET_ARTIST = "libraries/{libraryId}/artists/{artistId}"; + public const string UPDATE_ARTIST = "libraries/{libraryId}/artists/{artistId}"; + public const string UPDATE_ARTIST_COVER = "libraries/{libraryId}/artists/{artistId}/cover"; + public const string DELETE_ARTIST = "libraries/{libraryId}/artists/{artistId}"; + public const string GET_ARTIST_ALBUMS_LITE = "libraries/{libraryId}/artists/{artistId}/albums/lite"; + public const string GET_ALBUM = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}"; + public const string UPDATE_ALBUM = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}"; + public const string UPDATE_ALBUM_COVER = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover"; + public const string DELETE_ALBUM = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}"; + public const string GET_ALBUM_TRACKS_LITE = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/lite"; + public const string GET_TRACK = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}"; + public const string UPDATE_TRACK = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}"; + public const string DELETE_TRACK = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}"; + } +} diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Music.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Music.cs new file mode 100644 index 00000000..dd707299 --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Music.cs @@ -0,0 +1,32 @@ +namespace Lumina.Presentation.Web.Common.Routes; + +/// +/// Class for the collection of routes defined in the Web application. +/// +public static partial class WebRoutes +{ + /// + /// Routes for the music library pages. + /// + public static class Music + { + public const string ARTISTS_INDEX = "{culture}/library/audio-library/music-library/artists"; + public const string GET_ARTISTS = "{culture}/library/audio-library/music-library/artists/api-get-artists"; + public const string ARTIST = "{culture}/library/audio-library/music-library/artists/{artistId}"; + public const string GET_ARTIST = "{culture}/library/audio-library/music-library/artists/{artistId}/api-get-artist"; + public const string SAVE_ARTIST = "{culture}/library/audio-library/music-library/artists/{artistId}/api-save-artist"; + public const string UPDATE_ARTIST_COVER = "{culture}/library/audio-library/music-library/artists/{artistId}/api-update-cover"; + public const string DELETE_ARTIST = "{culture}/library/audio-library/music-library/artists/{artistId}/api-delete-artist"; + public const string GET_ARTIST_ALBUMS = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/api-get-albums"; + public const string ALBUM = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}"; + public const string GET_ALBUM = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-get-album"; + public const string SAVE_ALBUM = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-save-album"; + public const string UPDATE_ALBUM_COVER = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-update-cover"; + public const string DELETE_ALBUM = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-delete-album"; + public const string GET_ALBUM_TRACKS = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/api-get-tracks"; + public const string TRACK = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}"; + public const string GET_TRACK = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-get-track"; + public const string SAVE_TRACK = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-save-track"; + public const string DELETE_TRACK = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-delete-track"; + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpoint.cs new file mode 100644 index 00000000..819810d7 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpoint.cs @@ -0,0 +1,64 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.DeleteMusicAlbum; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-delete-album route. +/// +public class DeleteMusicAlbumEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public DeleteMusicAlbumEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.DELETE); + Routes(WebRoutes.Music.DELETE_ALBUM); + DontAutoTag(); + Options(options => options.WithTags("Music")); + EnableAntiforgery(); + } + + /// + /// Deletes the music album identified by the route. + /// + /// The request object. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken) + { + // The album is identified by the {artistId} and {albumId} route values; all ids are normalized to Guids before they are substituted + // into the upstream URL, so that a crafted value can never escape its URL segment, and an unparseable id is reported by the API as a + // missing id. + string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty; + string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString(); + string routeAlbumId = HttpContext.Request.RouteValues["albumId"]?.ToString() ?? string.Empty; + string albumId = Guid.TryParse(routeAlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString(); + string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString(); + string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString(); + + await _apiHttpClient.DeleteAsync(ApiRoutes.Music.DELETE_ALBUM.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId).Replace("{albumId}", albumId), cancellationToken).ConfigureAwait(false); + return JsonSuccess(); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointSummary.cs new file mode 100644 index 00000000..3386ca71 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointSummary.cs @@ -0,0 +1,24 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.DeleteMusicAlbum; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicAlbumEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public DeleteMusicAlbumEndpointSummary() + { + Summary = "Deletes a music album."; + Description = "Deletes the music album identified by the route, together with its tracks."; + + Response(200, "The music album was deleted."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpoint.cs new file mode 100644 index 00000000..0a491be2 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpoint.cs @@ -0,0 +1,133 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Themes; +using Lumina.Presentation.Web.Common.Primitives; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Common.Services; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Lumina.Presentation.Web.Core.Themes; +using Microsoft.AspNetCore.Antiforgery; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Localization; +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.EditMusicAlbum; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId} route. +/// +public class EditMusicAlbumViewEndpoint : BaseEndpoint +{ + // The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath. + private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Library.AudioLibrary.MusicLibrary.Albums.Item"; + private const string VIEW_RESOURCE_LOCATION = "Lumina.Presentation.Web"; + // The page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope. + private const string VIEW_PAGE_KEY = "library/audio-library/music-library/albums/item"; + + private static readonly JsonSerializerOptions s_camelCaseJsonOptions = new() + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + Converters = { new JsonStringEnumConverter() } + }; + + private readonly IApiHttpClient _apiHttpClient; + private readonly IUrlService _urlService; + private readonly ThemePageRenderer _themePageRenderer; + private readonly IAntiforgery _antiforgery; + private readonly IStringLocalizer _localizer; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + /// Injected service for generating URLs from action and controller names, with localization. + /// Injected service for rendering themed pages. + /// Injected service for anti-forgery token handling. + /// Injected factory used to create the localizer of the view resources. + public EditMusicAlbumViewEndpoint(IApiHttpClient apiHttpClient, IUrlService urlService, ThemePageRenderer themePageRenderer, IAntiforgery antiforgery, IStringLocalizerFactory stringLocalizerFactory) + { + _apiHttpClient = apiHttpClient; + _urlService = urlService; + _themePageRenderer = themePageRenderer; + _antiforgery = antiforgery; + _localizer = stringLocalizerFactory.Create(VIEW_RESOURCE_BASE_NAME, VIEW_RESOURCE_LOCATION); + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.GET); + Routes(WebRoutes.Music.ALBUM); + DontAutoTag(); + Options(options => options.WithTags("Music")); + } + + /// + /// Displays the music album details and editing view, rendered by the active theme with a fallback to the Razor view. + /// + /// The request containing the Id of the album to view. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(GetMusicAlbumViewRequest request, CancellationToken cancellationToken) + { + // The view needs the full details of the album to show its current values, so they are fetched from the API up front; the route + // values are normalized to Guids before they are substituted into the upstream URL, so that a crafted route value can never escape + // its URL segment, and an unparseable id is reported by the API as a missing album id. + request = request with { ArtistId = Guid.TryParse(request.ArtistId, out Guid artistId) ? artistId.ToString() : Guid.Empty.ToString() }; + request = request with { AlbumId = Guid.TryParse(request.AlbumId, out Guid albumId) ? albumId.ToString() : Guid.Empty.ToString() }; + MusicAlbumDto album = await _apiHttpClient.GetAsync(ApiRoutes.Music.GET_ALBUM.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId).Replace("{albumId}", request.AlbumId), cancellationToken).ConfigureAwait(false); + string title = album.Metadata?.Title ?? string.Empty; + + // The themed view is a regular page that submits its own requests, so a fresh anti-forgery token must be issued for it. + AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext); + + ThemePageDto pageModel = new() + { + PageKey = VIEW_PAGE_KEY, + Title = title, + Description = string.Empty, + PageData = new Dictionary + { + ["artistId"] = album.ArtistId.ToString(), + ["albumId"] = album.Id.ToString(), + ["libraryId"] = album.LibraryId.ToString(), + ["antiforgeryToken"] = antiforgeryTokens.RequestToken, + ["saveUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.SAVE_ALBUM, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty, + ["deleteUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_ALBUM, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty, + ["tracksUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ALBUM_TRACKS, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty, + ["trackUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.TRACK, new { artistId = default(Guid), albumId = default(Guid), trackId = default(Guid) }) ?? string.Empty, + ["coverUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.UPDATE_ALBUM_COVER, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty, + ["backUrl"] = (_urlService.GetAbsoluteUrl(WebRoutes.Music.ARTIST, new { artistId = album.ArtistId }) ?? string.Empty) + "?libraryId=" + album.LibraryId, + ["albumJson"] = JsonSerializer.Serialize(album, s_camelCaseJsonOptions), + ["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer), + ["stringsJson"] = JsonSerializer.Serialize(ThemePageDataFactory.CreateLocalizedStrings(_localizer), s_camelCaseJsonOptions) + } + }; + + Result sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false); + if (sectionResult.IsFailure) + { + Dictionary viewData = new() + { + ["Title"] = title + }; + return View("/Core/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.cshtml", album, viewData); + } + + return View( + "/Core/Views/Shared/_ThemedView.cshtml", + new ThemeViewDto(sectionResult.Value.Content, sectionResult.Value.Script), + new Dictionary { ["Title"] = title }); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointSummary.cs new file mode 100644 index 00000000..ab2881d2 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointSummary.cs @@ -0,0 +1,29 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.EditMusicAlbum; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class EditMusicAlbumViewEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public EditMusicAlbumViewEndpointSummary() + { + Summary = "Renders the music album details and editing view."; + Description = "Renders the view for displaying and editing the music album identified by the route."; + + RequestParam(r => r.ArtistId, "The unique identifier of the artist the album belongs to. Required."); + RequestParam(r => r.AlbumId, "The unique identifier of the album to display. Required."); + RequestParam(r => r.LibraryId, "The unique identifier of the media library the album belongs to. Required."); + + Response(200, "The view for displaying and editing the music album is rendered."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpoint.cs new file mode 100644 index 00000000..11ddeb00 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpoint.cs @@ -0,0 +1,77 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetArtistAlbums; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/api-get-albums route. +/// +public class GetArtistAlbumsEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public GetArtistAlbumsEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.GET); + Routes(WebRoutes.Music.GET_ARTIST_ALBUMS); + DontAutoTag(); + Options(options => options.WithTags("Music")); + } + + /// + /// Retrieves the lightweight details of the albums of a music artist. + /// + /// The request containing the parameters used to retrieve the albums. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(GetArtistAlbumsLiteRequest request, CancellationToken cancellationToken) + { + PaginatedMusicAlbumLiteDto response = await _apiHttpClient.GetAsync(BuildItemsEndpoint(request), cancellationToken).ConfigureAwait(false); + return JsonSuccess(response); + } + + /// + /// Builds the API endpoint used to retrieve the lightweight details of the albums of a music artist. + /// + /// The request containing the parameters used to retrieve the albums. + /// The API endpoint to which the retrieval request is sent. + private static string BuildItemsEndpoint(GetArtistAlbumsLiteRequest query) + { + // The route value is normalized to a Guid before it is substituted into the upstream URL, so that a crafted route value can never + // escape its URL segment, and an unparseable id is reported by the API as a missing artist id. + string artistId = Guid.TryParse(query.ArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString(); + StringBuilder endpoint = new(ApiRoutes.Music.GET_ARTIST_ALBUMS_LITE.Replace("{libraryId}", query.LibraryId.ToString()).Replace("{artistId}", artistId)); + List parameters = []; + if (query.CurrentPage is not null) + parameters.Add($"currentPage={query.CurrentPage}"); + if (query.PerPage is not null) + parameters.Add($"perPage={query.PerPage}"); + if (parameters.Count > 0) + endpoint.Append('?').Append(string.Join('&', parameters)); + return endpoint.ToString(); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs new file mode 100644 index 00000000..19597ae8 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointSummary.cs @@ -0,0 +1,38 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using System; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetArtistAlbums; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class GetArtistAlbumsEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public GetArtistAlbumsEndpointSummary() + { + Summary = "Retrieves the lightweight details of the albums of a music artist."; + Description = "Retrieves the lightweight read models of the albums of the music artist identified by the route."; + + RequestParam(r => r.ArtistId, "The unique identifier of the artist whose albums are retrieved. Required."); + RequestParam(r => r.LibraryId, "The Id of the media library the artist belongs to. Required."); + RequestParam(r => r.CurrentPage, "The page of results to retrieve. Optional."); + RequestParam(r => r.PerPage, "The maximum number of albums to retrieve per page. Optional."); + + ExampleRequest = new GetArtistAlbumsLiteRequest( + ArtistId: Guid.NewGuid().ToString(), + LibraryId: Guid.NewGuid(), + CurrentPage: 1, + PerPage: 10 + ); + + Response(200, "The lightweight details of the albums of the music artist are retrieved."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpoint.cs new file mode 100644 index 00000000..34ab493f --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpoint.cs @@ -0,0 +1,60 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetMusicAlbum; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-get-album route. +/// +public class GetMusicAlbumEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public GetMusicAlbumEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.GET); + Routes(WebRoutes.Music.GET_ALBUM); + DontAutoTag(); + Options(options => options.WithTags("Music")); + } + + /// + /// Retrieves the full details of the music album identified by . + /// + /// The request containing the Id of the album to retrieve. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(GetMusicAlbumViewRequest request, CancellationToken cancellationToken) + { + // The route values are normalized to Guids before they are substituted into the upstream URL, so that a crafted route value can never + // escape its URL segment, and an unparseable id is reported by the API as a missing album id. + request = request with { ArtistId = Guid.TryParse(request.ArtistId, out Guid artistId) ? artistId.ToString() : Guid.Empty.ToString() }; + request = request with { AlbumId = Guid.TryParse(request.AlbumId, out Guid albumId) ? albumId.ToString() : Guid.Empty.ToString() }; + + MusicAlbumDto album = await _apiHttpClient.GetAsync(ApiRoutes.Music.GET_ALBUM.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId).Replace("{albumId}", request.AlbumId), cancellationToken).ConfigureAwait(false); + return JsonSuccess(album); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointSummary.cs new file mode 100644 index 00000000..015782f5 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointSummary.cs @@ -0,0 +1,29 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetMusicAlbum; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class GetMusicAlbumEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public GetMusicAlbumEndpointSummary() + { + Summary = "Retrieves the full details of a music album."; + Description = "Retrieves the full details of the music album identified by the route."; + + RequestParam(r => r.ArtistId, "The unique identifier of the artist the album belongs to. Required."); + RequestParam(r => r.AlbumId, "The unique identifier of the album to retrieve. Required."); + RequestParam(r => r.LibraryId, "The unique identifier of the media library the album belongs to. Required."); + + Response(200, "The full details of the music album are retrieved."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpoint.cs new file mode 100644 index 00000000..714c1330 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpoint.cs @@ -0,0 +1,67 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.SaveMusicAlbum; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-save-album route. +/// +public class SaveMusicAlbumEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public SaveMusicAlbumEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.PUT); + Routes(WebRoutes.Music.SAVE_ALBUM); + DontAutoTag(); + Options(options => options.WithTags("Music")); + EnableAntiforgery(); + } + + /// + /// Updates the music album described by . + /// + /// The request containing the edited details of the album. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(UpdateMusicAlbumRequest request, CancellationToken cancellationToken) + { + // The album is identified by the {artistId} and {albumId} route values, not by any id posted in the body, so that a mismatched id can + // never redirect the update to another album; all ids are normalized to Guids before they are substituted into the upstream URL, so + // that a crafted value can never escape its URL segment, and an unparseable id is reported by the API as a missing id. + string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty; + string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString(); + string routeAlbumId = HttpContext.Request.RouteValues["albumId"]?.ToString() ?? string.Empty; + string albumId = Guid.TryParse(routeAlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString(); + string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString(); + string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString(); + + MusicAlbumDto album = await _apiHttpClient.PutAsync( + ApiRoutes.Music.UPDATE_ALBUM.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId).Replace("{albumId}", albumId), request, cancellationToken).ConfigureAwait(false); + return JsonSuccess(album); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointSummary.cs new file mode 100644 index 00000000..30deab2e --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointSummary.cs @@ -0,0 +1,25 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.SaveMusicAlbum; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicAlbumEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public SaveMusicAlbumEndpointSummary() + { + Summary = "Updates a music album."; + Description = "Updates the music album identified by the route, together with the tracks of the album."; + + Response(200, "The music album was updated."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpoint.cs new file mode 100644 index 00000000..39127f14 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpoint.cs @@ -0,0 +1,86 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Http; +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-update-cover route. +/// +public class UpdateAlbumCoverEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public UpdateAlbumCoverEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.PUT); + Routes(WebRoutes.Music.UPDATE_ALBUM_COVER); + DontAutoTag(); + Options(options => options.WithTags("Music")); + EnableAntiforgery(); + } + + /// + /// Updates the cover image of the album with the image uploaded in the multipart form of the request. + /// + /// The request object. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken) + { + // The endpoint takes no typed request, because its body is a multipart file, so the album id is read from the {albumId} route value and the + // owning library from the {libraryId} query string; all the ids are normalized to Guids before they are substituted into the upstream URL, so + // that a crafted value can never escape its URL segment, and an unparseable id is reported by the API as a missing id. A missing file is + // forwarded as a multipart form without any file, so that the upstream API reports it with its own validation error. + Guid artistId = Guid.TryParse(HttpContext.Request.RouteValues["artistId"]?.ToString(), out Guid parsedArtistId) ? parsedArtistId : Guid.Empty; + Guid albumId = Guid.TryParse(HttpContext.Request.RouteValues["albumId"]?.ToString(), out Guid parsedAlbumId) ? parsedAlbumId : Guid.Empty; + string libraryId = Guid.TryParse(HttpContext.Request.Query["libraryId"].ToString(), out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString(); + + IFormFile? cover = null; + if (HttpContext.Request.HasFormContentType) + { + try + { + cover = HttpContext.Request.Form.Files.Count > 0 ? HttpContext.Request.Form.Files[0] : null; + } + catch (InvalidDataException) + { + cover = null; + } + } + + // The cover stream must stay open while the file is streamed to the API, and is disposed when the request completes. + Stream? coverStream = cover?.OpenReadStream(); + try + { + UpdateMusicCoverDto response = await _apiHttpClient.PutMultipartAsync( + ApiRoutes.Music.UPDATE_ALBUM_COVER.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId.ToString()).Replace("{albumId}", albumId.ToString()), coverStream, cover?.FileName, "cover", cancellationToken).ConfigureAwait(false); + return JsonSuccess(response.CoverPath); + } + finally + { + coverStream?.Dispose(); + } + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs new file mode 100644 index 00000000..0a75f9e9 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointSummary.cs @@ -0,0 +1,25 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.DTO.Common; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public UpdateAlbumCoverEndpointSummary() + { + Summary = "Updates the cover image of an album."; + Description = "Updates the cover image of the album identified by the route, with the image uploaded in the multipart form of the request."; + + Response(200, "The relative path of the stored cover image is returned.", example: new SuccessResponse(true, default)); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpoint.cs new file mode 100644 index 00000000..4d1730fb --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpoint.cs @@ -0,0 +1,61 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.DeleteMusicArtist; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/api-delete-artist route. +/// +public class DeleteMusicArtistEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public DeleteMusicArtistEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.DELETE); + Routes(WebRoutes.Music.DELETE_ARTIST); + DontAutoTag(); + Options(options => options.WithTags("Music")); + EnableAntiforgery(); + } + + /// + /// Deletes the music artist identified by the route. + /// + /// The request object. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken) + { + // The artist is identified by the {artistId} route value; both ids are normalized to Guids before they are substituted into the + // upstream URL, so that a crafted value can never escape its URL segment, and an unparseable id is reported by the API as a missing id. + string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty; + string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString(); + string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString(); + string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString(); + + await _apiHttpClient.DeleteAsync(ApiRoutes.Music.DELETE_ARTIST.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId), cancellationToken).ConfigureAwait(false); + return JsonSuccess(); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointSummary.cs new file mode 100644 index 00000000..9a1db23b --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointSummary.cs @@ -0,0 +1,24 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.DeleteMusicArtist; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicArtistEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public DeleteMusicArtistEndpointSummary() + { + Summary = "Deletes a music artist."; + Description = "Deletes the music artist identified by the route, together with its albums and tracks."; + + Response(200, "The music artist was deleted."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpoint.cs new file mode 100644 index 00000000..c025b99d --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpoint.cs @@ -0,0 +1,132 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Themes; +using Lumina.Presentation.Web.Common.Primitives; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Common.Services; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Lumina.Presentation.Web.Core.Themes; +using Microsoft.AspNetCore.Antiforgery; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Localization; +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.EditMusicArtist; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId} route. +/// +public class EditMusicArtistViewEndpoint : BaseEndpoint +{ + // The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath. + private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Library.AudioLibrary.MusicLibrary.Artists.Item"; + private const string VIEW_RESOURCE_LOCATION = "Lumina.Presentation.Web"; + // The page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope. + private const string VIEW_PAGE_KEY = "library/audio-library/music-library/artists/item"; + + private static readonly JsonSerializerOptions s_camelCaseJsonOptions = new() + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + Converters = { new JsonStringEnumConverter() } + }; + + private readonly IApiHttpClient _apiHttpClient; + private readonly IUrlService _urlService; + private readonly ThemePageRenderer _themePageRenderer; + private readonly IAntiforgery _antiforgery; + private readonly IStringLocalizer _localizer; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + /// Injected service for generating URLs from action and controller names, with localization. + /// Injected service for rendering themed pages. + /// Injected service for anti-forgery token handling. + /// Injected factory used to create the localizer of the view resources. + public EditMusicArtistViewEndpoint(IApiHttpClient apiHttpClient, IUrlService urlService, ThemePageRenderer themePageRenderer, IAntiforgery antiforgery, IStringLocalizerFactory stringLocalizerFactory) + { + _apiHttpClient = apiHttpClient; + _urlService = urlService; + _themePageRenderer = themePageRenderer; + _antiforgery = antiforgery; + _localizer = stringLocalizerFactory.Create(VIEW_RESOURCE_BASE_NAME, VIEW_RESOURCE_LOCATION); + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.GET); + Routes(WebRoutes.Music.ARTIST); + DontAutoTag(); + Options(options => options.WithTags("Music")); + } + + /// + /// Displays the music artist details and editing view, rendered by the active theme with a fallback to the Razor view. + /// + /// The request containing the Id of the artist to view. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(GetMusicArtistViewRequest request, CancellationToken cancellationToken) + { + // The view needs the full details of the artist to show its current values, so they are fetched from the API up front; the route + // value is normalized to a Guid before it is substituted into the upstream URL, so that a crafted route value can never escape + // its URL segment, and an unparseable id is reported by the API as a missing artist id. + request = request with { ArtistId = Guid.TryParse(request.ArtistId, out Guid artistId) ? artistId.ToString() : Guid.Empty.ToString() }; + MusicArtistDto artist = await _apiHttpClient.GetAsync(ApiRoutes.Music.GET_ARTIST.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId), cancellationToken).ConfigureAwait(false); + string title = artist.Metadata?.Name ?? string.Empty; + + // The themed view is a regular page that submits its own requests, so a fresh anti-forgery token must be issued for it. + AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext); + + ThemePageDto pageModel = new() + { + PageKey = VIEW_PAGE_KEY, + Title = title, + Description = string.Empty, + PageData = new Dictionary + { + ["artistId"] = artist.Id.ToString(), + ["libraryId"] = artist.LibraryId.ToString(), + ["antiforgeryToken"] = antiforgeryTokens.RequestToken, + ["saveUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.SAVE_ARTIST, new { artistId = default(Guid) }) ?? string.Empty, + ["deleteUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_ARTIST, new { artistId = default(Guid) }) ?? string.Empty, + ["albumsUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ARTIST_ALBUMS, new { artistId = default(Guid) }) ?? string.Empty, + ["albumUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.ALBUM, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty, + ["deleteAlbumUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_ALBUM, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty, + ["coverUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.UPDATE_ARTIST_COVER, new { artistId = default(Guid) }) ?? string.Empty, + ["backUrl"] = (_urlService.GetAbsoluteUrl(WebRoutes.Music.ARTISTS_INDEX) ?? string.Empty) + "?libraryId=" + artist.LibraryId, + ["artistJson"] = JsonSerializer.Serialize(artist, s_camelCaseJsonOptions), + ["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer), + ["stringsJson"] = JsonSerializer.Serialize(ThemePageDataFactory.CreateLocalizedStrings(_localizer), s_camelCaseJsonOptions) + } + }; + + Result sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false); + if (sectionResult.IsFailure) + { + Dictionary viewData = new() + { + ["Title"] = title + }; + return View("/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.cshtml", artist, viewData); + } + + return View( + "/Core/Views/Shared/_ThemedView.cshtml", + new ThemeViewDto(sectionResult.Value.Content, sectionResult.Value.Script), + new Dictionary { ["Title"] = title }); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointSummary.cs new file mode 100644 index 00000000..8d037c1b --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointSummary.cs @@ -0,0 +1,29 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using System; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.EditMusicArtist; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class EditMusicArtistViewEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public EditMusicArtistViewEndpointSummary() + { + Summary = "Renders the music artist details and editing view."; + Description = "Renders the view for displaying and editing the music artist identified by the route."; + + RequestParam(r => r.ArtistId, "The unique identifier of the artist to display. Required."); + RequestParam(r => r.LibraryId, "The unique identifier of the media library the artist belongs to. Required."); + + Response(200, "The view for displaying and editing the music artist is rendered."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpoint.cs new file mode 100644 index 00000000..55ffee9d --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpoint.cs @@ -0,0 +1,59 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtist; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/api-get-artist route. +/// +public class GetMusicArtistEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public GetMusicArtistEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.GET); + Routes(WebRoutes.Music.GET_ARTIST); + DontAutoTag(); + Options(options => options.WithTags("Music")); + } + + /// + /// Retrieves the full details of the music artist identified by . + /// + /// The request containing the Id of the artist to retrieve. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(GetMusicArtistViewRequest request, CancellationToken cancellationToken) + { + // The route value is normalized to a Guid before it is substituted into the upstream URL, so that a crafted route value can never + // escape its URL segment, and an unparseable id is reported by the API as a missing artist id. + request = request with { ArtistId = Guid.TryParse(request.ArtistId, out Guid artistId) ? artistId.ToString() : Guid.Empty.ToString() }; + + MusicArtistDto artist = await _apiHttpClient.GetAsync(ApiRoutes.Music.GET_ARTIST.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId), cancellationToken).ConfigureAwait(false); + return JsonSuccess(artist); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointSummary.cs new file mode 100644 index 00000000..e293c4ed --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointSummary.cs @@ -0,0 +1,29 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using System; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtist; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class GetMusicArtistEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public GetMusicArtistEndpointSummary() + { + Summary = "Retrieves the full details of a music artist."; + Description = "Retrieves the full details of the music artist identified by the route."; + + RequestParam(r => r.ArtistId, "The unique identifier of the artist to retrieve. Required."); + RequestParam(r => r.LibraryId, "The unique identifier of the media library the artist belongs to. Required."); + + Response(200, "The full details of the music artist are retrieved."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpoint.cs new file mode 100644 index 00000000..843fae20 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpoint.cs @@ -0,0 +1,83 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtists; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/api-get-artists route. +/// +public class GetMusicArtistsEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public GetMusicArtistsEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.GET); + Routes(WebRoutes.Music.GET_ARTISTS); + DontAutoTag(); + Options(options => options.WithTags("Music")); + } + + /// + /// Retrieves the lightweight details of the music artists of a media library. + /// + /// The request containing the parameters used to retrieve the artists. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(GetMusicArtistsLiteRequest request, CancellationToken cancellationToken) + { + PaginatedMusicArtistLiteDto response = await _apiHttpClient.GetAsync(BuildItemsEndpoint(request), cancellationToken).ConfigureAwait(false); + return JsonSuccess(response); + } + + /// + /// Builds the API endpoint used to retrieve the lightweight details of the music artists of a media library. + /// + /// The request containing the parameters used to retrieve the artists. + /// The API endpoint to which the retrieval request is sent. + private static string BuildItemsEndpoint(GetMusicArtistsLiteRequest query) + { + StringBuilder endpoint = new(ApiRoutes.Music.GET_ARTISTS_LITE.Replace("{libraryId}", query.LibraryId.ToString())); + List parameters = []; + if (query.CurrentPage is not null) + parameters.Add($"currentPage={query.CurrentPage}"); + if (query.PerPage is not null) + parameters.Add($"perPage={query.PerPage}"); + if (!string.IsNullOrWhiteSpace(query.SearchTerm)) + parameters.Add($"searchTerm={Uri.EscapeDataString(query.SearchTerm)}"); + if (!string.IsNullOrWhiteSpace(query.FilterAlphaKey)) + parameters.Add($"filterAlphaKey={Uri.EscapeDataString(query.FilterAlphaKey)}"); + parameters.Add($"shouldIgnoreThePrefixForAlphaPicker={query.ShouldIgnoreThePrefixForAlphaPicker}"); + if (!string.IsNullOrWhiteSpace(query.SortBy)) + parameters.Add($"sortBy={Uri.EscapeDataString(query.SortBy)}"); + if (query.SortOrder is not null) + parameters.Add($"sortOrder={query.SortOrder}"); + if (parameters.Count > 0) + endpoint.Append('?').Append(string.Join('&', parameters)); + return endpoint.ToString(); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointSummary.cs new file mode 100644 index 00000000..5455a54e --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointSummary.cs @@ -0,0 +1,46 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using System; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtists; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class GetMusicArtistsEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public GetMusicArtistsEndpointSummary() + { + Summary = "Retrieves the lightweight details of the music artists of a media library."; + Description = "Retrieves the lightweight read models of the music artists of the media library identified by the route."; + + RequestParam(r => r.LibraryId, "The Id of the media library whose artists are retrieved. Required."); + RequestParam(r => r.CurrentPage, "The page of results to retrieve. Optional."); + RequestParam(r => r.PerPage, "The maximum number of artists to retrieve per page. Optional."); + RequestParam(r => r.SearchTerm, "The search term used to filter the artists by name. Optional."); + RequestParam(r => r.FilterAlphaKey, "The alpha key used to filter the results by the first character of their name, for the alpha picker. Optional."); + RequestParam(r => r.ShouldIgnoreThePrefixForAlphaPicker, "Whether the leading \"The \" prefix of a name is ignored when computing the alpha key, or not. Optional."); + RequestParam(r => r.SortBy, "The name of the field by which to sort the results. Optional."); + RequestParam(r => r.SortOrder, "The direction in which to sort the results. Optional."); + + ExampleRequest = new GetMusicArtistsLiteRequest( + LibraryId: Guid.NewGuid(), + CurrentPage: 1, + PerPage: 10, + SearchTerm: "queen", + FilterAlphaKey: null, + ShouldIgnoreThePrefixForAlphaPicker: false, + SortBy: null, + SortOrder: null + ); + + Response(200, "The lightweight details of the music artists of the media library are retrieved."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpoint.cs new file mode 100644 index 00000000..7a601d87 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpoint.cs @@ -0,0 +1,112 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.Libraries; +using Lumina.Presentation.Web.Common.DTO.Themes; +using Lumina.Presentation.Web.Common.Primitives; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Common.Services; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Lumina.Presentation.Web.Core.Themes; +using Microsoft.AspNetCore.Antiforgery; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Localization; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.Index; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists route. +/// +public class MusicArtistsIndexViewEndpoint : BaseEndpoint +{ + // The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it + // with the configured ResourcesPath, so "Lumina.Presentation.Web.Views.X" resolves to the embedded + // "Lumina.Presentation.Web.Core.Resources.Views.X" resource; including "Core" here would insert it twice. + private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Library.AudioLibrary.MusicLibrary.Artists.Index"; + private const string VIEW_RESOURCE_LOCATION = "Lumina.Presentation.Web"; + // The page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope. + private const string VIEW_PAGE_KEY = "library/audio-library/music-library/artists/index"; + + private readonly IApiHttpClient _apiHttpClient; + private readonly IUrlService _urlService; + private readonly ThemePageRenderer _themePageRenderer; + private readonly IAntiforgery _antiforgery; + private readonly IStringLocalizer _localizer; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + /// Injected service for generating URLs from action and controller names, with localization. + /// Injected service for rendering themed pages. + /// Injected service for anti-forgery token handling. + /// Injected factory used to create the localizer of the view resources. + public MusicArtistsIndexViewEndpoint(IApiHttpClient apiHttpClient, IUrlService urlService, ThemePageRenderer themePageRenderer, IAntiforgery antiforgery, IStringLocalizerFactory stringLocalizerFactory) + { + _apiHttpClient = apiHttpClient; + _urlService = urlService; + _themePageRenderer = themePageRenderer; + _antiforgery = antiforgery; + _localizer = stringLocalizerFactory.Create(VIEW_RESOURCE_BASE_NAME, VIEW_RESOURCE_LOCATION); + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.GET); + Routes(WebRoutes.Music.ARTISTS_INDEX); + DontAutoTag(); + Options(options => options.WithTags("Music")); + } + + /// + /// Displays the music artists browsing view, rendered by the active theme with a fallback to the Razor view. + /// + /// The request containing the Id of the media library whose artists are browsed. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(GetMusicArtistsViewRequest request, CancellationToken cancellationToken) + { + if (request.LibraryId is null) + return Results.Redirect(_urlService.GetAbsoluteUrl(WebRoutes.Home.INDEX_CULTURED)!); + LibraryDto library = await _apiHttpClient.GetAsync(ApiRoutes.Libraries.GET_LIBRARY_BY_ID.Replace("{id}", request.LibraryId.Value.ToString()), cancellationToken).ConfigureAwait(false); + + // The page exposes delete actions, which submit through the form anti-forgery token, so a fresh token is issued for it. + AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext); + + ThemePageDto pageModel = new() + { + PageKey = VIEW_PAGE_KEY, + Title = library.Title ?? string.Empty, + Description = string.Empty, + PageData = new Dictionary + { + ["libraryId"] = library.Id?.ToString() ?? request.LibraryId.Value.ToString(), + ["antiforgeryToken"] = antiforgeryTokens.RequestToken, + ["itemsUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.GET_ARTISTS) ?? string.Empty, + ["settingsUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Settings.GET_USER_SETTINGS) ?? string.Empty, + ["artistUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.ARTIST, new { artistId = default(Guid) }) ?? string.Empty, + ["deleteUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_ARTIST, new { artistId = default(Guid) }) ?? string.Empty, + ["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer) + } + }; + + Result sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false); + if (sectionResult.IsFailure) + return View("/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.cshtml", library); + + return View( + "/Core/Views/Shared/_ThemedView.cshtml", + new ThemeViewDto(sectionResult.Value.Content, sectionResult.Value.Script), + new Dictionary { ["Title"] = pageModel.Title }); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointSummary.cs new file mode 100644 index 00000000..6dcdfbd8 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointSummary.cs @@ -0,0 +1,32 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using System; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.Index; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class MusicArtistsIndexViewEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public MusicArtistsIndexViewEndpointSummary() + { + Summary = "Renders the music artists browsing view."; + Description = "Renders the view for browsing the music artists of the media library identified by the query."; + + RequestParam(r => r.LibraryId, "The unique identifier of the media library whose artists are browsed. Optional."); + + ExampleRequest = new GetMusicArtistsViewRequest( + LibraryId: Guid.NewGuid() + ); + + Response(200, "The view for browsing the music artists of the media library is rendered."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpoint.cs new file mode 100644 index 00000000..bef6bff2 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpoint.cs @@ -0,0 +1,65 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.SaveMusicArtist; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/api-save-artist route. +/// +public class SaveMusicArtistEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public SaveMusicArtistEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.PUT); + Routes(WebRoutes.Music.SAVE_ARTIST); + DontAutoTag(); + Options(options => options.WithTags("Music")); + EnableAntiforgery(); + } + + /// + /// Updates the music artist described by . + /// + /// The request containing the edited details of the artist. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(UpdateMusicArtistRequest request, CancellationToken cancellationToken) + { + // The artist is identified by the {artistId} route value, not by any id posted in the body, so that a mismatched id can never redirect + // the update to another artist; both ids are normalized to Guids before they are substituted into the upstream URL, so that a crafted + // value can never escape its URL segment, and an unparseable id is reported by the API as a missing id. + string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty; + string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString(); + string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString(); + string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString(); + + MusicArtistDto artist = await _apiHttpClient.PutAsync( + ApiRoutes.Music.UPDATE_ARTIST.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId), request, cancellationToken).ConfigureAwait(false); + return JsonSuccess(artist); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointSummary.cs new file mode 100644 index 00000000..96f071cc --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointSummary.cs @@ -0,0 +1,25 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.SaveMusicArtist; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicArtistEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public SaveMusicArtistEndpointSummary() + { + Summary = "Updates a music artist."; + Description = "Updates the music artist identified by the route, together with the albums of the artist and the tracks of those albums."; + + Response(200, "The music artist was updated."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpoint.cs new file mode 100644 index 00000000..d1ad480c --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpoint.cs @@ -0,0 +1,85 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Http; +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/api-update-cover route. +/// +public class UpdateArtistCoverEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public UpdateArtistCoverEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.PUT); + Routes(WebRoutes.Music.UPDATE_ARTIST_COVER); + DontAutoTag(); + Options(options => options.WithTags("Music")); + EnableAntiforgery(); + } + + /// + /// Updates the cover image of the artist with the image uploaded in the multipart form of the request. + /// + /// The request object. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken) + { + // The endpoint takes no typed request, because its body is a multipart file, so the artist id is read from the {artistId} route value and the + // owning library from the {libraryId} query string; both are normalized to Guids before they are substituted into the upstream URL, so that a + // crafted value can never escape its URL segment, and an unparseable id is reported by the API as a missing id. A missing file is forwarded + // as a multipart form without any file, so that the upstream API reports it with its own validation error. + Guid artistId = Guid.TryParse(HttpContext.Request.RouteValues["artistId"]?.ToString(), out Guid parsedArtistId) ? parsedArtistId : Guid.Empty; + string libraryId = Guid.TryParse(HttpContext.Request.Query["libraryId"].ToString(), out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString(); + + IFormFile? cover = null; + if (HttpContext.Request.HasFormContentType) + { + try + { + cover = HttpContext.Request.Form.Files.Count > 0 ? HttpContext.Request.Form.Files[0] : null; + } + catch (InvalidDataException) + { + cover = null; + } + } + + // The cover stream must stay open while the file is streamed to the API, and is disposed when the request completes. + Stream? coverStream = cover?.OpenReadStream(); + try + { + UpdateMusicCoverDto response = await _apiHttpClient.PutMultipartAsync( + ApiRoutes.Music.UPDATE_ARTIST_COVER.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId.ToString()), coverStream, cover?.FileName, "cover", cancellationToken).ConfigureAwait(false); + return JsonSuccess(response.CoverPath); + } + finally + { + coverStream?.Dispose(); + } + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointSummary.cs new file mode 100644 index 00000000..c1b8281b --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointSummary.cs @@ -0,0 +1,25 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.DTO.Common; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public UpdateArtistCoverEndpointSummary() + { + Summary = "Updates the cover image of an artist."; + Description = "Updates the cover image of the artist identified by the route, with the image uploaded in the multipart form of the request."; + + Response(200, "The relative path of the stored cover image is returned.", example: new SuccessResponse(true, default)); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpoint.cs new file mode 100644 index 00000000..5576f641 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpoint.cs @@ -0,0 +1,65 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.DeleteMusicTrack; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-delete-track route. +/// +public class DeleteMusicTrackEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public DeleteMusicTrackEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.DELETE); + Routes(WebRoutes.Music.DELETE_TRACK); + DontAutoTag(); + Options(options => options.WithTags("Music")); + EnableAntiforgery(); + } + + /// + /// Deletes the music track identified by the route. + /// + /// The request object. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken) + { + // The track is identified by the {artistId}, {albumId} and {trackId} route values; all ids are normalized to Guids before they are substituted + // into the upstream URL, so that a crafted value can never escape its URL segment, and an unparseable id is reported by the API as a missing id. + string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty; + string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString(); + string routeAlbumId = HttpContext.Request.RouteValues["albumId"]?.ToString() ?? string.Empty; + string albumId = Guid.TryParse(routeAlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString(); + string routeTrackId = HttpContext.Request.RouteValues["trackId"]?.ToString() ?? string.Empty; + string trackId = Guid.TryParse(routeTrackId, out Guid parsedTrackId) ? parsedTrackId.ToString() : Guid.Empty.ToString(); + string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString(); + string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString(); + + await _apiHttpClient.DeleteAsync(ApiRoutes.Music.DELETE_TRACK.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId).Replace("{albumId}", albumId).Replace("{trackId}", trackId), cancellationToken).ConfigureAwait(false); + return JsonSuccess(); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointSummary.cs new file mode 100644 index 00000000..a4d49a30 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointSummary.cs @@ -0,0 +1,24 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.DeleteMusicTrack; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicTrackEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public DeleteMusicTrackEndpointSummary() + { + Summary = "Deletes a music track."; + Description = "Deletes the music track identified by the route, together with its metadata."; + + Response(200, "The music track was deleted."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpoint.cs new file mode 100644 index 00000000..6695f583 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpoint.cs @@ -0,0 +1,140 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Themes; +using Lumina.Presentation.Web.Common.Primitives; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Common.Services; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Lumina.Presentation.Web.Core.Themes; +using Microsoft.AspNetCore.Antiforgery; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Localization; +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.EditMusicTrack; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId} route. +/// +public class EditMusicTrackViewEndpoint : BaseEndpoint +{ + // The resource base name deliberately excludes the "Core.Resources" segment: the localization factory re-roots it with the configured ResourcesPath. + private const string VIEW_RESOURCE_BASE_NAME = "Lumina.Presentation.Web.Views.Library.AudioLibrary.MusicLibrary.Tracks.Item"; + private const string VIEW_RESOURCE_LOCATION = "Lumina.Presentation.Web"; + // The page key mirrors the path of the Razor view under Core/Views, so that theme templates can override it at the page, section or default scope. + private const string VIEW_PAGE_KEY = "library/audio-library/music-library/tracks/item"; + + private static readonly JsonSerializerOptions s_camelCaseJsonOptions = new() + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + Converters = { new JsonStringEnumConverter() } + }; + + private readonly IApiHttpClient _apiHttpClient; + private readonly IUrlService _urlService; + private readonly ThemePageRenderer _themePageRenderer; + private readonly IAntiforgery _antiforgery; + private readonly IStringLocalizer _localizer; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + /// Injected service for generating URLs from action and controller names, with localization. + /// Injected service for rendering themed pages. + /// Injected service for anti-forgery token handling. + /// Injected factory used to create the localizer of the view resources. + public EditMusicTrackViewEndpoint(IApiHttpClient apiHttpClient, IUrlService urlService, ThemePageRenderer themePageRenderer, IAntiforgery antiforgery, IStringLocalizerFactory stringLocalizerFactory) + { + _apiHttpClient = apiHttpClient; + _urlService = urlService; + _themePageRenderer = themePageRenderer; + _antiforgery = antiforgery; + _localizer = stringLocalizerFactory.Create(VIEW_RESOURCE_BASE_NAME, VIEW_RESOURCE_LOCATION); + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.GET); + Routes(WebRoutes.Music.TRACK); + DontAutoTag(); + Options(options => options.WithTags("Music")); + } + + /// + /// Displays the music track details and editing view, rendered by the active theme with a fallback to the Razor view. + /// + /// The request containing the Ids of the artist, album, track and media library to view. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(GetMusicTrackViewRequest request, CancellationToken cancellationToken) + { + // The view needs the full details of the track to show its current values, so they are fetched from the API up front; the route + // values are normalized to Guids before they are substituted into the upstream URL, so that a crafted route value can never escape + // its URL segment, and an unparseable id is reported by the API as a missing id. + string normalizedArtistId = Guid.TryParse(request.ArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString(); + string normalizedAlbumId = Guid.TryParse(request.AlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString(); + string normalizedTrackId = Guid.TryParse(request.TrackId, out Guid parsedTrackId) ? parsedTrackId.ToString() : Guid.Empty.ToString(); + + MusicTrackDto track = await _apiHttpClient.GetAsync( + ApiRoutes.Music.GET_TRACK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", normalizedArtistId).Replace("{albumId}", normalizedAlbumId).Replace("{trackId}", normalizedTrackId), cancellationToken).ConfigureAwait(false); + string title = track.Metadata?.Title ?? string.Empty; + + // The cover shown on the left of the track page is the cover of the album that holds the track, so the album is fetched alongside the track. + MusicAlbumDto album = await _apiHttpClient.GetAsync( + ApiRoutes.Music.GET_ALBUM.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", normalizedArtistId).Replace("{albumId}", normalizedAlbumId), cancellationToken).ConfigureAwait(false); + + // The themed view is a regular page that submits its own requests, so a fresh anti-forgery token must be issued for it. + AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext); + + ThemePageDto pageModel = new() + { + PageKey = VIEW_PAGE_KEY, + Title = title, + Description = string.Empty, + PageData = new Dictionary + { + ["artistId"] = normalizedArtistId, + ["albumId"] = normalizedAlbumId, + ["trackId"] = track.Id.ToString(), + ["libraryId"] = track.LibraryId.ToString(), + ["antiforgeryToken"] = antiforgeryTokens.RequestToken, + ["saveUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.SAVE_TRACK, new { artistId = default(Guid), albumId = default(Guid), trackId = default(Guid) }) ?? string.Empty, + ["deleteUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_TRACK, new { artistId = default(Guid), albumId = default(Guid), trackId = default(Guid) }) ?? string.Empty, + ["backUrl"] = (_urlService.GetAbsoluteUrl(WebRoutes.Music.ALBUM, new { artistId = normalizedArtistId, albumId = track.AlbumId }) ?? string.Empty) + "?libraryId=" + track.LibraryId, + ["albumCoverPath"] = album.CoverPath ?? string.Empty, + ["trackJson"] = JsonSerializer.Serialize(track, s_camelCaseJsonOptions), + ["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer), + ["stringsJson"] = JsonSerializer.Serialize(ThemePageDataFactory.CreateLocalizedStrings(_localizer), s_camelCaseJsonOptions) + } + }; + + Result sectionResult = await _themePageRenderer.RenderAsync(pageModel, requestedThemeId: null, cancellationToken).ConfigureAwait(false); + if (sectionResult.IsFailure) + { + Dictionary viewData = new() + { + ["Title"] = title, + ["AlbumCoverPath"] = album.CoverPath ?? string.Empty + }; + return View("/Core/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.cshtml", track, viewData); + } + + return View( + "/Core/Views/Shared/_ThemedView.cshtml", + new ThemeViewDto(sectionResult.Value.Content, sectionResult.Value.Script), + new Dictionary { ["Title"] = title }); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointSummary.cs new file mode 100644 index 00000000..fc9c26fa --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointSummary.cs @@ -0,0 +1,31 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using System; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.EditMusicTrack; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class EditMusicTrackViewEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public EditMusicTrackViewEndpointSummary() + { + Summary = "Renders the music track details and editing view."; + Description = "Renders the view for displaying and editing the music track identified by the route."; + + RequestParam(r => r.ArtistId, "The unique identifier of the artist the album belongs to. Required."); + RequestParam(r => r.AlbumId, "The unique identifier of the album the track belongs to. Required."); + RequestParam(r => r.TrackId, "The unique identifier of the track to display. Required."); + RequestParam(r => r.LibraryId, "The unique identifier of the media library the track belongs to. Required."); + + Response(200, "The view for displaying and editing the music track is rendered."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpoint.cs new file mode 100644 index 00000000..8cdc19b4 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpoint.cs @@ -0,0 +1,78 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetAlbumTracks; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/api-get-tracks route. +/// +public class GetAlbumTracksEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public GetAlbumTracksEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.GET); + Routes(WebRoutes.Music.GET_ALBUM_TRACKS); + DontAutoTag(); + Options(options => options.WithTags("Music")); + } + + /// + /// Retrieves the lightweight details of the tracks of an album. + /// + /// The request containing the parameters used to retrieve the tracks. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(GetAlbumTracksLiteRequest request, CancellationToken cancellationToken) + { + PaginatedMusicTrackLiteDto response = await _apiHttpClient.GetAsync(BuildItemsEndpoint(request), cancellationToken).ConfigureAwait(false); + return JsonSuccess(response); + } + + /// + /// Builds the API endpoint used to retrieve the lightweight details of the tracks of an album. + /// + /// The request containing the parameters used to retrieve the tracks. + /// The API endpoint to which the retrieval request is sent. + private static string BuildItemsEndpoint(GetAlbumTracksLiteRequest query) + { + // The route values are normalized to Guids before they are substituted into the upstream URL, so that a crafted route value can never + // escape its URL segment, and an unparseable id is reported by the API as a missing id. + string artistId = Guid.TryParse(query.ArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString(); + string albumId = Guid.TryParse(query.AlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString(); + StringBuilder endpoint = new(ApiRoutes.Music.GET_ALBUM_TRACKS_LITE.Replace("{libraryId}", query.LibraryId.ToString()).Replace("{artistId}", artistId).Replace("{albumId}", albumId)); + List parameters = []; + if (query.CurrentPage is not null) + parameters.Add($"currentPage={query.CurrentPage}"); + if (query.PerPage is not null) + parameters.Add($"perPage={query.PerPage}"); + if (parameters.Count > 0) + endpoint.Append('?').Append(string.Join('&', parameters)); + return endpoint.ToString(); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointSummary.cs new file mode 100644 index 00000000..4aea7485 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointSummary.cs @@ -0,0 +1,40 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using System; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetAlbumTracks; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class GetAlbumTracksEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public GetAlbumTracksEndpointSummary() + { + Summary = "Retrieves the lightweight details of the tracks of an album."; + Description = "Retrieves the lightweight read models of the tracks of the album identified by the route."; + + RequestParam(r => r.ArtistId, "The unique identifier of the artist the album belongs to. Required."); + RequestParam(r => r.AlbumId, "The unique identifier of the album whose tracks are retrieved. Required."); + RequestParam(r => r.LibraryId, "The unique identifier of the media library the album belongs to. Required."); + RequestParam(r => r.CurrentPage, "The page of results to retrieve. Optional."); + RequestParam(r => r.PerPage, "The maximum number of tracks to retrieve per page. Optional."); + + ExampleRequest = new GetAlbumTracksLiteRequest( + ArtistId: Guid.NewGuid().ToString(), + AlbumId: Guid.NewGuid().ToString(), + LibraryId: Guid.NewGuid(), + CurrentPage: 1, + PerPage: 10 + ); + + Response(200, "The lightweight details of the tracks of the album are retrieved."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpoint.cs new file mode 100644 index 00000000..6ece0f5a --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpoint.cs @@ -0,0 +1,62 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetMusicTrack; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-get-track route. +/// +public class GetMusicTrackEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public GetMusicTrackEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.GET); + Routes(WebRoutes.Music.GET_TRACK); + DontAutoTag(); + Options(options => options.WithTags("Music")); + } + + /// + /// Retrieves the full details of the music track identified by . + /// + /// The request containing the Ids of the artist, album, track and media library to retrieve. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(GetMusicTrackViewRequest request, CancellationToken cancellationToken) + { + // The route values are normalized to Guids before they are substituted into the upstream URL, so that a crafted route value can never + // escape its URL segment, and an unparseable id is reported by the API as a missing id. + string normalizedArtistId = Guid.TryParse(request.ArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString(); + string normalizedAlbumId = Guid.TryParse(request.AlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString(); + string normalizedTrackId = Guid.TryParse(request.TrackId, out Guid parsedTrackId) ? parsedTrackId.ToString() : Guid.Empty.ToString(); + + MusicTrackDto track = await _apiHttpClient.GetAsync( + ApiRoutes.Music.GET_TRACK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", normalizedArtistId).Replace("{albumId}", normalizedAlbumId).Replace("{trackId}", normalizedTrackId), cancellationToken).ConfigureAwait(false); + return JsonSuccess(track); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointSummary.cs new file mode 100644 index 00000000..c01f4d4c --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointSummary.cs @@ -0,0 +1,31 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using System; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetMusicTrack; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class GetMusicTrackEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public GetMusicTrackEndpointSummary() + { + Summary = "Retrieves the full details of a music track."; + Description = "Retrieves the full details of the music track identified by the route."; + + RequestParam(r => r.ArtistId, "The unique identifier of the artist the album belongs to. Required."); + RequestParam(r => r.AlbumId, "The unique identifier of the album the track belongs to. Required."); + RequestParam(r => r.TrackId, "The unique identifier of the track to retrieve. Required."); + RequestParam(r => r.LibraryId, "The unique identifier of the media library the track belongs to. Required."); + + Response(200, "The full details of the music track are retrieved."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpoint.cs new file mode 100644 index 00000000..de4fd5d8 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpoint.cs @@ -0,0 +1,69 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.SaveMusicTrack; + +/// +/// API endpoint for the /{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-save-track route. +/// +public class SaveMusicTrackEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public SaveMusicTrackEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.PUT); + Routes(WebRoutes.Music.SAVE_TRACK); + DontAutoTag(); + Options(options => options.WithTags("Music")); + EnableAntiforgery(); + } + + /// + /// Updates the music track described by . + /// + /// The request containing the edited details of the track. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(UpdateMusicTrackRequest request, CancellationToken cancellationToken) + { + // The track is identified by the {artistId}, {albumId} and {trackId} route values, not by any id posted in the body, so that a mismatched + // id can never redirect the update to another track; all ids are normalized to Guids before they are substituted into the upstream URL, so + // that a crafted value can never escape its URL segment, and an unparseable id is reported by the API as a missing id. + string routeArtistId = HttpContext.Request.RouteValues["artistId"]?.ToString() ?? string.Empty; + string artistId = Guid.TryParse(routeArtistId, out Guid parsedArtistId) ? parsedArtistId.ToString() : Guid.Empty.ToString(); + string routeAlbumId = HttpContext.Request.RouteValues["albumId"]?.ToString() ?? string.Empty; + string albumId = Guid.TryParse(routeAlbumId, out Guid parsedAlbumId) ? parsedAlbumId.ToString() : Guid.Empty.ToString(); + string routeTrackId = HttpContext.Request.RouteValues["trackId"]?.ToString() ?? string.Empty; + string trackId = Guid.TryParse(routeTrackId, out Guid parsedTrackId) ? parsedTrackId.ToString() : Guid.Empty.ToString(); + string queryLibraryId = HttpContext.Request.Query["libraryId"].ToString(); + string libraryId = Guid.TryParse(queryLibraryId, out Guid parsedLibraryId) ? parsedLibraryId.ToString() : Guid.Empty.ToString(); + + MusicTrackDto track = await _apiHttpClient.PutAsync( + ApiRoutes.Music.UPDATE_TRACK.Replace("{libraryId}", libraryId).Replace("{artistId}", artistId).Replace("{albumId}", albumId).Replace("{trackId}", trackId), request, cancellationToken).ConfigureAwait(false); + return JsonSuccess(track); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointSummary.cs new file mode 100644 index 00000000..412a3198 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointSummary.cs @@ -0,0 +1,25 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.SaveMusicTrack; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicTrackEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public SaveMusicTrackEndpointSummary() + { + Summary = "Updates a music track."; + Description = "Updates the music track identified by the route, together with its metadata."; + + Response(200, "The music track was updated."); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ar-SA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ar-SA.resx new file mode 100644 index 00000000..b7449ba6 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ar-SA.resx @@ -0,0 +1,1509 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + العودة إلى الفنان + + + تعديل الألبوم + + + حفظ + + + تم حفظ الألبوم. + + + تعذر حفظ العنصر. + + + حذف الألبوم + + + تم حذف الألبوم. + + + هل أنت متأكد من أنك تريد حذف هذا العنصر؟ + + + تعذر حذف العنصر. + + + معلومات عامة + + + العنوان + + + العنوان الأصلي + + + الوصف + + + إزالة الالتباس + + + الكتابة + + + حالة الإصدار + + + إجمالي الأقراص + + + إجمالي المقاطع + + + عنوان الإصدار + + + صيغة الوسائط + + + التغليف + + + الباركود + + + أرقام الكتالوج + + + الشركة + + + ASIN + + + معرّف إصدار MusicBrainz + + + معرّف مجموعة إصدار MusicBrainz + + + معرّف فنان الإصدار MusicBrainz + + + معلومات الإصدار + + + تاريخ الإصدار الأصلي + + + سنة الإصدار الأصلي + + + تاريخ إعادة الإصدار + + + سنة إعادة الإصدار + + + بلد الإصدار + + + نسخة الإصدار + + + اللغة + + + رمز اللغة + + + اسم اللغة + + + الاسم الأصلي للغة + + + اللغة الأصلية + + + الأنواع + + + الوسوم + + + أنواع الإصدار + + + المقاطع + + + لا يحتوي هذا الألبوم على مقاطع + + + إزالة + + + نسخة مقرصنة + + + ملغى + + + محذوف + + + رسمي + + + ترويجي + + + إصدار زائف + + + مسحوب + + + أسيتات 10 بوصة + + + شيلاك 10 بوصة + + + فينيل 10 بوصة + + + أسيتات 12 بوصة + + + قرص ليزر 12 بوصة + + + شيلاك 12 بوصة + + + فينيل 12 بوصة + + + فينيل 3 بوصة + + + قرص مرن 3.5 بوصة + + + قرص مرن 5.25 بوصة + + + أسيتات 7 بوصة + + + قرص فليكسي 7 بوصة + + + شيلاك 7 بوصة + + + فينيل 7 بوصة + + + قرص ليزر 8 بوصة + + + خرطوشة ثمانية مسارات + + + CD 8 سم + + + CD 8 سم زائد G + + + CD 8 سم ناقص R + + + أسيتات + + + Betacam SP + + + Betamax + + + Blu-ray + + + Blu-ray ناقص R + + + Blu Spec CD + + + خرطوشة + + + كاسيت + + + CD + + + CD زائد G + + + CD Minusi + + + CD ناقص R + + + CDV + + + CED + + + CD حماية النسخ + + + DAT + + + CD بيانات + + + DVD بيانات + + + DVD بيانات ناقص R + + + Data Play + + + DCC + + + وسائط رقمية + + + بطاقة تنزيل + + + DTSCD + + + قرص مزدوج + + + قرص مزدوج - جانب CD + + + قرص مزدوج - جانب DVD + + + قرص مزدوج - جانب صوت DVD + + + قرص مزدوج - جانب فيديو DVD + + + DVD + + + DVD صوت + + + DVD ناقص R فيديو + + + DVD فيديو + + + DVD زائد + + + DVD زائد - جانب CD + + + DVD زائد - جانب صوت DVD + + + DVD زائد - جانب فيديو DVD + + + أسطوانة إديسون الماسية + + + CD محسن + + + قرص فليكسي + + + قرص مرن + + + HDDVD + + + HDCD + + + Hi Pac + + + HQCD + + + SACD هجين + + + SACD هجين طبقة CD + + + SACD هجين طبقة SACD + + + SACD هجين طبقة SACD قناتان + + + SACD هجين طبقة SACD متعدد القنوات + + + Ki T Album + + + قرص ليزر + + + ميكروكاسيت + + + Micro SD + + + Mini Disc + + + Mini DVD + + + Mini DVD صوت + + + Mini DVD فيديو + + + Minimax CD + + + Minimax DVD + + + Minimax DVD صوت + + + Minimax DVD فيديو + + + CD الوضع المختلط + + + آخر + + + أسطوانة Pathe + + + أسطوانة فونوغراف + + + لفافة بيانو + + + زر تشغيل + + + Play Tape + + + بكرة إلى بكرة + + + خرطوشة ROM + + + SACD + + + SACD قناتان + + + SACD متعدد القنوات + + + SD Card + + + شيلاك + + + SHMCD + + + SHMSACD + + + SHMSACD متعدد القنوات + + + Slot Music + + + SVCD + + + Tefifon + + + UMD + + + قرص فلاش USB + + + VCD + + + VHD + + + VHS + + + فينيل + + + قرص فينيل + + + قرص فينيل - جانب CD + + + قرص فينيل - جانب DVD + + + قرص فينيل - جانب فينيل + + + أسطوانة شمعية + + + قرص Zip + + + كتاب + + + صندوق + + + غلاف ورقي من الكرتون + + + علبة كاسيت + + + علبة صدفية + + + Digibook + + + Digifile + + + Digipak + + + منزلق علبة الأقراص + + + علبة سميكة + + + غلاف مطوي + + + علبة جواهر + + + علبة حفظ + + + صندوق طويل + + + علبة معدنية + + + غلاف بلاستيكي + + + حزمة منزلقة + + + علبة جواهر رفيعة + + + غلاف منزلق + + + علبة بمشبك + + + حزمة بمشبك + + + علبة جواهر فائقة + + + لا شيء + + + أفغانستان + + + ألبانيا + + + الجزائر + + + أندورا + + + أنغولا + + + أنتيغوا وبربودا + + + الأرجنتين + + + أرمينيا + + + أستراليا + + + النمسا + + + أذربيجان + + + الباهاما + + + البحرين + + + بنغلاديش + + + بربادوس + + + بيلاروسيا + + + بلجيكا + + + بليز + + + بنين + + + بوتان + + + بوليفيا + + + البوسنة والهرسك + + + بوتسوانا + + + البرازيل + + + بروناي + + + بلغاريا + + + بوركينا فاسو + + + بوروندي + + + الرأس الأخضر + + + كمبوديا + + + الكاميرون + + + كندا + + + جمهورية أفريقيا الوسطى + + + تشاد + + + تشيلي + + + الصين + + + كولومبيا + + + جزر القمر + + + الكونغو - برازافيل + + + الكونغو - كينشاسا + + + كوستاريكا + + + ساحل العاج + + + كرواتيا + + + كوبا + + + قبرص + + + التشيك + + + الدنمارك + + + جيبوتي + + + دومينيكا + + + جمهورية الدومينيكان + + + الإكوادور + + + مصر + + + السلفادور + + + غينيا الاستوائية + + + إريتريا + + + إستونيا + + + إسواتيني + + + إثيوبيا + + + فيجي + + + فنلندا + + + فرنسا + + + الغابون + + + غامبيا + + + جورجيا + + + ألمانيا + + + غانا + + + اليونان + + + غرينادا + + + غواتيمالا + + + غينيا + + + غينيا بيساو + + + غيانا + + + هايتي + + + هندوراس + + + هنغاريا + + + آيسلندا + + + الهند + + + إندونيسيا + + + إيران + + + العراق + + + أيرلندا + + + إسرائيل + + + إيطاليا + + + جامايكا + + + اليابان + + + الأردن + + + كازاخستان + + + كينيا + + + كيريباتي + + + كوريا الشمالية + + + كوريا الجنوبية + + + الكويت + + + قيرغيزستان + + + لاوس + + + لاتفيا + + + لبنان + + + ليسوتو + + + ليبيريا + + + ليبيا + + + ليختنشتاين + + + ليتوانيا + + + لوكسمبورغ + + + مدغشقر + + + مالاوي + + + ماليزيا + + + المالديف + + + مالي + + + مالطا + + + جزر مارشال + + + موريتانيا + + + موريشيوس + + + المكسيك + + + ميكرونيزيا + + + مولدوفا + + + موناكو + + + منغوليا + + + الجبل الأسود + + + المغرب + + + موزمبيق + + + ميانمار (بورما) + + + ناميبيا + + + ناورو + + + نيبال + + + هولندا + + + نيوزيلندا + + + نيكاراغوا + + + النيجر + + + نيجيريا + + + مقدونيا الشمالية + + + النرويج + + + عُمان + + + باكستان + + + بالاو + + + الأراضي الفلسطينية + + + بنما + + + بابوا غينيا الجديدة + + + باراغواي + + + بيرو + + + الفلبين + + + بولندا + + + البرتغال + + + قطر + + + رومانيا + + + روسيا + + + رواندا + + + سانت كيتس ونيفيس + + + سانت لوسيا + + + سانت فينسنت والغرينادين + + + ساموا + + + سان مارينو + + + ساو تومي وبرينسيبي + + + المملكة العربية السعودية + + + السنغال + + + صربيا + + + سيشل + + + سيراليون + + + سنغافورة + + + سلوفاكيا + + + سلوفينيا + + + جزر سليمان + + + الصومال + + + جنوب أفريقيا + + + جنوب السودان + + + إسبانيا + + + سريلانكا + + + السودان + + + سورينام + + + السويد + + + سويسرا + + + سوريا + + + تايوان + + + طاجيكستان + + + تنزانيا + + + تايلاند + + + تيمور الشرقية + + + توغو + + + تونغا + + + ترينيداد وتوباغو + + + تونس + + + تركيا + + + تركمانستان + + + توفالو + + + أوغندا + + + أوكرانيا + + + الإمارات العربية المتحدة + + + المملكة المتحدة + + + الولايات المتحدة + + + أوروغواي + + + أوزبكستان + + + فانواتو + + + مدينة الفاتيكان + + + فنزويلا + + + فيتنام + + + اليمن + + + زامبيا + + + زيمبابوي + + + جزر الأنتيل الهولندية + + + أوروبا + + + العالم + + + عنوان الألبوم. + + + العنوان الأصلي للألبوم عندما يختلف عن الحالي. + + + ملخص أو وصف قصير للألبوم. + + + تعليق يميز الألبوم عن غيره ممن يحمل العنوان نفسه. + + + الكتابة المستخدمة في عنوان الإصدار. + + + حالة إصدار الألبوم. + + + عدد الأقراص في الألبوم. + + + عدد المقطوعات في الألبوم. + + + عنوان الإصدار. + + + صيغة الوسائط للألبوم. + + + تغليف الألبوم. + + + الباركود الخاص بالألبوم. + + + أرقام فهارس الألبوم. + + + الشركة التي أصدرت الألبوم. + + + رقم تعريف أمازون القياسي للألبوم. + + + معرّف MusicBrainz للإصدار. + + + معرّف MusicBrainz لمجموعة الإصدارات. + + + معرّف MusicBrainz لفنان الإصدار. + + + تاريخ الإصدار الأصلي للألبوم. + + + سنة الإصدار الأصلي للألبوم. + + + تاريخ إعادة إصدار الألبوم. + + + سنة إعادة إصدار الألبوم. + + + بلد إصدار الألبوم. + + + النسخة الصادرة، مثل النسخة الأصلية. + + + رمز اللغة المكون من حرفين للألبوم. + + + اسم لغة الألبوم. + + + الاسم الأصلي للغة الألبوم. + + + الأنواع الموسيقية الخاصة بالألبوم. + + + الوسوم الخاصة بالألبوم. + + + أنواع إصدار الألبوم. + + + مقطوعات الألبوم. + + + تغيير الغلاف + + + صورة الغلاف + + + لا يوجد غلاف + + + تم تحديث صورة الغلاف. + + + تعذّر تحميل صورة الغلاف. + + + المساهمون + + + معرّف المساهم + + + الدور + + + إضافة مساهم + + + الأشخاص الذين ساهموا في الفنان. + + + التقييمات + + + التقييم + + + أقصى تقييم + + + المصدر + + + عدد الأصوات + + + إضافة تقييم + + + تقييمات الفنان من مصادر مختلفة. + + + مؤلف + + + مترجم + + + رسام + + + ناشر + + + راوٍ + + + ممثل + + + مخرج + + + كاتب سيناريو + + + ملحن + + + كاتب كلمات + + + موزع + + + قائد أوركسترا + + + منتج + + + منتج تنفيذي + + + مهندس صوت + + + خالط صوت + + + معيد المزج + + + شركة تسجيلات + + + غناء + + + غناء مساند + + + غيتار + + + غيتار باس + + + طبول + + + إيقاع + + + لوحات المفاتيح + + + بيانو + + + مركب صوتي + + + آلات وترية + + + آلات نفخ خشبية + + + آلات نفخ نحاسية + + + جوقة + + + منسق أوركسترالي + + + مؤدٍ + + + المستخدم + + + MusicBrainz + + + Discogs + + + Last.fm + + + النوع + + + إضافة نوع + + + وسم + + + إضافة وسم + + + نوع الإصدار + + + إضافة نوع إصدار + + + رقم الكتالوج + + + إضافة رقم كتالوج + + + الغلاف + + + الواجهة + + + الظهر + + + الكتيب + + + الوسيط + + + الدرج + + + الكعب + + + أوبي + + + ملصق + + + ملصق جداري + + + ملاحظات + + + علامة مائية + + + خلفية + + + لافتة + + + شعار + + + صورة مصغرة + + + المعرّفات + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.de-DE.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.de-DE.resx new file mode 100644 index 00000000..15e1f3f3 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.de-DE.resx @@ -0,0 +1,1509 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Zurück zum Künstler + + + Album bearbeiten + + + Speichern + + + Das Album wurde gespeichert. + + + Das Element konnte nicht gespeichert werden. + + + Album löschen + + + Das Album wurde gelöscht. + + + Möchten Sie dieses Element wirklich löschen? + + + Das Element konnte nicht gelöscht werden. + + + Allgemeine Informationen + + + Titel + + + Originaltitel + + + Beschreibung + + + Mehrdeutigkeit + + + Schrift + + + Veröffentlichungsstatus + + + Gesamtzahl der Discs + + + Gesamtzahl der Titel + + + Veröffentlichungstitel + + + Medienformat + + + Verpackung + + + Barcode + + + Katalognummern + + + Label + + + ASIN + + + MusicBrainz-Veröffentlichungs-Id + + + MusicBrainz-Veröffentlichungsgruppen-Id + + + MusicBrainz-Veröffentlichungskünstler-Id + + + Veröffentlichungsinformationen + + + Datum der Erstveröffentlichung + + + Jahr der Erstveröffentlichung + + + Datum der Neuveröffentlichung + + + Jahr der Neuveröffentlichung + + + Erscheinungsland + + + Veröffentlichungsversion + + + Sprache + + + Sprachcode + + + Sprachname + + + Muttersprachlicher Name + + + Originalsprache + + + Genres + + + Schlagwörter + + + Veröffentlichungsarten + + + Titel + + + Dieses Album hat keine Titel + + + Entfernen + + + Bootleg + + + Abgesagt + + + Gelöscht + + + Offiziell + + + Promotion + + + Pseudo-Veröffentlichung + + + Zurückgezogen + + + 10 Zoll Acetat + + + 10 Zoll Schellack + + + 10 Zoll Vinyl + + + 12 Zoll Acetat + + + 12 Zoll Laserdisc + + + 12 Zoll Schellack + + + 12 Zoll Vinyl + + + 3 Zoll Vinyl + + + 3,5 Zoll Diskette + + + 5,25 Zoll Diskette + + + 7 Zoll Acetat + + + 7 Zoll Flexi-Disc + + + 7 Zoll Schellack + + + 7 Zoll Vinyl + + + 8 Zoll Laserdisc + + + 8-Spur-Kassette + + + 8 cm CD + + + 8 cm CD Plus G + + + 8 cm CD Minus R + + + Acetat + + + Betacam SP + + + Betamax + + + Blu-ray + + + Blu-ray Minus R + + + Blu Spec CD + + + Cartridge + + + Kassette + + + CD + + + CD Plus G + + + CD Minusi + + + CD Minus R + + + CDV + + + CED + + + Copy Control CD + + + DAT + + + Daten-CD + + + Daten-DVD + + + Daten-DVD Minus R + + + Data Play + + + DCC + + + Digitale Medien + + + Download-Karte + + + DTSCD + + + Dual Disc + + + Dual Disc CD-Seite + + + Dual Disc DVD-Seite + + + Dual Disc DVD-Audioseite + + + Dual Disc DVD-Videoseite + + + DVD + + + DVD-Audio + + + DVD Minus R Video + + + DVD-Video + + + DVD Plus + + + DVD Plus CD-Seite + + + DVD Plus DVD-Audioseite + + + DVD Plus DVD-Videoseite + + + Edison Diamond Disc + + + Enhanced CD + + + Flexi-Disc + + + Diskette + + + HDDVD + + + HDCD + + + Hi Pac + + + HQCD + + + Hybrid SACD + + + Hybrid SACD CD-Schicht + + + Hybrid SACD SACD-Schicht + + + Hybrid SACD SACD-Schicht 2 Kanäle + + + Hybrid SACD SACD-Schicht Multikanal + + + Ki T Album + + + Laserdisc + + + Mikrokassette + + + MicroSD + + + MiniDisc + + + Mini DVD + + + Mini DVD-Audio + + + Mini DVD-Video + + + Minimax CD + + + Minimax DVD + + + Minimax DVD-Audio + + + Minimax DVD-Video + + + Mixed-Mode-CD + + + Sonstige + + + Pathe Disc + + + Grammophonplatte + + + Klavierrolle + + + Playbutton + + + PlayTape + + + Tonband + + + ROM-Cartridge + + + SACD + + + SACD 2 Kanäle + + + SACD Multikanal + + + SD Card + + + Schellack + + + SHMCD + + + SHMSACD + + + SHMSACD Multikanal + + + SlotMusic + + + SVCD + + + Tefifon + + + UMD + + + USB-Flash-Laufwerk + + + VCD + + + VHD + + + VHS + + + Vinyl + + + Vinyl Disc + + + Vinyl Disc CD-Seite + + + Vinyl Disc DVD-Seite + + + Vinyl Disc Vinyl-Seite + + + Wachswalze + + + Zip-Diskette + + + Buch + + + Box + + + Kartonpapierhülle + + + Kassettenhülle + + + Clamshell Case + + + Digibook + + + Digifile + + + Digipak + + + Discbox Slider + + + Fatbox + + + Gatefold-Cover + + + Jewel Case + + + Keep Case + + + Longbox + + + Metalldose + + + Plastikhülle + + + Slidepack + + + Slim Jewel Case + + + Schuber + + + Snap Case + + + Snap Pack + + + Super Jewel Box + + + Keine + + + Afghanistan + + + Albanien + + + Algerien + + + Andorra + + + Angola + + + Antigua und Barbuda + + + Argentinien + + + Armenien + + + Australien + + + Österreich + + + Aserbaidschan + + + Bahamas + + + Bahrain + + + Bangladesch + + + Barbados + + + Belarus + + + Belgien + + + Belize + + + Benin + + + Bhutan + + + Bolivien + + + Bosnien und Herzegowina + + + Botsuana + + + Brasilien + + + Brunei + + + Bulgarien + + + Burkina Faso + + + Burundi + + + Kap Verde + + + Kambodscha + + + Kamerun + + + Kanada + + + Zentralafrikanische Republik + + + Tschad + + + Chile + + + China + + + Kolumbien + + + Komoren + + + Kongo - Brazzaville + + + Kongo - Kinshasa + + + Costa Rica + + + Côte d'Ivoire + + + Kroatien + + + Kuba + + + Zypern + + + Tschechien + + + Dänemark + + + Dschibuti + + + Dominica + + + Dominikanische Republik + + + Ecuador + + + Ägypten + + + El Salvador + + + Äquatorialguinea + + + Eritrea + + + Estland + + + Eswatini + + + Äthiopien + + + Fidschi + + + Finnland + + + Frankreich + + + Gabun + + + Gambia + + + Georgien + + + Deutschland + + + Ghana + + + Griechenland + + + Grenada + + + Guatemala + + + Guinea + + + Guinea-Bissau + + + Guyana + + + Haiti + + + Honduras + + + Ungarn + + + Island + + + Indien + + + Indonesien + + + Iran + + + Irak + + + Irland + + + Israel + + + Italien + + + Jamaika + + + Japan + + + Jordanien + + + Kasachstan + + + Kenia + + + Kiribati + + + Nordkorea + + + Südkorea + + + Kuwait + + + Kirgisistan + + + Laos + + + Lettland + + + Libanon + + + Lesotho + + + Liberia + + + Libyen + + + Liechtenstein + + + Litauen + + + Luxemburg + + + Madagaskar + + + Malawi + + + Malaysia + + + Malediven + + + Mali + + + Malta + + + Marshallinseln + + + Mauretanien + + + Mauritius + + + Mexiko + + + Mikronesien + + + Moldau + + + Monaco + + + Mongolei + + + Montenegro + + + Marokko + + + Mosambik + + + Myanmar (Burma) + + + Namibia + + + Nauru + + + Nepal + + + Niederlande + + + Neuseeland + + + Nicaragua + + + Niger + + + Nigeria + + + Nordmazedonien + + + Norwegen + + + Oman + + + Pakistan + + + Palau + + + Palästinensische Autonomiegebiete + + + Panama + + + Papua-Neuguinea + + + Paraguay + + + Peru + + + Philippinen + + + Polen + + + Portugal + + + Katar + + + Rumänien + + + Russland + + + Ruanda + + + St. Kitts und Nevis + + + St. Lucia + + + St. Vincent und die Grenadinen + + + Samoa + + + San Marino + + + São Tomé und Príncipe + + + Saudi-Arabien + + + Senegal + + + Serbien + + + Seychellen + + + Sierra Leone + + + Singapur + + + Slowakei + + + Slowenien + + + Salomonen + + + Somalia + + + Südafrika + + + Südsudan + + + Spanien + + + Sri Lanka + + + Sudan + + + Suriname + + + Schweden + + + Schweiz + + + Syrien + + + Taiwan + + + Tadschikistan + + + Tansania + + + Thailand + + + Timor-Leste + + + Togo + + + Tonga + + + Trinidad und Tobago + + + Tunesien + + + Türkei + + + Turkmenistan + + + Tuvalu + + + Uganda + + + Ukraine + + + Vereinigte Arabische Emirate + + + Vereinigtes Königreich + + + Vereinigte Staaten + + + Uruguay + + + Usbekistan + + + Vanuatu + + + Vatikanstadt + + + Venezuela + + + Vietnam + + + Jemen + + + Sambia + + + Simbabwe + + + Niederländische Antillen + + + Europa + + + Weltweit + + + Der Titel des Albums. + + + Der Originaltitel des Albums, wenn er vom aktuellen abweicht. + + + Eine kurze Zusammenfassung oder Beschreibung des Albums. + + + Ein Kommentar, der das Album von anderen mit demselben Titel unterscheidet. + + + Die Schrift, die im Veröffentlichungstitel verwendet wird. + + + Der Veröffentlichungsstatus des Albums. + + + Die Anzahl der Discs des Albums. + + + Die Anzahl der Titel des Albums. + + + Der Titel der Veröffentlichung. + + + Das Medienformat des Albums. + + + Die Verpackung des Albums. + + + Der Barcode des Albums. + + + Die Katalognummern des Albums. + + + Das Label, das das Album veröffentlicht hat. + + + Die Amazon Standard Identification Number des Albums. + + + Die MusicBrainz-Kennung der Veröffentlichung. + + + Die MusicBrainz-Kennung der Veröffentlichungsgruppe. + + + Die MusicBrainz-Kennung des Veröffentlichungskünstlers. + + + Das Datum, an dem das Album ursprünglich veröffentlicht wurde. + + + Das Jahr, in dem das Album ursprünglich veröffentlicht wurde. + + + Das Datum, an dem das Album erneut veröffentlicht wurde. + + + Das Jahr, in dem das Album erneut veröffentlicht wurde. + + + Das Veröffentlichungsland des Albums. + + + Die Version der Veröffentlichung, etwa die Originalversion. + + + Der zweibuchstabige Sprachcode des Albums. + + + Der Name der Sprache des Albums. + + + Der einheimische Name der Sprache des Albums. + + + Die Genres des Albums. + + + Die Tags des Albums. + + + Die Veröffentlichungstypen des Albums. + + + Die Titel des Albums. + + + Cover ändern + + + Coverbild + + + Kein Cover + + + Das Coverbild wurde aktualisiert. + + + Das Coverbild konnte nicht hochgeladen werden. + + + Mitwirkende + + + Mitwirkenden-Id + + + Rolle + + + Mitwirkenden hinzufügen + + + Die Personen, die zum Künstler beigetragen haben. + + + Bewertungen + + + Bewertung + + + Höchstbewertung + + + Quelle + + + Stimmenzahl + + + Bewertung hinzufügen + + + Die Bewertungen des Künstlers aus verschiedenen Quellen. + + + Autor + + + Übersetzer + + + Illustrator + + + Verlag + + + Erzähler + + + Schauspieler + + + Regisseur + + + Drehbuchautor + + + Komponist + + + Liedtexter + + + Arrangeur + + + Dirigent + + + Produzent + + + Ausführender Produzent + + + Toningenieur + + + Mixer + + + Remixer + + + Plattenlabel + + + Gesang + + + Hintergrundgesang + + + Gitarre + + + Bassgitarre + + + Schlagzeug + + + Perkussion + + + Keyboards + + + Klavier + + + Synthesizer + + + Streicher + + + Holzbläser + + + Blechbläser + + + Chor + + + Orchestrator + + + Interpret + + + Benutzer + + + MusicBrainz + + + Discogs + + + Last.fm + + + Genre + + + Genre hinzufügen + + + Schlagwort + + + Schlagwort hinzufügen + + + Veröffentlichungstyp + + + Veröffentlichungstyp hinzufügen + + + Katalognummer + + + Katalognummer hinzufügen + + + Cover + + + Vorderseite + + + Rückseite + + + Booklet + + + Datenträger + + + Tray + + + Rücken + + + Obi + + + Aufkleber + + + Poster + + + Beiheft + + + Wasserzeichen + + + Hintergrund + + + Banner + + + Logo + + + Miniatur + + + Kennungen + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.en-US.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.en-US.resx new file mode 100644 index 00000000..880ed67d --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.en-US.resx @@ -0,0 +1,1509 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Back to artist + + + Edit album + + + Save + + + The album was saved. + + + The item could not be saved. + + + Delete album + + + The album was deleted. + + + Are you sure you want to delete this item? + + + The item could not be deleted. + + + General information + + + Title + + + Original title + + + Description + + + Disambiguation + + + Script + + + Release status + + + Total discs + + + Total tracks + + + Release title + + + Media format + + + Packaging + + + Barcode + + + Catalog numbers + + + Label + + + ASIN + + + MusicBrainz release Id + + + MusicBrainz release group Id + + + MusicBrainz release artist Id + + + Release information + + + Original release date + + + Original release year + + + Re-release date + + + Re-release year + + + Release country + + + Release version + + + Language + + + Language code + + + Language name + + + Native name + + + Original language + + + Genres + + + Tags + + + Release types + + + Tracks + + + This album has no tracks + + + Remove + + + Bootleg + + + Cancelled + + + Expunged + + + Official + + + Promotion + + + Pseudo Release + + + Withdrawn + + + 10 inch Acetate + + + 10 inch Shellac + + + 10 inch Vinyl + + + 12 inch Acetate + + + 12 inch Laser Disc + + + 12 inch Shellac + + + 12 inch Vinyl + + + 3 inch Vinyl + + + 3.5 inch Floppy Disk + + + 5.25 inch Floppy Disk + + + 7 inch Acetate + + + 7 inch Flexi Disc + + + 7 inch Shellac + + + 7 inch Vinyl + + + 8 inch Laser Disc + + + Eight Track Cartridge + + + 8 cm CD + + + 8 cm CD Plus G + + + 8 cm CD Minus R + + + Acetate + + + Betacam SP + + + Betamax + + + Blu Ray + + + Blu Ray Minus R + + + Blu Spec CD + + + Cartridge + + + Cassette + + + CD + + + CD Plus G + + + CD Minusi + + + CD Minus R + + + CDV + + + CED + + + Copy Control CD + + + DAT + + + Data CD + + + Data DVD + + + Data DVD Minus R + + + Data Play + + + DCC + + + Digital Media + + + Download Card + + + DTSCD + + + Dual Disc + + + Dual Disc CD Side + + + Dual Disc DVD Side + + + Dual Disc DVD Audio Side + + + Dual Disc DVD Video Side + + + DVD + + + DVD Audio + + + DVD Minus R Video + + + DVD Video + + + DVD Plus + + + DVD Plus CD Side + + + DVD Plus DVD Audio Side + + + DVD Plus DVD Video Side + + + Edison Diamond Disc + + + Enhanced CD + + + Flexi Disc + + + Floppy Disk + + + HDDVD + + + HDCD + + + Hi Pac + + + HQCD + + + Hybrid SACD + + + Hybrid SACDCD Layer + + + Hybrid SACDSACD Layer + + + Hybrid SACDSACD Layer 2 Channels + + + Hybrid SACDSACD Layer Multichannel + + + Ki T Album + + + Laser Disc + + + Microcassette + + + Micro SD + + + Mini Disc + + + Mini DVD + + + Mini DVD Audio + + + Mini DVD Video + + + Minimax CD + + + Minimax DVD + + + Minimax DVD Audio + + + Minimax DVD Video + + + Mixed Mode CD + + + Other + + + Pathe Disc + + + Phonograph Record + + + Piano Roll + + + Playbutton + + + Play Tape + + + Reel To Reel + + + ROM Cartridge + + + SACD + + + SACD 2 Channels + + + SACD Multichannel + + + SD Card + + + Shellac + + + SHMCD + + + SHMSACD + + + SHMSACD Multichannel + + + Slot Music + + + SVCD + + + Tefifon + + + UMD + + + USB Flash Drive + + + VCD + + + VHD + + + VHS + + + Vinyl + + + Vinyl Disc + + + Vinyl Disc CD Side + + + Vinyl Disc DVD Side + + + Vinyl Disc Vinyl Side + + + Wax Cylinder + + + Zip Disk + + + Book + + + Box + + + Cardboard Paper Sleeve + + + Cassette Case + + + Clamshell Case + + + Digibook + + + Digifile + + + Digipak + + + Discbox Slider + + + Fatbox + + + Gatefold Cover + + + Jewel Case + + + Keep Case + + + Longbox + + + Metal Tin + + + Plastic Sleeve + + + Slidepack + + + Slim Jewel Case + + + Slipcase + + + Snap Case + + + Snap Pack + + + Super Jewel Box + + + None + + + Afghanistan + + + Albania + + + Algeria + + + Andorra + + + Angola + + + Antigua & Barbuda + + + Argentina + + + Armenia + + + Australia + + + Austria + + + Azerbaijan + + + Bahamas + + + Bahrain + + + Bangladesh + + + Barbados + + + Belarus + + + Belgium + + + Belize + + + Benin + + + Bhutan + + + Bolivia + + + Bosnia & Herzegovina + + + Botswana + + + Brazil + + + Brunei + + + Bulgaria + + + Burkina Faso + + + Burundi + + + Cape Verde + + + Cambodia + + + Cameroon + + + Canada + + + Central African Republic + + + Chad + + + Chile + + + China + + + Colombia + + + Comoros + + + Congo - Brazzaville + + + Congo - Kinshasa + + + Costa Rica + + + Côte d’Ivoire + + + Croatia + + + Cuba + + + Cyprus + + + Czechia + + + Denmark + + + Djibouti + + + Dominica + + + Dominican Republic + + + Ecuador + + + Egypt + + + El Salvador + + + Equatorial Guinea + + + Eritrea + + + Estonia + + + Eswatini + + + Ethiopia + + + Fiji + + + Finland + + + France + + + Gabon + + + Gambia + + + Georgia + + + Germany + + + Ghana + + + Greece + + + Grenada + + + Guatemala + + + Guinea + + + Guinea-Bissau + + + Guyana + + + Haiti + + + Honduras + + + Hungary + + + Iceland + + + India + + + Indonesia + + + Iran + + + Iraq + + + Ireland + + + Israel + + + Italy + + + Jamaica + + + Japan + + + Jordan + + + Kazakhstan + + + Kenya + + + Kiribati + + + North Korea + + + South Korea + + + Kuwait + + + Kyrgyzstan + + + Laos + + + Latvia + + + Lebanon + + + Lesotho + + + Liberia + + + Libya + + + Liechtenstein + + + Lithuania + + + Luxembourg + + + Madagascar + + + Malawi + + + Malaysia + + + Maldives + + + Mali + + + Malta + + + Marshall Islands + + + Mauritania + + + Mauritius + + + Mexico + + + Micronesia + + + Moldova + + + Monaco + + + Mongolia + + + Montenegro + + + Morocco + + + Mozambique + + + Myanmar (Burma) + + + Namibia + + + Nauru + + + Nepal + + + Netherlands + + + New Zealand + + + Nicaragua + + + Niger + + + Nigeria + + + North Macedonia + + + Norway + + + Oman + + + Pakistan + + + Palau + + + Palestinian Territories + + + Panama + + + Papua New Guinea + + + Paraguay + + + Peru + + + Philippines + + + Poland + + + Portugal + + + Qatar + + + Romania + + + Russia + + + Rwanda + + + St. Kitts & Nevis + + + St. Lucia + + + St. Vincent & Grenadines + + + Samoa + + + San Marino + + + São Tomé & Príncipe + + + Saudi Arabia + + + Senegal + + + Serbia + + + Seychelles + + + Sierra Leone + + + Singapore + + + Slovakia + + + Slovenia + + + Solomon Islands + + + Somalia + + + South Africa + + + South Sudan + + + Spain + + + Sri Lanka + + + Sudan + + + Suriname + + + Sweden + + + Switzerland + + + Syria + + + Taiwan + + + Tajikistan + + + Tanzania + + + Thailand + + + Timor-Leste + + + Togo + + + Tonga + + + Trinidad & Tobago + + + Tunisia + + + Türkiye + + + Turkmenistan + + + Tuvalu + + + Uganda + + + Ukraine + + + United Arab Emirates + + + United Kingdom + + + United States + + + Uruguay + + + Uzbekistan + + + Vanuatu + + + Vatican City + + + Venezuela + + + Vietnam + + + Yemen + + + Zambia + + + Zimbabwe + + + Netherlands Antilles + + + Europe + + + Worldwide + + + The title of the album. + + + The original title of the album, when it differs from the current one. + + + A short summary or description of the album. + + + A comment that distinguishes the album from others with the same title. + + + The script used in the release title. + + + The release status of the album. + + + The number of discs of the album. + + + The number of tracks of the album. + + + The title of the release. + + + The media format of the album. + + + The packaging of the album. + + + The barcode of the album. + + + The catalog numbers of the album. + + + The label that released the album. + + + The Amazon Standard Identification Number of the album. + + + The MusicBrainz identifier of the release. + + + The MusicBrainz identifier of the release group. + + + The MusicBrainz identifier of the release artist. + + + The date when the album was originally released. + + + The year when the album was originally released. + + + The date when the album was released again. + + + The year when the album was released again. + + + The country of release of the album. + + + The version of the release, like the original one. + + + The two letter code of the language of the album. + + + The name of the language of the album. + + + The native name of the language of the album. + + + The genres of the album. + + + The tags of the album. + + + The release types of the album. + + + The tracks of the album. + + + Change cover + + + Cover image + + + No cover + + + The cover image was updated. + + + The cover image could not be uploaded. + + + Contributors + + + Contributor Id + + + Role + + + Add contributor + + + The people that contributed to the artist. + + + Ratings + + + Rating + + + Maximum rating + + + Source + + + Vote count + + + Add rating + + + The ratings of the artist from different sources. + + + Author + + + Translator + + + Illustrator + + + Publisher + + + Narrator + + + Actor + + + Director + + + Screenwriter + + + Composer + + + Lyricist + + + Arranger + + + Conductor + + + Producer + + + Executive Producer + + + Engineer + + + Mixer + + + Remixer + + + Record Label + + + Vocals + + + Backing Vocals + + + Guitar + + + Bass Guitar + + + Drums + + + Percussion + + + Keyboards + + + Piano + + + Synthesizer + + + Strings + + + Woodwinds + + + Brass + + + Choir + + + Orchestrator + + + Performer + + + User + + + MusicBrainz + + + Discogs + + + Last.fm + + + Genre + + + Add genre + + + Tag + + + Add tag + + + Release type + + + Add release type + + + Catalog number + + + Add catalog number + + + Cover + + + Front + + + Back + + + Booklet + + + Medium + + + Tray + + + Spine + + + Obi + + + Sticker + + + Poster + + + Liner notes + + + Watermark + + + Backdrop + + + Banner + + + Logo + + + Thumbnail + + + Identifiers + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.es-ES.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.es-ES.resx new file mode 100644 index 00000000..1259fd1d --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.es-ES.resx @@ -0,0 +1,1509 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Volver al artista + + + Editar álbum + + + Guardar + + + El álbum se ha guardado. + + + El elemento no se ha podido guardar. + + + Eliminar álbum + + + El álbum se ha eliminado. + + + ¿Seguro que quieres eliminar este elemento? + + + El elemento no se ha podido eliminar. + + + Información general + + + Título + + + Título original + + + Descripción + + + Desambiguación + + + Escritura + + + Estado de publicación + + + Total de discos + + + Total de pistas + + + Título de la publicación + + + Formato del medio + + + Embalaje + + + Código de barras + + + Números de catálogo + + + Sello + + + ASIN + + + Id de publicación de MusicBrainz + + + Id de grupo de publicación de MusicBrainz + + + Id de artista de publicación de MusicBrainz + + + Información de publicación + + + Fecha de publicación original + + + Año de publicación original + + + Fecha de reedición + + + Año de reedición + + + País de publicación + + + Versión de publicación + + + Idioma + + + Código de idioma + + + Nombre del idioma + + + Nombre nativo + + + Idioma original + + + Géneros + + + Etiquetas + + + Tipos de publicación + + + Pistas + + + Este álbum no tiene pistas + + + Eliminar + + + Bootleg + + + Cancelado + + + Suprimido + + + Oficial + + + Promoción + + + Pseudolanzamiento + + + Retirado + + + Acetato de 10 pulgadas + + + Shellac de 10 pulgadas + + + Vinilo de 10 pulgadas + + + Acetato de 12 pulgadas + + + Laser Disc de 12 pulgadas + + + Shellac de 12 pulgadas + + + Vinilo de 12 pulgadas + + + Vinilo de 3 pulgadas + + + Disquete de 3,5 pulgadas + + + Disquete de 5,25 pulgadas + + + Acetato de 7 pulgadas + + + Flexi Disc de 7 pulgadas + + + Shellac de 7 pulgadas + + + Vinilo de 7 pulgadas + + + Laser Disc de 8 pulgadas + + + Cartucho de ocho pistas + + + CD de 8 cm + + + CD de 8 cm Plus G + + + CD de 8 cm -R + + + Acetato + + + Betacam SP + + + Betamax + + + Blu-ray + + + Blu-ray -R + + + Blu-spec CD + + + Cartucho + + + Casete + + + CD + + + CD Plus G + + + CD-i + + + CD -R + + + CDV + + + CED + + + Copy Control CD + + + DAT + + + CD de datos + + + DVD de datos + + + DVD de datos -R + + + Data Play + + + DCC + + + Medios digitales + + + Tarjeta de descarga + + + DTSCD + + + Dual Disc + + + Dual Disc cara CD + + + Dual Disc cara DVD + + + Dual Disc cara DVD Audio + + + Dual Disc cara DVD Vídeo + + + DVD + + + DVD Audio + + + DVD -R Vídeo + + + DVD Vídeo + + + DVD Plus + + + DVD Plus cara CD + + + DVD Plus cara DVD Audio + + + DVD Plus cara DVD Vídeo + + + Edison Diamond Disc + + + CD mejorado + + + Flexi Disc + + + Disquete + + + HDDVD + + + HDCD + + + Hi Pac + + + HQCD + + + SACD híbrido + + + SACD híbrido capa CD + + + SACD híbrido capa SACD + + + SACD híbrido capa SACD 2 canales + + + SACD híbrido capa SACD multicanal + + + Ki T Album + + + LaserDisc + + + Microcasete + + + MicroSD + + + MiniDisc + + + Mini DVD + + + Mini DVD Audio + + + Mini DVD Vídeo + + + Minimax CD + + + Minimax DVD + + + Minimax DVD Audio + + + Minimax DVD Vídeo + + + CD de modo mixto + + + Otro + + + Pathe Disc + + + Disco de fonógrafo + + + Rollo de piano + + + Playbutton + + + PlayTape + + + Carrete a carrete + + + Cartucho ROM + + + SACD + + + SACD 2 canales + + + SACD multicanal + + + SDCard + + + Shellac + + + SHMCD + + + SHMSACD + + + SHMSACD multicanal + + + Slot Music + + + SVCD + + + Tefifon + + + UMD + + + Unidad flash USB + + + VCD + + + VHD + + + VHS + + + Vinilo + + + Disco de vinilo + + + Disco de vinilo cara CD + + + Disco de vinilo cara DVD + + + Disco de vinilo cara de vinilo + + + Cilindro de cera + + + Zip Disk + + + Libro + + + Caja + + + Funda de cartón + + + Estuche de casete + + + Estuche de concha + + + Digibook + + + Digifile + + + Digipak + + + Caja deslizante + + + Fatbox + + + Cubierta desplegable + + + Estuche jewel + + + Estuche keep + + + Caja larga + + + Lata metálica + + + Funda de plástico + + + Estuche deslizante + + + Estuche jewel slim + + + Funda + + + Estuche de cierre + + + Estuche de cierre + + + Super jewel box + + + Ninguno + + + Afganistán + + + Albania + + + Argelia + + + Andorra + + + Angola + + + Antigua y Barbuda + + + Argentina + + + Armenia + + + Australia + + + Austria + + + Azerbaiyán + + + Bahamas + + + Baréin + + + Bangladés + + + Barbados + + + Bielorrusia + + + Bélgica + + + Belice + + + Benín + + + Bután + + + Bolivia + + + Bosnia y Herzegovina + + + Botsuana + + + Brasil + + + Brunéi + + + Bulgaria + + + Burkina Faso + + + Burundi + + + Cabo Verde + + + Camboya + + + Camerún + + + Canadá + + + República Centroafricana + + + Chad + + + Chile + + + China + + + Colombia + + + Comoras + + + Congo - Brazzaville + + + Congo - Kinsasa + + + Costa Rica + + + Costa de Marfil + + + Croacia + + + Cuba + + + Chipre + + + Chequia + + + Dinamarca + + + Yibuti + + + Dominica + + + República Dominicana + + + Ecuador + + + Egipto + + + El Salvador + + + Guinea Ecuatorial + + + Eritrea + + + Estonia + + + Esuatini + + + Etiopía + + + Fiyi + + + Finlandia + + + Francia + + + Gabón + + + Gambia + + + Georgia + + + Alemania + + + Ghana + + + Grecia + + + Granada + + + Guatemala + + + Guinea + + + Guinea-Bisáu + + + Guyana + + + Haití + + + Honduras + + + Hungría + + + Islandia + + + India + + + Indonesia + + + Irán + + + Irak + + + Irlanda + + + Israel + + + Italia + + + Jamaica + + + Japón + + + Jordania + + + Kazajistán + + + Kenia + + + Kiribati + + + Corea del Norte + + + Corea del Sur + + + Kuwait + + + Kirguistán + + + Laos + + + Letonia + + + Líbano + + + Lesoto + + + Liberia + + + Libia + + + Liechtenstein + + + Lituania + + + Luxemburgo + + + Madagascar + + + Malaui + + + Malasia + + + Maldivas + + + Malí + + + Malta + + + Islas Marshall + + + Mauritania + + + Mauricio + + + México + + + Micronesia + + + Moldavia + + + Mónaco + + + Mongolia + + + Montenegro + + + Marruecos + + + Mozambique + + + Myanmar (Birmania) + + + Namibia + + + Nauru + + + Nepal + + + Países Bajos + + + Nueva Zelanda + + + Nicaragua + + + Níger + + + Nigeria + + + Macedonia del Norte + + + Noruega + + + Omán + + + Pakistán + + + Palaos + + + Territorios Palestinos + + + Panamá + + + Papúa Nueva Guinea + + + Paraguay + + + Perú + + + Filipinas + + + Polonia + + + Portugal + + + Catar + + + Rumanía + + + Rusia + + + Ruanda + + + San Cristóbal y Nieves + + + Santa Lucía + + + San Vicente y las Granadinas + + + Samoa + + + San Marino + + + Santo Tomé y Príncipe + + + Arabia Saudí + + + Senegal + + + Serbia + + + Seychelles + + + Sierra Leona + + + Singapur + + + Eslovaquia + + + Eslovenia + + + Islas Salomón + + + Somalia + + + Sudáfrica + + + Sudán del Sur + + + España + + + Sri Lanka + + + Sudán + + + Surinam + + + Suecia + + + Suiza + + + Siria + + + Taiwán + + + Tayikistán + + + Tanzania + + + Tailandia + + + Timor-Leste + + + Togo + + + Tonga + + + Trinidad y Tobago + + + Túnez + + + Turquía + + + Turkmenistán + + + Tuvalu + + + Uganda + + + Ucrania + + + Emiratos Árabes Unidos + + + Reino Unido + + + Estados Unidos + + + Uruguay + + + Uzbekistán + + + Vanuatu + + + Ciudad del Vaticano + + + Venezuela + + + Vietnam + + + Yemen + + + Zambia + + + Zimbabue + + + Antillas Neerlandesas + + + Europa + + + Mundial + + + El título del álbum. + + + El título original del álbum, cuando difiere del actual. + + + Un breve resumen o descripción del álbum. + + + Un comentario que distingue el álbum de otros con el mismo título. + + + El sistema de escritura usado en el título del lanzamiento. + + + El estado de lanzamiento del álbum. + + + El número de discos del álbum. + + + El número de pistas del álbum. + + + El título del lanzamiento. + + + El formato del medio del álbum. + + + El embalaje del álbum. + + + El código de barras del álbum. + + + Los números de catálogo del álbum. + + + El sello que publicó el álbum. + + + El Amazon Standard Identification Number del álbum. + + + El identificador MusicBrainz del lanzamiento. + + + El identificador MusicBrainz del grupo de lanzamientos. + + + El identificador MusicBrainz del artista del lanzamiento. + + + La fecha en que el álbum se lanzó originalmente. + + + El año en que el álbum se lanzó originalmente. + + + La fecha en que el álbum se lanzó de nuevo. + + + El año en que el álbum se lanzó de nuevo. + + + El país de lanzamiento del álbum. + + + La versión del lanzamiento, como la original. + + + El código de dos letras del idioma del álbum. + + + El nombre del idioma del álbum. + + + El nombre nativo del idioma del álbum. + + + Los géneros del álbum. + + + Las etiquetas del álbum. + + + Los tipos de lanzamiento del álbum. + + + Las pistas del álbum. + + + Cambiar la portada + + + Imagen de portada + + + Sin portada + + + La imagen de portada se actualizó. + + + No se pudo subir la imagen de portada. + + + Colaboradores + + + Id de colaborador + + + Rol + + + Añadir colaborador + + + Las personas que contribuyeron al artista. + + + Valoraciones + + + Valoración + + + Valoración máxima + + + Fuente + + + Número de votos + + + Añadir valoración + + + Las valoraciones del artista de diferentes fuentes. + + + Autor + + + Traductor + + + Ilustrador + + + Editorial + + + Narrador + + + Actor + + + Director + + + Guionista + + + Compositor + + + Letrista + + + Arreglista + + + Director de orquesta + + + Productor + + + Productor ejecutivo + + + Ingeniero + + + Mezclador + + + Remezclador + + + Discográfica + + + Voces + + + Coros + + + Guitarra + + + Bajo + + + Batería + + + Percusión + + + Teclados + + + Piano + + + Sintetizador + + + Cuerdas + + + Viento madera + + + Metales + + + Coro + + + Orquestador + + + Intérprete + + + Usuario + + + MusicBrainz + + + Discogs + + + Last.fm + + + Género + + + Añadir género + + + Etiqueta + + + Añadir etiqueta + + + Tipo de publicación + + + Añadir tipo de publicación + + + Número de catálogo + + + Añadir número de catálogo + + + Portada + + + Frente + + + Reverso + + + Folleto + + + Soporte + + + Bandeja + + + Lomo + + + Obi + + + Pegatina + + + Póster + + + Notas + + + Marca de agua + + + Fondo + + + Banner + + + Logotipo + + + Miniatura + + + Identificadores + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.fr-FR.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.fr-FR.resx new file mode 100644 index 00000000..0b38058a --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.fr-FR.resx @@ -0,0 +1,1509 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Retour à l'artiste + + + Modifier l'album + + + Enregistrer + + + L'album a été enregistré. + + + L'élément n'a pas pu être enregistré. + + + Supprimer l'album + + + L'album a été supprimé. + + + Voulez-vous vraiment supprimer cet élément ? + + + L'élément n'a pas pu être supprimé. + + + Informations générales + + + Titre + + + Titre original + + + Description + + + Désambiguïsation + + + Écriture + + + Statut de publication + + + Nombre total de disques + + + Nombre total de pistes + + + Titre de la publication + + + Format du support + + + Conditionnement + + + Code-barres + + + Numéros de catalogue + + + Label + + + ASIN + + + Id de publication MusicBrainz + + + Id de groupe de publication MusicBrainz + + + Id d'artiste de publication MusicBrainz + + + Informations de publication + + + Date de publication originale + + + Année de publication originale + + + Date de réédition + + + Année de réédition + + + Pays de publication + + + Version de publication + + + Langue + + + Code de langue + + + Nom de la langue + + + Nom natif + + + Langue originale + + + Genres + + + Étiquettes + + + Types de publication + + + Pistes + + + Cet album ne contient aucune piste + + + Supprimer + + + Bootleg + + + Annulé + + + Supprimé + + + Officiel + + + Promotion + + + Pseudo-release + + + Retiré + + + Acétate 10 pouces + + + Shellac 10 pouces + + + Vinyle 10 pouces + + + Acétate 12 pouces + + + Laser Disc 12 pouces + + + Shellac 12 pouces + + + Vinyle 12 pouces + + + Vinyle 3 pouces + + + Disquette 3,5 pouces + + + Disquette 5,25 pouces + + + Acétate 7 pouces + + + Flexi Disc 7 pouces + + + Shellac 7 pouces + + + Vinyle 7 pouces + + + Laser Disc 8 pouces + + + Cartouche huit pistes + + + CD 8 cm + + + CD 8 cm plus G + + + CD 8 cm moins R + + + Acétate + + + Betacam SP + + + Betamax + + + Blu-ray + + + Blu-ray moins R + + + Blu Spec CD + + + Cartouche + + + Cassette + + + CD + + + CD plus G + + + CD moins i + + + CD moins R + + + CDV + + + CED + + + CD Copy Control + + + DAT + + + CD de données + + + DVD de données + + + DVD de données moins R + + + Data Play + + + DCC + + + Support numérique + + + Carte de téléchargement + + + DTSCD + + + Dual Disc + + + Dual Disc face CD + + + Dual Disc face DVD + + + Dual Disc face DVD audio + + + Dual Disc face DVD vidéo + + + DVD + + + DVD audio + + + DVD moins R vidéo + + + DVD vidéo + + + DVD Plus + + + DVD Plus face CD + + + DVD Plus face DVD audio + + + DVD Plus face DVD vidéo + + + Edison Diamond Disc + + + CD amélioré + + + Flexi Disc + + + Disquette + + + HDDVD + + + HDCD + + + Hi Pac + + + HQCD + + + Hybrid SACD + + + Hybrid SACD couche CD + + + Hybrid SACD couche SACD + + + Hybrid SACD couche SACD 2 canaux + + + Hybrid SACD couche SACD multicanal + + + Ki T Album + + + Laser Disc + + + Microcassette + + + Micro SD + + + Mini Disc + + + Mini DVD + + + Mini DVD audio + + + Mini DVD vidéo + + + Minimax CD + + + Minimax DVD + + + Minimax DVD audio + + + Minimax DVD vidéo + + + CD en mode mixte + + + Autre + + + Pathe Disc + + + Disque phonographique + + + Rouleau de piano + + + Playbutton + + + Play Tape + + + Bobine à bobine + + + Cartouche ROM + + + SACD + + + SACD 2 canaux + + + SACD multicanal + + + SD Card + + + Shellac + + + SHMCD + + + SHMSACD + + + SHMSACD multicanal + + + Slot Music + + + SVCD + + + Tefifon + + + UMD + + + Clé USB + + + VCD + + + VHD + + + VHS + + + Vinyle + + + Disque vinyle + + + Disque vinyle face CD + + + Disque vinyle face DVD + + + Disque vinyle face vinyle + + + Cylindre de cire + + + Zip Disk + + + Livre + + + Boîte + + + Pochette en carton + + + Boîtier de cassette + + + Boîtier à charnière + + + Digibook + + + Digifile + + + Digipak + + + Discbox Slider + + + Fatbox + + + Pochette dépliante + + + Boîtier cristal + + + Boîtier à clip + + + Longbox + + + Boîte métallique + + + Pochette plastique + + + Slidepack + + + Boîtier cristal fin + + + Étui + + + Boîtier à pression + + + Snap Pack + + + Super Jewel Box + + + Aucun + + + Afghanistan + + + Albanie + + + Algérie + + + Andorre + + + Angola + + + Antigua-et-Barbuda + + + Argentine + + + Arménie + + + Australie + + + Autriche + + + Azerbaïdjan + + + Bahamas + + + Bahreïn + + + Bangladesh + + + Barbade + + + Biélorussie + + + Belgique + + + Belize + + + Bénin + + + Bhoutan + + + Bolivie + + + Bosnie-Herzégovine + + + Botswana + + + Brésil + + + Brunei + + + Bulgarie + + + Burkina Faso + + + Burundi + + + Cap-Vert + + + Cambodge + + + Cameroun + + + Canada + + + République centrafricaine + + + Tchad + + + Chili + + + Chine + + + Colombie + + + Comores + + + Congo-Brazzaville + + + Congo-Kinshasa + + + Costa Rica + + + Côte d'Ivoire + + + Croatie + + + Cuba + + + Chypre + + + Tchéquie + + + Danemark + + + Djibouti + + + Dominique + + + République dominicaine + + + Équateur + + + Égypte + + + Salvador + + + Guinée équatoriale + + + Érythrée + + + Estonie + + + Eswatini + + + Éthiopie + + + Fidji + + + Finlande + + + France + + + Gabon + + + Gambie + + + Géorgie + + + Allemagne + + + Ghana + + + Grèce + + + Grenade + + + Guatemala + + + Guinée + + + Guinée-Bissau + + + Guyana + + + Haïti + + + Honduras + + + Hongrie + + + Islande + + + Inde + + + Indonésie + + + Iran + + + Irak + + + Irlande + + + Israël + + + Italie + + + Jamaïque + + + Japon + + + Jordanie + + + Kazakhstan + + + Kenya + + + Kiribati + + + Corée du Nord + + + Corée du Sud + + + Koweït + + + Kirghizstan + + + Laos + + + Lettonie + + + Liban + + + Lesotho + + + Liberia + + + Libye + + + Liechtenstein + + + Lituanie + + + Luxembourg + + + Madagascar + + + Malawi + + + Malaisie + + + Maldives + + + Mali + + + Malte + + + Îles Marshall + + + Mauritanie + + + Maurice + + + Mexique + + + Micronésie + + + Moldavie + + + Monaco + + + Mongolie + + + Monténégro + + + Maroc + + + Mozambique + + + Myanmar (Birmanie) + + + Namibie + + + Nauru + + + Népal + + + Pays-Bas + + + Nouvelle-Zélande + + + Nicaragua + + + Niger + + + Nigeria + + + Macédoine du Nord + + + Norvège + + + Oman + + + Pakistan + + + Palaos + + + Territoires palestiniens + + + Panama + + + Papouasie-Nouvelle-Guinée + + + Paraguay + + + Pérou + + + Philippines + + + Pologne + + + Portugal + + + Qatar + + + Roumanie + + + Russie + + + Rwanda + + + Saint-Christophe-et-Niévès + + + Sainte-Lucie + + + Saint-Vincent-et-les Grenadines + + + Samoa + + + Saint-Marin + + + Sao Tomé-et-Principe + + + Arabie saoudite + + + Sénégal + + + Serbie + + + Seychelles + + + Sierra Leone + + + Singapour + + + Slovaquie + + + Slovénie + + + Îles Salomon + + + Somalie + + + Afrique du Sud + + + Soudan du Sud + + + Espagne + + + Sri Lanka + + + Soudan + + + Suriname + + + Suède + + + Suisse + + + Syrie + + + Taïwan + + + Tadjikistan + + + Tanzanie + + + Thaïlande + + + Timor oriental + + + Togo + + + Tonga + + + Trinité-et-Tobago + + + Tunisie + + + Turquie + + + Turkménistan + + + Tuvalu + + + Ouganda + + + Ukraine + + + Émirats arabes unis + + + Royaume-Uni + + + États-Unis + + + Uruguay + + + Ouzbékistan + + + Vanuatu + + + État de la Cité du Vatican + + + Venezuela + + + Viêt Nam + + + Yémen + + + Zambie + + + Zimbabwe + + + Antilles néerlandaises + + + Europe + + + Monde + + + Le titre de l'album. + + + Le titre original de l'album, lorsqu'il diffère du titre actuel. + + + Un bref résumé ou une description de l'album. + + + Un commentaire qui distingue l'album des autres portant le même titre. + + + L'écriture utilisée dans le titre de la sortie. + + + Le statut de sortie de l'album. + + + Le nombre de disques de l'album. + + + Le nombre de pistes de l'album. + + + Le titre de la sortie. + + + Le format du support de l'album. + + + Le conditionnement de l'album. + + + Le code-barres de l'album. + + + Les numéros de catalogue de l'album. + + + Le label qui a publié l'album. + + + L'Amazon Standard Identification Number de l'album. + + + L'identifiant MusicBrainz de la sortie. + + + L'identifiant MusicBrainz du groupe de sorties. + + + L'identifiant MusicBrainz de l'artiste de la sortie. + + + La date à laquelle l'album a été publié à l'origine. + + + L'année à laquelle l'album a été publié à l'origine. + + + La date à laquelle l'album a été publié à nouveau. + + + L'année à laquelle l'album a été publié à nouveau. + + + Le pays de sortie de l'album. + + + La version de la sortie, comme l'originale. + + + Le code à deux lettres de la langue de l'album. + + + Le nom de la langue de l'album. + + + Le nom natif de la langue de l'album. + + + Les genres de l'album. + + + Les étiquettes de l'album. + + + Les types de sortie de l'album. + + + Les pistes de l'album. + + + Changer la couverture + + + Image de couverture + + + Aucune couverture + + + L'image de couverture a été mise à jour. + + + L'image de couverture n'a pas pu être téléversée. + + + Contributeurs + + + Id du contributeur + + + Rôle + + + Ajouter un contributeur + + + Les personnes ayant contribué à l'artiste. + + + Évaluations + + + Évaluation + + + Évaluation maximale + + + Source + + + Nombre de votes + + + Ajouter une évaluation + + + Les notes de l'artiste provenant de différentes sources. + + + Auteur + + + Traducteur + + + Illustrateur + + + Éditeur + + + Narrateur + + + Acteur + + + Réalisateur + + + Scénariste + + + Compositeur + + + Parolier + + + Arrangeur + + + Chef d'orchestre + + + Producteur + + + Producteur exécutif + + + Ingénieur du son + + + Mixeur + + + Remixeur + + + Maison de disques + + + Chant + + + Chœurs + + + Guitare + + + Guitare basse + + + Batterie + + + Percussions + + + Claviers + + + Piano + + + Synthétiseur + + + Cordes + + + Bois + + + Cuivres + + + Chœur + + + Orchestrateur + + + Interprète + + + Utilisateur + + + MusicBrainz + + + Discogs + + + Last.fm + + + Genre + + + Ajouter un genre + + + Étiquette + + + Ajouter une étiquette + + + Type de publication + + + Ajouter un type de publication + + + Numéro de catalogue + + + Ajouter un numéro de catalogue + + + Couverture + + + Recto + + + Verso + + + Livret + + + Support + + + Plateau + + + Tranche + + + Obi + + + Autocollant + + + Affiche + + + Notes + + + Filigrane + + + Arrière-plan + + + Bannière + + + Logo + + + Miniature + + + Identifiants + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.it-IT.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.it-IT.resx new file mode 100644 index 00000000..80112399 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.it-IT.resx @@ -0,0 +1,1509 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Torna all'artista + + + Modifica album + + + Salva + + + L'album è stato salvato. + + + Non è stato possibile salvare l'elemento. + + + Elimina album + + + L'album è stato eliminato. + + + Sei sicuro di voler eliminare questo elemento? + + + Non è stato possibile eliminare l'elemento. + + + Informazioni generali + + + Titolo + + + Titolo originale + + + Descrizione + + + Disambiguazione + + + Scrittura + + + Stato di pubblicazione + + + Totale dischi + + + Totale tracce + + + Titolo della pubblicazione + + + Formato del supporto + + + Confezione + + + Codice a barre + + + Numeri di catalogo + + + Etichetta + + + ASIN + + + Id della pubblicazione MusicBrainz + + + Id del gruppo di pubblicazione MusicBrainz + + + Id dell'artista di pubblicazione MusicBrainz + + + Informazioni di pubblicazione + + + Data di pubblicazione originale + + + Anno di pubblicazione originale + + + Data di ripubblicazione + + + Anno di ripubblicazione + + + Paese di pubblicazione + + + Versione di pubblicazione + + + Lingua + + + Codice lingua + + + Nome della lingua + + + Nome nativo + + + Lingua originale + + + Generi + + + Etichette + + + Tipi di pubblicazione + + + Tracce + + + Questo album non ha tracce + + + Rimuovi + + + Bootleg + + + Cancellato + + + Espunto + + + Ufficiale + + + Promozione + + + Pseudo pubblicazione + + + Ritirato + + + Acetato da 10 pollici + + + Shellac da 10 pollici + + + Vinile da 10 pollici + + + Acetato da 12 pollici + + + Laserdisc da 12 pollici + + + Shellac da 12 pollici + + + Vinile da 12 pollici + + + Vinile da 3 pollici + + + Floppy disk da 3,5 pollici + + + Floppy disk da 5,25 pollici + + + Acetato da 7 pollici + + + Flexi Disc da 7 pollici + + + Shellac da 7 pollici + + + Vinile da 7 pollici + + + Laserdisc da 8 pollici + + + Cartuccia a otto tracce + + + CD da 8 cm + + + CD da 8 cm Plus G + + + CD-R da 8 cm + + + Acetato + + + Betacam SP + + + Betamax + + + Blu-ray + + + Blu-ray-R + + + Blu Spec CD + + + Cartuccia + + + Cassetta + + + CD + + + CD Plus G + + + CD-i + + + CD-R + + + CDV + + + CED + + + Copy Control CD + + + DAT + + + CD dati + + + DVD dati + + + Data DVD-R + + + Data Play + + + DCC + + + Supporto digitale + + + Scheda di download + + + DTSCD + + + Dual Disc + + + Dual Disc lato CD + + + Dual Disc lato DVD + + + Dual Disc lato DVD Audio + + + Dual Disc lato DVD video + + + DVD + + + DVD Audio + + + DVD-R video + + + DVD video + + + DVD Plus + + + DVD Plus lato CD + + + DVD Plus lato DVD Audio + + + DVD Plus lato DVD video + + + Edison Diamond Disc + + + CD enhanced + + + Flexi Disc + + + Floppy disk + + + HDDVD + + + HDCD + + + Hi Pac + + + HQCD + + + SACD ibrido + + + SACD ibrido strato CD + + + SACD ibrido strato SACD + + + SACD ibrido strato SACD 2 canali + + + SACD ibrido strato SACD multicanale + + + Ki T Album + + + Laserdisc + + + Microcassetta + + + Micro SD + + + MiniDisc + + + Mini DVD + + + Mini DVD Audio + + + Mini DVD video + + + Minimax CD + + + Minimax DVD + + + Minimax DVD Audio + + + Minimax DVD video + + + CD in modalità mista + + + Altro + + + Pathe Disc + + + Disco fonografico + + + Rullo per pianoforte + + + Playbutton + + + Play Tape + + + Bobina + + + Cartuccia ROM + + + SACD + + + SACD 2 canali + + + SACD multicanale + + + SD Card + + + Shellac + + + SHMCD + + + SHMSACD + + + SHMSACD multicanale + + + Slot Music + + + SVCD + + + Tefifon + + + UMD + + + Chiavetta USB + + + VCD + + + VHD + + + VHS + + + Vinile + + + Vinyl Disc + + + Vinyl Disc lato CD + + + Vinyl Disc lato DVD + + + Vinyl Disc lato vinile + + + Cilindro di cera + + + Zip Disk + + + Libro + + + Box + + + Busta in cartone + + + Custodia per cassette + + + Custodia clamshell + + + Digibook + + + Digifile + + + Digipak + + + Discbox Slider + + + Fatbox + + + Copertina gatefold + + + Custodia jewel + + + Keep case + + + Longbox + + + Lattina metallica + + + Busta in plastica + + + Slidepack + + + Custodia jewel slim + + + Slipcase + + + Custodia snap + + + Snap pack + + + Super Jewel Box + + + Nessuno + + + Afghanistan + + + Albania + + + Algeria + + + Andorra + + + Angola + + + Antigua e Barbuda + + + Argentina + + + Armenia + + + Australia + + + Austria + + + Azerbaigian + + + Bahamas + + + Bahrein + + + Bangladesh + + + Barbados + + + Bielorussia + + + Belgio + + + Belize + + + Benin + + + Bhutan + + + Bolivia + + + Bosnia ed Erzegovina + + + Botswana + + + Brasile + + + Brunei + + + Bulgaria + + + Burkina Faso + + + Burundi + + + Capo Verde + + + Cambogia + + + Camerun + + + Canada + + + Repubblica Centrafricana + + + Ciad + + + Cile + + + Cina + + + Colombia + + + Comore + + + Congo - Brazzaville + + + Congo - Kinshasa + + + Costa Rica + + + Costa d'Avorio + + + Croazia + + + Cuba + + + Cipro + + + Cechia + + + Danimarca + + + Gibuti + + + Dominica + + + Repubblica Dominicana + + + Ecuador + + + Egitto + + + El Salvador + + + Guinea Equatoriale + + + Eritrea + + + Estonia + + + Eswatini + + + Etiopia + + + Figi + + + Finlandia + + + Francia + + + Gabon + + + Gambia + + + Georgia + + + Germania + + + Ghana + + + Grecia + + + Grenada + + + Guatemala + + + Guinea + + + Guinea-Bissau + + + Guyana + + + Haiti + + + Honduras + + + Ungheria + + + Islanda + + + India + + + Indonesia + + + Iran + + + Iraq + + + Irlanda + + + Israele + + + Italia + + + Giamaica + + + Giappone + + + Giordania + + + Kazakistan + + + Kenya + + + Kiribati + + + Corea del Nord + + + Corea del Sud + + + Kuwait + + + Kirghizistan + + + Laos + + + Lettonia + + + Libano + + + Lesotho + + + Liberia + + + Libia + + + Liechtenstein + + + Lituania + + + Lussemburgo + + + Madagascar + + + Malawi + + + Malaysia + + + Maldive + + + Mali + + + Malta + + + Isole Marshall + + + Mauritania + + + Mauritius + + + Messico + + + Micronesia + + + Moldavia + + + Monaco + + + Mongolia + + + Montenegro + + + Marocco + + + Mozambico + + + Myanmar (Birmania) + + + Namibia + + + Nauru + + + Nepal + + + Paesi Bassi + + + Nuova Zelanda + + + Nicaragua + + + Niger + + + Nigeria + + + Macedonia del Nord + + + Norvegia + + + Oman + + + Pakistan + + + Palau + + + Territori palestinesi + + + Panama + + + Papua Nuova Guinea + + + Paraguay + + + Perù + + + Filippine + + + Polonia + + + Portogallo + + + Qatar + + + Romania + + + Russia + + + Ruanda + + + Saint Kitts e Nevis + + + Saint Lucia + + + Saint Vincent e Grenadine + + + Samoa + + + San Marino + + + São Tomé e Príncipe + + + Arabia Saudita + + + Senegal + + + Serbia + + + Seychelles + + + Sierra Leone + + + Singapore + + + Slovacchia + + + Slovenia + + + Isole Salomone + + + Somalia + + + Sudafrica + + + Sudan del Sud + + + Spagna + + + Sri Lanka + + + Sudan + + + Suriname + + + Svezia + + + Svizzera + + + Siria + + + Taiwan + + + Tagikistan + + + Tanzania + + + Thailandia + + + Timor Est + + + Togo + + + Tonga + + + Trinidad e Tobago + + + Tunisia + + + Turchia + + + Turkmenistan + + + Tuvalu + + + Uganda + + + Ucraina + + + Emirati Arabi Uniti + + + Regno Unito + + + Stati Uniti + + + Uruguay + + + Uzbekistan + + + Vanuatu + + + Città del Vaticano + + + Venezuela + + + Vietnam + + + Yemen + + + Zambia + + + Zimbabwe + + + Antille Olandesi + + + Europa + + + Mondiale + + + Il titolo dell'album. + + + Il titolo originale dell'album, quando differisce da quello attuale. + + + Un breve riassunto o descrizione dell'album. + + + Un commento che distingue l'album da altri con lo stesso titolo. + + + La scrittura usata nel titolo della pubblicazione. + + + Lo stato di pubblicazione dell'album. + + + Il numero di dischi dell'album. + + + Il numero di tracce dell'album. + + + Il titolo della pubblicazione. + + + Il formato del supporto dell'album. + + + La confezione dell'album. + + + Il codice a barre dell'album. + + + I numeri di catalogo dell'album. + + + L'etichetta che ha pubblicato l'album. + + + L'Amazon Standard Identification Number dell'album. + + + L'identificatore MusicBrainz della pubblicazione. + + + L'identificatore MusicBrainz del gruppo di pubblicazioni. + + + L'identificatore MusicBrainz dell'artista della pubblicazione. + + + La data in cui l'album è stato pubblicato originariamente. + + + L'anno in cui l'album è stato pubblicato originariamente. + + + La data in cui l'album è stato ripubblicato. + + + L'anno in cui l'album è stato ripubblicato. + + + Il paese di pubblicazione dell'album. + + + La versione della pubblicazione, come quella originale. + + + Il codice di due lettere della lingua dell'album. + + + Il nome della lingua dell'album. + + + Il nome nativo della lingua dell'album. + + + I generi dell'album. + + + I tag dell'album. + + + I tipi di pubblicazione dell'album. + + + Le tracce dell'album. + + + Cambia copertina + + + Immagine di copertina + + + Nessuna copertina + + + L'immagine di copertina è stata aggiornata. + + + Impossibile caricare l'immagine di copertina. + + + Collaboratori + + + Id collaboratore + + + Ruolo + + + Aggiungi collaboratore + + + Le persone che hanno contribuito all'artista. + + + Valutazioni + + + Valutazione + + + Valutazione massima + + + Fonte + + + Numero di voti + + + Aggiungi valutazione + + + Le valutazioni dell'artista da diverse fonti. + + + Autore + + + Traduttore + + + Illustratore + + + Editore + + + Narratore + + + Attore + + + Regista + + + Sceneggiatore + + + Compositore + + + Paroliere + + + Arrangiatore + + + Direttore d'orchestra + + + Produttore + + + Produttore esecutivo + + + Tecnico del suono + + + Mixer + + + Remixer + + + Etichetta discografica + + + Voce + + + Voci di supporto + + + Chitarra + + + Basso + + + Batteria + + + Percussioni + + + Tastiere + + + Pianoforte + + + Sintetizzatore + + + Archi + + + Legni + + + Ottoni + + + Coro + + + Orchestratore + + + Esecutore + + + Utente + + + MusicBrainz + + + Discogs + + + Last.fm + + + Genere + + + Aggiungi genere + + + Etichetta + + + Aggiungi etichetta + + + Tipo di pubblicazione + + + Aggiungi tipo di pubblicazione + + + Numero di catalogo + + + Aggiungi numero di catalogo + + + Copertina + + + Fronte + + + Retro + + + Libretto + + + Supporto + + + Vassoio + + + Dorso + + + Obi + + + Adesivo + + + Poster + + + Note + + + Filigrana + + + Sfondo + + + Banner + + + Logo + + + Miniatura + + + Identificatori + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ja-JP.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ja-JP.resx new file mode 100644 index 00000000..8dff23f1 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ja-JP.resx @@ -0,0 +1,1509 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + アーティストに戻る + + + アルバムを編集 + + + 保存 + + + アルバムを保存しました。 + + + 項目を保存できませんでした。 + + + アルバムを削除 + + + アルバムを削除しました。 + + + この項目を削除してもよろしいですか? + + + 項目を削除できませんでした。 + + + 一般情報 + + + タイトル + + + 原題 + + + 説明 + + + 曖昧性の解消 + + + 文字体系 + + + リリース状態 + + + ディスク総数 + + + トラック総数 + + + リリースタイトル + + + メディア形式 + + + パッケージ + + + バーコード + + + カタログ番号 + + + レーベル + + + ASIN + + + MusicBrainz リリース Id + + + MusicBrainz リリースグループ Id + + + MusicBrainz リリースアーティスト Id + + + リリース情報 + + + 初版発売日 + + + 初版発売年 + + + 再発売日 + + + 再発売年 + + + 発売国 + + + リリース版 + + + 言語 + + + 言語コード + + + 言語名 + + + 現地語名 + + + 原語 + + + ジャンル + + + タグ + + + リリースタイプ + + + トラック + + + このアルバムにはトラックがありません + + + 削除 + + + 海賊版 + + + 中止 + + + 抹消 + + + 公式 + + + プロモーション + + + 疑似リリース + + + 撤回 + + + 10インチアセテート + + + 10インチシェラック + + + 10インチビニール + + + 12インチアセテート + + + 12インチレーザーディスク + + + 12インチシェラック + + + 12インチビニール + + + 3インチビニール + + + 3.5インチフロッピーディスク + + + 5.25インチフロッピーディスク + + + 7インチアセテート + + + 7インチフレキシディスク + + + 7インチシェラック + + + 7インチビニール + + + 8インチレーザーディスク + + + 8トラックカートリッジ + + + 8 cm CD + + + 8 cm CDプラスG + + + 8 cm CD-R + + + アセテート + + + Betacam SP + + + Betamax + + + Blu-ray + + + Blu-ray-R + + + Blu-spec CD + + + カートリッジ + + + カセット + + + CD + + + CDプラスG + + + CD-i + + + CD-R + + + CDV + + + CED + + + コピーコントロールCD + + + DAT + + + データCD + + + データDVD + + + データDVD-R + + + データプレイ + + + DCC + + + デジタルメディア + + + ダウンロードカード + + + DTSCD + + + デュアルディスク + + + デュアルディスク CD面 + + + デュアルディスク DVD面 + + + デュアルディスク DVDオーディオ面 + + + デュアルディスク DVDビデオ面 + + + DVD + + + DVDオーディオ + + + DVD-Rビデオ + + + DVDビデオ + + + DVDプラス + + + DVDプラス CD面 + + + DVDプラス DVDオーディオ面 + + + DVDプラス DVDビデオ面 + + + エジソンダイヤモンドディスク + + + エンハンストCD + + + フレキシディスク + + + フロッピーディスク + + + HDDVD + + + HDCD + + + Hi-Pac + + + HQCD + + + ハイブリッドSACD + + + ハイブリッドSACDCDレイヤー + + + ハイブリッドSACDSACDレイヤー + + + ハイブリッドSACDSACDレイヤー 2チャンネル + + + ハイブリッドSACDSACDレイヤーマルチチャンネル + + + KiT Album + + + レーザーディスク + + + マイクロカセット + + + マイクロSD + + + ミニディスク + + + ミニDVD + + + ミニDVDオーディオ + + + ミニDVDビデオ + + + Minimax CD + + + Minimax DVD + + + Minimax DVDオーディオ + + + Minimax DVDビデオ + + + ミックスモードCD + + + その他 + + + パテディスク + + + 蓄音機レコード + + + ピアノロール + + + Playbutton + + + PlayTape + + + オープンリール + + + ROMカートリッジ + + + SACD + + + SACD 2チャンネル + + + SACDマルチチャンネル + + + SDカード + + + シェラック + + + SHMCD + + + SHMSACD + + + SHMSACDマルチチャンネル + + + SlotMusic + + + SVCD + + + Tefifon + + + UMD + + + USBフラッシュドライブ + + + VCD + + + VHD + + + VHS + + + ビニール + + + ビニールディスク + + + ビニールディスク CD面 + + + ビニールディスク DVD面 + + + ビニールディスク ビニール面 + + + ワックスシリンダー + + + Zipディスク + + + ブック + + + ボックス + + + 厚紙スリーブ + + + カセットケース + + + クラムシェルケース + + + Digibook + + + Digifile + + + Digipak + + + Discbox Slider + + + Fatbox + + + ゲートフォールドカバー + + + ジュエルケース + + + キープケース + + + Longbox + + + メタル缶 + + + プラスチックスリーブ + + + Slidepack + + + スリムジュエルケース + + + スリップケース + + + スナップケース + + + スナップパック + + + スーパージュエルボックス + + + なし + + + アフガニスタン + + + アルバニア + + + アルジェリア + + + アンドラ + + + アンゴラ + + + アンティグア・バーブーダ + + + アルゼンチン + + + アルメニア + + + オーストラリア + + + オーストリア + + + アゼルバイジャン + + + バハマ + + + バーレーン + + + バングラデシュ + + + バルバドス + + + ベラルーシ + + + ベルギー + + + ベリーズ + + + ベナン + + + ブータン + + + ボリビア + + + ボスニア・ヘルツェゴビナ + + + ボツワナ + + + ブラジル + + + ブルネイ + + + ブルガリア + + + ブルキナファソ + + + ブルンジ + + + カーボベルデ + + + カンボジア + + + カメルーン + + + カナダ + + + 中央アフリカ共和国 + + + チャド + + + チリ + + + 中国 + + + コロンビア + + + コモロ + + + コンゴ共和国 + + + コンゴ民主共和国 + + + コスタリカ + + + コートジボワール + + + クロアチア + + + キューバ + + + キプロス + + + チェコ + + + デンマーク + + + ジブチ + + + ドミニカ国 + + + ドミニカ共和国 + + + エクアドル + + + エジプト + + + エルサルバドル + + + 赤道ギニア + + + エリトリア + + + エストニア + + + エスワティニ + + + エチオピア + + + フィジー + + + フィンランド + + + フランス + + + ガボン + + + ガンビア + + + ジョージア + + + ドイツ + + + ガーナ + + + ギリシャ + + + グレナダ + + + グアテマラ + + + ギニア + + + ギニアビサウ + + + ガイアナ + + + ハイチ + + + ホンジュラス + + + ハンガリー + + + アイスランド + + + インド + + + インドネシア + + + イラン + + + イラク + + + アイルランド + + + イスラエル + + + イタリア + + + ジャマイカ + + + 日本 + + + ヨルダン + + + カザフスタン + + + ケニア + + + キリバス + + + 北朝鮮 + + + 韓国 + + + クウェート + + + キルギス + + + ラオス + + + ラトビア + + + レバノン + + + レソト + + + リベリア + + + リビア + + + リヒテンシュタイン + + + リトアニア + + + ルクセンブルク + + + マダガスカル + + + マラウイ + + + マレーシア + + + モルディブ + + + マリ + + + マルタ + + + マーシャル諸島 + + + モーリタニア + + + モーリシャス + + + メキシコ + + + ミクロネシア + + + モルドバ + + + モナコ + + + モンゴル + + + モンテネグロ + + + モロッコ + + + モザンビーク + + + ミャンマー + + + ナミビア + + + ナウル + + + ネパール + + + オランダ + + + ニュージーランド + + + ニカラグア + + + ニジェール + + + ナイジェリア + + + 北マケドニア + + + ノルウェー + + + オマーン + + + パキスタン + + + パラオ + + + パレスチナ + + + パナマ + + + パプアニューギニア + + + パラグアイ + + + ペルー + + + フィリピン + + + ポーランド + + + ポルトガル + + + カタール + + + ルーマニア + + + ロシア + + + ルワンダ + + + セントクリストファー・ネービス + + + セントルシア + + + セントビンセント・グレナディーン + + + サモア + + + サンマリノ + + + サントメ・プリンシペ + + + サウジアラビア + + + セネガル + + + セルビア + + + セーシェル + + + シエラレオネ + + + シンガポール + + + スロバキア + + + スロベニア + + + ソロモン諸島 + + + ソマリア + + + 南アフリカ + + + 南スーダン + + + スペイン + + + スリランカ + + + スーダン + + + スリナム + + + スウェーデン + + + スイス + + + シリア + + + 台湾 + + + タジキスタン + + + タンザニア + + + タイ + + + 東ティモール + + + トーゴ + + + トンガ + + + トリニダード・トバゴ + + + チュニジア + + + トルコ + + + トルクメニスタン + + + ツバル + + + ウガンダ + + + ウクライナ + + + アラブ首長国連邦 + + + イギリス + + + アメリカ合衆国 + + + ウルグアイ + + + ウズベキスタン + + + バヌアツ + + + バチカン市国 + + + ベネズエラ + + + ベトナム + + + イエメン + + + ザンビア + + + ジンバブエ + + + オランダ領アンティル + + + ヨーロッパ + + + 全世界 + + + アルバムのタイトル。 + + + 現在のタイトルと異なる場合のアルバムの原題。 + + + アルバムの簡単な概要または説明。 + + + 同じタイトルの他のアルバムと区別するためのコメント。 + + + リリースタイトルで使用される文字体系。 + + + アルバムのリリース状況。 + + + アルバムのディスク数。 + + + アルバムのトラック数。 + + + リリースのタイトル。 + + + アルバムのメディア形式。 + + + アルバムのパッケージ。 + + + アルバムのバーコード。 + + + アルバムのカタログ番号。 + + + アルバムをリリースしたレーベル。 + + + アルバムのAmazon標準識別番号。 + + + リリースのMusicBrainz識別子。 + + + リリースグループのMusicBrainz識別子。 + + + リリースアーティストのMusicBrainz識別子。 + + + アルバムが最初にリリースされた日付。 + + + アルバムが最初にリリースされた年。 + + + アルバムが再リリースされた日付。 + + + アルバムが再リリースされた年。 + + + アルバムのリリース国。 + + + オリジナルなどのリリースのバージョン。 + + + アルバムの言語の2文字コード。 + + + アルバムの言語の名前。 + + + アルバムの言語の現地名。 + + + アルバムのジャンル。 + + + アルバムのタグ。 + + + アルバムのリリースタイプ。 + + + アルバムのトラック。 + + + カバーを変更 + + + カバー画像 + + + カバーなし + + + カバー画像を更新しました。 + + + カバー画像をアップロードできませんでした。 + + + 貢献者 + + + 貢献者 Id + + + 役割 + + + 貢献者を追加 + + + アーティストに貢献した人々。 + + + 評価 + + + 評価 + + + 最大評価 + + + 出典 + + + 投票数 + + + 評価を追加 + + + さまざまな情報源によるアーティストの評価。 + + + 著者 + + + 翻訳者 + + + イラストレーター + + + 出版社 + + + ナレーター + + + 俳優 + + + 監督 + + + 脚本家 + + + 作曲者 + + + 作詞者 + + + 編曲者 + + + 指揮者 + + + プロデューサー + + + エグゼクティブプロデューサー + + + エンジニア + + + ミキサー + + + リミキサー + + + レコードレーベル + + + ボーカル + + + バッキングボーカル + + + ギター + + + ベースギター + + + ドラム + + + パーカッション + + + キーボード + + + ピアノ + + + シンセサイザー + + + 弦楽器 + + + 木管楽器 + + + 金管楽器 + + + 合唱 + + + 管弦楽編曲者 + + + 演奏者 + + + ユーザー + + + MusicBrainz + + + Discogs + + + Last.fm + + + ジャンル + + + ジャンルを追加 + + + タグ + + + タグを追加 + + + リリースタイプ + + + リリースタイプを追加 + + + カタログ番号 + + + カタログ番号を追加 + + + カバー + + + 前面 + + + 背面 + + + ブックレット + + + メディア + + + トレイ + + + 背表紙 + + + 帯 + + + ステッカー + + + ポスター + + + ライナーノーツ + + + 透かし + + + 背景 + + + バナー + + + ロゴ + + + サムネイル + + + 識別子 + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.resx new file mode 100644 index 00000000..880ed67d --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.resx @@ -0,0 +1,1509 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Back to artist + + + Edit album + + + Save + + + The album was saved. + + + The item could not be saved. + + + Delete album + + + The album was deleted. + + + Are you sure you want to delete this item? + + + The item could not be deleted. + + + General information + + + Title + + + Original title + + + Description + + + Disambiguation + + + Script + + + Release status + + + Total discs + + + Total tracks + + + Release title + + + Media format + + + Packaging + + + Barcode + + + Catalog numbers + + + Label + + + ASIN + + + MusicBrainz release Id + + + MusicBrainz release group Id + + + MusicBrainz release artist Id + + + Release information + + + Original release date + + + Original release year + + + Re-release date + + + Re-release year + + + Release country + + + Release version + + + Language + + + Language code + + + Language name + + + Native name + + + Original language + + + Genres + + + Tags + + + Release types + + + Tracks + + + This album has no tracks + + + Remove + + + Bootleg + + + Cancelled + + + Expunged + + + Official + + + Promotion + + + Pseudo Release + + + Withdrawn + + + 10 inch Acetate + + + 10 inch Shellac + + + 10 inch Vinyl + + + 12 inch Acetate + + + 12 inch Laser Disc + + + 12 inch Shellac + + + 12 inch Vinyl + + + 3 inch Vinyl + + + 3.5 inch Floppy Disk + + + 5.25 inch Floppy Disk + + + 7 inch Acetate + + + 7 inch Flexi Disc + + + 7 inch Shellac + + + 7 inch Vinyl + + + 8 inch Laser Disc + + + Eight Track Cartridge + + + 8 cm CD + + + 8 cm CD Plus G + + + 8 cm CD Minus R + + + Acetate + + + Betacam SP + + + Betamax + + + Blu Ray + + + Blu Ray Minus R + + + Blu Spec CD + + + Cartridge + + + Cassette + + + CD + + + CD Plus G + + + CD Minusi + + + CD Minus R + + + CDV + + + CED + + + Copy Control CD + + + DAT + + + Data CD + + + Data DVD + + + Data DVD Minus R + + + Data Play + + + DCC + + + Digital Media + + + Download Card + + + DTSCD + + + Dual Disc + + + Dual Disc CD Side + + + Dual Disc DVD Side + + + Dual Disc DVD Audio Side + + + Dual Disc DVD Video Side + + + DVD + + + DVD Audio + + + DVD Minus R Video + + + DVD Video + + + DVD Plus + + + DVD Plus CD Side + + + DVD Plus DVD Audio Side + + + DVD Plus DVD Video Side + + + Edison Diamond Disc + + + Enhanced CD + + + Flexi Disc + + + Floppy Disk + + + HDDVD + + + HDCD + + + Hi Pac + + + HQCD + + + Hybrid SACD + + + Hybrid SACDCD Layer + + + Hybrid SACDSACD Layer + + + Hybrid SACDSACD Layer 2 Channels + + + Hybrid SACDSACD Layer Multichannel + + + Ki T Album + + + Laser Disc + + + Microcassette + + + Micro SD + + + Mini Disc + + + Mini DVD + + + Mini DVD Audio + + + Mini DVD Video + + + Minimax CD + + + Minimax DVD + + + Minimax DVD Audio + + + Minimax DVD Video + + + Mixed Mode CD + + + Other + + + Pathe Disc + + + Phonograph Record + + + Piano Roll + + + Playbutton + + + Play Tape + + + Reel To Reel + + + ROM Cartridge + + + SACD + + + SACD 2 Channels + + + SACD Multichannel + + + SD Card + + + Shellac + + + SHMCD + + + SHMSACD + + + SHMSACD Multichannel + + + Slot Music + + + SVCD + + + Tefifon + + + UMD + + + USB Flash Drive + + + VCD + + + VHD + + + VHS + + + Vinyl + + + Vinyl Disc + + + Vinyl Disc CD Side + + + Vinyl Disc DVD Side + + + Vinyl Disc Vinyl Side + + + Wax Cylinder + + + Zip Disk + + + Book + + + Box + + + Cardboard Paper Sleeve + + + Cassette Case + + + Clamshell Case + + + Digibook + + + Digifile + + + Digipak + + + Discbox Slider + + + Fatbox + + + Gatefold Cover + + + Jewel Case + + + Keep Case + + + Longbox + + + Metal Tin + + + Plastic Sleeve + + + Slidepack + + + Slim Jewel Case + + + Slipcase + + + Snap Case + + + Snap Pack + + + Super Jewel Box + + + None + + + Afghanistan + + + Albania + + + Algeria + + + Andorra + + + Angola + + + Antigua & Barbuda + + + Argentina + + + Armenia + + + Australia + + + Austria + + + Azerbaijan + + + Bahamas + + + Bahrain + + + Bangladesh + + + Barbados + + + Belarus + + + Belgium + + + Belize + + + Benin + + + Bhutan + + + Bolivia + + + Bosnia & Herzegovina + + + Botswana + + + Brazil + + + Brunei + + + Bulgaria + + + Burkina Faso + + + Burundi + + + Cape Verde + + + Cambodia + + + Cameroon + + + Canada + + + Central African Republic + + + Chad + + + Chile + + + China + + + Colombia + + + Comoros + + + Congo - Brazzaville + + + Congo - Kinshasa + + + Costa Rica + + + Côte d’Ivoire + + + Croatia + + + Cuba + + + Cyprus + + + Czechia + + + Denmark + + + Djibouti + + + Dominica + + + Dominican Republic + + + Ecuador + + + Egypt + + + El Salvador + + + Equatorial Guinea + + + Eritrea + + + Estonia + + + Eswatini + + + Ethiopia + + + Fiji + + + Finland + + + France + + + Gabon + + + Gambia + + + Georgia + + + Germany + + + Ghana + + + Greece + + + Grenada + + + Guatemala + + + Guinea + + + Guinea-Bissau + + + Guyana + + + Haiti + + + Honduras + + + Hungary + + + Iceland + + + India + + + Indonesia + + + Iran + + + Iraq + + + Ireland + + + Israel + + + Italy + + + Jamaica + + + Japan + + + Jordan + + + Kazakhstan + + + Kenya + + + Kiribati + + + North Korea + + + South Korea + + + Kuwait + + + Kyrgyzstan + + + Laos + + + Latvia + + + Lebanon + + + Lesotho + + + Liberia + + + Libya + + + Liechtenstein + + + Lithuania + + + Luxembourg + + + Madagascar + + + Malawi + + + Malaysia + + + Maldives + + + Mali + + + Malta + + + Marshall Islands + + + Mauritania + + + Mauritius + + + Mexico + + + Micronesia + + + Moldova + + + Monaco + + + Mongolia + + + Montenegro + + + Morocco + + + Mozambique + + + Myanmar (Burma) + + + Namibia + + + Nauru + + + Nepal + + + Netherlands + + + New Zealand + + + Nicaragua + + + Niger + + + Nigeria + + + North Macedonia + + + Norway + + + Oman + + + Pakistan + + + Palau + + + Palestinian Territories + + + Panama + + + Papua New Guinea + + + Paraguay + + + Peru + + + Philippines + + + Poland + + + Portugal + + + Qatar + + + Romania + + + Russia + + + Rwanda + + + St. Kitts & Nevis + + + St. Lucia + + + St. Vincent & Grenadines + + + Samoa + + + San Marino + + + São Tomé & Príncipe + + + Saudi Arabia + + + Senegal + + + Serbia + + + Seychelles + + + Sierra Leone + + + Singapore + + + Slovakia + + + Slovenia + + + Solomon Islands + + + Somalia + + + South Africa + + + South Sudan + + + Spain + + + Sri Lanka + + + Sudan + + + Suriname + + + Sweden + + + Switzerland + + + Syria + + + Taiwan + + + Tajikistan + + + Tanzania + + + Thailand + + + Timor-Leste + + + Togo + + + Tonga + + + Trinidad & Tobago + + + Tunisia + + + Türkiye + + + Turkmenistan + + + Tuvalu + + + Uganda + + + Ukraine + + + United Arab Emirates + + + United Kingdom + + + United States + + + Uruguay + + + Uzbekistan + + + Vanuatu + + + Vatican City + + + Venezuela + + + Vietnam + + + Yemen + + + Zambia + + + Zimbabwe + + + Netherlands Antilles + + + Europe + + + Worldwide + + + The title of the album. + + + The original title of the album, when it differs from the current one. + + + A short summary or description of the album. + + + A comment that distinguishes the album from others with the same title. + + + The script used in the release title. + + + The release status of the album. + + + The number of discs of the album. + + + The number of tracks of the album. + + + The title of the release. + + + The media format of the album. + + + The packaging of the album. + + + The barcode of the album. + + + The catalog numbers of the album. + + + The label that released the album. + + + The Amazon Standard Identification Number of the album. + + + The MusicBrainz identifier of the release. + + + The MusicBrainz identifier of the release group. + + + The MusicBrainz identifier of the release artist. + + + The date when the album was originally released. + + + The year when the album was originally released. + + + The date when the album was released again. + + + The year when the album was released again. + + + The country of release of the album. + + + The version of the release, like the original one. + + + The two letter code of the language of the album. + + + The name of the language of the album. + + + The native name of the language of the album. + + + The genres of the album. + + + The tags of the album. + + + The release types of the album. + + + The tracks of the album. + + + Change cover + + + Cover image + + + No cover + + + The cover image was updated. + + + The cover image could not be uploaded. + + + Contributors + + + Contributor Id + + + Role + + + Add contributor + + + The people that contributed to the artist. + + + Ratings + + + Rating + + + Maximum rating + + + Source + + + Vote count + + + Add rating + + + The ratings of the artist from different sources. + + + Author + + + Translator + + + Illustrator + + + Publisher + + + Narrator + + + Actor + + + Director + + + Screenwriter + + + Composer + + + Lyricist + + + Arranger + + + Conductor + + + Producer + + + Executive Producer + + + Engineer + + + Mixer + + + Remixer + + + Record Label + + + Vocals + + + Backing Vocals + + + Guitar + + + Bass Guitar + + + Drums + + + Percussion + + + Keyboards + + + Piano + + + Synthesizer + + + Strings + + + Woodwinds + + + Brass + + + Choir + + + Orchestrator + + + Performer + + + User + + + MusicBrainz + + + Discogs + + + Last.fm + + + Genre + + + Add genre + + + Tag + + + Add tag + + + Release type + + + Add release type + + + Catalog number + + + Add catalog number + + + Cover + + + Front + + + Back + + + Booklet + + + Medium + + + Tray + + + Spine + + + Obi + + + Sticker + + + Poster + + + Liner notes + + + Watermark + + + Backdrop + + + Banner + + + Logo + + + Thumbnail + + + Identifiers + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ro-RO.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ro-RO.resx new file mode 100644 index 00000000..68b6915d --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.ro-RO.resx @@ -0,0 +1,1509 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Înapoi la artist + + + Editează albumul + + + Salvează + + + Albumul a fost salvat. + + + Elementul nu a putut fi salvat. + + + Șterge albumul + + + Albumul a fost șters. + + + Sigur doriți să ștergeți acest element? + + + Elementul nu a putut fi șters. + + + Informații generale + + + Titlu + + + Titlu original + + + Descriere + + + Dezambiguizare + + + Scriere + + + Starea lansării + + + Total discuri + + + Total piese + + + Titlul lansării + + + Format media + + + Ambalare + + + Cod de bare + + + Numere de catalog + + + Casă de discuri + + + ASIN + + + Id lansare MusicBrainz + + + Id grup lansare MusicBrainz + + + Id artist lansare MusicBrainz + + + Informații de lansare + + + Data lansării originale + + + Anul lansării originale + + + Data relansării + + + Anul relansării + + + Țara de lansare + + + Versiunea lansării + + + Limbă + + + Codul limbii + + + Denumirea limbii + + + Denumire nativă + + + Limba originală + + + Genuri + + + Etichete + + + Tipuri de lansare + + + Piese + + + Acest album nu are piese + + + Elimină + + + Bootleg + + + Anulat + + + Eliminat + + + Oficial + + + Promoție + + + Pseudo-lansare + + + Retras + + + Acetat de 10 inch + + + Șelac de 10 inch + + + Vinil de 10 inch + + + Acetat de 12 inch + + + Disc laser de 12 inch + + + Șelac de 12 inch + + + Vinil de 12 inch + + + Vinil de 3 inch + + + Dischetă de 3,5 inch + + + Dischetă de 5,25 inch + + + Acetat de 7 inch + + + Flexi Disc de 7 inch + + + Șelac de 7 inch + + + Vinil de 7 inch + + + Disc laser de 8 inch + + + Cartuș cu opt piste + + + CD de 8 cm + + + CD de 8 cm Plus G + + + CD de 8 cm Minus R + + + Acetat + + + Betacam SP + + + Betamax + + + Blu-ray + + + Blu-ray Minus R + + + Blu Spec CD + + + Cartuș + + + Casetă + + + CD + + + CD Plus G + + + CD Minusi + + + CD Minus R + + + CDV + + + CED + + + CD Copy Control + + + DAT + + + CD de date + + + DVD de date + + + Date DVD Minus R + + + Data Play + + + DCC + + + Media digitală + + + Card de descărcare + + + DTSCD + + + Dual Disc + + + Dual Disc partea CD + + + Dual Disc partea DVD + + + Dual Disc partea DVD Audio + + + Dual Disc partea DVD Video + + + DVD + + + DVD Audio + + + DVD Minus R Video + + + DVD Video + + + DVD Plus + + + DVD Plus partea CD + + + DVD Plus partea DVD Audio + + + DVD Plus partea DVD Video + + + Edison Diamond Disc + + + CD îmbunătățit + + + Flexi Disc + + + Dischetă + + + HDDVD + + + HDCD + + + Hi Pac + + + HQCD + + + SACD hibrid + + + SACD hibrid strat CD + + + SACD hibrid strat SACD + + + SACD hibrid strat SACD 2 canale + + + SACD hibrid strat SACD multicanal + + + Ki T Album + + + Disc laser + + + Microcasetă + + + Micro SD + + + Mini Disc + + + Mini DVD + + + Mini DVD Audio + + + Mini DVD Video + + + CD Minimax + + + DVD Minimax + + + DVD Audio Minimax + + + DVD Video Minimax + + + CD cu mod mixt + + + Altele + + + Pathe Disc + + + Disc de fonograf + + + Rulou de pian + + + Playbutton + + + Play Tape + + + Bandă pe rolă + + + Cartuș ROM + + + SACD + + + SACD 2 canale + + + SACD multicanal + + + Card SD + + + Șelac + + + SHMCD + + + SHMSACD + + + SHMSACD multicanal + + + Slot Music + + + SVCD + + + Tefifon + + + UMD + + + Unitate flash USB + + + VCD + + + VHD + + + VHS + + + Vinil + + + Disc vinil + + + Disc vinil partea CD + + + Disc vinil partea DVD + + + Disc vinil partea vinil + + + Cilindru de ceară + + + Disc Zip + + + Carte + + + Cutie + + + Buzunar din carton + + + Carcasă de casetă + + + Carcasă clamshell + + + Digibook + + + Digifile + + + Digipak + + + Discbox Slider + + + Fatbox + + + Copertă gatefold + + + Carcasă jewel + + + Carcasă keep + + + Longbox + + + Cutie metalică + + + Buzunar de plastic + + + Slidepack + + + Carcasă jewel subțire + + + Carcasă glisantă + + + Carcasă snap + + + Ambalaj snap + + + Super Jewel Box + + + Niciunul + + + Afganistan + + + Albania + + + Algeria + + + Andorra + + + Angola + + + Antigua și Barbuda + + + Argentina + + + Armenia + + + Australia + + + Austria + + + Azerbaidjan + + + Bahamas + + + Bahrain + + + Bangladesh + + + Barbados + + + Belarus + + + Belgia + + + Belize + + + Benin + + + Bhutan + + + Bolivia + + + Bosnia și Herțegovina + + + Botswana + + + Brazilia + + + Brunei + + + Bulgaria + + + Burkina Faso + + + Burundi + + + Capul Verde + + + Cambodgia + + + Camerun + + + Canada + + + Republica Centrafricană + + + Ciad + + + Chile + + + China + + + Columbia + + + Comore + + + Congo - Brazzaville + + + Congo - Kinshasa + + + Costa Rica + + + Coasta de Fildeș + + + Croația + + + Cuba + + + Cipru + + + Cehia + + + Danemarca + + + Djibouti + + + Dominica + + + Republica Dominicană + + + Ecuador + + + Egipt + + + El Salvador + + + Guineea Ecuatorială + + + Eritreea + + + Estonia + + + Eswatini + + + Etiopia + + + Fiji + + + Finlanda + + + Franța + + + Gabon + + + Gambia + + + Georgia + + + Germania + + + Ghana + + + Grecia + + + Grenada + + + Guatemala + + + Guineea + + + Guineea-Bissau + + + Guyana + + + Haiti + + + Honduras + + + Ungaria + + + Islanda + + + India + + + Indonezia + + + Iran + + + Irak + + + Irlanda + + + Israel + + + Italia + + + Jamaica + + + Japonia + + + Iordania + + + Kazahstan + + + Kenya + + + Kiribati + + + Coreea de Nord + + + Coreea de Sud + + + Kuweit + + + Kârgâzstan + + + Laos + + + Letonia + + + Liban + + + Lesotho + + + Liberia + + + Libia + + + Liechtenstein + + + Lituania + + + Luxemburg + + + Madagascar + + + Malawi + + + Malaysia + + + Maldive + + + Mali + + + Malta + + + Insulele Marshall + + + Mauritania + + + Mauritius + + + Mexic + + + Micronezia + + + Moldova + + + Monaco + + + Mongolia + + + Muntenegru + + + Maroc + + + Mozambic + + + Myanmar (Birmania) + + + Namibia + + + Nauru + + + Nepal + + + Țările de Jos + + + Noua Zeelandă + + + Nicaragua + + + Niger + + + Nigeria + + + Macedonia de Nord + + + Norvegia + + + Oman + + + Pakistan + + + Palau + + + Teritoriile Palestiniene + + + Panama + + + Papua Noua Guinee + + + Paraguay + + + Peru + + + Filipine + + + Polonia + + + Portugalia + + + Qatar + + + România + + + Rusia + + + Rwanda + + + Saint Kitts și Nevis + + + Sfânta Lucia + + + Saint Vincent și Grenadine + + + Samoa + + + San Marino + + + São Tomé și Príncipe + + + Arabia Saudită + + + Senegal + + + Serbia + + + Seychelles + + + Sierra Leone + + + Singapore + + + Slovacia + + + Slovenia + + + Insulele Solomon + + + Somalia + + + Africa de Sud + + + Sudanul de Sud + + + Spania + + + Sri Lanka + + + Sudan + + + Suriname + + + Suedia + + + Elveția + + + Siria + + + Taiwan + + + Tadjikistan + + + Tanzania + + + Thailanda + + + Timor-Leste + + + Togo + + + Tonga + + + Trinidad și Tobago + + + Tunisia + + + Turcia + + + Turkmenistan + + + Tuvalu + + + Uganda + + + Ucraina + + + Emiratele Arabe Unite + + + Regatul Unit + + + Statele Unite + + + Uruguay + + + Uzbekistan + + + Vanuatu + + + Vatican + + + Venezuela + + + Vietnam + + + Yemen + + + Zambia + + + Zimbabwe + + + Antilele Neerlandeze + + + Europa + + + La nivel mondial + + + Titlul albumului. + + + Titlul original al albumului, când diferă de cel actual. + + + Un scurt rezumat sau o descriere a albumului. + + + Un comentariu care distinge albumul de altele cu același titlu. + + + Scrierea folosită în titlul lansării. + + + Starea de lansare a albumului. + + + Numărul de discuri ale albumului. + + + Numărul de piese ale albumului. + + + Titlul lansării. + + + Formatul media al albumului. + + + Ambalajul albumului. + + + Codul de bare al albumului. + + + Numerele de catalog ale albumului. + + + Casa de discuri care a lansat albumul. + + + Numărul standard de identificare Amazon al albumului. + + + Identificatorul MusicBrainz al lansării. + + + Identificatorul MusicBrainz al grupului de lansări. + + + Identificatorul MusicBrainz al artistului lansării. + + + Data la care albumul a fost lansat inițial. + + + Anul în care albumul a fost lansat inițial. + + + Data la care albumul a fost relansat. + + + Anul în care albumul a fost relansat. + + + Țara de lansare a albumului. + + + Versiunea lansării, cum ar fi cea originală. + + + Codul din două litere al limbii albumului. + + + Numele limbii albumului. + + + Numele nativ al limbii albumului. + + + Genurile albumului. + + + Etichetele albumului. + + + Tipurile de lansare ale albumului. + + + Piesele albumului. + + + Schimbă coperta + + + Imagine de copertă + + + Fără copertă + + + Imaginea de copertă a fost actualizată. + + + Imaginea de copertă nu a putut fi încărcată. + + + Contribuitori + + + Id contribuitor + + + Rol + + + Adaugă contributor + + + Persoanele care au contribuit la artist. + + + Ratinguri + + + Rating + + + Rating maxim + + + Sursă + + + Număr de voturi + + + Adaugă rating + + + Evaluările artistului din surse diferite. + + + Autor + + + Traducător + + + Ilustrator + + + Editor + + + Narator + + + Actor + + + Regizor + + + Scenarist + + + Compozitor + + + Textier + + + Aranjor + + + Dirijor + + + Producător + + + Producător executiv + + + Inginer de sunet + + + Mixer + + + Remixer + + + Casă de discuri + + + Voce + + + Voci de acompaniament + + + Chitară + + + Chitară bas + + + Tobe + + + Percuție + + + Claviaturi + + + Pian + + + Sintetizator + + + Instrumente cu corzi + + + Instrumente de suflat din lemn + + + Instrumente de suflat din alamă + + + Cor + + + Orchestrator + + + Interpret + + + Utilizator + + + MusicBrainz + + + Discogs + + + Last.fm + + + Gen + + + Adaugă gen + + + Etichetă + + + Adaugă etichetă + + + Tip de lansare + + + Adaugă tip de lansare + + + Număr de catalog + + + Adaugă număr de catalog + + + Copertă + + + Față + + + Spate + + + Broșură + + + Suport + + + Tavă + + + Cotă + + + Obi + + + Autocolant + + + Poster + + + Note + + + Filigran + + + Fundal + + + Banner + + + Logo + + + Miniatură + + + Identificatori + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.uk-UA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.uk-UA.resx new file mode 100644 index 00000000..45d369f7 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.uk-UA.resx @@ -0,0 +1,1509 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Назад до виконавця + + + Редагувати альбом + + + Зберегти + + + Альбом збережено. + + + Не вдалося зберегти елемент. + + + Видалити альбом + + + Альбом видалено. + + + Ви впевнені, що хочете видалити цей елемент? + + + Не вдалося видалити елемент. + + + Загальна інформація + + + Назва + + + Оригінальна назва + + + Опис + + + Уточнення + + + Письмо + + + Статус випуску + + + Усього дисків + + + Усього треків + + + Назва випуску + + + Формат носія + + + Пакування + + + Штрихкод + + + Номери каталогу + + + Лейбл + + + ASIN + + + Ідентифікатор випуску MusicBrainz + + + Ідентифікатор групи випуску MusicBrainz + + + Ідентифікатор виконавця випуску MusicBrainz + + + Інформація про випуск + + + Дата першого випуску + + + Рік першого випуску + + + Дата перевипуску + + + Рік перевипуску + + + Країна випуску + + + Версія випуску + + + Мова + + + Код мови + + + Назва мови + + + Власна назва + + + Оригінальна мова + + + Жанри + + + Теги + + + Типи випуску + + + Треки + + + Цей альбом не має треків + + + Видалити + + + Бутлег + + + Скасовано + + + Вилучено + + + Офіційний + + + Промо + + + Псевдовидання + + + Відкликано + + + Ацетат 10 дюймів + + + Шелак 10 дюймів + + + Вініл 10 дюймів + + + Ацетат 12 дюймів + + + Лазерний диск 12 дюймів + + + Шелак 12 дюймів + + + Вініл 12 дюймів + + + Вініл 3 дюйми + + + Флопі-диск 3,5 дюйма + + + Флопі-диск 5,25 дюйма + + + Ацетат 7 дюймів + + + Флексі-диск 7 дюймів + + + Шелак 7 дюймів + + + Вініл 7 дюймів + + + Лазерний диск 8 дюймів + + + Восьмидоріжкова касета + + + CD 8 см + + + CD 8 см Plus G + + + CD-R 8 см + + + Ацетат + + + Betacam SP + + + Betamax + + + Blu-ray + + + Blu-ray-R + + + Blu-spec CD + + + Картридж + + + Касета + + + CD + + + CD Plus G + + + CD-i + + + CD-R + + + CDV + + + CED + + + Copy Control CD + + + DAT + + + CD з даними + + + DVD з даними + + + DVD-R з даними + + + Data Play + + + DCC + + + Цифровий носій + + + Картка завантаження + + + DTSCD + + + Dual Disc + + + Dual Disc, сторона CD + + + Dual Disc, сторона DVD + + + Dual Disc, сторона DVD-аудіо + + + Dual Disc, сторона DVD-відео + + + DVD + + + DVD-аудіо + + + DVD-R відео + + + DVD-відео + + + DVD Plus + + + DVD Plus, сторона CD + + + DVD Plus, сторона DVD-аудіо + + + DVD Plus, сторона DVD-відео + + + Edison Diamond Disc + + + Розширений CD + + + Флексі-диск + + + Флопі-диск + + + HDDVD + + + HDCD + + + Hi Pac + + + HQCD + + + Гібридний SACD + + + Гібридний SACD, шар CD + + + Гібридний SACD, шар SACD + + + Гібридний SACD, шар SACD, 2 канали + + + Гібридний SACD, шар SACD, багатоканальний + + + Ki T Album + + + Лазерний диск + + + Мікрокасета + + + MicroSD + + + Мінідиск + + + Міні DVD + + + Міні DVD-аудіо + + + Міні DVD-відео + + + Minimax CD + + + Minimax DVD + + + Minimax DVD-аудіо + + + Minimax DVD-відео + + + CD змішаного режиму + + + Інше + + + Pathe Disc + + + Грамофонна платівка + + + Ролик піаноли + + + Playbutton + + + PlayTape + + + Котушкова стрічка + + + ROM-картридж + + + SACD + + + SACD, 2 канали + + + SACD багатоканальний + + + SD-карта + + + Шелак + + + SHMCD + + + SHMSACD + + + SHMSACD багатоканальний + + + SlotMusic + + + SVCD + + + Tefifon + + + UMD + + + USB-флешка + + + VCD + + + VHD + + + VHS + + + Вініл + + + Вініловий диск + + + Вініловий диск, сторона CD + + + Вініловий диск, сторона DVD + + + Вініловий диск, вінілова сторона + + + Восковий циліндр + + + Zip-диск + + + Книга + + + Бокс + + + Картонний паперовий конверт + + + Корпус касети + + + Кейс-черепашка + + + Диджибук + + + Диджифайл + + + Диджипак + + + Слайдер дискового боксу + + + Фатбокс + + + Обкладинка-розгортка + + + Джевел-кейс + + + Кіп-кейс + + + Лонгбокс + + + Металева бляшанка + + + Пластиковий конверт + + + Слайд-пак + + + Тонкий джевел-кейс + + + Сліпкейс + + + Снеп-кейс + + + Снеп-пак + + + Супер-джевел-бокс + + + Немає + + + Афганістан + + + Албанія + + + Алжир + + + Андорра + + + Ангола + + + Антигуа і Барбуда + + + Аргентина + + + Вірменія + + + Австралія + + + Австрія + + + Азербайджан + + + Багамські острови + + + Бахрейн + + + Бангладеш + + + Барбадос + + + Білорусь + + + Бельгія + + + Беліз + + + Бенін + + + Бутан + + + Болівія + + + Боснія і Герцеговина + + + Ботсвана + + + Бразилія + + + Бруней + + + Болгарія + + + Буркіна-Фасо + + + Бурунді + + + Кабо-Верде + + + Камбоджа + + + Камерун + + + Канада + + + Центральноафриканська Республіка + + + Чад + + + Чилі + + + Китай + + + Колумбія + + + Коморські острови + + + Конго - Браззавіль + + + Конго - Кіншаса + + + Коста-Рика + + + Кот-д'Івуар + + + Хорватія + + + Куба + + + Кіпр + + + Чехія + + + Данія + + + Джибуті + + + Домініка + + + Домініканська Республіка + + + Еквадор + + + Єгипет + + + Сальвадор + + + Екваторіальна Гвінея + + + Еритрея + + + Естонія + + + Есватіні + + + Ефіопія + + + Фіджі + + + Фінляндія + + + Франція + + + Габон + + + Гамбія + + + Грузія + + + Німеччина + + + Гана + + + Греція + + + Гренада + + + Гватемала + + + Гвінея + + + Гвінея-Бісау + + + Гаяна + + + Гаїті + + + Гондурас + + + Угорщина + + + Ісландія + + + Індія + + + Індонезія + + + Іран + + + Ірак + + + Ірландія + + + Ізраїль + + + Італія + + + Ямайка + + + Японія + + + Йорданія + + + Казахстан + + + Кенія + + + Кірибаті + + + Північна Корея + + + Південна Корея + + + Кувейт + + + Киргизстан + + + Лаос + + + Латвія + + + Ліван + + + Лесото + + + Ліберія + + + Лівія + + + Ліхтенштейн + + + Литва + + + Люксембург + + + Мадагаскар + + + Малаві + + + Малайзія + + + Мальдіви + + + Малі + + + Мальта + + + Маршаллові Острови + + + Мавританія + + + Маврикій + + + Мексика + + + Мікронезія + + + Молдова + + + Монако + + + Монголія + + + Чорногорія + + + Марокко + + + Мозамбік + + + М'янма (Бірма) + + + Намібія + + + Науру + + + Непал + + + Нідерланди + + + Нова Зеландія + + + Нікарагуа + + + Нігер + + + Нігерія + + + Північна Македонія + + + Норвегія + + + Оман + + + Пакистан + + + Палау + + + Палестинські території + + + Панама + + + Папуа-Нова Гвінея + + + Парагвай + + + Перу + + + Філіппіни + + + Польща + + + Португалія + + + Катар + + + Румунія + + + Росія + + + Руанда + + + Сент-Кітс і Невіс + + + Сент-Люсія + + + Сент-Вінсент і Гренадини + + + Самоа + + + Сан-Марино + + + Сан-Томе і Принсіпі + + + Саудівська Аравія + + + Сенегал + + + Сербія + + + Сейшельські Острови + + + Сьєрра-Леоне + + + Сінгапур + + + Словаччина + + + Словенія + + + Соломонові Острови + + + Сомалі + + + Південно-Африканська Республіка + + + Південний Судан + + + Іспанія + + + Шрі-Ланка + + + Судан + + + Суринам + + + Швеція + + + Швейцарія + + + Сирія + + + Тайвань + + + Таджикистан + + + Танзанія + + + Таїланд + + + Тимор-Лешті + + + Того + + + Тонга + + + Тринідад і Тобаго + + + Туніс + + + Туреччина + + + Туркменістан + + + Тувалу + + + Уганда + + + Україна + + + Об'єднані Арабські Емірати + + + Велика Британія + + + Сполучені Штати Америки + + + Уругвай + + + Узбекистан + + + Вануату + + + Ватикан + + + Венесуела + + + В'єтнам + + + Ємен + + + Замбія + + + Зімбабве + + + Нідерландські Антильські острови + + + Європа + + + Увесь світ + + + Назва альбому. + + + Оригінальна назва альбому, якщо вона відрізняється від поточної. + + + Короткий опис або резюме альбому. + + + Коментар, який відрізняє альбом від інших з тією самою назвою. + + + Система письма, використана в назві релізу. + + + Статус випуску альбому. + + + Кількість дисків альбому. + + + Кількість треків альбому. + + + Назва релізу. + + + Медіаформат альбому. + + + Пакування альбому. + + + Штрих-код альбому. + + + Каталожні номери альбому. + + + Лейбл, який випустив альбом. + + + Стандартний ідентифікаційний номер Amazon альбому. + + + Ідентифікатор релізу у MusicBrainz. + + + Ідентифікатор групи релізів у MusicBrainz. + + + Ідентифікатор виконавця релізу у MusicBrainz. + + + Дата первинного випуску альбому. + + + Рік первинного випуску альбому. + + + Дата повторного випуску альбому. + + + Рік повторного випуску альбому. + + + Країна випуску альбому. + + + Версія релізу, наприклад оригінальна. + + + Дволітерний код мови альбому. + + + Назва мови альбому. + + + Рідна назва мови альбому. + + + Жанри альбому. + + + Теги альбому. + + + Типи випуску альбому. + + + Треки альбому. + + + Змінити обкладинку + + + Зображення обкладинки + + + Немає обкладинки + + + Зображення обкладинки оновлено. + + + Не вдалося завантажити зображення обкладинки. + + + Учасники + + + Ідентифікатор учасника + + + Роль + + + Додати учасника + + + Люди, які зробили внесок у виконавця. + + + Оцінки + + + Оцінка + + + Максимальна оцінка + + + Джерело + + + Кількість голосів + + + Додати оцінку + + + Оцінки виконавця з різних джерел. + + + Автор + + + Перекладач + + + Ілюстратор + + + Видавець + + + Оповідач + + + Актор + + + Режисер + + + Сценарист + + + Композитор + + + Автор текстів + + + Аранжувальник + + + Диригент + + + Продюсер + + + Виконавчий продюсер + + + Інженер + + + Мікшер + + + Реміксер + + + Лейбл звукозапису + + + Вокал + + + Бек-вокал + + + Гітара + + + Бас-гітара + + + Барабани + + + Перкусія + + + Клавішні + + + Піаніно + + + Синтезатор + + + Струнні + + + Дерев'яні духові + + + Мідні духові + + + Хор + + + Оркестратор + + + Виконавець + + + Користувач + + + MusicBrainz + + + Discogs + + + Last.fm + + + Жанр + + + Додати жанр + + + Тег + + + Додати тег + + + Тип випуску + + + Додати тип випуску + + + Номер каталогу + + + Додати номер каталогу + + + Обкладинка + + + Передня частина + + + Задня частина + + + Буклет + + + Носій + + + Лоток + + + Корінець + + + Обі + + + Наліпка + + + Плакат + + + Вкладка + + + Водяний знак + + + Фон + + + Банер + + + Логотип + + + Мініатюра + + + Ідентифікатори + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.zh-CN.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.zh-CN.resx new file mode 100644 index 00000000..f215465e --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.zh-CN.resx @@ -0,0 +1,1509 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 返回艺术家 + + + 编辑专辑 + + + 保存 + + + 专辑已保存。 + + + 无法保存该项目。 + + + 删除专辑 + + + 专辑已删除。 + + + 确定要删除此项目吗? + + + 无法删除该项目。 + + + 常规信息 + + + 标题 + + + 原标题 + + + 简介 + + + 消歧义 + + + 文字 + + + 发行状态 + + + 光盘总数 + + + 曲目总数 + + + 发行标题 + + + 媒介格式 + + + 包装 + + + 条码 + + + 目录编号 + + + 唱片公司 + + + ASIN + + + MusicBrainz 发行 Id + + + MusicBrainz 发行组 Id + + + MusicBrainz 发行艺术家 Id + + + 发行信息 + + + 首次发行日期 + + + 首次发行年份 + + + 再发行日期 + + + 再发行年份 + + + 发行国家 + + + 发行版本 + + + 语言 + + + 语言代码 + + + 语言名称 + + + 本地语名称 + + + 原语言 + + + 体裁 + + + 标签 + + + 发行类型 + + + 曲目 + + + 此专辑没有曲目 + + + 移除 + + + 盗版 + + + 已取消 + + + 已删除 + + + 官方 + + + 宣传 + + + 伪发行 + + + 已撤回 + + + 10 英寸醋酸盐唱片 + + + 10 英寸虫胶唱片 + + + 10 英寸黑胶 + + + 12 英寸醋酸盐唱片 + + + 12 英寸 Laser Disc + + + 12 英寸虫胶唱片 + + + 12 英寸黑胶 + + + 3 英寸黑胶 + + + 3.5 英寸软盘 + + + 5.25 英寸软盘 + + + 7 英寸醋酸盐唱片 + + + 7 英寸 Flexi Disc + + + 7 英寸虫胶唱片 + + + 7 英寸黑胶 + + + 8 英寸 Laser Disc + + + 八轨磁带盒 + + + 8 厘米 CD + + + 8 厘米 CD Plus G + + + 8 厘米 CD-R + + + 醋酸盐唱片 + + + Betacam SP + + + Betamax + + + Blu-ray + + + Blu-ray-R + + + Blu Spec CD + + + 卡带 + + + 盒式磁带 + + + CD + + + CD Plus G + + + CD Minusi + + + CD-R + + + CDV + + + CED + + + 复制控制 CD + + + DAT + + + 数据 CD + + + 数据 DVD + + + 数据 DVD-R + + + Data Play + + + DCC + + + 数字媒体 + + + 下载卡 + + + DTSCD + + + Dual Disc + + + Dual Disc CD 面 + + + Dual Disc DVD 面 + + + Dual Disc DVD 音频面 + + + Dual Disc DVD 视频面 + + + DVD + + + DVD 音频 + + + DVD-R 视频 + + + DVD 视频 + + + DVD Plus + + + DVD Plus CD 面 + + + DVD Plus DVD 音频面 + + + DVD Plus DVD 视频面 + + + Edison Diamond Disc + + + 增强型 CD + + + Flexi Disc + + + 软盘 + + + HDDVD + + + HDCD + + + Hi Pac + + + HQCD + + + 混合 SACD + + + 混合 SACDCD 层 + + + 混合 SACDSACD 层 + + + 混合 SACDSACD 层 2 声道 + + + 混合 SACDSACD 层多声道 + + + Ki T Album + + + Laser Disc + + + 微型盒式磁带 + + + Micro SD + + + Mini Disc + + + Mini DVD + + + Mini DVD 音频 + + + Mini DVD 视频 + + + Minimax CD + + + Minimax DVD + + + Minimax DVD 音频 + + + Minimax DVD 视频 + + + 混合模式 CD + + + 其他 + + + Pathe Disc + + + 留声机唱片 + + + 钢琴卷 + + + Playbutton + + + Play Tape + + + 开盘式磁带 + + + ROM 卡带 + + + SACD + + + SACD 2 声道 + + + SACD 多声道 + + + SD Card + + + 虫胶唱片 + + + SHMCD + + + SHMSACD + + + SHMSACD 多声道 + + + Slot Music + + + SVCD + + + Tefifon + + + UMD + + + USB 闪存盘 + + + VCD + + + VHD + + + VHS + + + 黑胶 + + + 黑胶唱片 + + + 黑胶唱片 CD 面 + + + 黑胶唱片 DVD 面 + + + 黑胶唱片 黑胶面 + + + 蜡筒 + + + Zip Disk + + + 书 + + + 盒装 + + + 纸板纸质套 + + + 盒式磁带盒 + + + 翻盖盒 + + + Digibook + + + Digifile + + + Digipak + + + Discbox Slider + + + Fatbox + + + 对开封面 + + + 珠宝盒 + + + Keep Case + + + 长盒 + + + 金属盒 + + + 塑料套 + + + Slidepack + + + 超薄珠宝盒 + + + 封套 + + + 卡扣盒 + + + Snap Pack + + + Super Jewel Box + + + 无 + + + 阿富汗 + + + 阿尔巴尼亚 + + + 阿尔及利亚 + + + 安道尔 + + + 安哥拉 + + + 安提瓜和巴布达 + + + 阿根廷 + + + 亚美尼亚 + + + 澳大利亚 + + + 奥地利 + + + 阿塞拜疆 + + + 巴哈马 + + + 巴林 + + + 孟加拉国 + + + 巴巴多斯 + + + 白俄罗斯 + + + 比利时 + + + 伯利兹 + + + 贝宁 + + + 不丹 + + + 玻利维亚 + + + 波斯尼亚和黑塞哥维那 + + + 博茨瓦纳 + + + 巴西 + + + 文莱 + + + 保加利亚 + + + 布基纳法索 + + + 布隆迪 + + + 佛得角 + + + 柬埔寨 + + + 喀麦隆 + + + 加拿大 + + + 中非共和国 + + + 乍得 + + + 智利 + + + 中国 + + + 哥伦比亚 + + + 科摩罗 + + + 刚果(布拉柴维尔) + + + 刚果(金沙萨) + + + 哥斯达黎加 + + + 科特迪瓦 + + + 克罗地亚 + + + 古巴 + + + 塞浦路斯 + + + 捷克 + + + 丹麦 + + + 吉布提 + + + 多米尼克 + + + 多米尼加共和国 + + + 厄瓜多尔 + + + 埃及 + + + 萨尔瓦多 + + + 赤道几内亚 + + + 厄立特里亚 + + + 爱沙尼亚 + + + 斯威士兰 + + + 埃塞俄比亚 + + + 斐济 + + + 芬兰 + + + 法国 + + + 加蓬 + + + 冈比亚 + + + 格鲁吉亚 + + + 德国 + + + 加纳 + + + 希腊 + + + 格林纳达 + + + 危地马拉 + + + 几内亚 + + + 几内亚比绍 + + + 圭亚那 + + + 海地 + + + 洪都拉斯 + + + 匈牙利 + + + 冰岛 + + + 印度 + + + 印度尼西亚 + + + 伊朗 + + + 伊拉克 + + + 爱尔兰 + + + 以色列 + + + 意大利 + + + 牙买加 + + + 日本 + + + 约旦 + + + 哈萨克斯坦 + + + 肯尼亚 + + + 基里巴斯 + + + 朝鲜 + + + 韩国 + + + 科威特 + + + 吉尔吉斯斯坦 + + + 老挝 + + + 拉脱维亚 + + + 黎巴嫩 + + + 莱索托 + + + 利比里亚 + + + 利比亚 + + + 列支敦士登 + + + 立陶宛 + + + 卢森堡 + + + 马达加斯加 + + + 马拉维 + + + 马来西亚 + + + 马尔代夫 + + + 马里 + + + 马耳他 + + + 马绍尔群岛 + + + 毛里塔尼亚 + + + 毛里求斯 + + + 墨西哥 + + + 密克罗尼西亚 + + + 摩尔多瓦 + + + 摩纳哥 + + + 蒙古 + + + 黑山 + + + 摩洛哥 + + + 莫桑比克 + + + 缅甸 + + + 纳米比亚 + + + 瑙鲁 + + + 尼泊尔 + + + 荷兰 + + + 新西兰 + + + 尼加拉瓜 + + + 尼日尔 + + + 尼日利亚 + + + 北马其顿 + + + 挪威 + + + 阿曼 + + + 巴基斯坦 + + + 帕劳 + + + 巴勒斯坦领土 + + + 巴拿马 + + + 巴布亚新几内亚 + + + 巴拉圭 + + + 秘鲁 + + + 菲律宾 + + + 波兰 + + + 葡萄牙 + + + 卡塔尔 + + + 罗马尼亚 + + + 俄罗斯 + + + 卢旺达 + + + 圣基茨和尼维斯 + + + 圣卢西亚 + + + 圣文森特和格林纳丁斯 + + + 萨摩亚 + + + 圣马力诺 + + + 圣多美和普林西比 + + + 沙特阿拉伯 + + + 塞内加尔 + + + 塞尔维亚 + + + 塞舌尔 + + + 塞拉利昂 + + + 新加坡 + + + 斯洛伐克 + + + 斯洛文尼亚 + + + 所罗门群岛 + + + 索马里 + + + 南非 + + + 南苏丹 + + + 西班牙 + + + 斯里兰卡 + + + 苏丹 + + + 苏里南 + + + 瑞典 + + + 瑞士 + + + 叙利亚 + + + 台湾 + + + 塔吉克斯坦 + + + 坦桑尼亚 + + + 泰国 + + + 东帝汶 + + + 多哥 + + + 汤加 + + + 特立尼达和多巴哥 + + + 突尼斯 + + + 土耳其 + + + 土库曼斯坦 + + + 图瓦卢 + + + 乌干达 + + + 乌克兰 + + + 阿拉伯联合酋长国 + + + 英国 + + + 美国 + + + 乌拉圭 + + + 乌兹别克斯坦 + + + 瓦努阿图 + + + 梵蒂冈 + + + 委内瑞拉 + + + 越南 + + + 也门 + + + 赞比亚 + + + 津巴布韦 + + + 荷属安的列斯 + + + 欧洲 + + + 全球 + + + 专辑的标题。 + + + 与当前标题不同时的专辑原始标题。 + + + 专辑的简短摘要或描述。 + + + 用于将专辑与同名专辑区分开的说明。 + + + 发行标题中使用的文字。 + + + 专辑的发行状态。 + + + 专辑的唱片数量。 + + + 专辑的音轨数量。 + + + 发行的标题。 + + + 专辑的媒体格式。 + + + 专辑的包装。 + + + 专辑的条形码。 + + + 专辑的目录编号。 + + + 发行该专辑的唱片公司。 + + + 专辑的亚马逊标准识别号。 + + + 发行的MusicBrainz标识符。 + + + 发行组的MusicBrainz标识符。 + + + 发行艺术家的MusicBrainz标识符。 + + + 专辑最初发行的日期。 + + + 专辑最初发行的年份。 + + + 专辑再次发行的日期。 + + + 专辑再次发行的年份。 + + + 专辑的发行国家/地区。 + + + 发行的版本,例如原始版本。 + + + 专辑语言的两字母代码。 + + + 专辑语言的名称。 + + + 专辑语言的本地名称。 + + + 专辑的流派。 + + + 专辑的标签。 + + + 专辑的发行类型。 + + + 专辑的音轨。 + + + 更改封面 + + + 封面图片 + + + 无封面 + + + 封面图片已更新。 + + + 无法上传封面图片。 + + + 贡献者 + + + 贡献者 Id + + + 角色 + + + 添加贡献者 + + + 为艺术家做出贡献的人员。 + + + 评分 + + + 评分 + + + 最高评分 + + + 来源 + + + 票数 + + + 添加评分 + + + 来自不同来源的艺术家评分。 + + + 作者 + + + 译者 + + + 插画师 + + + 出版商 + + + 旁白 + + + 演员 + + + 导演 + + + 编剧 + + + 作曲 + + + 作词 + + + 编曲 + + + 指挥 + + + 制作人 + + + 执行制作人 + + + 工程师 + + + 混音师 + + + 重混师 + + + 唱片公司 + + + 人声 + + + 和声 + + + 吉他 + + + 贝斯 + + + 鼓 + + + 打击乐 + + + 键盘 + + + 钢琴 + + + 合成器 + + + 弦乐 + + + 木管乐 + + + 铜管乐 + + + 合唱 + + + 配器 + + + 表演者 + + + 用户 + + + MusicBrainz + + + Discogs + + + Last.fm + + + 流派 + + + 添加流派 + + + 标签 + + + 添加标签 + + + 发行类型 + + + 添加发行类型 + + + 目录编号 + + + 添加目录编号 + + + 封面 + + + 正面 + + + 背面 + + + 小册子 + + + 介质 + + + 托盘 + + + 书脊 + + + 腰带 + + + 贴纸 + + + 海报 + + + 内页 + + + 水印 + + + 背景 + + + 横幅 + + + 标志 + + + 缩略图 + + + 标识符 + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ar-SA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ar-SA.resx new file mode 100644 index 00000000..d99952cb --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ar-SA.resx @@ -0,0 +1,60 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + بحث + + + عناصر + + + من + + + صفحة + + + السابق + + + التالي + + + الترتيب: أ-ي + + + الترتيب: ي-أ + + + لا تحتوي هذه المكتبة على أي عناصر + + + لا توجد عناصر تطابق الفلاتر الحالية + + + الكل + + + عرض التفاصيل + + + حذف + + + هل أنت متأكد من أنك تريد حذف هذا العنصر؟ + + + تعذر حذف العنصر. + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.de-DE.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.de-DE.resx new file mode 100644 index 00000000..f0b0fab2 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.de-DE.resx @@ -0,0 +1,60 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Suchen + + + Einträge + + + von + + + Seite + + + Zurück + + + Weiter + + + Sortieren: A-Z + + + Sortieren: Z-A + + + Diese Bibliothek hat keine Einträge + + + Keine Einträge entsprechen den aktuellen Filtern + + + Alle + + + Details anzeigen + + + Löschen + + + Möchten Sie dieses Element wirklich löschen? + + + Das Element konnte nicht gelöscht werden. + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.en-US.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.en-US.resx new file mode 100644 index 00000000..1120e9db --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.en-US.resx @@ -0,0 +1,60 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Search + + + items + + + of + + + Page + + + Previous + + + Next + + + Sort: A-Z + + + Sort: Z-A + + + This library has no items + + + No items match the current filters + + + All + + + View details + + + Delete + + + Are you sure you want to delete this item? + + + The item could not be deleted. + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.es-ES.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.es-ES.resx new file mode 100644 index 00000000..58ceea6a --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.es-ES.resx @@ -0,0 +1,60 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Buscar + + + elementos + + + de + + + Página + + + Anterior + + + Siguiente + + + Ordenar: A-Z + + + Ordenar: Z-A + + + Esta biblioteca no tiene elementos + + + Ningún elemento coincide con los filtros actuales + + + Todas + + + Ver detalles + + + Eliminar + + + ¿Seguro que quieres eliminar este elemento? + + + No se ha podido eliminar el elemento. + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.fr-FR.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.fr-FR.resx new file mode 100644 index 00000000..7d497880 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.fr-FR.resx @@ -0,0 +1,60 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Rechercher + + + éléments + + + sur + + + Page + + + Précédent + + + Suivant + + + Trier : A-Z + + + Trier : Z-A + + + Cette bibliothèque ne contient aucun élément + + + Aucun élément ne correspond aux filtres actuels + + + Toutes + + + Voir les détails + + + Supprimer + + + Voulez-vous vraiment supprimer cet élément ? + + + L'élément n'a pas pu être supprimé. + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.it-IT.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.it-IT.resx new file mode 100644 index 00000000..cfbcec6f --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.it-IT.resx @@ -0,0 +1,60 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cerca + + + elementi + + + di + + + Pagina + + + Precedente + + + Successivo + + + Ordina: A-Z + + + Ordina: Z-A + + + Questa biblioteca non contiene elementi + + + Nessun elemento corrisponde ai filtri correnti + + + Tutte + + + Visualizza dettagli + + + Elimina + + + Sei sicuro di voler eliminare questo elemento? + + + Non è stato possibile eliminare l'elemento. + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ja-JP.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ja-JP.resx new file mode 100644 index 00000000..16875e52 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ja-JP.resx @@ -0,0 +1,60 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 検索 + + + 件 + + + / + + + ページ + + + 前へ + + + 次へ + + + 並べ替え: A-Z + + + 並べ替え: Z-A + + + このライブラリには項目がありません + + + 現在のフィルターに一致する項目はありません + + + すべて + + + 詳細を表示 + + + 削除 + + + この項目を削除してもよろしいですか? + + + 項目を削除できませんでした。 + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.resx new file mode 100644 index 00000000..1120e9db --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.resx @@ -0,0 +1,60 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Search + + + items + + + of + + + Page + + + Previous + + + Next + + + Sort: A-Z + + + Sort: Z-A + + + This library has no items + + + No items match the current filters + + + All + + + View details + + + Delete + + + Are you sure you want to delete this item? + + + The item could not be deleted. + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ro-RO.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ro-RO.resx new file mode 100644 index 00000000..8ec59558 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.ro-RO.resx @@ -0,0 +1,60 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Caută + + + elemente + + + din + + + Pagina + + + Înapoi + + + Înainte + + + Sortare: A-Z + + + Sortare: Z-A + + + Această bibliotecă nu are elemente + + + Niciun element nu corespunde filtrelor curente + + + Toate + + + Vezi detalii + + + Șterge + + + Sigur doriți să ștergeți acest element? + + + Elementul nu a putut fi șters. + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.uk-UA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.uk-UA.resx new file mode 100644 index 00000000..be1c4469 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.uk-UA.resx @@ -0,0 +1,60 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Пошук + + + елементів + + + з + + + Сторінка + + + Назад + + + Вперед + + + Сортування: А-Я + + + Сортування: Я-А + + + У цій бібліотеці немає елементів + + + Жоден елемент не відповідає поточним фільтрам + + + Усі + + + Переглянути деталі + + + Видалити + + + Ви впевнені, що хочете видалити цей елемент? + + + Не вдалося видалити елемент. + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.zh-CN.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.zh-CN.resx new file mode 100644 index 00000000..35ed518d --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.zh-CN.resx @@ -0,0 +1,60 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 搜索 + + + 项 + + + / + + + 页 + + + 上一页 + + + 下一页 + + + 排序: A-Z + + + 排序: Z-A + + + 此库中没有项目 + + + 没有项目符合当前筛选条件 + + + 全部 + + + 查看详情 + + + 删除 + + + 确定要删除此项目吗? + + + 无法删除该项目。 + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ar-SA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ar-SA.resx new file mode 100644 index 00000000..14698b57 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ar-SA.resx @@ -0,0 +1,1086 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + العودة إلى الفنانين + + + تعديل الفنان + + + حفظ + + + تم حفظ الفنان. + + + تعذر حفظ العنصر. + + + حذف الفنان + + + تم حذف الفنان. + + + هل أنت متأكد من أنك تريد حذف هذا العنصر؟ + + + تعذر حذف العنصر. + + + معلومات عامة + + + الاسم + + + اسم الفرز + + + التوضيح + + + النوع + + + الجنس + + + البلد + + + الموقع الإلكتروني + + + معرّف فنان MusicBrainz + + + IPIs + + + ISNIs + + + تاريخ البدء + + + تاريخ الانتهاء + + + منتهٍ + + + الأنواع + + + الوسوم + + + المناطق + + + المنطقة + + + منطقة البداية + + + منطقة النهاية + + + الاسم + + + اسم الفرز + + + التوضيح + + + النوع + + + رمز ISO 3166 + + + معرّف منطقة MusicBrainz + + + الأسماء المستعارة + + + الاسم + + + اسم الفرز + + + النوع + + + اللغة + + + أساسي + + + تاريخ البدء + + + تاريخ الانتهاء + + + منتهٍ + + + إضافة اسم مستعار + + + المساهمون + + + معرّف المساهم + + + الدور + + + إضافة مساهم + + + التقييمات + + + التقييم + + + أقصى تقييم + + + المصدر + + + عدد الأصوات + + + إضافة تقييم + + + إزالة + + + الألبومات + + + لا توجد ألبومات لهذا الفنان + + + تم حذف الألبوم. + + + شخص + + + مجموعة + + + أوركسترا + + + جوقة + + + شخصية + + + آخر + + + ذكر + + + أنثى + + + لا ينطبق + + + مؤلف + + + مترجم + + + رسام + + + ناشر + + + راوٍ + + + ممثل + + + مخرج + + + كاتب سيناريو + + + ملحن + + + كاتب كلمات + + + موزع + + + قائد أوركسترا + + + منتج + + + منتج تنفيذي + + + مهندس صوت + + + خالط صوت + + + معيد المزج + + + شركة تسجيلات + + + غناء + + + غناء مساند + + + غيتار + + + غيتار باس + + + طبول + + + إيقاع + + + لوحات المفاتيح + + + بيانو + + + مركب صوتي + + + آلات وترية + + + آلات نفخ خشبية + + + آلات نفخ نحاسية + + + منسق أوركسترالي + + + المستخدم + + + MusicBrainz + + + Discogs + + + Last.fm + + + أفغانستان + + + ألبانيا + + + الجزائر + + + أندورا + + + أنغولا + + + أنتيغوا وبربودا + + + الأرجنتين + + + أرمينيا + + + أستراليا + + + النمسا + + + أذربيجان + + + الباهاما + + + البحرين + + + بنغلاديش + + + بربادوس + + + بيلاروسيا + + + بلجيكا + + + بليز + + + بنين + + + بوتان + + + بوليفيا + + + البوسنة والهرسك + + + بوتسوانا + + + البرازيل + + + بروناي + + + بلغاريا + + + بوركينا فاسو + + + بوروندي + + + الرأس الأخضر + + + كمبوديا + + + الكاميرون + + + كندا + + + جمهورية أفريقيا الوسطى + + + تشاد + + + تشيلي + + + الصين + + + كولومبيا + + + جزر القمر + + + الكونغو - برازافيل + + + الكونغو - كينشاسا + + + كوستاريكا + + + ساحل العاج + + + كرواتيا + + + كوبا + + + قبرص + + + التشيك + + + الدنمارك + + + جيبوتي + + + دومينيكا + + + جمهورية الدومينيكان + + + الإكوادور + + + مصر + + + السلفادور + + + غينيا الاستوائية + + + إريتريا + + + إستونيا + + + إسواتيني + + + إثيوبيا + + + فيجي + + + فنلندا + + + فرنسا + + + الغابون + + + غامبيا + + + جورجيا + + + ألمانيا + + + غانا + + + اليونان + + + غرينادا + + + غواتيمالا + + + غينيا + + + غينيا بيساو + + + غيانا + + + هايتي + + + هندوراس + + + هنغاريا + + + آيسلندا + + + الهند + + + إندونيسيا + + + إيران + + + العراق + + + أيرلندا + + + إسرائيل + + + إيطاليا + + + جامايكا + + + اليابان + + + الأردن + + + كازاخستان + + + كينيا + + + كيريباتي + + + كوريا الشمالية + + + كوريا الجنوبية + + + الكويت + + + قيرغيزستان + + + لاوس + + + لاتفيا + + + لبنان + + + ليسوتو + + + ليبيريا + + + ليبيا + + + ليختنشتاين + + + ليتوانيا + + + لوكسمبورغ + + + مدغشقر + + + مالاوي + + + ماليزيا + + + المالديف + + + مالي + + + مالطا + + + جزر مارشال + + + موريتانيا + + + موريشيوس + + + المكسيك + + + ميكرونيزيا + + + مولدوفا + + + موناكو + + + منغوليا + + + الجبل الأسود + + + المغرب + + + موزمبيق + + + ميانمار (بورما) + + + ناميبيا + + + ناورو + + + نيبال + + + هولندا + + + نيوزيلندا + + + نيكاراغوا + + + النيجر + + + نيجيريا + + + مقدونيا الشمالية + + + النرويج + + + عُمان + + + باكستان + + + بالاو + + + الأراضي الفلسطينية + + + بنما + + + بابوا غينيا الجديدة + + + باراغواي + + + بيرو + + + الفلبين + + + بولندا + + + البرتغال + + + قطر + + + رومانيا + + + روسيا + + + رواندا + + + سانت كيتس ونيفيس + + + سانت لوسيا + + + سانت فينسنت والغرينادين + + + ساموا + + + سان مارينو + + + ساو تومي وبرينسيبي + + + المملكة العربية السعودية + + + السنغال + + + صربيا + + + سيشل + + + سيراليون + + + سنغافورة + + + سلوفاكيا + + + سلوفينيا + + + جزر سليمان + + + الصومال + + + جنوب أفريقيا + + + جنوب السودان + + + إسبانيا + + + سريلانكا + + + السودان + + + سورينام + + + السويد + + + سويسرا + + + سوريا + + + تايوان + + + طاجيكستان + + + تنزانيا + + + تايلاند + + + تيمور الشرقية + + + توغو + + + تونغا + + + ترينيداد وتوباغو + + + تونس + + + تركيا + + + تركمانستان + + + توفالو + + + أوغندا + + + أوكرانيا + + + الإمارات العربية المتحدة + + + المملكة المتحدة + + + الولايات المتحدة + + + أوروغواي + + + أوزبكستان + + + فانواتو + + + مدينة الفاتيكان + + + فنزويلا + + + فيتنام + + + اليمن + + + زامبيا + + + زيمبابوي + + + جزر الأنتيل الهولندية + + + أوروبا + + + العالم + + + الإصدارات + + + ألبوم + + + بث + + + EP + + + أغنية منفردة + + + دراما صوتية + + + كتاب صوتي + + + تجميعة + + + مزيج دي جي + + + نسخة تجريبية + + + تسجيل ميداني + + + مقابلة + + + حي + + + ميكستايب + + + ريمكس + + + موسيقى تصويرية + + + كلام منطوق + + + مؤدٍ + + + اسم الفنان. + + + الاسم المستخدم لترتيب الفنان عندما يختلف عن الاسم المعروض. + + + تعليق يميز الفنان عن غيره ممن يحملون الاسم نفسه. + + + نوع الفنان، مثل شخص أو مجموعة. + + + جنس الفنان. + + + رمز الدولة المكون من حرفين للفنان. + + + الموقع الرسمي للفنان. + + + معرّف MusicBrainz للفنان. + + + أرقام معلومات الأطراف المعنية الخاصة بالفنان. + + + معرّفات الأسماء المعيارية الدولية الخاصة بالفنان. + + + تاريخ بدء نشاط الفنان. + + + تاريخ انتهاء نشاط الفنان. + + + ما إذا كان الفنان لم يعد نشطاً. + + + الأنواع الموسيقية الخاصة بالفنان. + + + الوسوم الخاصة بالفنان. + + + اسم المنطقة. + + + الاسم المستخدم لترتيب المنطقة. + + + تعليق يميز المنطقة عن غيرها ممن تحمل الاسم نفسه. + + + نوع المنطقة. + + + رمز ISO 3166 للمنطقة. + + + معرّف MusicBrainz للمنطقة. + + + الأسماء البديلة للفنان. + + + الأشخاص الذين ساهموا في الفنان. + + + تقييمات الفنان من مصادر مختلفة. + + + تغيير الغلاف + + + صورة الغلاف + + + لا يوجد غلاف + + + تم تحديث صورة الغلاف. + + + تعذّر تحميل صورة الغلاف. + + + النوع + + + إضافة نوع + + + وسم + + + إضافة وسم + + + IPI + + + إضافة IPI + + + ISNI + + + إضافة ISNI + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.de-DE.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.de-DE.resx new file mode 100644 index 00000000..58bf363f --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.de-DE.resx @@ -0,0 +1,1086 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Zurück zu den Künstlern + + + Künstler bearbeiten + + + Speichern + + + Der Künstler wurde gespeichert. + + + Das Element konnte nicht gespeichert werden. + + + Künstler löschen + + + Der Künstler wurde gelöscht. + + + Möchten Sie dieses Element wirklich löschen? + + + Das Element konnte nicht gelöscht werden. + + + Allgemeine Informationen + + + Name + + + Sortiername + + + Disambiguierung + + + Typ + + + Geschlecht + + + Land + + + Website + + + MusicBrainz-Künstler-Id + + + IPIs + + + ISNIs + + + Anfangsdatum + + + Enddatum + + + Beendet + + + Genres + + + Schlagwörter + + + Gebiete + + + Gebiet + + + Anfangsgebiet + + + Endgebiet + + + Name + + + Sortiername + + + Disambiguierung + + + Typ + + + ISO-3166-Code + + + MusicBrainz-Gebiet-Id + + + Aliase + + + Name + + + Sortiername + + + Typ + + + Gebietsschema + + + Primär + + + Anfangsdatum + + + Enddatum + + + Beendet + + + Alias hinzufügen + + + Mitwirkende + + + Mitwirkenden-Id + + + Rolle + + + Mitwirkenden hinzufügen + + + Bewertungen + + + Bewertung + + + Höchstbewertung + + + Quelle + + + Stimmenzahl + + + Bewertung hinzufügen + + + Entfernen + + + Alben + + + Dieser Künstler hat keine Alben + + + Das Album wurde gelöscht. + + + Person + + + Gruppe + + + Orchester + + + Chor + + + Charakter + + + Sonstige + + + Männlich + + + Weiblich + + + Nicht zutreffend + + + Autor + + + Übersetzer + + + Illustrator + + + Verlag + + + Erzähler + + + Schauspieler + + + Regisseur + + + Drehbuchautor + + + Komponist + + + Liedtexter + + + Arrangeur + + + Dirigent + + + Produzent + + + Ausführender Produzent + + + Toningenieur + + + Mixer + + + Remixer + + + Plattenlabel + + + Gesang + + + Hintergrundgesang + + + Gitarre + + + Bassgitarre + + + Schlagzeug + + + Perkussion + + + Keyboards + + + Klavier + + + Synthesizer + + + Streicher + + + Holzbläser + + + Blechbläser + + + Orchestrator + + + Benutzer + + + MusicBrainz + + + Discogs + + + Last.fm + + + Afghanistan + + + Albanien + + + Algerien + + + Andorra + + + Angola + + + Antigua und Barbuda + + + Argentinien + + + Armenien + + + Australien + + + Österreich + + + Aserbaidschan + + + Bahamas + + + Bahrain + + + Bangladesch + + + Barbados + + + Belarus + + + Belgien + + + Belize + + + Benin + + + Bhutan + + + Bolivien + + + Bosnien und Herzegowina + + + Botsuana + + + Brasilien + + + Brunei + + + Bulgarien + + + Burkina Faso + + + Burundi + + + Kap Verde + + + Kambodscha + + + Kamerun + + + Kanada + + + Zentralafrikanische Republik + + + Tschad + + + Chile + + + China + + + Kolumbien + + + Komoren + + + Kongo - Brazzaville + + + Kongo - Kinshasa + + + Costa Rica + + + Côte d'Ivoire + + + Kroatien + + + Kuba + + + Zypern + + + Tschechien + + + Dänemark + + + Dschibuti + + + Dominica + + + Dominikanische Republik + + + Ecuador + + + Ägypten + + + El Salvador + + + Äquatorialguinea + + + Eritrea + + + Estland + + + Eswatini + + + Äthiopien + + + Fidschi + + + Finnland + + + Frankreich + + + Gabun + + + Gambia + + + Georgien + + + Deutschland + + + Ghana + + + Griechenland + + + Grenada + + + Guatemala + + + Guinea + + + Guinea-Bissau + + + Guyana + + + Haiti + + + Honduras + + + Ungarn + + + Island + + + Indien + + + Indonesien + + + Iran + + + Irak + + + Irland + + + Israel + + + Italien + + + Jamaika + + + Japan + + + Jordanien + + + Kasachstan + + + Kenia + + + Kiribati + + + Nordkorea + + + Südkorea + + + Kuwait + + + Kirgisistan + + + Laos + + + Lettland + + + Libanon + + + Lesotho + + + Liberia + + + Libyen + + + Liechtenstein + + + Litauen + + + Luxemburg + + + Madagaskar + + + Malawi + + + Malaysia + + + Malediven + + + Mali + + + Malta + + + Marshallinseln + + + Mauretanien + + + Mauritius + + + Mexiko + + + Mikronesien + + + Moldau + + + Monaco + + + Mongolei + + + Montenegro + + + Marokko + + + Mosambik + + + Myanmar (Burma) + + + Namibia + + + Nauru + + + Nepal + + + Niederlande + + + Neuseeland + + + Nicaragua + + + Niger + + + Nigeria + + + Nordmazedonien + + + Norwegen + + + Oman + + + Pakistan + + + Palau + + + Palästinensische Autonomiegebiete + + + Panama + + + Papua-Neuguinea + + + Paraguay + + + Peru + + + Philippinen + + + Polen + + + Portugal + + + Katar + + + Rumänien + + + Russland + + + Ruanda + + + St. Kitts und Nevis + + + St. Lucia + + + St. Vincent und die Grenadinen + + + Samoa + + + San Marino + + + São Tomé und Príncipe + + + Saudi-Arabien + + + Senegal + + + Serbien + + + Seychellen + + + Sierra Leone + + + Singapur + + + Slowakei + + + Slowenien + + + Salomonen + + + Somalia + + + Südafrika + + + Südsudan + + + Spanien + + + Sri Lanka + + + Sudan + + + Suriname + + + Schweden + + + Schweiz + + + Syrien + + + Taiwan + + + Tadschikistan + + + Tansania + + + Thailand + + + Timor-Leste + + + Togo + + + Tonga + + + Trinidad und Tobago + + + Tunesien + + + Türkei + + + Turkmenistan + + + Tuvalu + + + Uganda + + + Ukraine + + + Vereinigte Arabische Emirate + + + Vereinigtes Königreich + + + Vereinigte Staaten + + + Uruguay + + + Usbekistan + + + Vanuatu + + + Vatikanstadt + + + Venezuela + + + Vietnam + + + Jemen + + + Sambia + + + Simbabwe + + + Niederländische Antillen + + + Europa + + + Weltweit + + + Veröffentlichungen + + + Album + + + Sendung + + + EP + + + Single + + + Hörspiel + + + Hörbuch + + + Kompilation + + + DJ-Mix + + + Demo + + + Feldaufnahme + + + Interview + + + Live + + + Mixtape + + + Remix + + + Soundtrack + + + Gesprochenes Wort + + + Interpret + + + Der Name des Künstlers. + + + Der Name, nach dem der Künstler sortiert wird, wenn er vom Anzeigenamen abweicht. + + + Ein Kommentar, der den Künstler von anderen mit demselben Namen unterscheidet. + + + Der Typ des Künstlers, etwa eine Person oder eine Gruppe. + + + Das Geschlecht des Künstlers. + + + Der zweibuchstabige Ländercode des Künstlers. + + + Die offizielle Website des Künstlers. + + + Die MusicBrainz-Kennung des Künstlers. + + + Die Interested-Parties-Information-Nummern des Künstlers. + + + Die International Standard Name Identifiers des Künstlers. + + + Das Datum, an dem der Künstler seine Tätigkeit begann. + + + Das Datum, an dem der Künstler seine Tätigkeit beendete. + + + Ob der Künstler nicht mehr aktiv ist. + + + Die Genres des Künstlers. + + + Die Tags des Künstlers. + + + Der Name des Gebiets. + + + Der Name, nach dem das Gebiet sortiert wird. + + + Ein Kommentar, der das Gebiet von anderen mit demselben Namen unterscheidet. + + + Der Typ des Gebiets. + + + Der ISO-3166-Code des Gebiets. + + + Die MusicBrainz-Kennung des Gebiets. + + + Die alternativen Namen des Künstlers. + + + Die Personen, die zum Künstler beigetragen haben. + + + Die Bewertungen des Künstlers aus verschiedenen Quellen. + + + Cover ändern + + + Coverbild + + + Kein Cover + + + Das Coverbild wurde aktualisiert. + + + Das Coverbild konnte nicht hochgeladen werden. + + + Genre + + + Genre hinzufügen + + + Schlagwort + + + Schlagwort hinzufügen + + + IPI + + + IPI hinzufügen + + + ISNI + + + ISNI hinzufügen + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.en-US.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.en-US.resx new file mode 100644 index 00000000..bbf79a82 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.en-US.resx @@ -0,0 +1,1086 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Back to artists + + + Edit artist + + + Save + + + The artist was saved. + + + The item could not be saved. + + + Delete artist + + + The artist was deleted. + + + Are you sure you want to delete this item? + + + The item could not be deleted. + + + General information + + + Name + + + Sort name + + + Disambiguation + + + Type + + + Gender + + + Country + + + Website + + + MusicBrainz artist Id + + + IPIs + + + ISNIs + + + Begin date + + + End date + + + Ended + + + Genres + + + Tags + + + Areas + + + Area + + + Begin area + + + End area + + + Name + + + Sort name + + + Disambiguation + + + Type + + + ISO 3166 code + + + MusicBrainz area Id + + + Aliases + + + Name + + + Sort name + + + Type + + + Locale + + + Primary + + + Begin date + + + End date + + + Ended + + + Add alias + + + Contributors + + + Contributor Id + + + Role + + + Add contributor + + + Ratings + + + Rating + + + Maximum rating + + + Source + + + Vote count + + + Add rating + + + Remove + + + Albums + + + This artist has no albums + + + The album was deleted. + + + Person + + + Group + + + Orchestra + + + Choir + + + Character + + + Other + + + Male + + + Female + + + Not Applicable + + + Author + + + Translator + + + Illustrator + + + Publisher + + + Narrator + + + Actor + + + Director + + + Screenwriter + + + Composer + + + Lyricist + + + Arranger + + + Conductor + + + Producer + + + Executive Producer + + + Engineer + + + Mixer + + + Remixer + + + Record Label + + + Vocals + + + Backing Vocals + + + Guitar + + + Bass Guitar + + + Drums + + + Percussion + + + Keyboards + + + Piano + + + Synthesizer + + + Strings + + + Woodwinds + + + Brass + + + Orchestrator + + + User + + + MusicBrainz + + + Discogs + + + Last.fm + + + Afghanistan + + + Albania + + + Algeria + + + Andorra + + + Angola + + + Antigua & Barbuda + + + Argentina + + + Armenia + + + Australia + + + Austria + + + Azerbaijan + + + Bahamas + + + Bahrain + + + Bangladesh + + + Barbados + + + Belarus + + + Belgium + + + Belize + + + Benin + + + Bhutan + + + Bolivia + + + Bosnia & Herzegovina + + + Botswana + + + Brazil + + + Brunei + + + Bulgaria + + + Burkina Faso + + + Burundi + + + Cape Verde + + + Cambodia + + + Cameroon + + + Canada + + + Central African Republic + + + Chad + + + Chile + + + China + + + Colombia + + + Comoros + + + Congo - Brazzaville + + + Congo - Kinshasa + + + Costa Rica + + + Côte d’Ivoire + + + Croatia + + + Cuba + + + Cyprus + + + Czechia + + + Denmark + + + Djibouti + + + Dominica + + + Dominican Republic + + + Ecuador + + + Egypt + + + El Salvador + + + Equatorial Guinea + + + Eritrea + + + Estonia + + + Eswatini + + + Ethiopia + + + Fiji + + + Finland + + + France + + + Gabon + + + Gambia + + + Georgia + + + Germany + + + Ghana + + + Greece + + + Grenada + + + Guatemala + + + Guinea + + + Guinea-Bissau + + + Guyana + + + Haiti + + + Honduras + + + Hungary + + + Iceland + + + India + + + Indonesia + + + Iran + + + Iraq + + + Ireland + + + Israel + + + Italy + + + Jamaica + + + Japan + + + Jordan + + + Kazakhstan + + + Kenya + + + Kiribati + + + North Korea + + + South Korea + + + Kuwait + + + Kyrgyzstan + + + Laos + + + Latvia + + + Lebanon + + + Lesotho + + + Liberia + + + Libya + + + Liechtenstein + + + Lithuania + + + Luxembourg + + + Madagascar + + + Malawi + + + Malaysia + + + Maldives + + + Mali + + + Malta + + + Marshall Islands + + + Mauritania + + + Mauritius + + + Mexico + + + Micronesia + + + Moldova + + + Monaco + + + Mongolia + + + Montenegro + + + Morocco + + + Mozambique + + + Myanmar (Burma) + + + Namibia + + + Nauru + + + Nepal + + + Netherlands + + + New Zealand + + + Nicaragua + + + Niger + + + Nigeria + + + North Macedonia + + + Norway + + + Oman + + + Pakistan + + + Palau + + + Palestinian Territories + + + Panama + + + Papua New Guinea + + + Paraguay + + + Peru + + + Philippines + + + Poland + + + Portugal + + + Qatar + + + Romania + + + Russia + + + Rwanda + + + St. Kitts & Nevis + + + St. Lucia + + + St. Vincent & Grenadines + + + Samoa + + + San Marino + + + São Tomé & Príncipe + + + Saudi Arabia + + + Senegal + + + Serbia + + + Seychelles + + + Sierra Leone + + + Singapore + + + Slovakia + + + Slovenia + + + Solomon Islands + + + Somalia + + + South Africa + + + South Sudan + + + Spain + + + Sri Lanka + + + Sudan + + + Suriname + + + Sweden + + + Switzerland + + + Syria + + + Taiwan + + + Tajikistan + + + Tanzania + + + Thailand + + + Timor-Leste + + + Togo + + + Tonga + + + Trinidad & Tobago + + + Tunisia + + + Türkiye + + + Turkmenistan + + + Tuvalu + + + Uganda + + + Ukraine + + + United Arab Emirates + + + United Kingdom + + + United States + + + Uruguay + + + Uzbekistan + + + Vanuatu + + + Vatican City + + + Venezuela + + + Vietnam + + + Yemen + + + Zambia + + + Zimbabwe + + + Netherlands Antilles + + + Europe + + + Worldwide + + + Releases + + + Album + + + Broadcast + + + EP + + + Single + + + Audio drama + + + Audiobook + + + Compilation + + + DJ mix + + + Demo + + + Field recording + + + Interview + + + Live + + + Mixtape + + + Remix + + + Soundtrack + + + Spoken word + + + Performer + + + The name of the artist. + + + The name used to sort the artist, when it differs from the display name. + + + A comment that distinguishes the artist from others with the same name. + + + The type of the artist, like a person or a group. + + + The gender of the artist. + + + The two letter code of the country of the artist. + + + The official website of the artist. + + + The MusicBrainz identifier of the artist. + + + The Interested Parties Information numbers of the artist. + + + The International Standard Name Identifiers of the artist. + + + The date when the artist began its activity. + + + The date when the artist ended its activity. + + + Whether the artist is no longer active. + + + The genres of the artist. + + + The tags of the artist. + + + The name of the area. + + + The name used to sort the area. + + + A comment that distinguishes the area from others with the same name. + + + The type of the area. + + + The ISO 3166 code of the area. + + + The MusicBrainz identifier of the area. + + + The alternative names of the artist. + + + The people that contributed to the artist. + + + The ratings of the artist from different sources. + + + Change cover + + + Cover image + + + No cover + + + The cover image was updated. + + + The cover image could not be uploaded. + + + Genre + + + Add genre + + + Tag + + + Add tag + + + IPI + + + Add IPI + + + ISNI + + + Add ISNI + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.es-ES.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.es-ES.resx new file mode 100644 index 00000000..e9476462 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.es-ES.resx @@ -0,0 +1,1086 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Volver a los artistas + + + Editar artista + + + Guardar + + + El artista se ha guardado. + + + No se ha podido guardar el elemento. + + + Eliminar artista + + + El artista se ha eliminado. + + + ¿Seguro que quieres eliminar este elemento? + + + No se ha podido eliminar el elemento. + + + Información General + + + Nombre + + + Nombre de ordenación + + + Desambiguación + + + Tipo + + + Género + + + País + + + Sitio web + + + Id de artista de MusicBrainz + + + IPIs + + + ISNIs + + + Fecha de inicio + + + Fecha de fin + + + Finalizado + + + Géneros + + + Etiquetas + + + Áreas + + + Área + + + Área de inicio + + + Área de fin + + + Nombre + + + Nombre de ordenación + + + Desambiguación + + + Tipo + + + Código ISO 3166 + + + Id de área de MusicBrainz + + + Alias + + + Nombre + + + Nombre de ordenación + + + Tipo + + + Configuración regional + + + Principal + + + Fecha de inicio + + + Fecha de fin + + + Finalizado + + + Añadir alias + + + Colaboradores + + + Id de colaborador + + + Rol + + + Añadir colaborador + + + Valoraciones + + + Valoración + + + Valoración máxima + + + Fuente + + + Número de votos + + + Añadir valoración + + + Eliminar + + + Álbumes + + + Este artista no tiene álbumes + + + El álbum se ha eliminado. + + + Persona + + + Grupo + + + Orquesta + + + Coro + + + Personaje + + + Otro + + + Masculino + + + Femenino + + + No aplicable + + + Autor + + + Traductor + + + Ilustrador + + + Editorial + + + Narrador + + + Actor + + + Director + + + Guionista + + + Compositor + + + Letrista + + + Arreglista + + + Director de orquesta + + + Productor + + + Productor ejecutivo + + + Ingeniero + + + Mezclador + + + Remezclador + + + Discográfica + + + Voces + + + Coros + + + Guitarra + + + Bajo + + + Batería + + + Percusión + + + Teclados + + + Piano + + + Sintetizador + + + Cuerdas + + + Viento madera + + + Metales + + + Orquestador + + + Usuario + + + MusicBrainz + + + Discogs + + + Last.fm + + + Afganistán + + + Albania + + + Argelia + + + Andorra + + + Angola + + + Antigua y Barbuda + + + Argentina + + + Armenia + + + Australia + + + Austria + + + Azerbaiyán + + + Bahamas + + + Baréin + + + Bangladés + + + Barbados + + + Bielorrusia + + + Bélgica + + + Belice + + + Benín + + + Bután + + + Bolivia + + + Bosnia y Herzegovina + + + Botsuana + + + Brasil + + + Brunéi + + + Bulgaria + + + Burkina Faso + + + Burundi + + + Cabo Verde + + + Camboya + + + Camerún + + + Canadá + + + República Centroafricana + + + Chad + + + Chile + + + China + + + Colombia + + + Comoras + + + Congo - Brazzaville + + + Congo - Kinsasa + + + Costa Rica + + + Costa de Marfil + + + Croacia + + + Cuba + + + Chipre + + + Chequia + + + Dinamarca + + + Yibuti + + + Dominica + + + República Dominicana + + + Ecuador + + + Egipto + + + El Salvador + + + Guinea Ecuatorial + + + Eritrea + + + Estonia + + + Esuatini + + + Etiopía + + + Fiyi + + + Finlandia + + + Francia + + + Gabón + + + Gambia + + + Georgia + + + Alemania + + + Ghana + + + Grecia + + + Granada + + + Guatemala + + + Guinea + + + Guinea-Bisáu + + + Guyana + + + Haití + + + Honduras + + + Hungría + + + Islandia + + + India + + + Indonesia + + + Irán + + + Irak + + + Irlanda + + + Israel + + + Italia + + + Jamaica + + + Japón + + + Jordania + + + Kazajistán + + + Kenia + + + Kiribati + + + Corea del Norte + + + Corea del Sur + + + Kuwait + + + Kirguistán + + + Laos + + + Letonia + + + Líbano + + + Lesoto + + + Liberia + + + Libia + + + Liechtenstein + + + Lituania + + + Luxemburgo + + + Madagascar + + + Malaui + + + Malasia + + + Maldivas + + + Malí + + + Malta + + + Islas Marshall + + + Mauritania + + + Mauricio + + + México + + + Micronesia + + + Moldavia + + + Mónaco + + + Mongolia + + + Montenegro + + + Marruecos + + + Mozambique + + + Myanmar (Birmania) + + + Namibia + + + Nauru + + + Nepal + + + Países Bajos + + + Nueva Zelanda + + + Nicaragua + + + Níger + + + Nigeria + + + Macedonia del Norte + + + Noruega + + + Omán + + + Pakistán + + + Palaos + + + Territorios Palestinos + + + Panamá + + + Papúa Nueva Guinea + + + Paraguay + + + Perú + + + Filipinas + + + Polonia + + + Portugal + + + Catar + + + Rumanía + + + Rusia + + + Ruanda + + + San Cristóbal y Nieves + + + Santa Lucía + + + San Vicente y las Granadinas + + + Samoa + + + San Marino + + + Santo Tomé y Príncipe + + + Arabia Saudí + + + Senegal + + + Serbia + + + Seychelles + + + Sierra Leona + + + Singapur + + + Eslovaquia + + + Eslovenia + + + Islas Salomón + + + Somalia + + + Sudáfrica + + + Sudán del Sur + + + España + + + Sri Lanka + + + Sudán + + + Surinam + + + Suecia + + + Suiza + + + Siria + + + Taiwán + + + Tayikistán + + + Tanzania + + + Tailandia + + + Timor-Leste + + + Togo + + + Tonga + + + Trinidad y Tobago + + + Túnez + + + Turquía + + + Turkmenistán + + + Tuvalu + + + Uganda + + + Ucrania + + + Emiratos Árabes Unidos + + + Reino Unido + + + Estados Unidos + + + Uruguay + + + Uzbekistán + + + Vanuatu + + + Ciudad del Vaticano + + + Venezuela + + + Vietnam + + + Yemen + + + Zambia + + + Zimbabue + + + Antillas Neerlandesas + + + Europa + + + Mundial + + + Publicaciones + + + Álbum + + + Emisión + + + EP + + + Sencillo + + + Audio drama + + + Audiolibro + + + Recopilación + + + Mezcla de DJ + + + Demo + + + Grabación de campo + + + Entrevista + + + Directo + + + Mixtape + + + Remezcla + + + Banda sonora + + + Palabra hablada + + + Intérprete + + + El nombre del artista. + + + El nombre usado para ordenar al artista, cuando difiere del nombre mostrado. + + + Un comentario que distingue al artista de otros con el mismo nombre. + + + El tipo de artista, como una persona o un grupo. + + + El género del artista. + + + El código de dos letras del país del artista. + + + El sitio web oficial del artista. + + + El identificador MusicBrainz del artista. + + + Los números de Información de Partes Interesadas del artista. + + + Los Identificadores Internacionales Normalizados de Nombre del artista. + + + La fecha en que el artista comenzó su actividad. + + + La fecha en que el artista terminó su actividad. + + + Indica si el artista ya no está activo. + + + Los géneros del artista. + + + Las etiquetas del artista. + + + El nombre del área. + + + El nombre usado para ordenar el área. + + + Un comentario que distingue el área de otras con el mismo nombre. + + + El tipo de área. + + + El código ISO 3166 del área. + + + El identificador MusicBrainz del área. + + + Los nombres alternativos del artista. + + + Las personas que contribuyeron al artista. + + + Las valoraciones del artista de diferentes fuentes. + + + Cambiar la portada + + + Imagen de portada + + + Sin portada + + + La imagen de portada se actualizó. + + + No se pudo subir la imagen de portada. + + + Género + + + Añadir género + + + Etiqueta + + + Añadir etiqueta + + + IPI + + + Añadir IPI + + + ISNI + + + Añadir ISNI + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.fr-FR.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.fr-FR.resx new file mode 100644 index 00000000..08fe26ea --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.fr-FR.resx @@ -0,0 +1,1086 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Retour aux artistes + + + Modifier l'artiste + + + Enregistrer + + + L'artiste a été enregistré. + + + L'élément n'a pas pu être enregistré. + + + Supprimer l'artiste + + + L'artiste a été supprimé. + + + Voulez-vous vraiment supprimer cet élément ? + + + L'élément n'a pas pu être supprimé. + + + Informations Générales + + + Nom + + + Nom de tri + + + Désambiguïsation + + + Type + + + Genre + + + Pays + + + Site web + + + Id d'artiste MusicBrainz + + + IPIs + + + ISNIs + + + Date de début + + + Date de fin + + + Terminé + + + Genres + + + Étiquettes + + + Zones + + + Zone + + + Zone de début + + + Zone de fin + + + Nom + + + Nom de tri + + + Désambiguïsation + + + Type + + + Code ISO 3166 + + + Id de zone MusicBrainz + + + Alias + + + Nom + + + Nom de tri + + + Type + + + Paramètres régionaux + + + Principal + + + Date de début + + + Date de fin + + + Terminé + + + Ajouter un alias + + + Contributeurs + + + Id du contributeur + + + Rôle + + + Ajouter un contributeur + + + Évaluations + + + Évaluation + + + Évaluation maximale + + + Source + + + Nombre de votes + + + Ajouter une évaluation + + + Supprimer + + + Albums + + + Cet artiste n'a aucun album + + + L'album a été supprimé. + + + Personne + + + Groupe + + + Orchestre + + + Chœur + + + Personnage + + + Autre + + + Masculin + + + Féminin + + + Non applicable + + + Auteur + + + Traducteur + + + Illustrateur + + + Éditeur + + + Narrateur + + + Acteur + + + Réalisateur + + + Scénariste + + + Compositeur + + + Parolier + + + Arrangeur + + + Chef d'orchestre + + + Producteur + + + Producteur exécutif + + + Ingénieur du son + + + Mixeur + + + Remixeur + + + Maison de disques + + + Chant + + + Chœurs + + + Guitare + + + Guitare basse + + + Batterie + + + Percussions + + + Claviers + + + Piano + + + Synthétiseur + + + Cordes + + + Bois + + + Cuivres + + + Orchestrateur + + + Utilisateur + + + MusicBrainz + + + Discogs + + + Last.fm + + + Afghanistan + + + Albanie + + + Algérie + + + Andorre + + + Angola + + + Antigua-et-Barbuda + + + Argentine + + + Arménie + + + Australie + + + Autriche + + + Azerbaïdjan + + + Bahamas + + + Bahreïn + + + Bangladesh + + + Barbade + + + Biélorussie + + + Belgique + + + Belize + + + Bénin + + + Bhoutan + + + Bolivie + + + Bosnie-Herzégovine + + + Botswana + + + Brésil + + + Brunei + + + Bulgarie + + + Burkina Faso + + + Burundi + + + Cap-Vert + + + Cambodge + + + Cameroun + + + Canada + + + République centrafricaine + + + Tchad + + + Chili + + + Chine + + + Colombie + + + Comores + + + Congo-Brazzaville + + + Congo-Kinshasa + + + Costa Rica + + + Côte d'Ivoire + + + Croatie + + + Cuba + + + Chypre + + + Tchéquie + + + Danemark + + + Djibouti + + + Dominique + + + République dominicaine + + + Équateur + + + Égypte + + + Salvador + + + Guinée équatoriale + + + Érythrée + + + Estonie + + + Eswatini + + + Éthiopie + + + Fidji + + + Finlande + + + France + + + Gabon + + + Gambie + + + Géorgie + + + Allemagne + + + Ghana + + + Grèce + + + Grenade + + + Guatemala + + + Guinée + + + Guinée-Bissau + + + Guyana + + + Haïti + + + Honduras + + + Hongrie + + + Islande + + + Inde + + + Indonésie + + + Iran + + + Irak + + + Irlande + + + Israël + + + Italie + + + Jamaïque + + + Japon + + + Jordanie + + + Kazakhstan + + + Kenya + + + Kiribati + + + Corée du Nord + + + Corée du Sud + + + Koweït + + + Kirghizstan + + + Laos + + + Lettonie + + + Liban + + + Lesotho + + + Liberia + + + Libye + + + Liechtenstein + + + Lituanie + + + Luxembourg + + + Madagascar + + + Malawi + + + Malaisie + + + Maldives + + + Mali + + + Malte + + + Îles Marshall + + + Mauritanie + + + Maurice + + + Mexique + + + Micronésie + + + Moldavie + + + Monaco + + + Mongolie + + + Monténégro + + + Maroc + + + Mozambique + + + Myanmar (Birmanie) + + + Namibie + + + Nauru + + + Népal + + + Pays-Bas + + + Nouvelle-Zélande + + + Nicaragua + + + Niger + + + Nigeria + + + Macédoine du Nord + + + Norvège + + + Oman + + + Pakistan + + + Palaos + + + Territoires palestiniens + + + Panama + + + Papouasie-Nouvelle-Guinée + + + Paraguay + + + Pérou + + + Philippines + + + Pologne + + + Portugal + + + Qatar + + + Roumanie + + + Russie + + + Rwanda + + + Saint-Christophe-et-Niévès + + + Sainte-Lucie + + + Saint-Vincent-et-les Grenadines + + + Samoa + + + Saint-Marin + + + Sao Tomé-et-Principe + + + Arabie saoudite + + + Sénégal + + + Serbie + + + Seychelles + + + Sierra Leone + + + Singapour + + + Slovaquie + + + Slovénie + + + Îles Salomon + + + Somalie + + + Afrique du Sud + + + Soudan du Sud + + + Espagne + + + Sri Lanka + + + Soudan + + + Suriname + + + Suède + + + Suisse + + + Syrie + + + Taïwan + + + Tadjikistan + + + Tanzanie + + + Thaïlande + + + Timor oriental + + + Togo + + + Tonga + + + Trinité-et-Tobago + + + Tunisie + + + Turquie + + + Turkménistan + + + Tuvalu + + + Ouganda + + + Ukraine + + + Émirats arabes unis + + + Royaume-Uni + + + États-Unis + + + Uruguay + + + Ouzbékistan + + + Vanuatu + + + État de la Cité du Vatican + + + Venezuela + + + Viêt Nam + + + Yémen + + + Zambie + + + Zimbabwe + + + Antilles néerlandaises + + + Europe + + + Monde + + + Publications + + + Album + + + Diffusion + + + EP + + + Single + + + Drame audio + + + Livre audio + + + Compilation + + + Mix DJ + + + Démo + + + Enregistrement de terrain + + + Entretien + + + Live + + + Mixtape + + + Remix + + + Bande originale + + + Texte parlé + + + Interprète + + + Le nom de l'artiste. + + + Le nom utilisé pour trier l'artiste, lorsqu'il diffère du nom affiché. + + + Un commentaire qui distingue l'artiste des autres portant le même nom. + + + Le type de l'artiste, comme une personne ou un groupe. + + + Le genre de l'artiste. + + + Le code à deux lettres du pays de l'artiste. + + + Le site web officiel de l'artiste. + + + L'identifiant MusicBrainz de l'artiste. + + + Les numéros IPI de l'artiste. + + + Les identifiants ISNI de l'artiste. + + + La date à laquelle l'artiste a commencé son activité. + + + La date à laquelle l'artiste a terminé son activité. + + + Indique si l'artiste n'est plus actif. + + + Les genres de l'artiste. + + + Les étiquettes de l'artiste. + + + Le nom de la zone. + + + Le nom utilisé pour trier la zone. + + + Un commentaire qui distingue la zone des autres portant le même nom. + + + Le type de la zone. + + + Le code ISO 3166 de la zone. + + + L'identifiant MusicBrainz de la zone. + + + Les noms alternatifs de l'artiste. + + + Les personnes ayant contribué à l'artiste. + + + Les notes de l'artiste provenant de différentes sources. + + + Changer la couverture + + + Image de couverture + + + Aucune couverture + + + L'image de couverture a été mise à jour. + + + L'image de couverture n'a pas pu être téléversée. + + + Genre + + + Ajouter un genre + + + Étiquette + + + Ajouter une étiquette + + + IPI + + + Ajouter un IPI + + + ISNI + + + Ajouter un ISNI + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.it-IT.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.it-IT.resx new file mode 100644 index 00000000..e2bf7d51 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.it-IT.resx @@ -0,0 +1,1086 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Torna agli artisti + + + Modifica artista + + + Salva + + + L'artista è stato salvato. + + + Non è stato possibile salvare l'elemento. + + + Elimina artista + + + L'artista è stato eliminato. + + + Sei sicuro di voler eliminare questo elemento? + + + Non è stato possibile eliminare l'elemento. + + + Informazioni Generali + + + Nome + + + Nome di ordinamento + + + Disambiguazione + + + Tipo + + + Genere + + + Paese + + + Sito web + + + Id artista MusicBrainz + + + IPIs + + + ISNIs + + + Data di inizio + + + Data di fine + + + Concluso + + + Generi + + + Etichette + + + Aree + + + Area + + + Area di inizio + + + Area di fine + + + Nome + + + Nome di ordinamento + + + Disambiguazione + + + Tipo + + + Codice ISO 3166 + + + Id area MusicBrainz + + + Alias + + + Nome + + + Nome di ordinamento + + + Tipo + + + Impostazioni locali + + + Principale + + + Data di inizio + + + Data di fine + + + Concluso + + + Aggiungi alias + + + Collaboratori + + + Id collaboratore + + + Ruolo + + + Aggiungi collaboratore + + + Valutazioni + + + Valutazione + + + Valutazione massima + + + Fonte + + + Numero di voti + + + Aggiungi valutazione + + + Rimuovi + + + Album + + + Questo artista non ha album + + + L'album è stato eliminato. + + + Persona + + + Gruppo + + + Orchestra + + + Coro + + + Personaggio + + + Altro + + + Maschio + + + Femmina + + + Non applicabile + + + Autore + + + Traduttore + + + Illustratore + + + Editore + + + Narratore + + + Attore + + + Regista + + + Sceneggiatore + + + Compositore + + + Paroliere + + + Arrangiatore + + + Direttore d'orchestra + + + Produttore + + + Produttore esecutivo + + + Tecnico del suono + + + Mixer + + + Remixer + + + Etichetta discografica + + + Voce + + + Voci di supporto + + + Chitarra + + + Basso + + + Batteria + + + Percussioni + + + Tastiere + + + Pianoforte + + + Sintetizzatore + + + Archi + + + Legni + + + Ottoni + + + Orchestratore + + + Utente + + + MusicBrainz + + + Discogs + + + Last.fm + + + Afghanistan + + + Albania + + + Algeria + + + Andorra + + + Angola + + + Antigua e Barbuda + + + Argentina + + + Armenia + + + Australia + + + Austria + + + Azerbaigian + + + Bahamas + + + Bahrein + + + Bangladesh + + + Barbados + + + Bielorussia + + + Belgio + + + Belize + + + Benin + + + Bhutan + + + Bolivia + + + Bosnia ed Erzegovina + + + Botswana + + + Brasile + + + Brunei + + + Bulgaria + + + Burkina Faso + + + Burundi + + + Capo Verde + + + Cambogia + + + Camerun + + + Canada + + + Repubblica Centrafricana + + + Ciad + + + Cile + + + Cina + + + Colombia + + + Comore + + + Congo - Brazzaville + + + Congo - Kinshasa + + + Costa Rica + + + Costa d'Avorio + + + Croazia + + + Cuba + + + Cipro + + + Cechia + + + Danimarca + + + Gibuti + + + Dominica + + + Repubblica Dominicana + + + Ecuador + + + Egitto + + + El Salvador + + + Guinea Equatoriale + + + Eritrea + + + Estonia + + + Eswatini + + + Etiopia + + + Figi + + + Finlandia + + + Francia + + + Gabon + + + Gambia + + + Georgia + + + Germania + + + Ghana + + + Grecia + + + Grenada + + + Guatemala + + + Guinea + + + Guinea-Bissau + + + Guyana + + + Haiti + + + Honduras + + + Ungheria + + + Islanda + + + India + + + Indonesia + + + Iran + + + Iraq + + + Irlanda + + + Israele + + + Italia + + + Giamaica + + + Giappone + + + Giordania + + + Kazakistan + + + Kenya + + + Kiribati + + + Corea del Nord + + + Corea del Sud + + + Kuwait + + + Kirghizistan + + + Laos + + + Lettonia + + + Libano + + + Lesotho + + + Liberia + + + Libia + + + Liechtenstein + + + Lituania + + + Lussemburgo + + + Madagascar + + + Malawi + + + Malaysia + + + Maldive + + + Mali + + + Malta + + + Isole Marshall + + + Mauritania + + + Mauritius + + + Messico + + + Micronesia + + + Moldavia + + + Monaco + + + Mongolia + + + Montenegro + + + Marocco + + + Mozambico + + + Myanmar (Birmania) + + + Namibia + + + Nauru + + + Nepal + + + Paesi Bassi + + + Nuova Zelanda + + + Nicaragua + + + Niger + + + Nigeria + + + Macedonia del Nord + + + Norvegia + + + Oman + + + Pakistan + + + Palau + + + Territori palestinesi + + + Panama + + + Papua Nuova Guinea + + + Paraguay + + + Perù + + + Filippine + + + Polonia + + + Portogallo + + + Qatar + + + Romania + + + Russia + + + Ruanda + + + Saint Kitts e Nevis + + + Saint Lucia + + + Saint Vincent e Grenadine + + + Samoa + + + San Marino + + + São Tomé e Príncipe + + + Arabia Saudita + + + Senegal + + + Serbia + + + Seychelles + + + Sierra Leone + + + Singapore + + + Slovacchia + + + Slovenia + + + Isole Salomone + + + Somalia + + + Sudafrica + + + Sudan del Sud + + + Spagna + + + Sri Lanka + + + Sudan + + + Suriname + + + Svezia + + + Svizzera + + + Siria + + + Taiwan + + + Tagikistan + + + Tanzania + + + Thailandia + + + Timor Est + + + Togo + + + Tonga + + + Trinidad e Tobago + + + Tunisia + + + Turchia + + + Turkmenistan + + + Tuvalu + + + Uganda + + + Ucraina + + + Emirati Arabi Uniti + + + Regno Unito + + + Stati Uniti + + + Uruguay + + + Uzbekistan + + + Vanuatu + + + Città del Vaticano + + + Venezuela + + + Vietnam + + + Yemen + + + Zambia + + + Zimbabwe + + + Antille Olandesi + + + Europa + + + Mondiale + + + Pubblicazioni + + + Album + + + Trasmissione + + + EP + + + Singolo + + + Dramma audio + + + Audiolibro + + + Compilation + + + DJ mix + + + Demo + + + Registrazione sul campo + + + Intervista + + + Dal vivo + + + Mixtape + + + Remix + + + Colonna sonora + + + Parlato + + + Esecutore + + + Il nome dell'artista. + + + Il nome usato per ordinare l'artista, quando differisce dal nome visualizzato. + + + Un commento che distingue l'artista da altri con lo stesso nome. + + + Il tipo di artista, come una persona o un gruppo. + + + Il genere dell'artista. + + + Il codice di due lettere del paese dell'artista. + + + Il sito web ufficiale dell'artista. + + + L'identificatore MusicBrainz dell'artista. + + + I numeri di Interested Parties Information dell'artista. + + + Gli International Standard Name Identifiers dell'artista. + + + La data in cui l'artista ha iniziato la sua attività. + + + La data in cui l'artista ha terminato la sua attività. + + + Indica se l'artista non è più attivo. + + + I generi dell'artista. + + + I tag dell'artista. + + + Il nome dell'area. + + + Il nome usato per ordinare l'area. + + + Un commento che distingue l'area da altre con lo stesso nome. + + + Il tipo dell'area. + + + Il codice ISO 3166 dell'area. + + + L'identificatore MusicBrainz dell'area. + + + I nomi alternativi dell'artista. + + + Le persone che hanno contribuito all'artista. + + + Le valutazioni dell'artista da diverse fonti. + + + Cambia copertina + + + Immagine di copertina + + + Nessuna copertina + + + L'immagine di copertina è stata aggiornata. + + + Impossibile caricare l'immagine di copertina. + + + Genere + + + Aggiungi genere + + + Etichetta + + + Aggiungi etichetta + + + IPI + + + Aggiungi IPI + + + ISNI + + + Aggiungi ISNI + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ja-JP.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ja-JP.resx new file mode 100644 index 00000000..490821f4 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ja-JP.resx @@ -0,0 +1,1086 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + アーティストに戻る + + + アーティストを編集 + + + 保存 + + + アーティストを保存しました。 + + + 項目を保存できませんでした。 + + + アーティストを削除 + + + アーティストを削除しました。 + + + この項目を削除してもよろしいですか? + + + 項目を削除できませんでした。 + + + 一般情報 + + + 名前 + + + 並べ替え名 + + + 曖昧さ回避 + + + 種類 + + + 性別 + + + 国 + + + ウェブサイト + + + MusicBrainz アーティスト Id + + + IPIs + + + ISNIs + + + 開始日 + + + 終了日 + + + 終了 + + + ジャンル + + + タグ + + + 地域 + + + 地域 + + + 開始地域 + + + 終了地域 + + + 名前 + + + 並べ替え名 + + + 曖昧さ回避 + + + 種類 + + + ISO 3166 コード + + + MusicBrainz 地域 Id + + + 別名 + + + 名前 + + + 並べ替え名 + + + 種類 + + + ロケール + + + 優先 + + + 開始日 + + + 終了日 + + + 終了 + + + 別名を追加 + + + 貢献者 + + + 貢献者 Id + + + 役割 + + + 貢献者を追加 + + + 評価 + + + 評価 + + + 最大評価 + + + 出典 + + + 投票数 + + + 評価を追加 + + + 削除 + + + アルバム + + + このアーティストにはアルバムがありません + + + アルバムを削除しました。 + + + 個人 + + + グループ + + + オーケストラ + + + 合唱 + + + キャラクター + + + その他 + + + 男性 + + + 女性 + + + 該当なし + + + 著者 + + + 翻訳者 + + + イラストレーター + + + 出版社 + + + ナレーター + + + 俳優 + + + 監督 + + + 脚本家 + + + 作曲者 + + + 作詞者 + + + 編曲者 + + + 指揮者 + + + プロデューサー + + + エグゼクティブプロデューサー + + + エンジニア + + + ミキサー + + + リミキサー + + + レコードレーベル + + + ボーカル + + + バッキングボーカル + + + ギター + + + ベースギター + + + ドラム + + + パーカッション + + + キーボード + + + ピアノ + + + シンセサイザー + + + 弦楽器 + + + 木管楽器 + + + 金管楽器 + + + 管弦楽編曲者 + + + ユーザー + + + MusicBrainz + + + Discogs + + + Last.fm + + + アフガニスタン + + + アルバニア + + + アルジェリア + + + アンドラ + + + アンゴラ + + + アンティグア・バーブーダ + + + アルゼンチン + + + アルメニア + + + オーストラリア + + + オーストリア + + + アゼルバイジャン + + + バハマ + + + バーレーン + + + バングラデシュ + + + バルバドス + + + ベラルーシ + + + ベルギー + + + ベリーズ + + + ベナン + + + ブータン + + + ボリビア + + + ボスニア・ヘルツェゴビナ + + + ボツワナ + + + ブラジル + + + ブルネイ + + + ブルガリア + + + ブルキナファソ + + + ブルンジ + + + カーボベルデ + + + カンボジア + + + カメルーン + + + カナダ + + + 中央アフリカ共和国 + + + チャド + + + チリ + + + 中国 + + + コロンビア + + + コモロ + + + コンゴ共和国 + + + コンゴ民主共和国 + + + コスタリカ + + + コートジボワール + + + クロアチア + + + キューバ + + + キプロス + + + チェコ + + + デンマーク + + + ジブチ + + + ドミニカ国 + + + ドミニカ共和国 + + + エクアドル + + + エジプト + + + エルサルバドル + + + 赤道ギニア + + + エリトリア + + + エストニア + + + エスワティニ + + + エチオピア + + + フィジー + + + フィンランド + + + フランス + + + ガボン + + + ガンビア + + + ジョージア + + + ドイツ + + + ガーナ + + + ギリシャ + + + グレナダ + + + グアテマラ + + + ギニア + + + ギニアビサウ + + + ガイアナ + + + ハイチ + + + ホンジュラス + + + ハンガリー + + + アイスランド + + + インド + + + インドネシア + + + イラン + + + イラク + + + アイルランド + + + イスラエル + + + イタリア + + + ジャマイカ + + + 日本 + + + ヨルダン + + + カザフスタン + + + ケニア + + + キリバス + + + 北朝鮮 + + + 韓国 + + + クウェート + + + キルギス + + + ラオス + + + ラトビア + + + レバノン + + + レソト + + + リベリア + + + リビア + + + リヒテンシュタイン + + + リトアニア + + + ルクセンブルク + + + マダガスカル + + + マラウイ + + + マレーシア + + + モルディブ + + + マリ + + + マルタ + + + マーシャル諸島 + + + モーリタニア + + + モーリシャス + + + メキシコ + + + ミクロネシア + + + モルドバ + + + モナコ + + + モンゴル + + + モンテネグロ + + + モロッコ + + + モザンビーク + + + ミャンマー + + + ナミビア + + + ナウル + + + ネパール + + + オランダ + + + ニュージーランド + + + ニカラグア + + + ニジェール + + + ナイジェリア + + + 北マケドニア + + + ノルウェー + + + オマーン + + + パキスタン + + + パラオ + + + パレスチナ + + + パナマ + + + パプアニューギニア + + + パラグアイ + + + ペルー + + + フィリピン + + + ポーランド + + + ポルトガル + + + カタール + + + ルーマニア + + + ロシア + + + ルワンダ + + + セントクリストファー・ネービス + + + セントルシア + + + セントビンセント・グレナディーン + + + サモア + + + サンマリノ + + + サントメ・プリンシペ + + + サウジアラビア + + + セネガル + + + セルビア + + + セーシェル + + + シエラレオネ + + + シンガポール + + + スロバキア + + + スロベニア + + + ソロモン諸島 + + + ソマリア + + + 南アフリカ + + + 南スーダン + + + スペイン + + + スリランカ + + + スーダン + + + スリナム + + + スウェーデン + + + スイス + + + シリア + + + 台湾 + + + タジキスタン + + + タンザニア + + + タイ + + + 東ティモール + + + トーゴ + + + トンガ + + + トリニダード・トバゴ + + + チュニジア + + + トルコ + + + トルクメニスタン + + + ツバル + + + ウガンダ + + + ウクライナ + + + アラブ首長国連邦 + + + イギリス + + + アメリカ合衆国 + + + ウルグアイ + + + ウズベキスタン + + + バヌアツ + + + バチカン市国 + + + ベネズエラ + + + ベトナム + + + イエメン + + + ザンビア + + + ジンバブエ + + + オランダ領アンティル + + + ヨーロッパ + + + 全世界 + + + リリース + + + アルバム + + + 放送 + + + EP + + + シングル + + + オーディオドラマ + + + オーディオブック + + + コンピレーション + + + DJミックス + + + デモ + + + フィールドレコーディング + + + インタビュー + + + ライブ + + + ミックステープ + + + リミックス + + + サウンドトラック + + + スポークンワード + + + 演奏者 + + + アーティストの名前。 + + + 表示名と異なる場合にアーティストの並べ替えに使う名前。 + + + 同じ名前の他のアーティストと区別するためのコメント。 + + + 人物やグループなどのアーティストの種類。 + + + アーティストの性別。 + + + アーティストの国の2文字コード。 + + + アーティストの公式ウェブサイト。 + + + アーティストのMusicBrainz識別子。 + + + アーティストのIPI番号。 + + + アーティストのISNI。 + + + アーティストが活動を開始した日付。 + + + アーティストが活動を終了した日付。 + + + アーティストが活動を終了しているかどうか。 + + + アーティストのジャンル。 + + + アーティストのタグ。 + + + 地域の名前。 + + + 地域の並べ替えに使う名前。 + + + 同じ名前の他の地域と区別するためのコメント。 + + + 地域の種類。 + + + 地域のISO 3166コード。 + + + 地域のMusicBrainz識別子。 + + + アーティストの別名。 + + + アーティストに貢献した人々。 + + + さまざまな情報源によるアーティストの評価。 + + + カバーを変更 + + + カバー画像 + + + カバーなし + + + カバー画像を更新しました。 + + + カバー画像をアップロードできませんでした。 + + + ジャンル + + + ジャンルを追加 + + + タグ + + + タグを追加 + + + IPI + + + IPI を追加 + + + ISNI + + + ISNI を追加 + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.resx new file mode 100644 index 00000000..bbf79a82 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.resx @@ -0,0 +1,1086 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Back to artists + + + Edit artist + + + Save + + + The artist was saved. + + + The item could not be saved. + + + Delete artist + + + The artist was deleted. + + + Are you sure you want to delete this item? + + + The item could not be deleted. + + + General information + + + Name + + + Sort name + + + Disambiguation + + + Type + + + Gender + + + Country + + + Website + + + MusicBrainz artist Id + + + IPIs + + + ISNIs + + + Begin date + + + End date + + + Ended + + + Genres + + + Tags + + + Areas + + + Area + + + Begin area + + + End area + + + Name + + + Sort name + + + Disambiguation + + + Type + + + ISO 3166 code + + + MusicBrainz area Id + + + Aliases + + + Name + + + Sort name + + + Type + + + Locale + + + Primary + + + Begin date + + + End date + + + Ended + + + Add alias + + + Contributors + + + Contributor Id + + + Role + + + Add contributor + + + Ratings + + + Rating + + + Maximum rating + + + Source + + + Vote count + + + Add rating + + + Remove + + + Albums + + + This artist has no albums + + + The album was deleted. + + + Person + + + Group + + + Orchestra + + + Choir + + + Character + + + Other + + + Male + + + Female + + + Not Applicable + + + Author + + + Translator + + + Illustrator + + + Publisher + + + Narrator + + + Actor + + + Director + + + Screenwriter + + + Composer + + + Lyricist + + + Arranger + + + Conductor + + + Producer + + + Executive Producer + + + Engineer + + + Mixer + + + Remixer + + + Record Label + + + Vocals + + + Backing Vocals + + + Guitar + + + Bass Guitar + + + Drums + + + Percussion + + + Keyboards + + + Piano + + + Synthesizer + + + Strings + + + Woodwinds + + + Brass + + + Orchestrator + + + User + + + MusicBrainz + + + Discogs + + + Last.fm + + + Afghanistan + + + Albania + + + Algeria + + + Andorra + + + Angola + + + Antigua & Barbuda + + + Argentina + + + Armenia + + + Australia + + + Austria + + + Azerbaijan + + + Bahamas + + + Bahrain + + + Bangladesh + + + Barbados + + + Belarus + + + Belgium + + + Belize + + + Benin + + + Bhutan + + + Bolivia + + + Bosnia & Herzegovina + + + Botswana + + + Brazil + + + Brunei + + + Bulgaria + + + Burkina Faso + + + Burundi + + + Cape Verde + + + Cambodia + + + Cameroon + + + Canada + + + Central African Republic + + + Chad + + + Chile + + + China + + + Colombia + + + Comoros + + + Congo - Brazzaville + + + Congo - Kinshasa + + + Costa Rica + + + Côte d’Ivoire + + + Croatia + + + Cuba + + + Cyprus + + + Czechia + + + Denmark + + + Djibouti + + + Dominica + + + Dominican Republic + + + Ecuador + + + Egypt + + + El Salvador + + + Equatorial Guinea + + + Eritrea + + + Estonia + + + Eswatini + + + Ethiopia + + + Fiji + + + Finland + + + France + + + Gabon + + + Gambia + + + Georgia + + + Germany + + + Ghana + + + Greece + + + Grenada + + + Guatemala + + + Guinea + + + Guinea-Bissau + + + Guyana + + + Haiti + + + Honduras + + + Hungary + + + Iceland + + + India + + + Indonesia + + + Iran + + + Iraq + + + Ireland + + + Israel + + + Italy + + + Jamaica + + + Japan + + + Jordan + + + Kazakhstan + + + Kenya + + + Kiribati + + + North Korea + + + South Korea + + + Kuwait + + + Kyrgyzstan + + + Laos + + + Latvia + + + Lebanon + + + Lesotho + + + Liberia + + + Libya + + + Liechtenstein + + + Lithuania + + + Luxembourg + + + Madagascar + + + Malawi + + + Malaysia + + + Maldives + + + Mali + + + Malta + + + Marshall Islands + + + Mauritania + + + Mauritius + + + Mexico + + + Micronesia + + + Moldova + + + Monaco + + + Mongolia + + + Montenegro + + + Morocco + + + Mozambique + + + Myanmar (Burma) + + + Namibia + + + Nauru + + + Nepal + + + Netherlands + + + New Zealand + + + Nicaragua + + + Niger + + + Nigeria + + + North Macedonia + + + Norway + + + Oman + + + Pakistan + + + Palau + + + Palestinian Territories + + + Panama + + + Papua New Guinea + + + Paraguay + + + Peru + + + Philippines + + + Poland + + + Portugal + + + Qatar + + + Romania + + + Russia + + + Rwanda + + + St. Kitts & Nevis + + + St. Lucia + + + St. Vincent & Grenadines + + + Samoa + + + San Marino + + + São Tomé & Príncipe + + + Saudi Arabia + + + Senegal + + + Serbia + + + Seychelles + + + Sierra Leone + + + Singapore + + + Slovakia + + + Slovenia + + + Solomon Islands + + + Somalia + + + South Africa + + + South Sudan + + + Spain + + + Sri Lanka + + + Sudan + + + Suriname + + + Sweden + + + Switzerland + + + Syria + + + Taiwan + + + Tajikistan + + + Tanzania + + + Thailand + + + Timor-Leste + + + Togo + + + Tonga + + + Trinidad & Tobago + + + Tunisia + + + Türkiye + + + Turkmenistan + + + Tuvalu + + + Uganda + + + Ukraine + + + United Arab Emirates + + + United Kingdom + + + United States + + + Uruguay + + + Uzbekistan + + + Vanuatu + + + Vatican City + + + Venezuela + + + Vietnam + + + Yemen + + + Zambia + + + Zimbabwe + + + Netherlands Antilles + + + Europe + + + Worldwide + + + Releases + + + Album + + + Broadcast + + + EP + + + Single + + + Audio drama + + + Audiobook + + + Compilation + + + DJ mix + + + Demo + + + Field recording + + + Interview + + + Live + + + Mixtape + + + Remix + + + Soundtrack + + + Spoken word + + + Performer + + + The name of the artist. + + + The name used to sort the artist, when it differs from the display name. + + + A comment that distinguishes the artist from others with the same name. + + + The type of the artist, like a person or a group. + + + The gender of the artist. + + + The two letter code of the country of the artist. + + + The official website of the artist. + + + The MusicBrainz identifier of the artist. + + + The Interested Parties Information numbers of the artist. + + + The International Standard Name Identifiers of the artist. + + + The date when the artist began its activity. + + + The date when the artist ended its activity. + + + Whether the artist is no longer active. + + + The genres of the artist. + + + The tags of the artist. + + + The name of the area. + + + The name used to sort the area. + + + A comment that distinguishes the area from others with the same name. + + + The type of the area. + + + The ISO 3166 code of the area. + + + The MusicBrainz identifier of the area. + + + The alternative names of the artist. + + + The people that contributed to the artist. + + + The ratings of the artist from different sources. + + + Change cover + + + Cover image + + + No cover + + + The cover image was updated. + + + The cover image could not be uploaded. + + + Genre + + + Add genre + + + Tag + + + Add tag + + + IPI + + + Add IPI + + + ISNI + + + Add ISNI + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ro-RO.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ro-RO.resx new file mode 100644 index 00000000..6f23f468 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.ro-RO.resx @@ -0,0 +1,1086 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Înapoi la artiști + + + Editează artist + + + Salvare + + + Artistul a fost salvat. + + + Elementul nu a putut fi salvat. + + + Șterge artist + + + Artistul a fost șters. + + + Sigur doriți să ștergeți acest element? + + + Elementul nu a putut fi șters. + + + Informații Generale + + + Nume + + + Nume de sortare + + + Dezambiguizare + + + Tip + + + Gen + + + Țară + + + Site web + + + Id artist MusicBrainz + + + IPIs + + + ISNIs + + + Data de început + + + Data de sfârșit + + + Încheiat + + + Genuri + + + Etichete + + + Zone + + + Zonă + + + Zona de început + + + Zona de sfârșit + + + Nume + + + Nume de sortare + + + Dezambiguizare + + + Tip + + + Cod ISO 3166 + + + Id zonă MusicBrainz + + + Aliasuri + + + Nume + + + Nume de sortare + + + Tip + + + Setare regională + + + Principal + + + Data de început + + + Data de sfârșit + + + Încheiat + + + Adaugă alias + + + Contribuitori + + + Id contribuitor + + + Rol + + + Adaugă contributor + + + Ratinguri + + + Rating + + + Rating maxim + + + Sursă + + + Număr de voturi + + + Adaugă rating + + + Elimină + + + Albume + + + Acest artist nu are albume + + + Albumul a fost șters. + + + Persoană + + + Grup + + + Orchestră + + + Cor + + + Personaj + + + Altele + + + Masculin + + + Feminin + + + Nu se aplică + + + Autor + + + Traducător + + + Ilustrator + + + Editor + + + Narator + + + Actor + + + Regizor + + + Scenarist + + + Compozitor + + + Textier + + + Aranjor + + + Dirijor + + + Producător + + + Producător executiv + + + Inginer de sunet + + + Mixer + + + Remixer + + + Casă de discuri + + + Voce + + + Voci de acompaniament + + + Chitară + + + Chitară bas + + + Tobe + + + Percuție + + + Claviaturi + + + Pian + + + Sintetizator + + + Instrumente cu corzi + + + Instrumente de suflat din lemn + + + Instrumente de suflat din alamă + + + Orchestrator + + + Utilizator + + + MusicBrainz + + + Discogs + + + Last.fm + + + Afganistan + + + Albania + + + Algeria + + + Andorra + + + Angola + + + Antigua și Barbuda + + + Argentina + + + Armenia + + + Australia + + + Austria + + + Azerbaidjan + + + Bahamas + + + Bahrain + + + Bangladesh + + + Barbados + + + Belarus + + + Belgia + + + Belize + + + Benin + + + Bhutan + + + Bolivia + + + Bosnia și Herțegovina + + + Botswana + + + Brazilia + + + Brunei + + + Bulgaria + + + Burkina Faso + + + Burundi + + + Capul Verde + + + Cambodgia + + + Camerun + + + Canada + + + Republica Centrafricană + + + Ciad + + + Chile + + + China + + + Columbia + + + Comore + + + Congo - Brazzaville + + + Congo - Kinshasa + + + Costa Rica + + + Coasta de Fildeș + + + Croația + + + Cuba + + + Cipru + + + Cehia + + + Danemarca + + + Djibouti + + + Dominica + + + Republica Dominicană + + + Ecuador + + + Egipt + + + El Salvador + + + Guineea Ecuatorială + + + Eritreea + + + Estonia + + + Eswatini + + + Etiopia + + + Fiji + + + Finlanda + + + Franța + + + Gabon + + + Gambia + + + Georgia + + + Germania + + + Ghana + + + Grecia + + + Grenada + + + Guatemala + + + Guineea + + + Guineea-Bissau + + + Guyana + + + Haiti + + + Honduras + + + Ungaria + + + Islanda + + + India + + + Indonezia + + + Iran + + + Irak + + + Irlanda + + + Israel + + + Italia + + + Jamaica + + + Japonia + + + Iordania + + + Kazahstan + + + Kenya + + + Kiribati + + + Coreea de Nord + + + Coreea de Sud + + + Kuweit + + + Kârgâzstan + + + Laos + + + Letonia + + + Liban + + + Lesotho + + + Liberia + + + Libia + + + Liechtenstein + + + Lituania + + + Luxemburg + + + Madagascar + + + Malawi + + + Malaysia + + + Maldive + + + Mali + + + Malta + + + Insulele Marshall + + + Mauritania + + + Mauritius + + + Mexic + + + Micronezia + + + Moldova + + + Monaco + + + Mongolia + + + Muntenegru + + + Maroc + + + Mozambic + + + Myanmar (Birmania) + + + Namibia + + + Nauru + + + Nepal + + + Țările de Jos + + + Noua Zeelandă + + + Nicaragua + + + Niger + + + Nigeria + + + Macedonia de Nord + + + Norvegia + + + Oman + + + Pakistan + + + Palau + + + Teritoriile Palestiniene + + + Panama + + + Papua Noua Guinee + + + Paraguay + + + Peru + + + Filipine + + + Polonia + + + Portugalia + + + Qatar + + + România + + + Rusia + + + Rwanda + + + Saint Kitts și Nevis + + + Sfânta Lucia + + + Saint Vincent și Grenadine + + + Samoa + + + San Marino + + + São Tomé și Príncipe + + + Arabia Saudită + + + Senegal + + + Serbia + + + Seychelles + + + Sierra Leone + + + Singapore + + + Slovacia + + + Slovenia + + + Insulele Solomon + + + Somalia + + + Africa de Sud + + + Sudanul de Sud + + + Spania + + + Sri Lanka + + + Sudan + + + Suriname + + + Suedia + + + Elveția + + + Siria + + + Taiwan + + + Tadjikistan + + + Tanzania + + + Thailanda + + + Timor-Leste + + + Togo + + + Tonga + + + Trinidad și Tobago + + + Tunisia + + + Turcia + + + Turkmenistan + + + Tuvalu + + + Uganda + + + Ucraina + + + Emiratele Arabe Unite + + + Regatul Unit + + + Statele Unite + + + Uruguay + + + Uzbekistan + + + Vanuatu + + + Vatican + + + Venezuela + + + Vietnam + + + Yemen + + + Zambia + + + Zimbabwe + + + Antilele Neerlandeze + + + Europa + + + La nivel mondial + + + Publicații + + + Album + + + Emisiune + + + EP + + + Single + + + Dramă audio + + + Carte audio + + + Compilație + + + Mix DJ + + + Demo + + + Înregistrare de teren + + + Interviu + + + Live + + + Mixtape + + + Remix + + + Coloană sonoră + + + Text recitat + + + Interpret + + + Numele artistului. + + + Numele folosit pentru sortarea artistului, când acesta diferă de numele afișat. + + + Un comentariu care distinge artistul de alții cu același nume. + + + Tipul artistului, cum ar fi o persoană sau un grup. + + + Genul artistului. + + + Codul din două litere al țării artistului. + + + Site-ul web oficial al artistului. + + + Identificatorul MusicBrainz al artistului. + + + Numerele de informații ale părților interesate ale artistului. + + + Identificatorii internaționali standard de nume ai artistului. + + + Data la care artistul și-a început activitatea. + + + Data la care artistul și-a încheiat activitatea. + + + Dacă artistul nu mai este activ. + + + Genurile artistului. + + + Etichetele artistului. + + + Numele zonei. + + + Numele folosit pentru sortarea zonei. + + + Un comentariu care distinge zona de altele cu același nume. + + + Tipul zonei. + + + Codul ISO 3166 al zonei. + + + Identificatorul MusicBrainz al zonei. + + + Numele alternative ale artistului. + + + Persoanele care au contribuit la artist. + + + Evaluările artistului din surse diferite. + + + Schimbă coperta + + + Imagine de copertă + + + Fără copertă + + + Imaginea de copertă a fost actualizată. + + + Imaginea de copertă nu a putut fi încărcată. + + + Gen + + + Adaugă gen + + + Etichetă + + + Adaugă etichetă + + + IPI + + + Adaugă IPI + + + ISNI + + + Adaugă ISNI + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.uk-UA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.uk-UA.resx new file mode 100644 index 00000000..5bbfe32d --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.uk-UA.resx @@ -0,0 +1,1086 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Повернутися до виконавців + + + Редагувати виконавця + + + Зберегти + + + Виконавця збережено. + + + Не вдалося зберегти елемент. + + + Видалити виконавця + + + Виконавця видалено. + + + Ви впевнені, що хочете видалити цей елемент? + + + Не вдалося видалити елемент. + + + Загальна інформація + + + Ім'я + + + Назва для сортування + + + Уточнення + + + Тип + + + Стать + + + Країна + + + Вебсайт + + + Ідентифікатор виконавця MusicBrainz + + + IPIs + + + ISNIs + + + Дата початку + + + Дата закінчення + + + Завершено + + + Жанри + + + Теги + + + Області + + + Область + + + Початкова область + + + Кінцева область + + + Ім'я + + + Назва для сортування + + + Уточнення + + + Тип + + + Код ISO 3166 + + + Ідентифікатор області MusicBrainz + + + Псевдоніми + + + Ім'я + + + Назва для сортування + + + Тип + + + Локаль + + + Основний + + + Дата початку + + + Дата закінчення + + + Завершено + + + Додати псевдонім + + + Учасники + + + Ідентифікатор учасника + + + Роль + + + Додати учасника + + + Оцінки + + + Оцінка + + + Максимальна оцінка + + + Джерело + + + Кількість голосів + + + Додати оцінку + + + Видалити + + + Альбоми + + + У цього виконавця немає альбомів + + + Альбом видалено. + + + Особа + + + Гурт + + + Оркестр + + + Хор + + + Персонаж + + + Інше + + + Чоловіча + + + Жіноча + + + Не застосовно + + + Автор + + + Перекладач + + + Ілюстратор + + + Видавець + + + Оповідач + + + Актор + + + Режисер + + + Сценарист + + + Композитор + + + Автор текстів + + + Аранжувальник + + + Диригент + + + Продюсер + + + Виконавчий продюсер + + + Інженер + + + Мікшер + + + Реміксер + + + Лейбл звукозапису + + + Вокал + + + Бек-вокал + + + Гітара + + + Бас-гітара + + + Барабани + + + Перкусія + + + Клавішні + + + Піаніно + + + Синтезатор + + + Струнні + + + Дерев'яні духові + + + Мідні духові + + + Оркестратор + + + Користувач + + + MusicBrainz + + + Discogs + + + Last.fm + + + Афганістан + + + Албанія + + + Алжир + + + Андорра + + + Ангола + + + Антигуа і Барбуда + + + Аргентина + + + Вірменія + + + Австралія + + + Австрія + + + Азербайджан + + + Багамські острови + + + Бахрейн + + + Бангладеш + + + Барбадос + + + Білорусь + + + Бельгія + + + Беліз + + + Бенін + + + Бутан + + + Болівія + + + Боснія і Герцеговина + + + Ботсвана + + + Бразилія + + + Бруней + + + Болгарія + + + Буркіна-Фасо + + + Бурунді + + + Кабо-Верде + + + Камбоджа + + + Камерун + + + Канада + + + Центральноафриканська Республіка + + + Чад + + + Чилі + + + Китай + + + Колумбія + + + Коморські острови + + + Конго - Браззавіль + + + Конго - Кіншаса + + + Коста-Рика + + + Кот-д'Івуар + + + Хорватія + + + Куба + + + Кіпр + + + Чехія + + + Данія + + + Джибуті + + + Домініка + + + Домініканська Республіка + + + Еквадор + + + Єгипет + + + Сальвадор + + + Екваторіальна Гвінея + + + Еритрея + + + Естонія + + + Есватіні + + + Ефіопія + + + Фіджі + + + Фінляндія + + + Франція + + + Габон + + + Гамбія + + + Грузія + + + Німеччина + + + Гана + + + Греція + + + Гренада + + + Гватемала + + + Гвінея + + + Гвінея-Бісау + + + Гаяна + + + Гаїті + + + Гондурас + + + Угорщина + + + Ісландія + + + Індія + + + Індонезія + + + Іран + + + Ірак + + + Ірландія + + + Ізраїль + + + Італія + + + Ямайка + + + Японія + + + Йорданія + + + Казахстан + + + Кенія + + + Кірибаті + + + Північна Корея + + + Південна Корея + + + Кувейт + + + Киргизстан + + + Лаос + + + Латвія + + + Ліван + + + Лесото + + + Ліберія + + + Лівія + + + Ліхтенштейн + + + Литва + + + Люксембург + + + Мадагаскар + + + Малаві + + + Малайзія + + + Мальдіви + + + Малі + + + Мальта + + + Маршаллові Острови + + + Мавританія + + + Маврикій + + + Мексика + + + Мікронезія + + + Молдова + + + Монако + + + Монголія + + + Чорногорія + + + Марокко + + + Мозамбік + + + М'янма (Бірма) + + + Намібія + + + Науру + + + Непал + + + Нідерланди + + + Нова Зеландія + + + Нікарагуа + + + Нігер + + + Нігерія + + + Північна Македонія + + + Норвегія + + + Оман + + + Пакистан + + + Палау + + + Палестинські території + + + Панама + + + Папуа-Нова Гвінея + + + Парагвай + + + Перу + + + Філіппіни + + + Польща + + + Португалія + + + Катар + + + Румунія + + + Росія + + + Руанда + + + Сент-Кітс і Невіс + + + Сент-Люсія + + + Сент-Вінсент і Гренадини + + + Самоа + + + Сан-Марино + + + Сан-Томе і Принсіпі + + + Саудівська Аравія + + + Сенегал + + + Сербія + + + Сейшельські Острови + + + Сьєрра-Леоне + + + Сінгапур + + + Словаччина + + + Словенія + + + Соломонові Острови + + + Сомалі + + + Південно-Африканська Республіка + + + Південний Судан + + + Іспанія + + + Шрі-Ланка + + + Судан + + + Суринам + + + Швеція + + + Швейцарія + + + Сирія + + + Тайвань + + + Таджикистан + + + Танзанія + + + Таїланд + + + Тимор-Лешті + + + Того + + + Тонга + + + Тринідад і Тобаго + + + Туніс + + + Туреччина + + + Туркменістан + + + Тувалу + + + Уганда + + + Україна + + + Об'єднані Арабські Емірати + + + Велика Британія + + + Сполучені Штати Америки + + + Уругвай + + + Узбекистан + + + Вануату + + + Ватикан + + + Венесуела + + + В'єтнам + + + Ємен + + + Замбія + + + Зімбабве + + + Нідерландські Антильські острови + + + Європа + + + Увесь світ + + + Релізи + + + Альбом + + + Трансляція + + + EP + + + Сингл + + + Аудіодрама + + + Аудіокнига + + + Збірка + + + DJ-мікс + + + Демо + + + Польовий запис + + + Інтерв'ю + + + Наживо + + + Мікстейп + + + Ремікс + + + Саундтрек + + + Усне слово + + + Виконавець + + + Ім'я виконавця. + + + Ім'я, яке використовується для сортування виконавця, коли воно відрізняється від відображуваного імені. + + + Коментар, який відрізняє виконавця від інших з тим самим ім'ям. + + + Тип виконавця, наприклад особа чи гурт. + + + Стать виконавця. + + + Дволітерний код країни виконавця. + + + Офіційний вебсайт виконавця. + + + Ідентифікатор виконавця у MusicBrainz. + + + Номери IPI виконавця. + + + Ідентифікатори ISNI виконавця. + + + Дата початку діяльності виконавця. + + + Дата завершення діяльності виконавця. + + + Чи виконавець більше не активний. + + + Жанри виконавця. + + + Теги виконавця. + + + Назва області. + + + Ім'я, яке використовується для сортування області. + + + Коментар, який відрізняє область від інших з тією самою назвою. + + + Тип області. + + + Код ISO 3166 області. + + + Ідентифікатор області у MusicBrainz. + + + Альтернативні імена виконавця. + + + Люди, які зробили внесок у виконавця. + + + Оцінки виконавця з різних джерел. + + + Змінити обкладинку + + + Зображення обкладинки + + + Немає обкладинки + + + Зображення обкладинки оновлено. + + + Не вдалося завантажити зображення обкладинки. + + + Жанр + + + Додати жанр + + + Тег + + + Додати тег + + + IPI + + + Додати IPI + + + ISNI + + + Додати ISNI + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.zh-CN.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.zh-CN.resx new file mode 100644 index 00000000..e1f06152 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.zh-CN.resx @@ -0,0 +1,1086 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 返回艺术家 + + + 编辑艺术家 + + + 保存 + + + 艺术家已保存。 + + + 无法保存该项目。 + + + 删除艺术家 + + + 艺术家已删除。 + + + 确定要删除此项目吗? + + + 无法删除该项目。 + + + 常规信息 + + + 名称 + + + 排序名称 + + + 消歧义 + + + 类型 + + + 性别 + + + 国家 + + + 网站 + + + MusicBrainz 艺术家 Id + + + IPIs + + + ISNIs + + + 开始日期 + + + 结束日期 + + + 已结束 + + + 体裁 + + + 标签 + + + 地区 + + + 地区 + + + 起始地区 + + + 结束地区 + + + 名称 + + + 排序名称 + + + 消歧义 + + + 类型 + + + ISO 3166 代码 + + + MusicBrainz 地区 Id + + + 别名 + + + 名称 + + + 排序名称 + + + 类型 + + + 区域设置 + + + 主要 + + + 开始日期 + + + 结束日期 + + + 已结束 + + + 添加别名 + + + 贡献者 + + + 贡献者 Id + + + 角色 + + + 添加贡献者 + + + 评分 + + + 评分 + + + 最高评分 + + + 来源 + + + 票数 + + + 添加评分 + + + 删除 + + + 专辑 + + + 此艺术家没有专辑 + + + 专辑已删除。 + + + 个人 + + + 团体 + + + 管弦乐团 + + + 合唱 + + + 角色 + + + 其他 + + + 男 + + + 女 + + + 不适用 + + + 作者 + + + 译者 + + + 插画师 + + + 出版商 + + + 旁白 + + + 演员 + + + 导演 + + + 编剧 + + + 作曲 + + + 作词 + + + 编曲 + + + 指挥 + + + 制作人 + + + 执行制作人 + + + 工程师 + + + 混音师 + + + 重混师 + + + 唱片公司 + + + 人声 + + + 和声 + + + 吉他 + + + 贝斯 + + + 鼓 + + + 打击乐 + + + 键盘 + + + 钢琴 + + + 合成器 + + + 弦乐 + + + 木管乐 + + + 铜管乐 + + + 配器 + + + 用户 + + + MusicBrainz + + + Discogs + + + Last.fm + + + 阿富汗 + + + 阿尔巴尼亚 + + + 阿尔及利亚 + + + 安道尔 + + + 安哥拉 + + + 安提瓜和巴布达 + + + 阿根廷 + + + 亚美尼亚 + + + 澳大利亚 + + + 奥地利 + + + 阿塞拜疆 + + + 巴哈马 + + + 巴林 + + + 孟加拉国 + + + 巴巴多斯 + + + 白俄罗斯 + + + 比利时 + + + 伯利兹 + + + 贝宁 + + + 不丹 + + + 玻利维亚 + + + 波斯尼亚和黑塞哥维那 + + + 博茨瓦纳 + + + 巴西 + + + 文莱 + + + 保加利亚 + + + 布基纳法索 + + + 布隆迪 + + + 佛得角 + + + 柬埔寨 + + + 喀麦隆 + + + 加拿大 + + + 中非共和国 + + + 乍得 + + + 智利 + + + 中国 + + + 哥伦比亚 + + + 科摩罗 + + + 刚果(布拉柴维尔) + + + 刚果(金沙萨) + + + 哥斯达黎加 + + + 科特迪瓦 + + + 克罗地亚 + + + 古巴 + + + 塞浦路斯 + + + 捷克 + + + 丹麦 + + + 吉布提 + + + 多米尼克 + + + 多米尼加共和国 + + + 厄瓜多尔 + + + 埃及 + + + 萨尔瓦多 + + + 赤道几内亚 + + + 厄立特里亚 + + + 爱沙尼亚 + + + 斯威士兰 + + + 埃塞俄比亚 + + + 斐济 + + + 芬兰 + + + 法国 + + + 加蓬 + + + 冈比亚 + + + 格鲁吉亚 + + + 德国 + + + 加纳 + + + 希腊 + + + 格林纳达 + + + 危地马拉 + + + 几内亚 + + + 几内亚比绍 + + + 圭亚那 + + + 海地 + + + 洪都拉斯 + + + 匈牙利 + + + 冰岛 + + + 印度 + + + 印度尼西亚 + + + 伊朗 + + + 伊拉克 + + + 爱尔兰 + + + 以色列 + + + 意大利 + + + 牙买加 + + + 日本 + + + 约旦 + + + 哈萨克斯坦 + + + 肯尼亚 + + + 基里巴斯 + + + 朝鲜 + + + 韩国 + + + 科威特 + + + 吉尔吉斯斯坦 + + + 老挝 + + + 拉脱维亚 + + + 黎巴嫩 + + + 莱索托 + + + 利比里亚 + + + 利比亚 + + + 列支敦士登 + + + 立陶宛 + + + 卢森堡 + + + 马达加斯加 + + + 马拉维 + + + 马来西亚 + + + 马尔代夫 + + + 马里 + + + 马耳他 + + + 马绍尔群岛 + + + 毛里塔尼亚 + + + 毛里求斯 + + + 墨西哥 + + + 密克罗尼西亚 + + + 摩尔多瓦 + + + 摩纳哥 + + + 蒙古 + + + 黑山 + + + 摩洛哥 + + + 莫桑比克 + + + 缅甸 + + + 纳米比亚 + + + 瑙鲁 + + + 尼泊尔 + + + 荷兰 + + + 新西兰 + + + 尼加拉瓜 + + + 尼日尔 + + + 尼日利亚 + + + 北马其顿 + + + 挪威 + + + 阿曼 + + + 巴基斯坦 + + + 帕劳 + + + 巴勒斯坦领土 + + + 巴拿马 + + + 巴布亚新几内亚 + + + 巴拉圭 + + + 秘鲁 + + + 菲律宾 + + + 波兰 + + + 葡萄牙 + + + 卡塔尔 + + + 罗马尼亚 + + + 俄罗斯 + + + 卢旺达 + + + 圣基茨和尼维斯 + + + 圣卢西亚 + + + 圣文森特和格林纳丁斯 + + + 萨摩亚 + + + 圣马力诺 + + + 圣多美和普林西比 + + + 沙特阿拉伯 + + + 塞内加尔 + + + 塞尔维亚 + + + 塞舌尔 + + + 塞拉利昂 + + + 新加坡 + + + 斯洛伐克 + + + 斯洛文尼亚 + + + 所罗门群岛 + + + 索马里 + + + 南非 + + + 南苏丹 + + + 西班牙 + + + 斯里兰卡 + + + 苏丹 + + + 苏里南 + + + 瑞典 + + + 瑞士 + + + 叙利亚 + + + 台湾 + + + 塔吉克斯坦 + + + 坦桑尼亚 + + + 泰国 + + + 东帝汶 + + + 多哥 + + + 汤加 + + + 特立尼达和多巴哥 + + + 突尼斯 + + + 土耳其 + + + 土库曼斯坦 + + + 图瓦卢 + + + 乌干达 + + + 乌克兰 + + + 阿拉伯联合酋长国 + + + 英国 + + + 美国 + + + 乌拉圭 + + + 乌兹别克斯坦 + + + 瓦努阿图 + + + 梵蒂冈 + + + 委内瑞拉 + + + 越南 + + + 也门 + + + 赞比亚 + + + 津巴布韦 + + + 荷属安的列斯 + + + 欧洲 + + + 全球 + + + 发行 + + + 专辑 + + + 广播 + + + EP + + + 单曲 + + + 音频剧 + + + 有声书 + + + 合辑 + + + DJ 混音 + + + 小样 + + + 实地录音 + + + 访谈 + + + 现场 + + + 混音带 + + + 混音版 + + + 原声带 + + + 口语 + + + 表演者 + + + 艺术家名称。 + + + 与显示名称不同时用于对艺术家排序的名称。 + + + 用于将艺术家与同名者区分开的说明。 + + + 艺术家的类型,例如个人或团体。 + + + 艺术家的性别。 + + + 艺术家的国家/地区两字母代码。 + + + 艺术家的官方网站。 + + + 艺术家的MusicBrainz标识符。 + + + 艺术家的利害关系方信息编号。 + + + 艺术家的国际标准名称标识符。 + + + 艺术家开始活动的日期。 + + + 艺术家结束活动的日期。 + + + 艺术家是否已停止活动。 + + + 艺术家的流派。 + + + 艺术家的标签。 + + + 地区名称。 + + + 用于对地区排序的名称。 + + + 用于将该地区与同名地区区分开的说明。 + + + 地区的类型。 + + + 地区的ISO 3166代码。 + + + 地区的MusicBrainz标识符。 + + + 艺术家的别名。 + + + 为艺术家做出贡献的人员。 + + + 来自不同来源的艺术家评分。 + + + 更改封面 + + + 封面图片 + + + 无封面 + + + 封面图片已更新。 + + + 无法上传封面图片。 + + + 流派 + + + 添加流派 + + + 标签 + + + 添加标签 + + + IPI + + + 添加 IPI + + + ISNI + + + 添加 ISNI + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ar-SA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ar-SA.resx new file mode 100644 index 00000000..2bf6599a --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ar-SA.resx @@ -0,0 +1,1182 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + العودة إلى الألبوم + + + تعديل المقطع + + + حفظ + + + تم حفظ المقطع. + + + تعذر حفظ العنصر. + + + حذف المقطع + + + تم حذف المقطع. + + + هل أنت متأكد من أنك تريد حذف هذا العنصر؟ + + + تعذر حذف العنصر. + + + معلومات عامة + + + المسار + + + العنوان + + + العنوان الأصلي + + + رقم المقطع + + + رقم القرص + + + الكتابة + + + المفتاح + + + BPM + + + الأنواع + + + الوسوم + + + المدة (بالثواني) + + + المعرّفات + + + معرّف التسجيل MusicBrainz + + + معرّف مقطع MusicBrainz + + + العمل + + + عنوان العمل + + + معرّف MusicBrainz للعمل + + + المزاجات + + + ISRCs + + + دو كبير + + + دو# كبير + + + ري كبير + + + ري# كبير + + + مي كبير + + + فا كبير + + + فا# كبير + + + صول كبير + + + صول# كبير + + + لا كبير + + + لا# كبير + + + سي كبير + + + دو صغير + + + دو# صغير + + + ري صغير + + + ري# صغير + + + مي صغير + + + فا صغير + + + فا# صغير + + + صول صغير + + + صول# صغير + + + لا صغير + + + لا# صغير + + + سي صغير + + + مسار الملف للمقطوعة. + + + عنوان المقطوعة. + + + العنوان الأصلي للمقطوعة عندما يختلف عن الحالي. + + + موضع المقطوعة على القرص. + + + رقم القرص الذي تنتمي إليه المقطوعة. + + + الكتابة المستخدمة في لغة المقطوعة. + + + المقام الموسيقي للمقطوعة. + + + سرعة المقطوعة بعدد النبضات في الدقيقة. + + + الأنواع الموسيقية الخاصة بالمقطع. + + + الوسوم الخاصة بالمقطع. + + + مدة المقطوعة بالثواني. + + + معرّف MusicBrainz للتسجيل. + + + معرّف MusicBrainz للمقطوعة. + + + عنوان العمل الذي سُجلت منه المقطوعة. + + + معرّف MusicBrainz للعمل. + + + الحالات المزاجية الخاصة بالمقطع. + + + رموز ISRC الخاصة بالمقطع. + + + الوصف + + + ملخص قصير أو وصف للمقطع. + + + إزالة الالتباس + + + تعليق يميز المقطع عن غيره ممن يحملون العنوان نفسه. + + + تسجيل فيديو + + + ما إذا كان تسجيل المقطع تسجيل فيديو. + + + معلومات الإصدار + + + تاريخ الإصدار الأصلي + + + تاريخ الإصدار الأول للمقطع. + + + سنة الإصدار الأصلية + + + السنة التي صدر فيها المقطع أول مرة. + + + تاريخ إعادة الإصدار + + + تاريخ إعادة إصدار المقطع. + + + سنة إعادة الإصدار + + + السنة التي أعيد فيها إصدار المقطع. + + + بلد الإصدار + + + بلد إصدار المقطع. + + + إصدار النسخة + + + نسخة الإصدار، مثل النسخة الأصلية. + + + اللغة + + + اللغة الأصلية + + + خصائص الصوت + + + معدل أخذ العينات (Hz) + + + معدل أخذ العينات لصوت المقطع بالهرتز (Hz). + + + القنوات + + + عدد قنوات الصوت في المقطع. + + + عمق البت + + + عمق بت صوت المقطع. + + + ترميز الصوت + + + ترميز الصوت المستخدم في المقطع. + + + معدل البت (kbps) + + + معدل البت لصوت المقطع بالكيلوبت في الثانية (kbps). + + + AcoustID + + + معرّف بصمة AcoustID لملف صوت المقطع. + + + ReplayGain + + + كسب المقطع (dB) + + + كسب ReplayGain للمقطع بالديسيبل. + + + ذروة المقطع + + + ذروة ReplayGain للمقطع. + + + كسب الألبوم (dB) + + + كسب ReplayGain للألبوم بالديسيبل. + + + ذروة الألبوم + + + ذروة ReplayGain للألبوم. + + + نوع العمل + + + نوع العمل في MusicBrainz، مثل أغنية. + + + أكواد ISWC للعمل + + + رموز ISWC الخاصة بالعمل. + + + لغات العمل + + + لغات العمل. + + + الرمز + + + الاسم + + + الاسم الأصلي + + + إضافة لغة + + + رمز الحرفين للغة المقطع. + + + اسم لغة المقطع. + + + الاسم الأصلي للغة المقطع. + + + رمز اللغة + + + اسم اللغة + + + الاسم الأصلي للغة + + + المساهمون + + + معرّف المساهم + + + الدور + + + إضافة مساهم + + + الأشخاص الذين ساهموا في الفنان. + + + التقييمات + + + التقييم + + + أقصى تقييم + + + المصدر + + + عدد الأصوات + + + إضافة تقييم + + + تقييمات الفنان من مصادر مختلفة. + + + إزالة + + + آخر + + + مؤلف + + + مترجم + + + رسام + + + ناشر + + + راوٍ + + + ممثل + + + مخرج + + + كاتب سيناريو + + + ملحن + + + كاتب كلمات + + + موزع + + + قائد أوركسترا + + + منتج + + + منتج تنفيذي + + + مهندس صوت + + + خالط صوت + + + معيد المزج + + + شركة تسجيلات + + + غناء + + + غناء مساند + + + غيتار + + + غيتار باس + + + طبول + + + إيقاع + + + لوحات المفاتيح + + + بيانو + + + مركب صوتي + + + آلات وترية + + + آلات نفخ خشبية + + + آلات نفخ نحاسية + + + جوقة + + + منسق أوركسترالي + + + مؤدٍ + + + المستخدم + + + MusicBrainz + + + Discogs + + + Last.fm + + + أندورا + + + الإمارات العربية المتحدة + + + أفغانستان + + + أنتيغوا وبربودا + + + ألبانيا + + + أرمينيا + + + جزر الأنتيل الهولندية + + + أنغولا + + + الأرجنتين + + + النمسا + + + أستراليا + + + أذربيجان + + + البوسنة والهرسك + + + بربادوس + + + بنغلاديش + + + بلجيكا + + + بوركينا فاسو + + + بلغاريا + + + البحرين + + + بوروندي + + + بنين + + + بروناي + + + بوليفيا + + + البرازيل + + + الباهاما + + + بوتان + + + بوتسوانا + + + بيلاروسيا + + + بليز + + + كندا + + + الكونغو - كينشاسا + + + جمهورية أفريقيا الوسطى + + + الكونغو - برازافيل + + + سويسرا + + + ساحل العاج + + + تشيلي + + + الكاميرون + + + الصين + + + كولومبيا + + + كوستاريكا + + + كوبا + + + الرأس الأخضر + + + قبرص + + + التشيك + + + ألمانيا + + + جيبوتي + + + الدنمارك + + + دومينيكا + + + جمهورية الدومينيكان + + + الجزائر + + + الإكوادور + + + إستونيا + + + مصر + + + إريتريا + + + إسبانيا + + + إثيوبيا + + + فنلندا + + + فيجي + + + ميكرونيزيا + + + فرنسا + + + الغابون + + + المملكة المتحدة + + + غرينادا + + + جورجيا + + + غانا + + + غامبيا + + + غينيا + + + غينيا الاستوائية + + + اليونان + + + غواتيمالا + + + غينيا بيساو + + + غيانا + + + هندوراس + + + كرواتيا + + + هايتي + + + هنغاريا + + + إندونيسيا + + + أيرلندا + + + إسرائيل + + + الهند + + + العراق + + + إيران + + + آيسلندا + + + إيطاليا + + + جامايكا + + + الأردن + + + اليابان + + + كينيا + + + قيرغيزستان + + + كمبوديا + + + كيريباتي + + + جزر القمر + + + سانت كيتس ونيفيس + + + كوريا الشمالية + + + كوريا الجنوبية + + + الكويت + + + كازاخستان + + + لاوس + + + لبنان + + + سانت لوسيا + + + ليختنشتاين + + + سريلانكا + + + ليبيريا + + + ليسوتو + + + ليتوانيا + + + لوكسمبورغ + + + لاتفيا + + + ليبيا + + + المغرب + + + موناكو + + + مولدوفا + + + الجبل الأسود + + + مدغشقر + + + جزر مارشال + + + مقدونيا الشمالية + + + مالي + + + ميانمار (بورما) + + + منغوليا + + + موريتانيا + + + مالطا + + + موريشيوس + + + المالديف + + + مالاوي + + + المكسيك + + + ماليزيا + + + موزمبيق + + + ناميبيا + + + النيجر + + + نيجيريا + + + نيكاراغوا + + + هولندا + + + النرويج + + + نيبال + + + ناورو + + + نيوزيلندا + + + عُمان + + + بنما + + + بيرو + + + بابوا غينيا الجديدة + + + الفلبين + + + باكستان + + + بولندا + + + الأراضي الفلسطينية + + + البرتغال + + + بالاو + + + باراغواي + + + قطر + + + رومانيا + + + صربيا + + + روسيا + + + رواندا + + + المملكة العربية السعودية + + + جزر سليمان + + + سيشل + + + السودان + + + السويد + + + سنغافورة + + + سلوفينيا + + + سلوفاكيا + + + سيراليون + + + سان مارينو + + + السنغال + + + الصومال + + + سورينام + + + جنوب السودان + + + ساو تومي وبرينسيبي + + + السلفادور + + + سوريا + + + إسواتيني + + + تشاد + + + توغو + + + تايلاند + + + طاجيكستان + + + تيمور الشرقية + + + تركمانستان + + + تونس + + + تونغا + + + تركيا + + + ترينيداد وتوباغو + + + توفالو + + + تايوان + + + تنزانيا + + + أوكرانيا + + + أوغندا + + + الولايات المتحدة + + + أوروغواي + + + أوزبكستان + + + مدينة الفاتيكان + + + سانت فينسنت والغرينادين + + + فنزويلا + + + فيتنام + + + فانواتو + + + ساموا + + + أوروبا + + + العالم + + + اليمن + + + جنوب أفريقيا + + + زامبيا + + + زيمبابوي + + + النوع + + + إضافة نوع + + + وسم + + + إضافة وسم + + + المزاج + + + إضافة مزاج + + + ISRC + + + إضافة ISRC + + + ISWC + + + إضافة ISWC + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.de-DE.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.de-DE.resx new file mode 100644 index 00000000..43c6973b --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.de-DE.resx @@ -0,0 +1,1182 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Zurück zum Album + + + Titel bearbeiten + + + Speichern + + + Der Titel wurde gespeichert. + + + Das Element konnte nicht gespeichert werden. + + + Titel löschen + + + Der Titel wurde gelöscht. + + + Möchten Sie dieses Element wirklich löschen? + + + Das Element konnte nicht gelöscht werden. + + + Allgemeine Informationen + + + Pfad + + + Titel + + + Originaltitel + + + Titelnummer + + + Discnummer + + + Schrift + + + Tonart + + + BPM + + + Genres + + + Schlagwörter + + + Dauer (Sekunden) + + + Kennungen + + + MusicBrainz-Aufnahme-Id + + + MusicBrainz-Titel-Id + + + Werk + + + Werktitel + + + MusicBrainz-Id des Werks + + + Stimmungen + + + ISRCs + + + C-Dur + + + Cis-Dur + + + D-Dur + + + Dis-Dur + + + E-Dur + + + F-Dur + + + Fis-Dur + + + G-Dur + + + Gis-Dur + + + A-Dur + + + Ais-Dur + + + H-Dur + + + C-Moll + + + Cis-Moll + + + D-Moll + + + Dis-Moll + + + E-Moll + + + F-Moll + + + Fis-Moll + + + G-Moll + + + Gis-Moll + + + A-Moll + + + Ais-Moll + + + H-Moll + + + Der Dateisystempfad des Titels. + + + Der Titel des Titels. + + + Der Originaltitel des Titels, wenn er vom aktuellen abweicht. + + + Die Position des Titels auf seiner Disc. + + + Die Nummer der Disc, zu der der Titel gehört. + + + Die Schrift, die von der Sprache des Titels verwendet wird. + + + Die Tonart des Titels. + + + Das Tempo des Titels in Schlägen pro Minute. + + + Die Genres des Titels. + + + Die Tags des Titels. + + + Die Dauer des Titels in Sekunden. + + + Die MusicBrainz-Kennung der Aufnahme. + + + Die MusicBrainz-Kennung des Titels. + + + Der Titel des Werks, von dem der Titel eine Aufnahme ist. + + + Die MusicBrainz-Kennung des Werks. + + + Die Stimmungen des Titels. + + + Die ISRCs des Titels. + + + Beschreibung + + + Eine kurze Zusammenfassung oder Beschreibung des Titels. + + + Abgrenzung + + + Ein Kommentar, der den Titel von anderen mit demselben Namen unterscheidet. + + + Videoaufnahme + + + Ob es sich bei der Aufnahme des Titels um eine Videoaufnahme handelt. + + + Veröffentlichungsinformationen + + + Ursprüngliches Veröffentlichungsdatum + + + Das Datum, an dem der Titel ursprünglich veröffentlicht wurde. + + + Ursprüngliches Veröffentlichungsjahr + + + Das Jahr, in dem der Titel ursprünglich veröffentlicht wurde. + + + Erneutes Veröffentlichungsdatum + + + Das Datum, an dem der Titel erneut veröffentlicht wurde. + + + Erneutes Veröffentlichungsjahr + + + Das Jahr, in dem der Titel erneut veröffentlicht wurde. + + + Veröffentlichungsland + + + Das Land, in dem der Titel veröffentlicht wurde. + + + Veröffentlichungsversion + + + Die Version der Veröffentlichung, wie die ursprüngliche. + + + Sprache + + + Originalsprache + + + Audioeigenschaften + + + Abtastrate (Hz) + + + Die Abtastrate des Audios des Titels in Hz. + + + Kanäle + + + Die Anzahl der Audiokanäle des Titels. + + + Bittiefe + + + Die Bittiefe des Audios des Titels. + + + Audiocodec + + + Der vom Titel verwendete Audiocodec. + + + Bitrate (kbps) + + + Die Bitrate des Audios des Titels in kbps. + + + AcoustID + + + Die AcoustID-Fingerprint-Kennung der Audiodatei des Titels. + + + ReplayGain + + + Titelverstärkung (dB) + + + Die ReplayGain-Titelverstärkung des Titels in Dezibel. + + + Titelspitzenwert + + + Der ReplayGain-Titelspitzenwert des Titels. + + + Albumverstärkung (dB) + + + Die ReplayGain-Albumverstärkung des Titels in Dezibel. + + + Albumspitzenwert + + + Der ReplayGain-Albumspitzenwert des Titels. + + + Werktyp + + + Der MusicBrainz-Typ des Werks, wie Song. + + + Werk-ISWCs + + + Die ISWCs des Werks. + + + Werk-Sprachen + + + Die Sprachen des Werks. + + + Code + + + Name + + + Nativer Name + + + Sprache hinzufügen + + + Der zweibuchstabige Code der Sprache des Titels. + + + Der Name der Sprache des Titels. + + + Der native Name der Sprache des Titels. + + + Sprachcode + + + Sprachname + + + Muttersprachlicher Name + + + Mitwirkende + + + Mitwirkenden-Id + + + Rolle + + + Mitwirkenden hinzufügen + + + Die Personen, die zum Künstler beigetragen haben. + + + Bewertungen + + + Bewertung + + + Höchstbewertung + + + Quelle + + + Stimmenzahl + + + Bewertung hinzufügen + + + Die Bewertungen des Künstlers aus verschiedenen Quellen. + + + Entfernen + + + Sonstige + + + Autor + + + Übersetzer + + + Illustrator + + + Verlag + + + Erzähler + + + Schauspieler + + + Regisseur + + + Drehbuchautor + + + Komponist + + + Liedtexter + + + Arrangeur + + + Dirigent + + + Produzent + + + Ausführender Produzent + + + Toningenieur + + + Mixer + + + Remixer + + + Plattenlabel + + + Gesang + + + Hintergrundgesang + + + Gitarre + + + Bassgitarre + + + Schlagzeug + + + Perkussion + + + Keyboards + + + Klavier + + + Synthesizer + + + Streicher + + + Holzbläser + + + Blechbläser + + + Chor + + + Orchestrator + + + Interpret + + + Benutzer + + + MusicBrainz + + + Discogs + + + Last.fm + + + Andorra + + + Vereinigte Arabische Emirate + + + Afghanistan + + + Antigua und Barbuda + + + Albanien + + + Armenien + + + Niederländische Antillen + + + Angola + + + Argentinien + + + Österreich + + + Australien + + + Aserbaidschan + + + Bosnien und Herzegowina + + + Barbados + + + Bangladesch + + + Belgien + + + Burkina Faso + + + Bulgarien + + + Bahrain + + + Burundi + + + Benin + + + Brunei + + + Bolivien + + + Brasilien + + + Bahamas + + + Bhutan + + + Botsuana + + + Belarus + + + Belize + + + Kanada + + + Kongo - Kinshasa + + + Zentralafrikanische Republik + + + Kongo - Brazzaville + + + Schweiz + + + Côte d'Ivoire + + + Chile + + + Kamerun + + + China + + + Kolumbien + + + Costa Rica + + + Kuba + + + Kap Verde + + + Zypern + + + Tschechien + + + Deutschland + + + Dschibuti + + + Dänemark + + + Dominica + + + Dominikanische Republik + + + Algerien + + + Ecuador + + + Estland + + + Ägypten + + + Eritrea + + + Spanien + + + Äthiopien + + + Finnland + + + Fidschi + + + Mikronesien + + + Frankreich + + + Gabun + + + Vereinigtes Königreich + + + Grenada + + + Georgien + + + Ghana + + + Gambia + + + Guinea + + + Äquatorialguinea + + + Griechenland + + + Guatemala + + + Guinea-Bissau + + + Guyana + + + Honduras + + + Kroatien + + + Haiti + + + Ungarn + + + Indonesien + + + Irland + + + Israel + + + Indien + + + Irak + + + Iran + + + Island + + + Italien + + + Jamaika + + + Jordanien + + + Japan + + + Kenia + + + Kirgisistan + + + Kambodscha + + + Kiribati + + + Komoren + + + St. Kitts und Nevis + + + Nordkorea + + + Südkorea + + + Kuwait + + + Kasachstan + + + Laos + + + Libanon + + + St. Lucia + + + Liechtenstein + + + Sri Lanka + + + Liberia + + + Lesotho + + + Litauen + + + Luxemburg + + + Lettland + + + Libyen + + + Marokko + + + Monaco + + + Moldau + + + Montenegro + + + Madagaskar + + + Marshallinseln + + + Nordmazedonien + + + Mali + + + Myanmar (Burma) + + + Mongolei + + + Mauretanien + + + Malta + + + Mauritius + + + Malediven + + + Malawi + + + Mexiko + + + Malaysia + + + Mosambik + + + Namibia + + + Niger + + + Nigeria + + + Nicaragua + + + Niederlande + + + Norwegen + + + Nepal + + + Nauru + + + Neuseeland + + + Oman + + + Panama + + + Peru + + + Papua-Neuguinea + + + Philippinen + + + Pakistan + + + Polen + + + Palästinensische Autonomiegebiete + + + Portugal + + + Palau + + + Paraguay + + + Katar + + + Rumänien + + + Serbien + + + Russland + + + Ruanda + + + Saudi-Arabien + + + Salomonen + + + Seychellen + + + Sudan + + + Schweden + + + Singapur + + + Slowenien + + + Slowakei + + + Sierra Leone + + + San Marino + + + Senegal + + + Somalia + + + Suriname + + + Südsudan + + + São Tomé und Príncipe + + + El Salvador + + + Syrien + + + Eswatini + + + Tschad + + + Togo + + + Thailand + + + Tadschikistan + + + Timor-Leste + + + Turkmenistan + + + Tunesien + + + Tonga + + + Türkei + + + Trinidad und Tobago + + + Tuvalu + + + Taiwan + + + Tansania + + + Ukraine + + + Uganda + + + Vereinigte Staaten + + + Uruguay + + + Usbekistan + + + Vatikanstadt + + + St. Vincent und die Grenadinen + + + Venezuela + + + Vietnam + + + Vanuatu + + + Samoa + + + Europa + + + Weltweit + + + Jemen + + + Südafrika + + + Sambia + + + Simbabwe + + + Genre + + + Genre hinzufügen + + + Schlagwort + + + Schlagwort hinzufügen + + + Stimmung + + + Stimmung hinzufügen + + + ISRC + + + ISRC hinzufügen + + + ISWC + + + ISWC hinzufügen + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.en-US.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.en-US.resx new file mode 100644 index 00000000..252da4a1 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.en-US.resx @@ -0,0 +1,1182 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Back to album + + + Edit track + + + Save + + + The track was saved. + + + The item could not be saved. + + + Delete track + + + The track was deleted. + + + Are you sure you want to delete this item? + + + The item could not be deleted. + + + General information + + + Path + + + Title + + + Original title + + + Track number + + + Disc number + + + Script + + + Key + + + BPM + + + Genres + + + Tags + + + Duration (seconds) + + + Identifiers + + + MusicBrainz recording Id + + + MusicBrainz track Id + + + Work + + + Work title + + + Work MusicBrainz Id + + + Moods + + + ISRCs + + + C major + + + C# major + + + D major + + + D# major + + + E major + + + F major + + + F# major + + + G major + + + G# major + + + A major + + + A# major + + + B major + + + C minor + + + C# minor + + + D minor + + + D# minor + + + E minor + + + F minor + + + F# minor + + + G minor + + + G# minor + + + A minor + + + A# minor + + + B minor + + + The file system path of the track. + + + The title of the track. + + + The original title of the track, when it differs from the current one. + + + The position of the track on its disc. + + + The number of the disc the track belongs to. + + + The script used by the language of the track. + + + The musical key of the track. + + + The tempo of the track in beats per minute. + + + The genres of the track. + + + The tags of the track. + + + The duration of the track in seconds. + + + The MusicBrainz identifier of the recording. + + + The MusicBrainz identifier of the track. + + + The title of the work the track is a recording of. + + + The MusicBrainz identifier of the work. + + + The moods of the track. + + + The ISRCs of the track. + + + Description + + + A short summary or description of the track. + + + Disambiguation + + + A comment that distinguishes the track from others with the same title. + + + Video recording + + + Whether the recording of the track is a video recording. + + + Release information + + + Original release date + + + The date when the track was originally released. + + + Original release year + + + The year when the track was originally released. + + + Re-release date + + + The date when the track was released again. + + + Re-release year + + + The year when the track was released again. + + + Release country + + + The country of release of the track. + + + Release version + + + The version of the release, like the original one. + + + Language + + + Original language + + + Audio properties + + + Sample rate (Hz) + + + The sample rate of the audio of the track in Hz. + + + Channels + + + The number of audio channels of the track. + + + Bit depth + + + The bit depth of the audio of the track. + + + Audio codec + + + The audio codec used by the track. + + + Bitrate (kbps) + + + The bitrate of the audio of the track in kbps. + + + AcoustID + + + The AcoustID fingerprint identifier of the audio file of the track. + + + ReplayGain + + + Track gain (dB) + + + The ReplayGain track gain of the track in decibels. + + + Track peak + + + The ReplayGain track peak of the track. + + + Album gain (dB) + + + The ReplayGain album gain of the track in decibels. + + + Album peak + + + The ReplayGain album peak of the track. + + + Work type + + + The MusicBrainz type of the work, like Song. + + + Work ISWCs + + + The ISWCs of the work. + + + Work languages + + + The languages of the work. + + + Code + + + Name + + + Native name + + + Add language + + + The two letter code of the language of the track. + + + The name of the language of the track. + + + The native name of the language of the track. + + + Language code + + + Language name + + + Native name + + + Contributors + + + Contributor Id + + + Role + + + Add contributor + + + The people that contributed to the artist. + + + Ratings + + + Rating + + + Maximum rating + + + Source + + + Vote count + + + Add rating + + + The ratings of the artist from different sources. + + + Remove + + + Other + + + Author + + + Translator + + + Illustrator + + + Publisher + + + Narrator + + + Actor + + + Director + + + Screenwriter + + + Composer + + + Lyricist + + + Arranger + + + Conductor + + + Producer + + + Executive Producer + + + Engineer + + + Mixer + + + Remixer + + + Record Label + + + Vocals + + + Backing Vocals + + + Guitar + + + Bass Guitar + + + Drums + + + Percussion + + + Keyboards + + + Piano + + + Synthesizer + + + Strings + + + Woodwinds + + + Brass + + + Choir + + + Orchestrator + + + Performer + + + User + + + MusicBrainz + + + Discogs + + + Last.fm + + + Andorra + + + United Arab Emirates + + + Afghanistan + + + Antigua & Barbuda + + + Albania + + + Armenia + + + Netherlands Antilles + + + Angola + + + Argentina + + + Austria + + + Australia + + + Azerbaijan + + + Bosnia & Herzegovina + + + Barbados + + + Bangladesh + + + Belgium + + + Burkina Faso + + + Bulgaria + + + Bahrain + + + Burundi + + + Benin + + + Brunei + + + Bolivia + + + Brazil + + + Bahamas + + + Bhutan + + + Botswana + + + Belarus + + + Belize + + + Canada + + + Congo - Kinshasa + + + Central African Republic + + + Congo - Brazzaville + + + Switzerland + + + Côte d’Ivoire + + + Chile + + + Cameroon + + + China + + + Colombia + + + Costa Rica + + + Cuba + + + Cape Verde + + + Cyprus + + + Czechia + + + Germany + + + Djibouti + + + Denmark + + + Dominica + + + Dominican Republic + + + Algeria + + + Ecuador + + + Estonia + + + Egypt + + + Eritrea + + + Spain + + + Ethiopia + + + Finland + + + Fiji + + + Micronesia + + + France + + + Gabon + + + United Kingdom + + + Grenada + + + Georgia + + + Ghana + + + Gambia + + + Guinea + + + Equatorial Guinea + + + Greece + + + Guatemala + + + Guinea-Bissau + + + Guyana + + + Honduras + + + Croatia + + + Haiti + + + Hungary + + + Indonesia + + + Ireland + + + Israel + + + India + + + Iraq + + + Iran + + + Iceland + + + Italy + + + Jamaica + + + Jordan + + + Japan + + + Kenya + + + Kyrgyzstan + + + Cambodia + + + Kiribati + + + Comoros + + + St. Kitts & Nevis + + + North Korea + + + South Korea + + + Kuwait + + + Kazakhstan + + + Laos + + + Lebanon + + + St. Lucia + + + Liechtenstein + + + Sri Lanka + + + Liberia + + + Lesotho + + + Lithuania + + + Luxembourg + + + Latvia + + + Libya + + + Morocco + + + Monaco + + + Moldova + + + Montenegro + + + Madagascar + + + Marshall Islands + + + North Macedonia + + + Mali + + + Myanmar (Burma) + + + Mongolia + + + Mauritania + + + Malta + + + Mauritius + + + Maldives + + + Malawi + + + Mexico + + + Malaysia + + + Mozambique + + + Namibia + + + Niger + + + Nigeria + + + Nicaragua + + + Netherlands + + + Norway + + + Nepal + + + Nauru + + + New Zealand + + + Oman + + + Panama + + + Peru + + + Papua New Guinea + + + Philippines + + + Pakistan + + + Poland + + + Palestinian Territories + + + Portugal + + + Palau + + + Paraguay + + + Qatar + + + Romania + + + Serbia + + + Russia + + + Rwanda + + + Saudi Arabia + + + Solomon Islands + + + Seychelles + + + Sudan + + + Sweden + + + Singapore + + + Slovenia + + + Slovakia + + + Sierra Leone + + + San Marino + + + Senegal + + + Somalia + + + Suriname + + + South Sudan + + + São Tomé & Príncipe + + + El Salvador + + + Syria + + + Eswatini + + + Chad + + + Togo + + + Thailand + + + Tajikistan + + + Timor-Leste + + + Turkmenistan + + + Tunisia + + + Tonga + + + Türkiye + + + Trinidad & Tobago + + + Tuvalu + + + Taiwan + + + Tanzania + + + Ukraine + + + Uganda + + + United States + + + Uruguay + + + Uzbekistan + + + Vatican City + + + St. Vincent & Grenadines + + + Venezuela + + + Vietnam + + + Vanuatu + + + Samoa + + + Europe + + + Worldwide + + + Yemen + + + South Africa + + + Zambia + + + Zimbabwe + + + Genre + + + Add genre + + + Tag + + + Add tag + + + Mood + + + Add mood + + + ISRC + + + Add ISRC + + + ISWC + + + Add ISWC + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.es-ES.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.es-ES.resx new file mode 100644 index 00000000..a431f4cd --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.es-ES.resx @@ -0,0 +1,1182 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Volver al álbum + + + Editar pista + + + Guardar + + + La pista se ha guardado. + + + El elemento no se ha podido guardar. + + + Eliminar pista + + + La pista se ha eliminado. + + + ¿Seguro que quieres eliminar este elemento? + + + El elemento no se ha podido eliminar. + + + Información general + + + Ruta + + + Título + + + Título original + + + Número de pista + + + Número de disco + + + Escritura + + + Tonalidad + + + BPM + + + Géneros + + + Etiquetas + + + Duración (segundos) + + + Identificadores + + + Id de grabación de MusicBrainz + + + Id de pista de MusicBrainz + + + Obra + + + Título de la obra + + + Id de MusicBrainz de la obra + + + Estados de ánimo + + + ISRCs + + + Do mayor + + + Do# mayor + + + Re mayor + + + Re# mayor + + + Mi mayor + + + Fa mayor + + + Fa# mayor + + + Sol mayor + + + Sol# mayor + + + La mayor + + + La# mayor + + + Si mayor + + + Do menor + + + Do# menor + + + Re menor + + + Re# menor + + + Mi menor + + + Fa menor + + + Fa# menor + + + Sol menor + + + Sol# menor + + + La menor + + + La# menor + + + Si menor + + + La ruta del archivo de la pista. + + + El título de la pista. + + + El título original de la pista, cuando difiere del actual. + + + La posición de la pista en su disco. + + + El número del disco al que pertenece la pista. + + + El sistema de escritura usado por el idioma de la pista. + + + La tonalidad de la pista. + + + El tempo de la pista en pulsaciones por minuto. + + + Los géneros de la pista. + + + Las etiquetas de la pista. + + + La duración de la pista en segundos. + + + El identificador MusicBrainz de la grabación. + + + El identificador MusicBrainz de la pista. + + + El título de la obra de la que la pista es una grabación. + + + El identificador MusicBrainz de la obra. + + + Los estados de ánimo de la pista. + + + Los ISRC de la pista. + + + Descripción + + + Un resumen o descripción breve de la pista. + + + Desambiguación + + + Un comentario que distingue la pista de otras con el mismo título. + + + Grabación de vídeo + + + Indica si la grabación de la pista es una grabación de vídeo. + + + Información de publicación + + + Fecha de publicación original + + + La fecha en que se publicó originalmente la pista. + + + Año de publicación original + + + El año en que se publicó originalmente la pista. + + + Fecha de republicación + + + La fecha en que se volvió a publicar la pista. + + + Año de republicación + + + El año en que se volvió a publicar la pista. + + + País de publicación + + + El país de publicación de la pista. + + + Versión de publicación + + + La versión de la publicación, como la original. + + + Idioma + + + Idioma original + + + Propiedades de audio + + + Frecuencia de muestreo (Hz) + + + La frecuencia de muestreo del audio de la pista en Hz. + + + Canales + + + El número de canales de audio de la pista. + + + Profundidad de bits + + + La profundidad de bits del audio de la pista. + + + Códec de audio + + + El códec de audio usado por la pista. + + + Tasa de bits (kbps) + + + La tasa de bits del audio de la pista en kbps. + + + AcoustID + + + El identificador de huella AcoustID del archivo de audio de la pista. + + + ReplayGain + + + Ganancia de pista (dB) + + + La ganancia de pista de ReplayGain de la pista en decibelios. + + + Pico de pista + + + El pico de pista de ReplayGain de la pista. + + + Ganancia de álbum (dB) + + + La ganancia de álbum de ReplayGain de la pista en decibelios. + + + Pico de álbum + + + El pico de álbum de ReplayGain de la pista. + + + Tipo de obra + + + El tipo de obra de MusicBrainz, como Canción. + + + ISWC de la obra + + + Los ISWC de la obra. + + + Idiomas de la obra + + + Los idiomas de la obra. + + + Code + + + Name + + + Nombre nativo + + + Añadir idioma + + + El código de dos letras del idioma de la pista. + + + El nombre del idioma de la pista. + + + El nombre nativo del idioma de la pista. + + + Código de idioma + + + Nombre del idioma + + + Nombre nativo + + + Colaboradores + + + Id de colaborador + + + Rol + + + Añadir colaborador + + + Las personas que contribuyeron al artista. + + + Valoraciones + + + Valoración + + + Valoración máxima + + + Fuente + + + Número de votos + + + Añadir valoración + + + Las valoraciones del artista de diferentes fuentes. + + + Eliminar + + + Otro + + + Autor + + + Traductor + + + Ilustrador + + + Editorial + + + Narrador + + + Actor + + + Director + + + Guionista + + + Compositor + + + Letrista + + + Arreglista + + + Director de orquesta + + + Productor + + + Productor ejecutivo + + + Ingeniero + + + Mezclador + + + Remezclador + + + Discográfica + + + Voces + + + Coros + + + Guitarra + + + Bajo + + + Batería + + + Percusión + + + Teclados + + + Piano + + + Sintetizador + + + Cuerdas + + + Viento madera + + + Metales + + + Coro + + + Orquestador + + + Intérprete + + + Usuario + + + MusicBrainz + + + Discogs + + + Last.fm + + + Andorra + + + Emiratos Árabes Unidos + + + Afganistán + + + Antigua y Barbuda + + + Albania + + + Armenia + + + Antillas Neerlandesas + + + Angola + + + Argentina + + + Austria + + + Australia + + + Azerbaiyán + + + Bosnia y Herzegovina + + + Barbados + + + Bangladés + + + Bélgica + + + Burkina Faso + + + Bulgaria + + + Baréin + + + Burundi + + + Benín + + + Brunéi + + + Bolivia + + + Brasil + + + Bahamas + + + Bután + + + Botsuana + + + Bielorrusia + + + Belice + + + Canadá + + + Congo - Kinsasa + + + República Centroafricana + + + Congo - Brazzaville + + + Suiza + + + Costa de Marfil + + + Chile + + + Camerún + + + China + + + Colombia + + + Costa Rica + + + Cuba + + + Cabo Verde + + + Chipre + + + Chequia + + + Alemania + + + Yibuti + + + Dinamarca + + + Dominica + + + República Dominicana + + + Argelia + + + Ecuador + + + Estonia + + + Egipto + + + Eritrea + + + España + + + Etiopía + + + Finlandia + + + Fiyi + + + Micronesia + + + Francia + + + Gabón + + + Reino Unido + + + Granada + + + Georgia + + + Ghana + + + Gambia + + + Guinea + + + Guinea Ecuatorial + + + Grecia + + + Guatemala + + + Guinea-Bisáu + + + Guyana + + + Honduras + + + Croacia + + + Haití + + + Hungría + + + Indonesia + + + Irlanda + + + Israel + + + India + + + Irak + + + Irán + + + Islandia + + + Italia + + + Jamaica + + + Jordania + + + Japón + + + Kenia + + + Kirguistán + + + Camboya + + + Kiribati + + + Comoras + + + San Cristóbal y Nieves + + + Corea del Norte + + + Corea del Sur + + + Kuwait + + + Kazajistán + + + Laos + + + Líbano + + + Santa Lucía + + + Liechtenstein + + + Sri Lanka + + + Liberia + + + Lesoto + + + Lituania + + + Luxemburgo + + + Letonia + + + Libia + + + Marruecos + + + Mónaco + + + Moldavia + + + Montenegro + + + Madagascar + + + Islas Marshall + + + Macedonia del Norte + + + Malí + + + Myanmar (Birmania) + + + Mongolia + + + Mauritania + + + Malta + + + Mauricio + + + Maldivas + + + Malaui + + + México + + + Malasia + + + Mozambique + + + Namibia + + + Níger + + + Nigeria + + + Nicaragua + + + Países Bajos + + + Noruega + + + Nepal + + + Nauru + + + Nueva Zelanda + + + Omán + + + Panamá + + + Perú + + + Papúa Nueva Guinea + + + Filipinas + + + Pakistán + + + Polonia + + + Territorios Palestinos + + + Portugal + + + Palaos + + + Paraguay + + + Catar + + + Rumanía + + + Serbia + + + Rusia + + + Ruanda + + + Arabia Saudí + + + Islas Salomón + + + Seychelles + + + Sudán + + + Suecia + + + Singapur + + + Eslovenia + + + Eslovaquia + + + Sierra Leona + + + San Marino + + + Senegal + + + Somalia + + + Surinam + + + Sudán del Sur + + + Santo Tomé y Príncipe + + + El Salvador + + + Siria + + + Esuatini + + + Chad + + + Togo + + + Tailandia + + + Tayikistán + + + Timor-Leste + + + Turkmenistán + + + Túnez + + + Tonga + + + Turquía + + + Trinidad y Tobago + + + Tuvalu + + + Taiwán + + + Tanzania + + + Ucrania + + + Uganda + + + Estados Unidos + + + Uruguay + + + Uzbekistán + + + Ciudad del Vaticano + + + San Vicente y las Granadinas + + + Venezuela + + + Vietnam + + + Vanuatu + + + Samoa + + + Europa + + + Mundial + + + Yemen + + + Sudáfrica + + + Zambia + + + Zimbabue + + + Género + + + Añadir género + + + Etiqueta + + + Añadir etiqueta + + + Estado de ánimo + + + Añadir estado de ánimo + + + ISRC + + + Añadir ISRC + + + ISWC + + + Añadir ISWC + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.fr-FR.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.fr-FR.resx new file mode 100644 index 00000000..8734fe07 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.fr-FR.resx @@ -0,0 +1,1182 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Retour à l'album + + + Modifier la piste + + + Enregistrer + + + La piste a été enregistrée. + + + L'élément n'a pas pu être enregistré. + + + Supprimer la piste + + + La piste a été supprimée. + + + Voulez-vous vraiment supprimer cet élément ? + + + L'élément n'a pas pu être supprimé. + + + Informations générales + + + Chemin + + + Titre + + + Titre original + + + Numéro de piste + + + Numéro de disque + + + Écriture + + + Tonalité + + + BPM + + + Genres + + + Étiquettes + + + Durée (secondes) + + + Identifiants + + + Id d'enregistrement MusicBrainz + + + Id de piste MusicBrainz + + + Œuvre + + + Titre de l'œuvre + + + Id MusicBrainz de l'œuvre + + + Ambiances + + + ISRCs + + + Do majeur + + + Do# majeur + + + Ré majeur + + + Ré# majeur + + + Mi majeur + + + Fa majeur + + + Fa# majeur + + + Sol majeur + + + Sol# majeur + + + La majeur + + + La# majeur + + + Si majeur + + + Do mineur + + + Do# mineur + + + Ré mineur + + + Ré# mineur + + + Mi mineur + + + Fa mineur + + + Fa# mineur + + + Sol mineur + + + Sol# mineur + + + La mineur + + + La# mineur + + + Si mineur + + + Le chemin du fichier de la piste. + + + Le titre de la piste. + + + Le titre original de la piste, lorsqu'il diffère du titre actuel. + + + La position de la piste sur son disque. + + + Le numéro du disque auquel appartient la piste. + + + L'écriture utilisée par la langue de la piste. + + + La tonalité de la piste. + + + Le tempo de la piste en battements par minute. + + + Les genres de la piste. + + + Les étiquettes de la piste. + + + La durée de la piste en secondes. + + + L'identifiant MusicBrainz de l'enregistrement. + + + L'identifiant MusicBrainz de la piste. + + + Le titre de l'œuvre dont la piste est un enregistrement. + + + L'identifiant MusicBrainz de l'œuvre. + + + Les ambiances de la piste. + + + Les codes ISRC de la piste. + + + Description + + + Un court résumé ou une description de la piste. + + + Désambiguïsation + + + Un commentaire qui distingue la piste des autres ayant le même titre. + + + Enregistrement vidéo + + + Indique si l'enregistrement de la piste est un enregistrement vidéo. + + + Informations sur la sortie + + + Date de sortie originale + + + La date à laquelle la piste est sortie à l'origine. + + + Année de sortie originale + + + L'année à laquelle la piste est sortie à l'origine. + + + Date de ressortie + + + La date à laquelle la piste est ressortie. + + + Année de ressortie + + + L'année à laquelle la piste est ressortie. + + + Pays de sortie + + + Le pays de sortie de la piste. + + + Version de sortie + + + La version de la sortie, comme l'originale. + + + Langue + + + Langue originale + + + Propriétés audio + + + Fréquence d'échantillonnage (Hz) + + + La fréquence d'échantillonnage de l'audio de la piste en Hz. + + + Canaux + + + Le nombre de canaux audio de la piste. + + + Profondeur de bits + + + La profondeur de bits de l'audio de la piste. + + + Codec audio + + + Le codec audio utilisé par la piste. + + + Débit binaire (kbps) + + + Le débit binaire de l'audio de la piste en kbps. + + + AcoustID + + + L'identifiant d'empreinte AcoustID du fichier audio de la piste. + + + ReplayGain + + + Gain de la piste (dB) + + + Le gain de la piste ReplayGain de la piste en décibels. + + + Crête de la piste + + + La crête de la piste ReplayGain de la piste. + + + Gain de l'album (dB) + + + Le gain de l'album ReplayGain de la piste en décibels. + + + Crête de l'album + + + La crête de l'album ReplayGain de la piste. + + + Type d'oeuvre + + + Le type MusicBrainz de l'oeuvre, comme Song. + + + ISWC de l'oeuvre + + + Les codes ISWC de l'œuvre. + + + Langues de l'oeuvre + + + Les langues de l'oeuvre. + + + Code + + + Name + + + Nom natif + + + Ajouter une langue + + + Le code à deux lettres de la langue de la piste. + + + Le nom de la langue de la piste. + + + Le nom natif de la langue de la piste. + + + Code de langue + + + Nom de la langue + + + Nom natif + + + Contributeurs + + + Id du contributeur + + + Rôle + + + Ajouter un contributeur + + + Les personnes ayant contribué à l'artiste. + + + Évaluations + + + Évaluation + + + Évaluation maximale + + + Source + + + Nombre de votes + + + Ajouter une évaluation + + + Les notes de l'artiste provenant de différentes sources. + + + Supprimer + + + Autre + + + Auteur + + + Traducteur + + + Illustrateur + + + Éditeur + + + Narrateur + + + Acteur + + + Réalisateur + + + Scénariste + + + Compositeur + + + Parolier + + + Arrangeur + + + Chef d'orchestre + + + Producteur + + + Producteur exécutif + + + Ingénieur du son + + + Mixeur + + + Remixeur + + + Maison de disques + + + Chant + + + Chœurs + + + Guitare + + + Guitare basse + + + Batterie + + + Percussions + + + Claviers + + + Piano + + + Synthétiseur + + + Cordes + + + Bois + + + Cuivres + + + Chœur + + + Orchestrateur + + + Interprète + + + Utilisateur + + + MusicBrainz + + + Discogs + + + Last.fm + + + Andorre + + + Émirats arabes unis + + + Afghanistan + + + Antigua-et-Barbuda + + + Albanie + + + Arménie + + + Antilles néerlandaises + + + Angola + + + Argentine + + + Autriche + + + Australie + + + Azerbaïdjan + + + Bosnie-Herzégovine + + + Barbade + + + Bangladesh + + + Belgique + + + Burkina Faso + + + Bulgarie + + + Bahreïn + + + Burundi + + + Bénin + + + Brunei + + + Bolivie + + + Brésil + + + Bahamas + + + Bhoutan + + + Botswana + + + Biélorussie + + + Belize + + + Canada + + + Congo-Kinshasa + + + République centrafricaine + + + Congo-Brazzaville + + + Suisse + + + Côte d'Ivoire + + + Chili + + + Cameroun + + + Chine + + + Colombie + + + Costa Rica + + + Cuba + + + Cap-Vert + + + Chypre + + + Tchéquie + + + Allemagne + + + Djibouti + + + Danemark + + + Dominique + + + République dominicaine + + + Algérie + + + Équateur + + + Estonie + + + Égypte + + + Érythrée + + + Espagne + + + Éthiopie + + + Finlande + + + Fidji + + + Micronésie + + + France + + + Gabon + + + Royaume-Uni + + + Grenade + + + Géorgie + + + Ghana + + + Gambie + + + Guinée + + + Guinée équatoriale + + + Grèce + + + Guatemala + + + Guinée-Bissau + + + Guyana + + + Honduras + + + Croatie + + + Haïti + + + Hongrie + + + Indonésie + + + Irlande + + + Israël + + + Inde + + + Irak + + + Iran + + + Islande + + + Italie + + + Jamaïque + + + Jordanie + + + Japon + + + Kenya + + + Kirghizstan + + + Cambodge + + + Kiribati + + + Comores + + + Saint-Christophe-et-Niévès + + + Corée du Nord + + + Corée du Sud + + + Koweït + + + Kazakhstan + + + Laos + + + Liban + + + Sainte-Lucie + + + Liechtenstein + + + Sri Lanka + + + Liberia + + + Lesotho + + + Lituanie + + + Luxembourg + + + Lettonie + + + Libye + + + Maroc + + + Monaco + + + Moldavie + + + Monténégro + + + Madagascar + + + Îles Marshall + + + Macédoine du Nord + + + Mali + + + Myanmar (Birmanie) + + + Mongolie + + + Mauritanie + + + Malte + + + Maurice + + + Maldives + + + Malawi + + + Mexique + + + Malaisie + + + Mozambique + + + Namibie + + + Niger + + + Nigeria + + + Nicaragua + + + Pays-Bas + + + Norvège + + + Népal + + + Nauru + + + Nouvelle-Zélande + + + Oman + + + Panama + + + Pérou + + + Papouasie-Nouvelle-Guinée + + + Philippines + + + Pakistan + + + Pologne + + + Territoires palestiniens + + + Portugal + + + Palaos + + + Paraguay + + + Qatar + + + Roumanie + + + Serbie + + + Russie + + + Rwanda + + + Arabie saoudite + + + Îles Salomon + + + Seychelles + + + Soudan + + + Suède + + + Singapour + + + Slovénie + + + Slovaquie + + + Sierra Leone + + + Saint-Marin + + + Sénégal + + + Somalie + + + Suriname + + + Soudan du Sud + + + Sao Tomé-et-Principe + + + Salvador + + + Syrie + + + Eswatini + + + Tchad + + + Togo + + + Thaïlande + + + Tadjikistan + + + Timor oriental + + + Turkménistan + + + Tunisie + + + Tonga + + + Turquie + + + Trinité-et-Tobago + + + Tuvalu + + + Taïwan + + + Tanzanie + + + Ukraine + + + Ouganda + + + États-Unis + + + Uruguay + + + Ouzbékistan + + + État de la Cité du Vatican + + + Saint-Vincent-et-les Grenadines + + + Venezuela + + + Viêt Nam + + + Vanuatu + + + Samoa + + + Europe + + + Monde + + + Yémen + + + Afrique du Sud + + + Zambie + + + Zimbabwe + + + Genre + + + Ajouter un genre + + + Étiquette + + + Ajouter une étiquette + + + Ambiance + + + Ajouter une ambiance + + + ISRC + + + Ajouter un ISRC + + + ISWC + + + Ajouter un ISWC + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.it-IT.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.it-IT.resx new file mode 100644 index 00000000..b3163394 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.it-IT.resx @@ -0,0 +1,1182 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Torna all'album + + + Modifica traccia + + + Salva + + + La traccia è stata salvata. + + + Non è stato possibile salvare l'elemento. + + + Elimina traccia + + + La traccia è stata eliminata. + + + Sei sicuro di voler eliminare questo elemento? + + + Non è stato possibile eliminare l'elemento. + + + Informazioni generali + + + Percorso + + + Titolo + + + Titolo originale + + + Numero traccia + + + Numero disco + + + Scrittura + + + Tonalità + + + BPM + + + Generi + + + Etichette + + + Durata (secondi) + + + Identificatori + + + Id della registrazione MusicBrainz + + + Id della traccia MusicBrainz + + + Opera + + + Titolo dell'opera + + + Id MusicBrainz dell'opera + + + Umori + + + ISRCs + + + Do maggiore + + + Do# maggiore + + + Re maggiore + + + Re# maggiore + + + Mi maggiore + + + Fa maggiore + + + Fa# maggiore + + + Sol maggiore + + + Sol# maggiore + + + La maggiore + + + La# maggiore + + + Si maggiore + + + Do minore + + + Do# minore + + + Re minore + + + Re# minore + + + Mi minore + + + Fa minore + + + Fa# minore + + + Sol minore + + + Sol# minore + + + La minore + + + La# minore + + + Si minore + + + Il percorso del file della traccia. + + + Il titolo della traccia. + + + Il titolo originale della traccia, quando differisce da quello attuale. + + + La posizione della traccia sul suo disco. + + + Il numero del disco a cui appartiene la traccia. + + + La scrittura usata dalla lingua della traccia. + + + La tonalità della traccia. + + + Il tempo della traccia in battiti al minuto. + + + I generi della traccia. + + + I tag della traccia. + + + La durata della traccia in secondi. + + + L'identificatore MusicBrainz della registrazione. + + + L'identificatore MusicBrainz della traccia. + + + Il titolo dell'opera di cui la traccia è una registrazione. + + + L'identificatore MusicBrainz dell'opera. + + + Gli stati d'animo della traccia. + + + I codici ISRC della traccia. + + + Descrizione + + + Un breve riassunto o una descrizione del brano. + + + Disambiguazione + + + Un commento che distingue il brano da altri con lo stesso titolo. + + + Registrazione video + + + Indica se la registrazione del brano è una registrazione video. + + + Informazioni sulla pubblicazione + + + Data di pubblicazione originale + + + La data in cui il brano è stato originariamente pubblicato. + + + Anno di pubblicazione originale + + + L'anno in cui il brano è stato originariamente pubblicato. + + + Data di ripubblicazione + + + La data in cui il brano è stato pubblicato di nuovo. + + + Anno di ripubblicazione + + + L'anno in cui il brano è stato pubblicato di nuovo. + + + Paese di pubblicazione + + + Il paese di pubblicazione del brano. + + + Versione di pubblicazione + + + La versione della pubblicazione, come quella originale. + + + Lingua + + + Lingua originale + + + Proprietà audio + + + Frequenza di campionamento (Hz) + + + La frequenza di campionamento dell'audio del brano in Hz. + + + Canali + + + Il numero di canali audio del brano. + + + Profondità di bit + + + La profondità di bit dell'audio del brano. + + + Codec audio + + + Il codec audio utilizzato dal brano. + + + Bitrate (kbps) + + + Il bitrate dell'audio del brano in kbps. + + + AcoustID + + + L'identificatore di impronta AcoustID del file audio del brano. + + + ReplayGain + + + Guadagno del brano (dB) + + + Il guadagno del brano ReplayGain del brano in decibel. + + + Picco del brano + + + Il picco del brano ReplayGain del brano. + + + Guadagno dell'album (dB) + + + Il guadagno dell'album ReplayGain del brano in decibel. + + + Picco dell'album + + + Il picco dell'album ReplayGain del brano. + + + Tipo di opera + + + Il tipo MusicBrainz dell'opera, come Song. + + + ISWC dell'opera + + + I codici ISWC dell'opera. + + + Lingue dell'opera + + + Le lingue dell'opera. + + + Code + + + Name + + + Nome nativo + + + Aggiungi lingua + + + Il codice di due lettere della lingua del brano. + + + Il nome della lingua del brano. + + + Il nome nativo della lingua del brano. + + + Codice lingua + + + Nome della lingua + + + Nome nativo + + + Collaboratori + + + Id collaboratore + + + Ruolo + + + Aggiungi collaboratore + + + Le persone che hanno contribuito all'artista. + + + Valutazioni + + + Valutazione + + + Valutazione massima + + + Fonte + + + Numero di voti + + + Aggiungi valutazione + + + Le valutazioni dell'artista da diverse fonti. + + + Rimuovi + + + Altro + + + Autore + + + Traduttore + + + Illustratore + + + Editore + + + Narratore + + + Attore + + + Regista + + + Sceneggiatore + + + Compositore + + + Paroliere + + + Arrangiatore + + + Direttore d'orchestra + + + Produttore + + + Produttore esecutivo + + + Tecnico del suono + + + Mixer + + + Remixer + + + Etichetta discografica + + + Voce + + + Voci di supporto + + + Chitarra + + + Basso + + + Batteria + + + Percussioni + + + Tastiere + + + Pianoforte + + + Sintetizzatore + + + Archi + + + Legni + + + Ottoni + + + Coro + + + Orchestratore + + + Esecutore + + + Utente + + + MusicBrainz + + + Discogs + + + Last.fm + + + Andorra + + + Emirati Arabi Uniti + + + Afghanistan + + + Antigua e Barbuda + + + Albania + + + Armenia + + + Antille Olandesi + + + Angola + + + Argentina + + + Austria + + + Australia + + + Azerbaigian + + + Bosnia ed Erzegovina + + + Barbados + + + Bangladesh + + + Belgio + + + Burkina Faso + + + Bulgaria + + + Bahrein + + + Burundi + + + Benin + + + Brunei + + + Bolivia + + + Brasile + + + Bahamas + + + Bhutan + + + Botswana + + + Bielorussia + + + Belize + + + Canada + + + Congo - Kinshasa + + + Repubblica Centrafricana + + + Congo - Brazzaville + + + Svizzera + + + Costa d'Avorio + + + Cile + + + Camerun + + + Cina + + + Colombia + + + Costa Rica + + + Cuba + + + Capo Verde + + + Cipro + + + Cechia + + + Germania + + + Gibuti + + + Danimarca + + + Dominica + + + Repubblica Dominicana + + + Algeria + + + Ecuador + + + Estonia + + + Egitto + + + Eritrea + + + Spagna + + + Etiopia + + + Finlandia + + + Figi + + + Micronesia + + + Francia + + + Gabon + + + Regno Unito + + + Grenada + + + Georgia + + + Ghana + + + Gambia + + + Guinea + + + Guinea Equatoriale + + + Grecia + + + Guatemala + + + Guinea-Bissau + + + Guyana + + + Honduras + + + Croazia + + + Haiti + + + Ungheria + + + Indonesia + + + Irlanda + + + Israele + + + India + + + Iraq + + + Iran + + + Islanda + + + Italia + + + Giamaica + + + Giordania + + + Giappone + + + Kenya + + + Kirghizistan + + + Cambogia + + + Kiribati + + + Comore + + + Saint Kitts e Nevis + + + Corea del Nord + + + Corea del Sud + + + Kuwait + + + Kazakistan + + + Laos + + + Libano + + + Saint Lucia + + + Liechtenstein + + + Sri Lanka + + + Liberia + + + Lesotho + + + Lituania + + + Lussemburgo + + + Lettonia + + + Libia + + + Marocco + + + Monaco + + + Moldavia + + + Montenegro + + + Madagascar + + + Isole Marshall + + + Macedonia del Nord + + + Mali + + + Myanmar (Birmania) + + + Mongolia + + + Mauritania + + + Malta + + + Mauritius + + + Maldive + + + Malawi + + + Messico + + + Malaysia + + + Mozambico + + + Namibia + + + Niger + + + Nigeria + + + Nicaragua + + + Paesi Bassi + + + Norvegia + + + Nepal + + + Nauru + + + Nuova Zelanda + + + Oman + + + Panama + + + Perù + + + Papua Nuova Guinea + + + Filippine + + + Pakistan + + + Polonia + + + Territori palestinesi + + + Portogallo + + + Palau + + + Paraguay + + + Qatar + + + Romania + + + Serbia + + + Russia + + + Ruanda + + + Arabia Saudita + + + Isole Salomone + + + Seychelles + + + Sudan + + + Svezia + + + Singapore + + + Slovenia + + + Slovacchia + + + Sierra Leone + + + San Marino + + + Senegal + + + Somalia + + + Suriname + + + Sudan del Sud + + + São Tomé e Príncipe + + + El Salvador + + + Siria + + + Eswatini + + + Ciad + + + Togo + + + Thailandia + + + Tagikistan + + + Timor Est + + + Turkmenistan + + + Tunisia + + + Tonga + + + Turchia + + + Trinidad e Tobago + + + Tuvalu + + + Taiwan + + + Tanzania + + + Ucraina + + + Uganda + + + Stati Uniti + + + Uruguay + + + Uzbekistan + + + Città del Vaticano + + + Saint Vincent e Grenadine + + + Venezuela + + + Vietnam + + + Vanuatu + + + Samoa + + + Europa + + + Mondiale + + + Yemen + + + Sudafrica + + + Zambia + + + Zimbabwe + + + Genere + + + Aggiungi genere + + + Etichetta + + + Aggiungi etichetta + + + Umore + + + Aggiungi umore + + + ISRC + + + Aggiungi ISRC + + + ISWC + + + Aggiungi ISWC + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ja-JP.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ja-JP.resx new file mode 100644 index 00000000..9a91da4d --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ja-JP.resx @@ -0,0 +1,1182 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + アルバムに戻る + + + トラックを編集 + + + 保存 + + + トラックを保存しました。 + + + 項目を保存できませんでした。 + + + トラックを削除 + + + トラックを削除しました。 + + + この項目を削除してもよろしいですか? + + + 項目を削除できませんでした。 + + + 一般情報 + + + パス + + + タイトル + + + 原題 + + + トラック番号 + + + ディスク番号 + + + 文字体系 + + + キー + + + BPM + + + ジャンル + + + タグ + + + 長さ(秒) + + + 識別子 + + + MusicBrainz レコーディング Id + + + MusicBrainz トラック Id + + + 作品 + + + 作品タイトル + + + 作品 MusicBrainz Id + + + ムード + + + ISRCs + + + ハ長調 + + + 嬰ハ長調 + + + ニ長調 + + + 嬰ニ長調 + + + ホ長調 + + + ヘ長調 + + + 嬰ヘ長調 + + + ト長調 + + + 嬰ト長調 + + + イ長調 + + + 嬰イ長調 + + + ロ長調 + + + ハ短調 + + + 嬰ハ短調 + + + ニ短調 + + + 嬰ニ短調 + + + ホ短調 + + + ヘ短調 + + + 嬰ヘ短調 + + + ト短調 + + + 嬰ト短調 + + + イ短調 + + + 嬰イ短調 + + + ロ短調 + + + トラックのファイルパス。 + + + トラックのタイトル。 + + + 現在のタイトルと異なる場合のトラックの原題。 + + + ディスク上のトラックの位置。 + + + トラックが属するディスク番号。 + + + トラックの言語で使用される文字体系。 + + + トラックの調。 + + + 1分あたりの拍数で表したトラックのテンポ。 + + + トラックのジャンル。 + + + トラックのタグ。 + + + 秒単位のトラックの長さ。 + + + 録音のMusicBrainz識別子。 + + + トラックのMusicBrainz識別子。 + + + トラックが録音である作品のタイトル。 + + + 作品のMusicBrainz識別子。 + + + トラックのムード。 + + + トラックのISRC。 + + + 説明 + + + トラックの簡単な概要または説明。 + + + 曖昧さ回避 + + + 同じタイトルの他のトラックと区別するためのコメント。 + + + 映像録音 + + + トラックの録音が映像録音かどうか。 + + + リリース情報 + + + 初回リリース日 + + + トラックが最初にリリースされた日付。 + + + 初回リリース年 + + + トラックが最初にリリースされた年。 + + + 再リリース日 + + + トラックが再リリースされた日付。 + + + 再リリース年 + + + トラックが再リリースされた年。 + + + リリース国 + + + トラックのリリース国。 + + + リリースバージョン + + + リリースのバージョン (元のものなど)。 + + + 言語 + + + 原語 + + + オーディオプロパティ + + + サンプルレート (Hz) + + + トラックの音声のサンプルレート (Hz)。 + + + チャンネル + + + トラックのオーディオチャンネル数。 + + + ビット深度 + + + トラックの音声のビット深度。 + + + オーディオコーデック + + + トラックで使用されているオーディオコーデック。 + + + ビットレート (kbps) + + + トラックの音声のビットレート (kbps)。 + + + AcoustID + + + トラックの音声ファイルの AcoustID フィンガープリント識別子。 + + + ReplayGain + + + トラックゲイン (dB) + + + トラックの ReplayGain トラックゲイン (デシベル)。 + + + トラックピーク + + + トラックの ReplayGain トラックピーク。 + + + アルバムゲイン (dB) + + + トラックの ReplayGain アルバムゲイン (デシベル)。 + + + アルバムピーク + + + トラックの ReplayGain アルバムピーク。 + + + 作品タイプ + + + 作品の MusicBrainz タイプ (楽曲など)。 + + + 作品の ISWC + + + 作品のISWC。 + + + 作品の言語 + + + 作品の言語。 + + + コード + + + 名前 + + + ネイティブ名 + + + 言語を追加 + + + トラックの言語の 2 文字コード。 + + + トラックの言語の名前。 + + + トラックの言語のネイティブ名。 + + + 言語コード + + + 言語名 + + + 現地語名 + + + 貢献者 + + + 貢献者 Id + + + 役割 + + + 貢献者を追加 + + + アーティストに貢献した人々。 + + + 評価 + + + 評価 + + + 最大評価 + + + 出典 + + + 投票数 + + + 評価を追加 + + + さまざまな情報源によるアーティストの評価。 + + + 削除 + + + その他 + + + 著者 + + + 翻訳者 + + + イラストレーター + + + 出版社 + + + ナレーター + + + 俳優 + + + 監督 + + + 脚本家 + + + 作曲者 + + + 作詞者 + + + 編曲者 + + + 指揮者 + + + プロデューサー + + + エグゼクティブプロデューサー + + + エンジニア + + + ミキサー + + + リミキサー + + + レコードレーベル + + + ボーカル + + + バッキングボーカル + + + ギター + + + ベースギター + + + ドラム + + + パーカッション + + + キーボード + + + ピアノ + + + シンセサイザー + + + 弦楽器 + + + 木管楽器 + + + 金管楽器 + + + 合唱 + + + 管弦楽編曲者 + + + 演奏者 + + + ユーザー + + + MusicBrainz + + + Discogs + + + Last.fm + + + アンドラ + + + アラブ首長国連邦 + + + アフガニスタン + + + アンティグア・バーブーダ + + + アルバニア + + + アルメニア + + + オランダ領アンティル + + + アンゴラ + + + アルゼンチン + + + オーストリア + + + オーストラリア + + + アゼルバイジャン + + + ボスニア・ヘルツェゴビナ + + + バルバドス + + + バングラデシュ + + + ベルギー + + + ブルキナファソ + + + ブルガリア + + + バーレーン + + + ブルンジ + + + ベナン + + + ブルネイ + + + ボリビア + + + ブラジル + + + バハマ + + + ブータン + + + ボツワナ + + + ベラルーシ + + + ベリーズ + + + カナダ + + + コンゴ民主共和国 + + + 中央アフリカ共和国 + + + コンゴ共和国 + + + スイス + + + コートジボワール + + + チリ + + + カメルーン + + + 中国 + + + コロンビア + + + コスタリカ + + + キューバ + + + カーボベルデ + + + キプロス + + + チェコ + + + ドイツ + + + ジブチ + + + デンマーク + + + ドミニカ国 + + + ドミニカ共和国 + + + アルジェリア + + + エクアドル + + + エストニア + + + エジプト + + + エリトリア + + + スペイン + + + エチオピア + + + フィンランド + + + フィジー + + + ミクロネシア + + + フランス + + + ガボン + + + イギリス + + + グレナダ + + + ジョージア + + + ガーナ + + + ガンビア + + + ギニア + + + 赤道ギニア + + + ギリシャ + + + グアテマラ + + + ギニアビサウ + + + ガイアナ + + + ホンジュラス + + + クロアチア + + + ハイチ + + + ハンガリー + + + インドネシア + + + アイルランド + + + イスラエル + + + インド + + + イラク + + + イラン + + + アイスランド + + + イタリア + + + ジャマイカ + + + ヨルダン + + + 日本 + + + ケニア + + + キルギス + + + カンボジア + + + キリバス + + + コモロ + + + セントクリストファー・ネービス + + + 北朝鮮 + + + 韓国 + + + クウェート + + + カザフスタン + + + ラオス + + + レバノン + + + セントルシア + + + リヒテンシュタイン + + + スリランカ + + + リベリア + + + レソト + + + リトアニア + + + ルクセンブルク + + + ラトビア + + + リビア + + + モロッコ + + + モナコ + + + モルドバ + + + モンテネグロ + + + マダガスカル + + + マーシャル諸島 + + + 北マケドニア + + + マリ + + + ミャンマー + + + モンゴル + + + モーリタニア + + + マルタ + + + モーリシャス + + + モルディブ + + + マラウイ + + + メキシコ + + + マレーシア + + + モザンビーク + + + ナミビア + + + ニジェール + + + ナイジェリア + + + ニカラグア + + + オランダ + + + ノルウェー + + + ネパール + + + ナウル + + + ニュージーランド + + + オマーン + + + パナマ + + + ペルー + + + パプアニューギニア + + + フィリピン + + + パキスタン + + + ポーランド + + + パレスチナ + + + ポルトガル + + + パラオ + + + パラグアイ + + + カタール + + + ルーマニア + + + セルビア + + + ロシア + + + ルワンダ + + + サウジアラビア + + + ソロモン諸島 + + + セーシェル + + + スーダン + + + スウェーデン + + + シンガポール + + + スロベニア + + + スロバキア + + + シエラレオネ + + + サンマリノ + + + セネガル + + + ソマリア + + + スリナム + + + 南スーダン + + + サントメ・プリンシペ + + + エルサルバドル + + + シリア + + + エスワティニ + + + チャド + + + トーゴ + + + タイ + + + タジキスタン + + + 東ティモール + + + トルクメニスタン + + + チュニジア + + + トンガ + + + トルコ + + + トリニダード・トバゴ + + + ツバル + + + 台湾 + + + タンザニア + + + ウクライナ + + + ウガンダ + + + アメリカ合衆国 + + + ウルグアイ + + + ウズベキスタン + + + バチカン市国 + + + セントビンセント・グレナディーン + + + ベネズエラ + + + ベトナム + + + バヌアツ + + + サモア + + + ヨーロッパ + + + 全世界 + + + イエメン + + + 南アフリカ + + + ザンビア + + + ジンバブエ + + + ジャンル + + + ジャンルを追加 + + + タグ + + + タグを追加 + + + 気分 + + + 気分を追加 + + + ISRC + + + ISRC を追加 + + + ISWC + + + ISWC を追加 + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.resx new file mode 100644 index 00000000..252da4a1 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.resx @@ -0,0 +1,1182 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Back to album + + + Edit track + + + Save + + + The track was saved. + + + The item could not be saved. + + + Delete track + + + The track was deleted. + + + Are you sure you want to delete this item? + + + The item could not be deleted. + + + General information + + + Path + + + Title + + + Original title + + + Track number + + + Disc number + + + Script + + + Key + + + BPM + + + Genres + + + Tags + + + Duration (seconds) + + + Identifiers + + + MusicBrainz recording Id + + + MusicBrainz track Id + + + Work + + + Work title + + + Work MusicBrainz Id + + + Moods + + + ISRCs + + + C major + + + C# major + + + D major + + + D# major + + + E major + + + F major + + + F# major + + + G major + + + G# major + + + A major + + + A# major + + + B major + + + C minor + + + C# minor + + + D minor + + + D# minor + + + E minor + + + F minor + + + F# minor + + + G minor + + + G# minor + + + A minor + + + A# minor + + + B minor + + + The file system path of the track. + + + The title of the track. + + + The original title of the track, when it differs from the current one. + + + The position of the track on its disc. + + + The number of the disc the track belongs to. + + + The script used by the language of the track. + + + The musical key of the track. + + + The tempo of the track in beats per minute. + + + The genres of the track. + + + The tags of the track. + + + The duration of the track in seconds. + + + The MusicBrainz identifier of the recording. + + + The MusicBrainz identifier of the track. + + + The title of the work the track is a recording of. + + + The MusicBrainz identifier of the work. + + + The moods of the track. + + + The ISRCs of the track. + + + Description + + + A short summary or description of the track. + + + Disambiguation + + + A comment that distinguishes the track from others with the same title. + + + Video recording + + + Whether the recording of the track is a video recording. + + + Release information + + + Original release date + + + The date when the track was originally released. + + + Original release year + + + The year when the track was originally released. + + + Re-release date + + + The date when the track was released again. + + + Re-release year + + + The year when the track was released again. + + + Release country + + + The country of release of the track. + + + Release version + + + The version of the release, like the original one. + + + Language + + + Original language + + + Audio properties + + + Sample rate (Hz) + + + The sample rate of the audio of the track in Hz. + + + Channels + + + The number of audio channels of the track. + + + Bit depth + + + The bit depth of the audio of the track. + + + Audio codec + + + The audio codec used by the track. + + + Bitrate (kbps) + + + The bitrate of the audio of the track in kbps. + + + AcoustID + + + The AcoustID fingerprint identifier of the audio file of the track. + + + ReplayGain + + + Track gain (dB) + + + The ReplayGain track gain of the track in decibels. + + + Track peak + + + The ReplayGain track peak of the track. + + + Album gain (dB) + + + The ReplayGain album gain of the track in decibels. + + + Album peak + + + The ReplayGain album peak of the track. + + + Work type + + + The MusicBrainz type of the work, like Song. + + + Work ISWCs + + + The ISWCs of the work. + + + Work languages + + + The languages of the work. + + + Code + + + Name + + + Native name + + + Add language + + + The two letter code of the language of the track. + + + The name of the language of the track. + + + The native name of the language of the track. + + + Language code + + + Language name + + + Native name + + + Contributors + + + Contributor Id + + + Role + + + Add contributor + + + The people that contributed to the artist. + + + Ratings + + + Rating + + + Maximum rating + + + Source + + + Vote count + + + Add rating + + + The ratings of the artist from different sources. + + + Remove + + + Other + + + Author + + + Translator + + + Illustrator + + + Publisher + + + Narrator + + + Actor + + + Director + + + Screenwriter + + + Composer + + + Lyricist + + + Arranger + + + Conductor + + + Producer + + + Executive Producer + + + Engineer + + + Mixer + + + Remixer + + + Record Label + + + Vocals + + + Backing Vocals + + + Guitar + + + Bass Guitar + + + Drums + + + Percussion + + + Keyboards + + + Piano + + + Synthesizer + + + Strings + + + Woodwinds + + + Brass + + + Choir + + + Orchestrator + + + Performer + + + User + + + MusicBrainz + + + Discogs + + + Last.fm + + + Andorra + + + United Arab Emirates + + + Afghanistan + + + Antigua & Barbuda + + + Albania + + + Armenia + + + Netherlands Antilles + + + Angola + + + Argentina + + + Austria + + + Australia + + + Azerbaijan + + + Bosnia & Herzegovina + + + Barbados + + + Bangladesh + + + Belgium + + + Burkina Faso + + + Bulgaria + + + Bahrain + + + Burundi + + + Benin + + + Brunei + + + Bolivia + + + Brazil + + + Bahamas + + + Bhutan + + + Botswana + + + Belarus + + + Belize + + + Canada + + + Congo - Kinshasa + + + Central African Republic + + + Congo - Brazzaville + + + Switzerland + + + Côte d’Ivoire + + + Chile + + + Cameroon + + + China + + + Colombia + + + Costa Rica + + + Cuba + + + Cape Verde + + + Cyprus + + + Czechia + + + Germany + + + Djibouti + + + Denmark + + + Dominica + + + Dominican Republic + + + Algeria + + + Ecuador + + + Estonia + + + Egypt + + + Eritrea + + + Spain + + + Ethiopia + + + Finland + + + Fiji + + + Micronesia + + + France + + + Gabon + + + United Kingdom + + + Grenada + + + Georgia + + + Ghana + + + Gambia + + + Guinea + + + Equatorial Guinea + + + Greece + + + Guatemala + + + Guinea-Bissau + + + Guyana + + + Honduras + + + Croatia + + + Haiti + + + Hungary + + + Indonesia + + + Ireland + + + Israel + + + India + + + Iraq + + + Iran + + + Iceland + + + Italy + + + Jamaica + + + Jordan + + + Japan + + + Kenya + + + Kyrgyzstan + + + Cambodia + + + Kiribati + + + Comoros + + + St. Kitts & Nevis + + + North Korea + + + South Korea + + + Kuwait + + + Kazakhstan + + + Laos + + + Lebanon + + + St. Lucia + + + Liechtenstein + + + Sri Lanka + + + Liberia + + + Lesotho + + + Lithuania + + + Luxembourg + + + Latvia + + + Libya + + + Morocco + + + Monaco + + + Moldova + + + Montenegro + + + Madagascar + + + Marshall Islands + + + North Macedonia + + + Mali + + + Myanmar (Burma) + + + Mongolia + + + Mauritania + + + Malta + + + Mauritius + + + Maldives + + + Malawi + + + Mexico + + + Malaysia + + + Mozambique + + + Namibia + + + Niger + + + Nigeria + + + Nicaragua + + + Netherlands + + + Norway + + + Nepal + + + Nauru + + + New Zealand + + + Oman + + + Panama + + + Peru + + + Papua New Guinea + + + Philippines + + + Pakistan + + + Poland + + + Palestinian Territories + + + Portugal + + + Palau + + + Paraguay + + + Qatar + + + Romania + + + Serbia + + + Russia + + + Rwanda + + + Saudi Arabia + + + Solomon Islands + + + Seychelles + + + Sudan + + + Sweden + + + Singapore + + + Slovenia + + + Slovakia + + + Sierra Leone + + + San Marino + + + Senegal + + + Somalia + + + Suriname + + + South Sudan + + + São Tomé & Príncipe + + + El Salvador + + + Syria + + + Eswatini + + + Chad + + + Togo + + + Thailand + + + Tajikistan + + + Timor-Leste + + + Turkmenistan + + + Tunisia + + + Tonga + + + Türkiye + + + Trinidad & Tobago + + + Tuvalu + + + Taiwan + + + Tanzania + + + Ukraine + + + Uganda + + + United States + + + Uruguay + + + Uzbekistan + + + Vatican City + + + St. Vincent & Grenadines + + + Venezuela + + + Vietnam + + + Vanuatu + + + Samoa + + + Europe + + + Worldwide + + + Yemen + + + South Africa + + + Zambia + + + Zimbabwe + + + Genre + + + Add genre + + + Tag + + + Add tag + + + Mood + + + Add mood + + + ISRC + + + Add ISRC + + + ISWC + + + Add ISWC + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ro-RO.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ro-RO.resx new file mode 100644 index 00000000..58f0296d --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.ro-RO.resx @@ -0,0 +1,1182 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Înapoi la album + + + Editează piesa + + + Salvează + + + Piesa a fost salvată. + + + Elementul nu a putut fi salvat. + + + Șterge piesa + + + Piesa a fost ștearsă. + + + Sigur doriți să ștergeți acest element? + + + Elementul nu a putut fi șters. + + + Informații generale + + + Cale + + + Titlu + + + Titlu original + + + Număr piesă + + + Număr disc + + + Scriere + + + Tonalitate + + + BPM + + + Genuri + + + Etichete + + + Durată (secunde) + + + Identificatori + + + Id înregistrare MusicBrainz + + + Id piesă MusicBrainz + + + Operă + + + Titlul operei + + + Id MusicBrainz al operei + + + Stări + + + ISRCs + + + Do major + + + Do# major + + + Re major + + + Re# major + + + Mi major + + + Fa major + + + Fa# major + + + Sol major + + + Sol# major + + + La major + + + La# major + + + Si major + + + Do minor + + + Do# minor + + + Re minor + + + Re# minor + + + Mi minor + + + Fa minor + + + Fa# minor + + + Sol minor + + + Sol# minor + + + La minor + + + La# minor + + + Si minor + + + Calea pe disc a piesei. + + + Titlul piesei. + + + Titlul original al piesei, când diferă de cel actual. + + + Poziția piesei pe discul său. + + + Numărul discului căruia îi aparține piesa. + + + Scrierea folosită de limba piesei. + + + Tonalitatea piesei. + + + Tempo-ul piesei în bătăi pe minut. + + + Genurile piesei. + + + Etichetele piesei. + + + Durata piesei în secunde. + + + Identificatorul MusicBrainz al înregistrării. + + + Identificatorul MusicBrainz al piesei. + + + Titlul operei din care piesa este o înregistrare. + + + Identificatorul MusicBrainz al operei. + + + Stările piesei. + + + Codurile ISRC ale piesei. + + + Descriere + + + Un scurt rezumat sau o descriere a piesei. + + + Dezambiguizare + + + Un comentariu care distinge piesa de alte piese cu același titlu. + + + Înregistrare video + + + Dacă înregistrarea piesei este o înregistrare video. + + + Informații despre lansare + + + Data lansării originale + + + Data la care piesa a fost lansată original. + + + Anul lansării originale + + + Anul în care piesa a fost lansată original. + + + Data relansării + + + Data la care piesa a fost relansată. + + + Anul relansării + + + Anul în care piesa a fost relansată. + + + Țara de lansare + + + Țara de lansare a piesei. + + + Versiunea lansării + + + Versiunea lansării, precum cea originală. + + + Limba + + + Limba originală + + + Proprietăți audio + + + Rata de eșantionare (Hz) + + + Rata de eșantionare a audio-ului piesei în Hz. + + + Canale + + + Numărul de canale audio ale piesei. + + + Adâncimea de biți + + + Adâncimea de biți a audio-ului piesei. + + + Codec audio + + + Codec audio folosit de piesă. + + + Bitrate (kbps) + + + Bitrate-ul audio-ului piesei în kbps. + + + AcoustID + + + Identificatorul amprentei AcoustID al fișierului audio al piesei. + + + ReplayGain + + + Câștigul piesei (dB) + + + Câștigul ReplayGain al piesei în decibeli. + + + Vârful piesei + + + Vârful ReplayGain al piesei. + + + Câștigul albumului (dB) + + + Câștigul ReplayGain al albumului în decibeli. + + + Vârful albumului + + + Vârful ReplayGain al albumului. + + + Tipul operei + + + Tipul MusicBrainz al operei, precum Song. + + + ISWC-urile operei + + + Codurile ISWC ale lucrării. + + + Limbile operei + + + Limbile operei. + + + Code + + + Name + + + Nume nativ + + + Adaugă limbă + + + Codul de două litere al limbii piesei. + + + Numele limbii piesei. + + + Numele nativ al limbii piesei. + + + Codul limbii + + + Denumirea limbii + + + Denumire nativă + + + Contribuitori + + + Id contribuitor + + + Rol + + + Adaugă contributor + + + Persoanele care au contribuit la artist. + + + Ratinguri + + + Rating + + + Rating maxim + + + Sursă + + + Număr de voturi + + + Adaugă rating + + + Evaluările artistului din surse diferite. + + + Elimină + + + Altele + + + Autor + + + Traducător + + + Ilustrator + + + Editor + + + Narator + + + Actor + + + Regizor + + + Scenarist + + + Compozitor + + + Textier + + + Aranjor + + + Dirijor + + + Producător + + + Producător executiv + + + Inginer de sunet + + + Mixer + + + Remixer + + + Casă de discuri + + + Voce + + + Voci de acompaniament + + + Chitară + + + Chitară bas + + + Tobe + + + Percuție + + + Claviaturi + + + Pian + + + Sintetizator + + + Instrumente cu corzi + + + Instrumente de suflat din lemn + + + Instrumente de suflat din alamă + + + Cor + + + Orchestrator + + + Interpret + + + Utilizator + + + MusicBrainz + + + Discogs + + + Last.fm + + + Andorra + + + Emiratele Arabe Unite + + + Afganistan + + + Antigua și Barbuda + + + Albania + + + Armenia + + + Antilele Neerlandeze + + + Angola + + + Argentina + + + Austria + + + Australia + + + Azerbaidjan + + + Bosnia și Herțegovina + + + Barbados + + + Bangladesh + + + Belgia + + + Burkina Faso + + + Bulgaria + + + Bahrain + + + Burundi + + + Benin + + + Brunei + + + Bolivia + + + Brazilia + + + Bahamas + + + Bhutan + + + Botswana + + + Belarus + + + Belize + + + Canada + + + Congo - Kinshasa + + + Republica Centrafricană + + + Congo - Brazzaville + + + Elveția + + + Coasta de Fildeș + + + Chile + + + Camerun + + + China + + + Columbia + + + Costa Rica + + + Cuba + + + Capul Verde + + + Cipru + + + Cehia + + + Germania + + + Djibouti + + + Danemarca + + + Dominica + + + Republica Dominicană + + + Algeria + + + Ecuador + + + Estonia + + + Egipt + + + Eritreea + + + Spania + + + Etiopia + + + Finlanda + + + Fiji + + + Micronezia + + + Franța + + + Gabon + + + Regatul Unit + + + Grenada + + + Georgia + + + Ghana + + + Gambia + + + Guineea + + + Guineea Ecuatorială + + + Grecia + + + Guatemala + + + Guineea-Bissau + + + Guyana + + + Honduras + + + Croația + + + Haiti + + + Ungaria + + + Indonezia + + + Irlanda + + + Israel + + + India + + + Irak + + + Iran + + + Islanda + + + Italia + + + Jamaica + + + Iordania + + + Japonia + + + Kenya + + + Kârgâzstan + + + Cambodgia + + + Kiribati + + + Comore + + + Saint Kitts și Nevis + + + Coreea de Nord + + + Coreea de Sud + + + Kuweit + + + Kazahstan + + + Laos + + + Liban + + + Sfânta Lucia + + + Liechtenstein + + + Sri Lanka + + + Liberia + + + Lesotho + + + Lituania + + + Luxemburg + + + Letonia + + + Libia + + + Maroc + + + Monaco + + + Moldova + + + Muntenegru + + + Madagascar + + + Insulele Marshall + + + Macedonia de Nord + + + Mali + + + Myanmar (Birmania) + + + Mongolia + + + Mauritania + + + Malta + + + Mauritius + + + Maldive + + + Malawi + + + Mexic + + + Malaysia + + + Mozambic + + + Namibia + + + Niger + + + Nigeria + + + Nicaragua + + + Țările de Jos + + + Norvegia + + + Nepal + + + Nauru + + + Noua Zeelandă + + + Oman + + + Panama + + + Peru + + + Papua Noua Guinee + + + Filipine + + + Pakistan + + + Polonia + + + Teritoriile Palestiniene + + + Portugalia + + + Palau + + + Paraguay + + + Qatar + + + România + + + Serbia + + + Rusia + + + Rwanda + + + Arabia Saudită + + + Insulele Solomon + + + Seychelles + + + Sudan + + + Suedia + + + Singapore + + + Slovenia + + + Slovacia + + + Sierra Leone + + + San Marino + + + Senegal + + + Somalia + + + Suriname + + + Sudanul de Sud + + + São Tomé și Príncipe + + + El Salvador + + + Siria + + + Eswatini + + + Ciad + + + Togo + + + Thailanda + + + Tadjikistan + + + Timor-Leste + + + Turkmenistan + + + Tunisia + + + Tonga + + + Turcia + + + Trinidad și Tobago + + + Tuvalu + + + Taiwan + + + Tanzania + + + Ucraina + + + Uganda + + + Statele Unite + + + Uruguay + + + Uzbekistan + + + Vatican + + + Saint Vincent și Grenadine + + + Venezuela + + + Vietnam + + + Vanuatu + + + Samoa + + + Europa + + + La nivel mondial + + + Yemen + + + Africa de Sud + + + Zambia + + + Zimbabwe + + + Gen + + + Adaugă gen + + + Etichetă + + + Adaugă etichetă + + + Stare de spirit + + + Adaugă stare de spirit + + + ISRC + + + Adaugă ISRC + + + ISWC + + + Adaugă ISWC + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.uk-UA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.uk-UA.resx new file mode 100644 index 00000000..e18711ea --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.uk-UA.resx @@ -0,0 +1,1182 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Назад до альбому + + + Редагувати трек + + + Зберегти + + + Трек збережено. + + + Не вдалося зберегти елемент. + + + Видалити трек + + + Трек видалено. + + + Ви впевнені, що хочете видалити цей елемент? + + + Не вдалося видалити елемент. + + + Загальна інформація + + + Шлях + + + Назва + + + Оригінальна назва + + + Номер треку + + + Номер диска + + + Письмо + + + Тональність + + + BPM + + + Жанри + + + Теги + + + Тривалість (секунди) + + + Ідентифікатори + + + Ідентифікатор запису MusicBrainz + + + Ідентифікатор треку MusicBrainz + + + Твір + + + Назва твору + + + Ідентифікатор MusicBrainz твору + + + Настрої + + + ISRCs + + + До мажор + + + До# мажор + + + Ре мажор + + + Ре# мажор + + + Мі мажор + + + Фа мажор + + + Фа# мажор + + + Соль мажор + + + Соль# мажор + + + Ля мажор + + + Ля# мажор + + + Сі мажор + + + До мінор + + + До# мінор + + + Ре мінор + + + Ре# мінор + + + Мі мінор + + + Фа мінор + + + Фа# мінор + + + Соль мінор + + + Соль# мінор + + + Ля мінор + + + Ля# мінор + + + Сі мінор + + + Шлях до файлу треку у файловій системі. + + + Назва треку. + + + Оригінальна назва треку, якщо вона відрізняється від поточної. + + + Позиція треку на диску. + + + Номер диска, до якого належить трек. + + + Система письма, яку використовує мова треку. + + + Музична тональність треку. + + + Темп треку в ударах на хвилину. + + + Жанри треку. + + + Теги треку. + + + Тривалість треку в секундах. + + + Ідентифікатор запису у MusicBrainz. + + + Ідентифікатор треку у MusicBrainz. + + + Назва твору, записом якого є трек. + + + Ідентифікатор твору у MusicBrainz. + + + Настрої треку. + + + Коди ISRC треку. + + + Опис + + + Короткий підсумок або опис треку. + + + Уточнення + + + Коментар, що відрізняє трек від інших із такою самою назвою. + + + Відеозапис + + + Чи є запис треку відеозаписом. + + + Інформація про випуск + + + Дата оригінального випуску + + + Дата, коли трек було вперше випущено. + + + Рік оригінального випуску + + + Рік, коли трек було вперше випущено. + + + Дата повторного випуску + + + Дата, коли трек було випущено знову. + + + Рік повторного випуску + + + Рік, коли трек було випущено знову. + + + Країна випуску + + + Країна випуску треку. + + + Версія випуску + + + Версія випуску, наприклад оригінальна. + + + Мова + + + Оригінальна мова + + + Аудіовластивості + + + Частота дискретизації (Hz) + + + Частота дискретизації аудіо треку в Hz. + + + Канали + + + Кількість аудіоканалів треку. + + + Глибина бітів + + + Глибина бітів аудіо треку. + + + Аудіокодек + + + Аудіокодек, використаний у треку. + + + Бітрейт (kbps) + + + Бітрейт аудіо треку в kbps. + + + AcoustID + + + Ідентифікатор відбитка AcoustID аудіофайлу треку. + + + ReplayGain + + + Підсилення треку (dB) + + + Підсилення треку ReplayGain у децибелах. + + + Пік треку + + + Пік треку ReplayGain. + + + Підсилення альбому (dB) + + + Підсилення альбому ReplayGain у децибелах. + + + Пік альбому + + + Пік альбому ReplayGain. + + + Тип твору + + + Тип твору в MusicBrainz, наприклад Song. + + + ISWC твору + + + Коди ISWC твору. + + + Мови твору + + + Мови твору. + + + Code + + + Name + + + Рідна назва + + + Додати мову + + + Дволітерний код мови треку. + + + Назва мови треку. + + + Рідна назва мови треку. + + + Код мови + + + Назва мови + + + Власна назва + + + Учасники + + + Ідентифікатор учасника + + + Роль + + + Додати учасника + + + Люди, які зробили внесок у виконавця. + + + Оцінки + + + Оцінка + + + Максимальна оцінка + + + Джерело + + + Кількість голосів + + + Додати оцінку + + + Оцінки виконавця з різних джерел. + + + Видалити + + + Інше + + + Автор + + + Перекладач + + + Ілюстратор + + + Видавець + + + Оповідач + + + Актор + + + Режисер + + + Сценарист + + + Композитор + + + Автор текстів + + + Аранжувальник + + + Диригент + + + Продюсер + + + Виконавчий продюсер + + + Інженер + + + Мікшер + + + Реміксер + + + Лейбл звукозапису + + + Вокал + + + Бек-вокал + + + Гітара + + + Бас-гітара + + + Барабани + + + Перкусія + + + Клавішні + + + Піаніно + + + Синтезатор + + + Струнні + + + Дерев'яні духові + + + Мідні духові + + + Хор + + + Оркестратор + + + Виконавець + + + Користувач + + + MusicBrainz + + + Discogs + + + Last.fm + + + Андорра + + + Об'єднані Арабські Емірати + + + Афганістан + + + Антигуа і Барбуда + + + Албанія + + + Вірменія + + + Нідерландські Антильські острови + + + Ангола + + + Аргентина + + + Австрія + + + Австралія + + + Азербайджан + + + Боснія і Герцеговина + + + Барбадос + + + Бангладеш + + + Бельгія + + + Буркіна-Фасо + + + Болгарія + + + Бахрейн + + + Бурунді + + + Бенін + + + Бруней + + + Болівія + + + Бразилія + + + Багамські острови + + + Бутан + + + Ботсвана + + + Білорусь + + + Беліз + + + Канада + + + Конго - Кіншаса + + + Центральноафриканська Республіка + + + Конго - Браззавіль + + + Швейцарія + + + Кот-д'Івуар + + + Чилі + + + Камерун + + + Китай + + + Колумбія + + + Коста-Рика + + + Куба + + + Кабо-Верде + + + Кіпр + + + Чехія + + + Німеччина + + + Джибуті + + + Данія + + + Домініка + + + Домініканська Республіка + + + Алжир + + + Еквадор + + + Естонія + + + Єгипет + + + Еритрея + + + Іспанія + + + Ефіопія + + + Фінляндія + + + Фіджі + + + Мікронезія + + + Франція + + + Габон + + + Велика Британія + + + Гренада + + + Грузія + + + Гана + + + Гамбія + + + Гвінея + + + Екваторіальна Гвінея + + + Греція + + + Гватемала + + + Гвінея-Бісау + + + Гаяна + + + Гондурас + + + Хорватія + + + Гаїті + + + Угорщина + + + Індонезія + + + Ірландія + + + Ізраїль + + + Індія + + + Ірак + + + Іран + + + Ісландія + + + Італія + + + Ямайка + + + Йорданія + + + Японія + + + Кенія + + + Киргизстан + + + Камбоджа + + + Кірибаті + + + Коморські острови + + + Сент-Кітс і Невіс + + + Північна Корея + + + Південна Корея + + + Кувейт + + + Казахстан + + + Лаос + + + Ліван + + + Сент-Люсія + + + Ліхтенштейн + + + Шрі-Ланка + + + Ліберія + + + Лесото + + + Литва + + + Люксембург + + + Латвія + + + Лівія + + + Марокко + + + Монако + + + Молдова + + + Чорногорія + + + Мадагаскар + + + Маршаллові Острови + + + Північна Македонія + + + Малі + + + М'янма (Бірма) + + + Монголія + + + Мавританія + + + Мальта + + + Маврикій + + + Мальдіви + + + Малаві + + + Мексика + + + Малайзія + + + Мозамбік + + + Намібія + + + Нігер + + + Нігерія + + + Нікарагуа + + + Нідерланди + + + Норвегія + + + Непал + + + Науру + + + Нова Зеландія + + + Оман + + + Панама + + + Перу + + + Папуа-Нова Гвінея + + + Філіппіни + + + Пакистан + + + Польща + + + Палестинські території + + + Португалія + + + Палау + + + Парагвай + + + Катар + + + Румунія + + + Сербія + + + Росія + + + Руанда + + + Саудівська Аравія + + + Соломонові Острови + + + Сейшельські Острови + + + Судан + + + Швеція + + + Сінгапур + + + Словенія + + + Словаччина + + + Сьєрра-Леоне + + + Сан-Марино + + + Сенегал + + + Сомалі + + + Суринам + + + Південний Судан + + + Сан-Томе і Принсіпі + + + Сальвадор + + + Сирія + + + Есватіні + + + Чад + + + Того + + + Таїланд + + + Таджикистан + + + Тимор-Лешті + + + Туркменістан + + + Туніс + + + Тонга + + + Туреччина + + + Тринідад і Тобаго + + + Тувалу + + + Тайвань + + + Танзанія + + + Україна + + + Уганда + + + Сполучені Штати Америки + + + Уругвай + + + Узбекистан + + + Ватикан + + + Сент-Вінсент і Гренадини + + + Венесуела + + + В'єтнам + + + Вануату + + + Самоа + + + Європа + + + Увесь світ + + + Ємен + + + Південно-Африканська Республіка + + + Замбія + + + Зімбабве + + + Жанр + + + Додати жанр + + + Тег + + + Додати тег + + + Настрій + + + Додати настрій + + + ISRC + + + Додати ISRC + + + ISWC + + + Додати ISWC + + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.zh-CN.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.zh-CN.resx new file mode 100644 index 00000000..ba893c16 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.zh-CN.resx @@ -0,0 +1,1182 @@ + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 返回专辑 + + + 编辑曲目 + + + 保存 + + + 曲目已保存。 + + + 无法保存该项目。 + + + 删除曲目 + + + 曲目已删除。 + + + 确定要删除此项目吗? + + + 无法删除该项目。 + + + 常规信息 + + + 路径 + + + 标题 + + + 原标题 + + + 曲目编号 + + + 光盘编号 + + + 文字 + + + 调 + + + BPM + + + 体裁 + + + 标签 + + + 时长(秒) + + + 标识符 + + + MusicBrainz 录音 Id + + + MusicBrainz 曲目 Id + + + 作品 + + + 作品标题 + + + 作品 MusicBrainz Id + + + 情绪 + + + ISRCs + + + C 大调 + + + C# 大调 + + + D 大调 + + + D# 大调 + + + E 大调 + + + F 大调 + + + F# 大调 + + + G 大调 + + + G# 大调 + + + A 大调 + + + A# 大调 + + + B 大调 + + + C 小调 + + + C# 小调 + + + D 小调 + + + D# 小调 + + + E 小调 + + + F 小调 + + + F# 小调 + + + G 小调 + + + G# 小调 + + + A 小调 + + + A# 小调 + + + B 小调 + + + 音轨的文件路径。 + + + 音轨的标题。 + + + 与当前标题不同时的音轨原始标题。 + + + 音轨在其唱片上的位置。 + + + 音轨所属的唱片编号。 + + + 音轨语言使用的文字。 + + + 音轨的调。 + + + 音轨的速度,以每分钟节拍数表示。 + + + 音轨的流派。 + + + 音轨的标签。 + + + 音轨的时长(秒)。 + + + 录音的MusicBrainz标识符。 + + + 音轨的MusicBrainz标识符。 + + + 音轨所录制作品的标题。 + + + 作品的MusicBrainz标识符。 + + + 音轨的情绪。 + + + 音轨的 ISRC。 + + + 描述 + + + 曲目的简短摘要或描述。 + + + 消歧义 + + + 用于将曲目与其他同名曲目区分开的注释。 + + + 视频录制 + + + 曲目的录音是否为视频录制。 + + + 发行信息 + + + 原始发行日期 + + + 曲目最初发行的日期。 + + + 原始发行年份 + + + 曲目最初发行的年份。 + + + 重新发行日期 + + + 曲目再次发行的日期。 + + + 重新发行年份 + + + 曲目再次发行的年份。 + + + 发行国家 + + + 曲目的发行国家。 + + + 发行版本 + + + 发行的版本,例如原始版本。 + + + 语言 + + + 原始语言 + + + 音频属性 + + + 采样率 (Hz) + + + 曲目音频的采样率,单位为 Hz。 + + + 声道 + + + 曲目的音频声道数。 + + + 位深度 + + + 曲目音频的位深度。 + + + 音频编解码器 + + + 曲目使用的音频编解码器。 + + + 比特率 (kbps) + + + 曲目音频的比特率,单位为 kbps。 + + + AcoustID + + + 曲目音频文件的 AcoustID 指纹标识符。 + + + ReplayGain + + + 曲目增益 (dB) + + + 曲目的 ReplayGain 曲目增益,单位为分贝。 + + + 曲目峰值 + + + 曲目的 ReplayGain 曲目峰值。 + + + 专辑增益 (dB) + + + 曲目的 ReplayGain 专辑增益,单位为分贝。 + + + 专辑峰值 + + + 曲目的 ReplayGain 专辑峰值。 + + + 作品类型 + + + 作品的 MusicBrainz 类型,例如 Song。 + + + 作品 ISWC + + + 作品的 ISWC。 + + + 作品语言 + + + 作品的语言。 + + + 代码 + + + 名称 + + + 本地名称 + + + 添加语言 + + + 曲目语言的双字母代码。 + + + 曲目语言的名称。 + + + 曲目语言的本地名称。 + + + 语言代码 + + + 语言名称 + + + 本地语名称 + + + 贡献者 + + + 贡献者 Id + + + 角色 + + + 添加贡献者 + + + 为艺术家做出贡献的人员。 + + + 评分 + + + 评分 + + + 最高评分 + + + 来源 + + + 票数 + + + 添加评分 + + + 来自不同来源的艺术家评分。 + + + 删除 + + + 其他 + + + 作者 + + + 译者 + + + 插画师 + + + 出版商 + + + 旁白 + + + 演员 + + + 导演 + + + 编剧 + + + 作曲 + + + 作词 + + + 编曲 + + + 指挥 + + + 制作人 + + + 执行制作人 + + + 工程师 + + + 混音师 + + + 重混师 + + + 唱片公司 + + + 人声 + + + 和声 + + + 吉他 + + + 贝斯 + + + 鼓 + + + 打击乐 + + + 键盘 + + + 钢琴 + + + 合成器 + + + 弦乐 + + + 木管乐 + + + 铜管乐 + + + 合唱 + + + 配器 + + + 表演者 + + + 用户 + + + MusicBrainz + + + Discogs + + + Last.fm + + + 安道尔 + + + 阿拉伯联合酋长国 + + + 阿富汗 + + + 安提瓜和巴布达 + + + 阿尔巴尼亚 + + + 亚美尼亚 + + + 荷属安的列斯 + + + 安哥拉 + + + 阿根廷 + + + 奥地利 + + + 澳大利亚 + + + 阿塞拜疆 + + + 波斯尼亚和黑塞哥维那 + + + 巴巴多斯 + + + 孟加拉国 + + + 比利时 + + + 布基纳法索 + + + 保加利亚 + + + 巴林 + + + 布隆迪 + + + 贝宁 + + + 文莱 + + + 玻利维亚 + + + 巴西 + + + 巴哈马 + + + 不丹 + + + 博茨瓦纳 + + + 白俄罗斯 + + + 伯利兹 + + + 加拿大 + + + 刚果(金沙萨) + + + 中非共和国 + + + 刚果(布拉柴维尔) + + + 瑞士 + + + 科特迪瓦 + + + 智利 + + + 喀麦隆 + + + 中国 + + + 哥伦比亚 + + + 哥斯达黎加 + + + 古巴 + + + 佛得角 + + + 塞浦路斯 + + + 捷克 + + + 德国 + + + 吉布提 + + + 丹麦 + + + 多米尼克 + + + 多米尼加共和国 + + + 阿尔及利亚 + + + 厄瓜多尔 + + + 爱沙尼亚 + + + 埃及 + + + 厄立特里亚 + + + 西班牙 + + + 埃塞俄比亚 + + + 芬兰 + + + 斐济 + + + 密克罗尼西亚 + + + 法国 + + + 加蓬 + + + 英国 + + + 格林纳达 + + + 格鲁吉亚 + + + 加纳 + + + 冈比亚 + + + 几内亚 + + + 赤道几内亚 + + + 希腊 + + + 危地马拉 + + + 几内亚比绍 + + + 圭亚那 + + + 洪都拉斯 + + + 克罗地亚 + + + 海地 + + + 匈牙利 + + + 印度尼西亚 + + + 爱尔兰 + + + 以色列 + + + 印度 + + + 伊拉克 + + + 伊朗 + + + 冰岛 + + + 意大利 + + + 牙买加 + + + 约旦 + + + 日本 + + + 肯尼亚 + + + 吉尔吉斯斯坦 + + + 柬埔寨 + + + 基里巴斯 + + + 科摩罗 + + + 圣基茨和尼维斯 + + + 朝鲜 + + + 韩国 + + + 科威特 + + + 哈萨克斯坦 + + + 老挝 + + + 黎巴嫩 + + + 圣卢西亚 + + + 列支敦士登 + + + 斯里兰卡 + + + 利比里亚 + + + 莱索托 + + + 立陶宛 + + + 卢森堡 + + + 拉脱维亚 + + + 利比亚 + + + 摩洛哥 + + + 摩纳哥 + + + 摩尔多瓦 + + + 黑山 + + + 马达加斯加 + + + 马绍尔群岛 + + + 北马其顿 + + + 马里 + + + 缅甸 + + + 蒙古 + + + 毛里塔尼亚 + + + 马耳他 + + + 毛里求斯 + + + 马尔代夫 + + + 马拉维 + + + 墨西哥 + + + 马来西亚 + + + 莫桑比克 + + + 纳米比亚 + + + 尼日尔 + + + 尼日利亚 + + + 尼加拉瓜 + + + 荷兰 + + + 挪威 + + + 尼泊尔 + + + 瑙鲁 + + + 新西兰 + + + 阿曼 + + + 巴拿马 + + + 秘鲁 + + + 巴布亚新几内亚 + + + 菲律宾 + + + 巴基斯坦 + + + 波兰 + + + 巴勒斯坦领土 + + + 葡萄牙 + + + 帕劳 + + + 巴拉圭 + + + 卡塔尔 + + + 罗马尼亚 + + + 塞尔维亚 + + + 俄罗斯 + + + 卢旺达 + + + 沙特阿拉伯 + + + 所罗门群岛 + + + 塞舌尔 + + + 苏丹 + + + 瑞典 + + + 新加坡 + + + 斯洛文尼亚 + + + 斯洛伐克 + + + 塞拉利昂 + + + 圣马力诺 + + + 塞内加尔 + + + 索马里 + + + 苏里南 + + + 南苏丹 + + + 圣多美和普林西比 + + + 萨尔瓦多 + + + 叙利亚 + + + 斯威士兰 + + + 乍得 + + + 多哥 + + + 泰国 + + + 塔吉克斯坦 + + + 东帝汶 + + + 土库曼斯坦 + + + 突尼斯 + + + 汤加 + + + 土耳其 + + + 特立尼达和多巴哥 + + + 图瓦卢 + + + 台湾 + + + 坦桑尼亚 + + + 乌克兰 + + + 乌干达 + + + 美国 + + + 乌拉圭 + + + 乌兹别克斯坦 + + + 梵蒂冈 + + + 圣文森特和格林纳丁斯 + + + 委内瑞拉 + + + 越南 + + + 瓦努阿图 + + + 萨摩亚 + + + 欧洲 + + + 全球 + + + 也门 + + + 南非 + + + 赞比亚 + + + 津巴布韦 + + + 流派 + + + 添加流派 + + + 标签 + + + 添加标签 + + + 情绪 + + + 添加情绪 + + + ISRC + + + 添加 ISRC + + + ISWC + + + 添加 ISWC + + diff --git a/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.cshtml b/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.cshtml new file mode 100644 index 00000000..731f9935 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Albums/Item.cshtml @@ -0,0 +1,1120 @@ +@* + FALLBACK MUSIC ALBUM DETAILS / EDITING VIEW - READ BEFORE EDITING + + This view is the application fallback of the music album details and editing page, rendered only when the + active theme does not provide its own template for the page. On a healthy site the page is presented by + the theme files, which hook into the class names and element ids that this view uses as a contract. + + The tracks of the album are NOT edited inline: they are listed as cards that navigate to their own pages, + and the update request never changes the tracks. + + To change the behavior of the page, edit this script (and the theme template, when present). To restyle + the page, edit the theme files. This fallback keeps every feature working without styling, so that a + broken theme is obvious to the user while the page still functions. + + /library/audio-library/music-library/artists/{artistId}/albums/{albumId}?libraryId=... +*@ + +@using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary +@using Lumina.Presentation.Web.Common.Enums.AudioLibrary +@using Lumina.Presentation.Web.Common.Enums.Common +@using Lumina.Presentation.Web.Common.Enums.MediaContributors +@using Lumina.Presentation.Web.Common.Services +@using Microsoft.AspNetCore.Mvc.Localization +@using System +@using System.Globalization +@using System.Linq + +@{ + // Generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler. + var scriptId = ScriptIdentifierHelper.GenerateScriptId(); + var artistId = Model.ArtistId.ToString(); + var albumId = Model.Id.ToString(); + var libraryId = Model.LibraryId.ToString(); + var metadata = Model.Metadata; + var releaseInfo = metadata?.ReleaseInfo; + var language = metadata?.Language; + var originalLanguage = metadata?.OriginalLanguage; + var genres = metadata?.Genres ?? []; + var tags = metadata?.Tags ?? []; + var releaseTypes = metadata?.ReleaseTypes ?? []; + var contributors = Model.Contributors ?? []; + var ratings = Model.Ratings ?? []; + // Resolves the localized label of a release country, shown as "DE (Germany)", keyed by its ISO code. + Func releaseCountryLabel = countryCode => + { + if (string.IsNullOrEmpty(countryCode)) + return "-"; + string localizedName = _localizer[$"Country.{countryCode}"].Value; + if (localizedName == $"Country.{countryCode}") + return countryCode; + return $"{countryCode} ({localizedName})"; + }; + var currentReleaseCountry = releaseInfo?.ReleaseCountry?.ToString() ?? string.Empty; + // The localized options of the release types, contributor roles and rating sources, serialized for the dynamic rows of the client script. + var releaseTypeOptionsJson = System.Text.Json.JsonSerializer.Serialize( + Enum.GetNames().Select(type => new { value = type, label = _localizer[type].Value }), + new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase }); + var contributorRoleOptionsJson = System.Text.Json.JsonSerializer.Serialize( + Enum.GetNames().Select(role => new { value = role, label = _localizer[role].Value }), + new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase }); + var ratingSourceOptionsJson = System.Text.Json.JsonSerializer.Serialize( + Enum.GetNames().Select(source => new { value = source, label = _localizer[source].Value }), + new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase }); + // The stored artwork of the album, each with the localized label of its type, serialized for the client carousel script. + var artworkItems = (Model.Artwork ?? []) + .Where(artwork => !string.IsNullOrWhiteSpace(artwork.Path)) + .Select(artwork => new + { + path = artwork.Path, + label = artwork.Ordinal > 0 + ? $"{_localizer[artwork.Type.ToString()].Value} {artwork.Ordinal}" + : _localizer[artwork.Type.ToString()].Value + }) + .ToList(); + var artworkItemsJson = System.Text.Json.JsonSerializer.Serialize(artworkItems); +} + +@inject IViewLocalizer _localizer +@inject IUrlService _urlService + +@model MusicAlbumDto + +@Html.AntiForgeryToken() + +
+
+
+
+
+ +
+
+

@_localizer["EditAlbum"]

+
+
+ +
+ @_localizer[ + +
+ + +
+
+ @(Model.CoverPath ?? _localizer["NoCover"].Value) +
+
+ +
+ +

@_localizer["Tracks"]

+
+ + + + + + + +
+ + @_localizer["TracksDescription"] +
+ +

@_localizer["GeneralInformation"]

+ +
+
*:
+
+ @_localizer["AlbumTitleDescription"] +
+ +
+
:
+
+ @_localizer["AlbumOriginalTitleDescription"] +
+ +
+
:
+
+ @_localizer["AlbumDescriptionDescription"] +
+ +
+
:
+
+ @_localizer["AlbumDisambiguationDescription"] +
+ +
+
:
+
+ @_localizer["AlbumScriptDescription"] +
+ +
+
:
+
+
+
+ + +
+
-
+ @foreach (string status in Enum.GetNames()) + { +
@_localizer[status].Value
+ } +
+
+
+ @_localizer["AlbumReleaseStatusDescription"] +
+ +
+
:
+
+ @_localizer["AlbumTotalDiscsDescription"] +
+ +
+
:
+
+ @_localizer["AlbumTotalTracksDescription"] +
+ +
+
:
+
+ @_localizer["AlbumReleaseTitleDescription"] +
+ +
+
:
+
+
+
+ + +
+
-
+ @foreach (string format in Enum.GetNames()) + { +
@_localizer[format].Value
+ } +
+
+
+ @_localizer["AlbumMediaFormatDescription"] +
+ +
+
:
+
+
+
+ + +
+
-
+ @foreach (string packaging in Enum.GetNames()) + { +
@_localizer[packaging].Value
+ } +
+
+
+ @_localizer["AlbumPackagingDescription"] +
+ + +

@_localizer["Contributors"]

+
+ + + + + + + + + + @{ int contributorIndex = 0; } + @foreach (var contributor in contributors) + { + + + + + + contributorIndex++; + } + +
@_localizer["ContributorId"]@_localizer["ContributorRole"]
+
+
+ + +
+
-
+ @foreach (string role in Enum.GetNames()) + { +
@_localizer[role].Value
+ } +
+
+
@_localizer[
+ + @_localizer["ContributorsDescription"] +
+ + +

@_localizer["Ratings"]

+
+ + + + + + + + + + + + @{ int ratingIndex = 0; } + @foreach (var rating in ratings) + { + + + + + + + + ratingIndex++; + } + +
@_localizer["RatingValue"]@_localizer["RatingMaxValue"]@_localizer["RatingSource"]@_localizer["RatingVoteCount"]
+
+
+ + +
+
-
+ @foreach (string source in Enum.GetNames()) + { +
@_localizer[source].Value
+ } +
+
+
@_localizer[
+ + @_localizer["RatingsDescription"] +
+ + +

@_localizer["AlbumGenres"]

+
+ + + + + + + + + @foreach (var genre in genres) + { + + + + + } + +
@_localizer["Genre"]
@_localizer[
+ + @_localizer["AlbumGenresDescription"] +
+ +

@_localizer["AlbumTags"]

+
+ + + + + + + + + @foreach (var tag in tags) + { + + + + + } + +
@_localizer["Tag"]
@_localizer[
+ + @_localizer["AlbumTagsDescription"] +
+ +

@_localizer["AlbumReleaseTypes"]

+
+ + + + + + + + + @{ int releaseTypeIndex = 0; } + @foreach (var releaseType in releaseTypes) + { + + + + + releaseTypeIndex++; + } + +
@_localizer["ReleaseType"]
+
+
+ + +
+
-
+ @foreach (string releaseTypeOption in Enum.GetNames()) + { +
@_localizer[releaseTypeOption].Value
+ } +
+
+
@_localizer[
+ + @_localizer["AlbumReleaseTypesDescription"] +
+ + +

@_localizer["AlbumReleaseInformation"]

+ +
+
:
+
+ @_localizer["AlbumOriginalReleaseDateDescription"] +
+ +
+
:
+
+ @_localizer["AlbumOriginalReleaseYearDescription"] +
+ +
+
:
+
+ @_localizer["AlbumReReleaseDateDescription"] +
+ +
+
:
+
+ @_localizer["AlbumReReleaseYearDescription"] +
+ +
+
:
+
+
+
+ + +
+
-
+ @foreach (string country in Enum.GetNames()) + { +
@releaseCountryLabel(country)
+ } +
+
+
+ @_localizer["AlbumReleaseCountryDescription"] +
+ +
+
:
+
+ @_localizer["AlbumReleaseVersionDescription"] +
+ + +

@_localizer["AlbumLanguage"]

+ +
+
:
+
+ @_localizer["LanguageCodeDescription"] +
+ +
+
:
+
+ @_localizer["LanguageNameDescription"] +
+ +
+
:
+
+ @_localizer["NativeNameDescription"] +
+ +

@_localizer["AlbumOriginalLanguage"]

+ +
+
:
+
+ @_localizer["LanguageCodeDescription"] +
+ +
+
:
+
+ @_localizer["LanguageNameDescription"] +
+ +
+
:
+
+ @_localizer["NativeNameDescription"] +
+ + +

@_localizer["AlbumCatalogNumbers"]

+
+ + + + + + + + + @foreach (string catalogNumber in Model.CatalogNumbers ?? []) + { + + + + + } + +
@_localizer["CatalogNumber"]
@_localizer[
+ + @_localizer["AlbumCatalogNumbersDescription"] +
+ + +

@_localizer["Identifiers"]

+ +
+
:
+
+ @_localizer["AlbumBarcodeDescription"] +
+ +
+
:
+
+ @_localizer["AlbumLabelDescription"] +
+ +
+
:
+
+ @_localizer["AlbumAsinDescription"] +
+ +
+
:
+
+ @_localizer["AlbumMusicBrainzReleaseIdDescription"] +
+ +
+
:
+
+ @_localizer["AlbumMusicBrainzReleaseGroupIdDescription"] +
+ +
+
:
+
+ @_localizer["AlbumMusicBrainzReleaseArtistIdDescription"] +
+ +
+ + +
+
+
+
+
+ +@section Scripts { + + +} diff --git a/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.cshtml b/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.cshtml new file mode 100644 index 00000000..968984d8 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Index.cshtml @@ -0,0 +1,486 @@ +@* + FALLBACK MUSIC ARTISTS BROWSING VIEW - READ BEFORE EDITING + + This view is the application fallback of the music artists browsing page, rendered only when the theme template + of the page cannot be loaded. On a healthy site the page comes from the theme's + library/audio-library/music-library/artists/index template. It keeps the DOM contract and the client script the + theme template mirrors, so that navigation, searching and the card actions menu keep working even without the theme. + + To restyle the page, edit the theme files. This fallback is intentionally plain, so that a broken theme + is obvious to the user while the page still functions. + +/library/audio-library/music-library/artists?libraryId=... +*@ + +@using Lumina.Presentation.Web.Common.DTO.Libraries +@using Lumina.Presentation.Web.Common.Services +@using Microsoft.AspNetCore.Mvc.Localization + +@{ + // Generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler. + var scriptId = ScriptIdentifierHelper.GenerateScriptId(); +} + +@inject IViewLocalizer _localizer +@inject IUrlService _urlService + +@model LibraryDto + +@Html.AntiForgeryToken() + +
+ +
+ +
+
+ +
+

@(Model.Title ?? string.Empty)

+
+
+ + + + + + + +
+
+ +
+ + + +
+ +
+
+ + +
+
+
+ +@section Scripts { + + +} diff --git a/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.cshtml b/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.cshtml new file mode 100644 index 00000000..10142b94 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Artists/Item.cshtml @@ -0,0 +1,1325 @@ +@* + FALLBACK MUSIC ARTIST DETAILS / EDITING VIEW - READ BEFORE EDITING + + This view is the application fallback of the music artist details and editing page, rendered only when the + active theme does not provide its own template for the page. On a healthy site the page is presented + by the theme files, which hook into the class names and element ids that this view uses as a contract, + exactly like the media library editing page. + + The albums of the artist are NOT edited inline: they are listed as cards that navigate to their own pages, + and the update request only round-trips the albums unchanged, so that updating the artist never drops them. + + To change the behavior of the page, edit this script (and the theme template, when present). To restyle + the page, edit the theme files. This fallback keeps every feature working without styling, so that a + broken theme is obvious to the user while the page still functions. + + /library/audio-library/music-library/artists/{artistId}?libraryId=... +*@ + +@using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary +@using Lumina.Presentation.Web.Common.Enums.AudioLibrary +@using Lumina.Presentation.Web.Common.Enums.Common +@using Lumina.Presentation.Web.Common.Enums.MediaContributors +@using Lumina.Presentation.Web.Common.Services +@using Microsoft.AspNetCore.Mvc.Localization +@using System +@using System.Globalization +@using System.Linq + +@{ + // Generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler. + var scriptId = ScriptIdentifierHelper.GenerateScriptId(); + + var artistId = Model.Id.ToString(); + var libraryId = Model.LibraryId.ToString(); + var metadata = Model.Metadata; + var aliases = metadata?.Aliases ?? []; + var contributors = Model.Contributors ?? []; + var ratings = Model.Ratings ?? []; + var genres = metadata?.Genres ?? []; + var tags = metadata?.Tags ?? []; + var area = metadata?.Area; + var beginArea = metadata?.BeginArea; + var endArea = metadata?.EndArea; + // Resolves the localized label of a release country, shown as "DE (Germany)", keyed by its ISO code. + Func releaseCountryLabel = countryCode => + { + if (string.IsNullOrEmpty(countryCode)) + return "-"; + string localizedName = _localizer[$"Country.{countryCode}"].Value; + if (localizedName == $"Country.{countryCode}") + return countryCode; + return $"{countryCode} ({localizedName})"; + }; + // The baseline of the albums of the artist, mapped to the update request shape, so that the update round-trips them unchanged. + var albumsBaseline = (Model.Albums ?? []).Select(album => new + { + AlbumId = album.Id, + Metadata = album.Metadata, + MediaFormat = album.MediaFormat, + Packaging = album.Packaging, + Barcode = album.Barcode, + CatalogNumbers = album.CatalogNumbers, + Label = album.Label, + ASIN = album.ASIN, + MusicBrainzReleaseId = album.MusicBrainzReleaseId, + MusicBrainzReleaseGroupId = album.MusicBrainzReleaseGroupId, + MusicBrainzReleaseArtistId = album.MusicBrainzReleaseArtistId, + Contributors = album.Contributors, + Ratings = album.Ratings, + Tracks = (album.Tracks ?? []).Select(track => new + { + TrackId = track.Id, + Path = track.Path, + Metadata = track.Metadata, + TrackNumber = track.TrackNumber, + DiscNumber = track.DiscNumber, + Script = track.Script, + Key = track.Key, + Bpm = track.Bpm, + Work = track.Work, + MusicBrainzRecordingId = track.MusicBrainzRecordingId, + MusicBrainzTrackId = track.MusicBrainzTrackId, + Moods = track.Moods, + Isrcs = track.Isrcs, + Contributors = track.Contributors, + Ratings = track.Ratings + }) + }); + var albumsBaselineJson = System.Text.Json.JsonSerializer.Serialize(albumsBaseline, new System.Text.Json.JsonSerializerOptions { Converters = { new System.Text.Json.Serialization.JsonStringEnumConverter() } }); + // The localized options of the contributor roles and rating sources, serialized for the dynamic rows of the client script. + var contributorRoleOptionsJson = System.Text.Json.JsonSerializer.Serialize( + Enum.GetNames().Select(role => new { value = role, label = _localizer[role].Value }), + new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase }); + var ratingSourceOptionsJson = System.Text.Json.JsonSerializer.Serialize( + Enum.GetNames().Select(source => new { value = source, label = _localizer[source].Value }), + new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase }); +} + +@inject IViewLocalizer _localizer +@inject IUrlService _urlService + +@model MusicArtistDto + +@Html.AntiForgeryToken() + +
+ +
+
+
+
+ +
+
+

@_localizer["EditArtist"]

+
+
+ +
+ @_localizer[ +
+ + +
+
+ @(Model.CoverPath ?? _localizer["NoCover"].Value) +
+
+ +
+ +

@_localizer["Releases"]

+ +
+
+ +
+
+ + +

@_localizer["GeneralInformation"]

+ +
+
*:
+
+ @_localizer["NameDescription"] +
+ +
+
:
+
+ @_localizer["SortNameDescription"] +
+ +
+
:
+
+ @_localizer["DisambiguationDescription"] +
+ +
+
:
+
+
+
+ + +
+
-
+ @foreach (string type in Enum.GetNames()) + { +
@_localizer[type].Value
+ } +
+
+
+ @_localizer["TypeDescription"] +
+ +
+
:
+
+
+
+ + +
+
-
+ @foreach (string gender in Enum.GetNames()) + { +
@_localizer[gender].Value
+ } +
+
+
+ @_localizer["GenderDescription"] +
+ +
+
:
+
+ @_localizer["CountryDescription"] +
+ +
+
:
+
+ @_localizer["WebsiteDescription"] +
+ +
+
:
+
+ @_localizer["MusicBrainzArtistIdDescription"] +
+ +
+
:
+
+ @_localizer["LifeSpanBeginDescription"] +
+ +
+
:
+
+ @_localizer["LifeSpanEndDescription"] +
+ +
+
:
+
+ +
+ @_localizer["IsEndedDescription"] +
+ + +

@_localizer["Contributors"]

+ +
+ + + + + + + + + + @{ int contributorIndex = 0; } + @foreach (var contributor in contributors) + { + + + + + + contributorIndex++; + } + +
@_localizer["ContributorId"]@_localizer["ContributorRole"]
+
+
+ + +
+
-
+ @foreach (string role in Enum.GetNames()) + { +
@_localizer[role].Value
+ } +
+
+
@_localizer[
+ + @_localizer["ContributorsDescription"] +
+ + +

@_localizer["Ratings"]

+ +
+ + + + + + + + + + + + @{ int ratingIndex = 0; } + @foreach (var rating in ratings) + { + + + + + + + + ratingIndex++; + } + +
@_localizer["RatingValue"]@_localizer["RatingMaxValue"]@_localizer["RatingSource"]@_localizer["RatingVoteCount"]
+
+
+ + +
+
-
+ @foreach (string source in Enum.GetNames()) + { +
@_localizer[source].Value
+ } +
+
+
@_localizer[
+ + @_localizer["RatingsDescription"] +
+ + +

@_localizer["Genres"]

+ +
+ + + + + + + + + @foreach (var genre in genres) + { + + + + + } + +
@_localizer["Genre"]
@_localizer[
+ + @_localizer["GenresDescription"] +
+ + +

@_localizer["Tags"]

+ +
+ + + + + + + + + @foreach (var tag in tags) + { + + + + + } + +
@_localizer["Tag"]
@_localizer[
+ + @_localizer["TagsDescription"] +
+ + +

@_localizer["Aliases"]

+ +
+ + + + + + + + + + + + + + + + @foreach (var alias in aliases) + { + + + + + + + + + + + + } + +
@_localizer["AliasName"]@_localizer["AliasSortName"]@_localizer["AliasType"]@_localizer["AliasLocale"]@_localizer["AliasIsPrimary"]@_localizer["AliasBeginDate"]@_localizer["AliasEndDate"]@_localizer["AliasIsEnded"]
@_localizer[
+ + @_localizer["AliasesDescription"] +
+ + +

@_localizer["Areas"]

+ +

@_localizer["Area"]

+ +
+
:
+
+ @_localizer["AreaNameDescription"] +
+ +
+
:
+
+ @_localizer["AreaSortNameDescription"] +
+ +
+
:
+
+ @_localizer["AreaDisambiguationDescription"] +
+ +
+
:
+
+ @_localizer["AreaTypeDescription"] +
+ +
+
:
+
+ @_localizer["Iso3166CodeDescription"] +
+ +
+
:
+
+ @_localizer["MusicBrainzAreaIdDescription"] +
+ + +

@_localizer["BeginArea"]

+ +
+
:
+
+ @_localizer["AreaNameDescription"] +
+ +
+
:
+
+ @_localizer["AreaSortNameDescription"] +
+ +
+
:
+
+ @_localizer["AreaDisambiguationDescription"] +
+ +
+
:
+
+ @_localizer["AreaTypeDescription"] +
+ +
+
:
+
+ @_localizer["Iso3166CodeDescription"] +
+ +
+
:
+
+ @_localizer["MusicBrainzAreaIdDescription"] +
+ + +

@_localizer["EndArea"]

+ +
+
:
+
+ @_localizer["AreaNameDescription"] +
+ +
+
:
+
+ @_localizer["AreaSortNameDescription"] +
+ +
+
:
+
+ @_localizer["AreaDisambiguationDescription"] +
+ +
+
:
+
+ @_localizer["AreaTypeDescription"] +
+ +
+
:
+
+ @_localizer["Iso3166CodeDescription"] +
+ +
+
:
+
+ @_localizer["MusicBrainzAreaIdDescription"] +
+ + +

@_localizer["Ipis"]

+ +
+ + + + + + + + + @foreach (string ipi in Model.Ipis ?? []) + { + + + + + } + +
@_localizer["Ipi"]
@_localizer[
+ + @_localizer["IpisDescription"] +
+ + +

@_localizer["Isnis"]

+ +
+ + + + + + + + + @foreach (string isni in Model.Isnis ?? []) + { + + + + + } + +
@_localizer["Isni"]
@_localizer[
+ + @_localizer["IsnisDescription"] +
+ +
+ + +
+
+
+
+
+ +@section Scripts { + + +} diff --git a/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.cshtml b/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.cshtml new file mode 100644 index 00000000..133310d4 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.cshtml @@ -0,0 +1,1059 @@ +@* + FALLBACK MUSIC TRACK DETAILS / EDITING VIEW - READ BEFORE EDITING + + This view is the application fallback of the music track details and editing page, rendered only when the + active theme does not provide its own template for the page. On a healthy site the page is presented by + the theme files, which hook into the class names and element ids that this view uses as a contract, and + which template the same fields rather than change which fields are offered. + + The view exposes every field a track stores, so that editing a track never drops any of its stored data. + The audio properties, the release information, the language and original language, the work, the + contributors, the ratings, the moods and the ISRCs are all editable, and they are all round-tripped on save. + + To change the behavior of the page, edit this script (and the theme template, when present). To restyle + the page, edit the theme files. This fallback keeps every feature working without styling, so that a + broken theme is obvious to the user while the page still functions. + + /library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}?libraryId=... +*@ + +@using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary +@using Lumina.Presentation.Web.Common.DTO.Common +@using Lumina.Presentation.Web.Common.Enums.AudioLibrary +@using Lumina.Presentation.Web.Common.Enums.Common +@using Lumina.Presentation.Web.Common.Enums.MediaContributors +@using Lumina.Presentation.Web.Common.Services +@using Microsoft.AspNetCore.Mvc.Localization +@using System +@using System.Globalization +@using System.Linq + +@{ + // Generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler. + var scriptId = ScriptIdentifierHelper.GenerateScriptId(); + var trackId = Model.Id.ToString(); + var libraryId = Model.LibraryId.ToString(); + // The cover shown on the left is the cover of the album the track belongs to, passed in by the endpoint. + var albumCoverPath = ViewData["AlbumCoverPath"]?.ToString() ?? string.Empty; + // The track DTO does not carry the Id of its artist, so it is taken from the route that rendered the view. + var artistId = Context.Request.RouteValues["artistId"]?.ToString() ?? string.Empty; + var metadata = Model.Metadata; + var work = Model.Work; + var releaseInfo = metadata?.ReleaseInfo; + var language = metadata?.Language; + var originalLanguage = metadata?.OriginalLanguage; + var workLanguages = work?.Languages ?? []; + var genres = metadata?.Genres ?? []; + var tags = metadata?.Tags ?? []; + var moods = Model.Moods ?? []; + var isrcs = Model.Isrcs ?? []; + var contributors = Model.Contributors ?? []; + var ratings = Model.Ratings ?? []; + // Resolves the localized label of a release country, shown as "DE (Germany)", keyed by its ISO code. + Func releaseCountryLabel = countryCode => + { + if (string.IsNullOrEmpty(countryCode)) + return "-"; + string localizedName = _localizer[$"Country.{countryCode}"].Value; + if (localizedName == $"Country.{countryCode}") + return countryCode; + return $"{countryCode} ({localizedName})"; + }; + var currentReleaseCountry = releaseInfo?.ReleaseCountry?.ToString() ?? string.Empty; + // The localized options of the contributor roles and rating sources, serialized for the dynamic rows of the client script. + var contributorRoleOptionsJson = System.Text.Json.JsonSerializer.Serialize( + Enum.GetNames().Select(role => new { value = role, label = _localizer[role].Value }), + new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase }); + var ratingSourceOptionsJson = System.Text.Json.JsonSerializer.Serialize( + Enum.GetNames().Select(source => new { value = source, label = _localizer[source].Value }), + new System.Text.Json.JsonSerializerOptions { PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase }); +} + +@inject IViewLocalizer _localizer +@inject IUrlService _urlService + +@model MusicTrackDto + +@Html.AntiForgeryToken() + +
+
+
+
+
+ +
+
+

@_localizer["EditTrack"]

+
+
+ +
+ @(metadata?.Title ?? string.Empty) +
+ +
+ +

@_localizer["GeneralInformation"]

+ +
+
:
+
+ @_localizer["TrackPathDescription"] +
+ +
+
:
+
+ @_localizer["TrackTitleDescription"] +
+ +
+
:
+
+ @_localizer["TrackOriginalTitleDescription"] +
+ +
+
:
+
+ @_localizer["TrackDescriptionDescription"] +
+ +
+
:
+
+ @_localizer["TrackDisambiguationDescription"] +
+ +
+
:
+
+ @_localizer["TrackNumberDescription"] +
+ +
+
:
+
+ @_localizer["DiscNumberDescription"] +
+ +
+
:
+
+ @_localizer["ScriptDescription"] +
+ +
+
:
+
+
+
+ + +
+
-
+ @foreach (string key in Enum.GetNames()) + { +
@_localizer[key].Value
+ } +
+
+
+ @_localizer["KeyDescription"] +
+ +
+
:
+
+ @_localizer["BpmDescription"] +
+ +
+
:
+
+ +
+ @_localizer["TrackIsVideoDescription"] +
+ +
+
:
+
+ @_localizer["DurationDescription"] +
+ +

@_localizer["Contributors"]

+
+ + + + + + + + + + @{ int contributorIndex = 0; } + @foreach (var contributor in contributors) + { + + + + + + contributorIndex++; + } + +
@_localizer["ContributorId"]@_localizer["ContributorRole"]
+
+
+ + +
+
-
+ @foreach (string role in Enum.GetNames()) + { +
@_localizer[role].Value
+ } +
+
+
@_localizer[
+ + @_localizer["ContributorsDescription"] +
+ + +

@_localizer["Ratings"]

+
+ + + + + + + + + + + + @{ int ratingIndex = 0; } + @foreach (var rating in ratings) + { + + + + + + + + ratingIndex++; + } + +
@_localizer["RatingValue"]@_localizer["RatingMaxValue"]@_localizer["RatingSource"]@_localizer["RatingVoteCount"]
+
+
+ + +
+
-
+ @foreach (string source in Enum.GetNames()) + { +
@_localizer[source].Value
+ } +
+
+
@_localizer[
+ + @_localizer["RatingsDescription"] +
+ + +

@_localizer["Genres"]

+
+ + + + + + + + + @foreach (var genre in genres) + { + + + + + } + +
@_localizer["Genre"]
@_localizer[
+ + @_localizer["GenresDescription"] +
+ +

@_localizer["Tags"]

+
+ + + + + + + + + @foreach (var tag in tags) + { + + + + + } + +
@_localizer["Tag"]
@_localizer[
+ + @_localizer["TagsDescription"] +
+ + +

@_localizer["Moods"]

+
+ + + + + + + + + @foreach (var mood in moods) + { + + + + + } + +
@_localizer["Mood"]
@_localizer[
+ + @_localizer["MoodsDescription"] +
+ +

@_localizer["TrackReleaseInformation"]

+ +
+
:
+
+ @_localizer["TrackOriginalReleaseDateDescription"] +
+ +
+
:
+
+ @_localizer["TrackOriginalReleaseYearDescription"] +
+ +
+
:
+
+ @_localizer["TrackReReleaseDateDescription"] +
+ +
+
:
+
+ @_localizer["TrackReReleaseYearDescription"] +
+ +
+
:
+
+
+
+ + +
+
-
+ @foreach (string country in Enum.GetNames()) + { +
@releaseCountryLabel(country)
+ } +
+
+
+ @_localizer["TrackReleaseCountryDescription"] +
+ +
+
:
+
+ @_localizer["TrackReleaseVersionDescription"] +
+ + +

@_localizer["TrackLanguage"]

+ +
+
:
+
+ @_localizer["LanguageCodeDescription"] +
+ +
+
:
+
+ @_localizer["LanguageNameDescription"] +
+ +
+
:
+
+ @_localizer["NativeNameDescription"] +
+ +

@_localizer["TrackOriginalLanguage"]

+ +
+
:
+
+ @_localizer["LanguageCodeDescription"] +
+ +
+
:
+
+ @_localizer["LanguageNameDescription"] +
+ +
+
:
+
+ @_localizer["NativeNameDescription"] +
+ + +

@_localizer["Work"]

+ +
+
:
+
+ @_localizer["WorkTitleDescription"] +
+ +
+
:
+
+ @_localizer["WorkMusicBrainzIdDescription"] +
+ +
+
:
+
+ @_localizer["TrackWorkTypeDescription"] +
+ +

@_localizer["TrackWorkIswcs"]

+
+ + + + + + + + + @foreach (string workIswc in work?.Iswcs ?? []) + { + + + + + } + +
@_localizer["WorkIswc"]
@_localizer[
+ + @_localizer["TrackWorkIswcsDescription"] +
+ +

@_localizer["TrackWorkLanguages"]

+
+ + + + + + + + + + + @foreach (var workLanguage in workLanguages) + { + + + + + + + } + +
@_localizer["WorkLanguageCode"]@_localizer["WorkLanguageName"]@_localizer["WorkLanguageNativeName"]
@_localizer[
+ + @_localizer["TrackWorkLanguagesDescription"] +
+ + +

@_localizer["Isrcs"]

+
+ + + + + + + + + @foreach (var isrc in isrcs) + { + + + + + } + +
@_localizer["Isrc"]
@_localizer[
+ + @_localizer["IsrcsDescription"] +
+ + +

@_localizer["Identifiers"]

+ +
+
:
+
+ @_localizer["MusicBrainzRecordingIdDescription"] +
+ +
+
:
+
+ @_localizer["MusicBrainzTrackIdDescription"] +
+ + +

@_localizer["TrackAudioProperties"]

+ +
+
:
+
+ @_localizer["TrackSampleRateDescription"] +
+ +
+
:
+
+ @_localizer["TrackChannelsDescription"] +
+ +
+
:
+
+ @_localizer["TrackBitDepthDescription"] +
+ +
+
:
+
+ @_localizer["TrackAudioCodecDescription"] +
+ +
+
:
+
+ @_localizer["TrackBitrateDescription"] +
+ +
+
:
+
+ @_localizer["TrackAcoustIdDescription"] +
+ +

@_localizer["TrackReplayGain"]

+ +
+
:
+
+ @_localizer["TrackReplayGainTrackGainDescription"] +
+ +
+
:
+
+ @_localizer["TrackReplayGainTrackPeakDescription"] +
+ +
+
:
+
+ @_localizer["TrackReplayGainAlbumGainDescription"] +
+ +
+
:
+
+ @_localizer["TrackReplayGainAlbumPeakDescription"] +
+ +
+ + +
+
+
+
+
+ +@section Scripts { + + +} diff --git a/src/Lumina.Presentation.Web/wwwroot/css/site.css b/src/Lumina.Presentation.Web/wwwroot/css/site.css index 57c84741..a0b95d58 100644 --- a/src/Lumina.Presentation.Web/wwwroot/css/site.css +++ b/src/Lumina.Presentation.Web/wwwroot/css/site.css @@ -1188,3 +1188,65 @@ body { .reader-content p { margin: 0 0 1em; } + +/* Music album track list. */ +.tracks-table { + table-layout: fixed; +} + + .tracks-table .track-number-column { + width: 44px; + } + + .tracks-table .track-duration-column { + width: 64px; + } + +.track-name-link { + text-decoration: none; + color: #E6E6E6; +} + +.track-name-link:visited { + color: #9AA7B0; +} + +.track-name-link:hover { + color: #FFFFFF; +} + +/* Music album artwork carousel. */ +.artwork-carousel { + display: flex; + flex-direction: row; + gap: 6px; + width: 100%; + max-width: 300px; + overflow-x: auto; + padding-bottom: 4px; +} + +.artwork-carousel-item { + flex: 0 0 auto; + width: 56px; + height: 56px; + padding: 0; + border: 1px solid #555555; + background-color: #00000033; + cursor: pointer; +} + +.artwork-carousel-item img { + width: 100%; + height: 100%; + object-fit: cover; + display: block; +} + +.artwork-carousel-item.selected { + border-color: #6DCBFE; +} + +.artwork-carousel-item:hover { + border-color: #FFFFFF; +} diff --git a/src/Lumina.Presentation.Web/wwwroot/images/ui/music-placeholder.svg b/src/Lumina.Presentation.Web/wwwroot/images/ui/music-placeholder.svg new file mode 100644 index 00000000..648bf363 --- /dev/null +++ b/src/Lumina.Presentation.Web/wwwroot/images/ui/music-placeholder.svg @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/AudioRatingDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/AudioRatingDtoFixture.cs new file mode 100644 index 00000000..5c067d7b --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/AudioRatingDtoFixture.cs @@ -0,0 +1,60 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class AudioRatingDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The numeric value of the rating. + /// Optional. The maximum possible rating value. + /// Optional. The number of votes the rating is based on. + /// Optional. The source of the audio rating. + /// Whether the value should be included, or forced to . + /// Whether the maximum value should be included, or forced to . + /// Whether the vote count should be included, or forced to . + /// Whether the source should be included, or forced to . + /// A configured instance. + public AudioRatingDto Create( + decimal? value = null, + decimal? maxValue = null, + int? voteCount = null, + AudioRatingSource? source = null, + bool includeValue = true, + bool includeMaxValue = true, + bool includeVoteCount = true, + bool includeSource = true) + { + return new AudioRatingDto + { + Value = includeValue ? (value ?? _faker.Random.Decimal(1, 5)) : null, + MaxValue = includeMaxValue ? (maxValue ?? 5) : null, + VoteCount = includeVoteCount ? (voteCount ?? _faker.Random.Number(1, 1000)) : null, + Source = includeSource ? (source ?? _faker.PickRandom()) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/IsrcDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/IsrcDtoFixture.cs new file mode 100644 index 00000000..c1a88b18 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/IsrcDtoFixture.cs @@ -0,0 +1,44 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class IsrcDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The value of the ISRC. + /// Whether the value should be included, or forced to . + /// A configured instance. + public IsrcDto Create( + string? value = null, + bool includeValue = true) + { + return new IsrcDto + { + Value = includeValue ? (value ?? $"US{_faker.Random.String2(3, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")}{_faker.Random.Number(10000, 99999)}") : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumDtoFixture.cs new file mode 100644 index 00000000..16e437c2 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumDtoFixture.cs @@ -0,0 +1,144 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Common; +using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicAlbumDtoFixture +{ + private readonly Faker _faker = new(); + private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new(); + private readonly MediaArtworkDtoFixture _mediaArtworkDtoFixture = new(); + private readonly MusicTrackDtoFixture _musicTrackDtoFixture = new(); + private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new(); + private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The Id of the album. + /// Optional. The Id of the artist the album belongs to. + /// Optional. The Id of the media library this album belongs to. + /// Optional. The path of the image representing the album. + /// Optional. The stored artwork of the album. + /// Optional. The album metadata of the album. + /// Optional. The physical or digital medium of the album. + /// Optional. The outermost physical packaging of the album. + /// Optional. The barcode of the album. + /// Optional. The catalog numbers of the album. + /// Optional. The name of the label that issued the album. + /// Optional. The ASIN of the album. + /// Optional. The MusicBrainz identifier of the release. + /// Optional. The MusicBrainz identifier of the release group. + /// Optional. The MusicBrainz identifier of the release artist. + /// Optional. The date and time when the album was created. + /// Optional. The date and time when the album was updated. + /// Optional. The references to the media contributors that performed on the album. + /// Optional. The ratings of the album. + /// Optional. The tracks of the album. + /// Whether the cover path should be included, or forced to . + /// Whether the artwork should be included, or forced to . + /// Whether the metadata should be included, or forced to . + /// Whether the media format should be included, or forced to . + /// Whether the packaging should be included, or forced to . + /// Whether the barcode should be included, or forced to . + /// Whether the catalog numbers should be included, or forced to . + /// Whether the label should be included, or forced to . + /// Whether the ASIN should be included, or forced to . + /// Whether the MusicBrainz release Id should be included, or forced to . + /// Whether the MusicBrainz release group Id should be included, or forced to . + /// Whether the MusicBrainz release artist Id should be included, or forced to . + /// Whether the update date should be included, or forced to . + /// Whether the contributors should be included, or forced to . + /// Whether the ratings should be included, or forced to . + /// Whether the tracks should be included, or forced to . + /// A configured instance. + public MusicAlbumDto Create( + Guid? id = null, + Guid? artistId = null, + Guid? libraryId = null, + string? coverPath = null, + List? artwork = null, + MusicAlbumMetadataDto? metadata = null, + MusicMediaFormat? mediaFormat = null, + MusicReleasePackaging? packaging = null, + string? barcode = null, + List? catalogNumbers = null, + string? label = null, + string? asin = null, + Guid? musicBrainzReleaseId = null, + Guid? musicBrainzReleaseGroupId = null, + Guid? musicBrainzReleaseArtistId = null, + DateTime? createdOnUtc = null, + DateTime? updatedOnUtc = null, + List? contributors = null, + List? ratings = null, + List? tracks = null, + bool includeCoverPath = true, + bool includeArtwork = true, + bool includeMetadata = true, + bool includeMediaFormat = true, + bool includePackaging = true, + bool includeBarcode = true, + bool includeCatalogNumbers = true, + bool includeLabel = true, + bool includeAsin = true, + bool includeMusicBrainzReleaseId = true, + bool includeMusicBrainzReleaseGroupId = true, + bool includeMusicBrainzReleaseArtistId = true, + bool includeUpdatedOnUtc = true, + bool includeContributors = true, + bool includeRatings = true, + bool includeTracks = true) + { + return new MusicAlbumDto + { + Id = id ?? _faker.Random.Guid(), + ArtistId = artistId ?? _faker.Random.Guid(), + LibraryId = libraryId ?? _faker.Random.Guid(), + CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null, + Artwork = includeArtwork ? (artwork ?? [.. _mediaArtworkDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Metadata = includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null, + MediaFormat = includeMediaFormat ? (mediaFormat ?? _faker.PickRandom()) : null, + Packaging = includePackaging ? (packaging ?? _faker.PickRandom()) : null, + Barcode = includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null, + CatalogNumbers = includeCatalogNumbers ? (catalogNumbers ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(10))]) : null, + Label = includeLabel ? (label ?? _faker.Company.CompanyName()) : null, + ASIN = includeAsin ? (asin ?? _faker.Random.String2(10)) : null, + MusicBrainzReleaseId = includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null, + MusicBrainzReleaseGroupId = includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null, + MusicBrainzReleaseArtistId = includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null, + CreatedOnUtc = createdOnUtc ?? _faker.Date.Past(), + UpdatedOnUtc = includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent()) : null, + Contributors = includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Ratings = includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Tracks = includeTracks ? (tracks ?? [.. _musicTrackDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumLiteDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumLiteDtoFixture.cs new file mode 100644 index 00000000..ae034435 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumLiteDtoFixture.cs @@ -0,0 +1,65 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicAlbumLiteDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The Id of the album. + /// Optional. The title of the album. + /// Optional. The number of tracks of the release. + /// Optional. The path of the image representing the album. + /// Optional. The release year of the album. + /// Optional. The set of types of the release. + /// Whether the cover path should be included, or forced to . + /// Whether the release year should be included, or forced to . + /// Whether the release types should be included, or forced to . + /// A configured instance. + public MusicAlbumLiteDto Create( + Guid? id = null, + string? title = null, + int? totalTracks = null, + string? coverPath = null, + int? releaseYear = null, + List? releaseTypes = null, + bool includeCoverPath = true, + bool includeReleaseYear = true, + bool includeReleaseTypes = true) + { + return new MusicAlbumLiteDto + { + Id = id ?? _faker.Random.Guid(), + Title = title ?? _faker.Lorem.Sentence(3), + TotalTracks = totalTracks ?? _faker.Random.Number(1, 30), + CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null, + ReleaseYear = includeReleaseYear ? (releaseYear ?? Random.Shared.Next(1900, 2026)) : null, + ReleaseTypes = includeReleaseTypes ? (releaseTypes ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.PickRandom())]) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumMetadataDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumMetadataDtoFixture.cs new file mode 100644 index 00000000..eed39f4e --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAlbumMetadataDtoFixture.cs @@ -0,0 +1,121 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Common; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicAlbumMetadataDtoFixture +{ + private readonly Faker _faker = new(); + private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new(); + private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new(); + private readonly TagDtoFixture _tagDtoFixture = new(); + private readonly GenreDtoFixture _genreDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The title of the album. + /// Optional. The original title of the album. + /// Optional. A brief description of the album. + /// Optional. The disambiguation comment of the album. + /// Optional. The release information of the album. + /// Optional. The language of the album. + /// Optional. The original language of the album. + /// Optional. The tags that describe or categorize the album. + /// Optional. The genres associated with the album. + /// Optional. The script used by the language of the release of the album. + /// Optional. The set of types of the release. + /// Optional. The status of the release. + /// Optional. The number of discs of the release. + /// Optional. The number of tracks of the release. + /// Optional. The title of the specific release the album files match. + /// Whether the title should be included, or forced to . + /// Whether the original title should be included, or forced to . + /// Whether the description should be included, or forced to . + /// Whether the disambiguation should be included, or forced to . + /// Whether the release information should be included, or forced to . + /// Whether the language should be included, or forced to . + /// Whether the original language should be included, or forced to . + /// Whether the tags should be included, or forced to . + /// Whether the genres should be included, or forced to . + /// Whether the script should be included, or forced to . + /// Whether the release types should be included, or forced to . + /// Whether the release status should be included, or forced to . + /// Whether the total number of discs should be included, or forced to . + /// Whether the total number of tracks should be included, or forced to . + /// Whether the release title should be included, or forced to . + /// A configured instance. + public MusicAlbumMetadataDto Create( + string? title = null, + string? originalTitle = null, + string? description = null, + string? disambiguation = null, + ReleaseInfoDto? releaseInfo = null, + LanguageInfoDto? language = null, + LanguageInfoDto? originalLanguage = null, + List? tags = null, + List? genres = null, + string? script = null, + List? releaseTypes = null, + MusicReleaseStatus? releaseStatus = null, + int? totalDiscs = null, + int? totalTracks = null, + string? releaseTitle = null, + bool includeTitle = true, + bool includeOriginalTitle = true, + bool includeDescription = true, + bool includeDisambiguation = true, + bool includeReleaseInfo = true, + bool includeLanguage = true, + bool includeOriginalLanguage = true, + bool includeTags = true, + bool includeGenres = true, + bool includeScript = true, + bool includeReleaseTypes = true, + bool includeReleaseStatus = true, + bool includeTotalDiscs = true, + bool includeTotalTracks = true, + bool includeReleaseTitle = true) + { + return new MusicAlbumMetadataDto + { + Title = includeTitle ? (title ?? _faker.Lorem.Sentence(3)) : null, + OriginalTitle = includeOriginalTitle ? (originalTitle ?? _faker.Lorem.Sentence(3)) : null, + Description = includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null, + Disambiguation = includeDisambiguation ? (disambiguation ?? _faker.Lorem.Word()) : null, + ReleaseInfo = includeReleaseInfo ? (releaseInfo ?? _releaseInfoDtoFixture.Create()) : null, + Language = includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null, + OriginalLanguage = includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null, + Tags = includeTags ? (tags ?? [.. _tagDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Genres = includeGenres ? (genres ?? [.. _genreDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Script = includeScript ? (script ?? _faker.Lorem.Word()) : null, + ReleaseTypes = includeReleaseTypes ? (releaseTypes ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.PickRandom())]) : null, + ReleaseStatus = includeReleaseStatus ? (releaseStatus ?? _faker.PickRandom()) : null, + TotalDiscs = includeTotalDiscs ? (totalDiscs ?? _faker.Random.Number(1, 4)) : null, + TotalTracks = includeTotalTracks ? (totalTracks ?? _faker.Random.Number(1, 30)) : null, + ReleaseTitle = includeReleaseTitle ? (releaseTitle ?? _faker.Lorem.Sentence(3)) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAreaDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAreaDtoFixture.cs new file mode 100644 index 00000000..bfef5e0c --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicAreaDtoFixture.cs @@ -0,0 +1,70 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicAreaDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The MusicBrainz identifier of the area. + /// Optional. The name of the area. + /// Optional. The sort name of the area. + /// Optional. The disambiguation comment of the area. + /// Optional. The MusicBrainz type of the area. + /// Optional. The ISO 3166 code of the area. + /// Whether the MusicBrainz area Id should be included, or forced to . + /// Whether the name should be included, or forced to . + /// Whether the sort name should be included, or forced to . + /// Whether the disambiguation should be included, or forced to . + /// Whether the type should be included, or forced to . + /// Whether the ISO 3166 code should be included, or forced to . + /// A configured instance. + public MusicAreaDto Create( + Guid? musicBrainzAreaId = null, + string? name = null, + string? sortName = null, + string? disambiguation = null, + string? type = null, + string? iso3166Code = null, + bool includeMusicBrainzAreaId = true, + bool includeName = true, + bool includeSortName = true, + bool includeDisambiguation = true, + bool includeType = true, + bool includeIso3166Code = true) + { + return new MusicAreaDto + { + MusicBrainzAreaId = includeMusicBrainzAreaId ? (musicBrainzAreaId ?? _faker.Random.Guid()) : null, + Name = includeName ? (name ?? _faker.Address.Country()) : null, + SortName = includeSortName ? (sortName ?? _faker.Address.Country()) : null, + Disambiguation = includeDisambiguation ? (disambiguation ?? _faker.Lorem.Word()) : null, + Type = includeType ? (type ?? _faker.Lorem.Word()) : null, + Iso3166Code = includeIso3166Code ? (iso3166Code ?? _faker.Address.CountryCode()) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistAliasDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistAliasDtoFixture.cs new file mode 100644 index 00000000..5242f765 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistAliasDtoFixture.cs @@ -0,0 +1,79 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicArtistAliasDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The name of the alias. + /// Optional. The sort name of the alias. + /// Optional. The type of the alias. + /// Optional. The locale the alias is used in. + /// Optional. Whether this is the primary alias of the artist. + /// Optional. The date the alias began being used. + /// Optional. The date the alias stopped being used. + /// Optional. Whether the alias is no longer used. + /// Whether the name should be included, or forced to . + /// Whether the sort name should be included, or forced to . + /// Whether the type should be included, or forced to . + /// Whether the locale should be included, or forced to . + /// Whether the begin date should be included, or forced to . + /// Whether the end date should be included, or forced to . + /// A configured instance. + public MusicArtistAliasDto Create( + string? name = null, + string? sortName = null, + string? type = null, + string? locale = null, + bool isPrimary = false, + DateOnly? beginDate = null, + DateOnly? endDate = null, + bool isEnded = false, + bool includeName = true, + bool includeSortName = true, + bool includeType = true, + bool includeLocale = true, + bool includeBeginDate = true, + bool includeEndDate = true) + { + DateOnly resolvedBeginDate = beginDate ?? DateOnly.FromDateTime(_faker.Date.Past()); + DateOnly resolvedEndDate = endDate ?? DateOnly.FromDateTime(_faker.Date.Future()); + + return new MusicArtistAliasDto + { + Name = includeName ? (name ?? _faker.Name.FullName()) : null, + SortName = includeSortName ? (sortName ?? _faker.Name.LastName()) : null, + Type = includeType ? (type ?? _faker.Lorem.Word()) : null, + Locale = includeLocale ? (locale ?? _faker.Random.String2(2, "abcdefghijklmnopqrstuvwxyz")) : null, + IsPrimary = isPrimary, + BeginDate = includeBeginDate ? resolvedBeginDate : null, + EndDate = includeEndDate ? resolvedEndDate : null, + IsEnded = isEnded + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistDtoFixture.cs new file mode 100644 index 00000000..304e577c --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistDtoFixture.cs @@ -0,0 +1,107 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicArtistDtoFixture +{ + private readonly Faker _faker = new(); + private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new(); + private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new(); + private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new(); + private readonly MusicAlbumDtoFixture _musicAlbumDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The Id of the artist. + /// Optional. The Id of the media library this artist belongs to. + /// Optional. The path of the image representing the artist. + /// Optional. The metadata of the artist. + /// Optional. The website of the artist. + /// Optional. The MusicBrainz identifier of the artist. + /// Optional. The IPI codes of the artist. + /// Optional. The ISNI codes of the artist. + /// Optional. The date and time when the artist was created. + /// Optional. The date and time when the artist was updated. + /// Optional. The references to the media contributors that make up the artist. + /// Optional. The ratings of the artist. + /// Optional. The albums of the artist. + /// Whether the cover path should be included, or forced to . + /// Whether the metadata should be included, or forced to . + /// Whether the website should be included, or forced to . + /// Whether the MusicBrainz artist Id should be included, or forced to . + /// Whether the IPI codes should be included, or forced to . + /// Whether the ISNI codes should be included, or forced to . + /// Whether the update date should be included, or forced to . + /// Whether the contributors should be included, or forced to . + /// Whether the ratings should be included, or forced to . + /// Whether the albums should be included, or forced to . + /// A configured instance. + public MusicArtistDto Create( + Guid? id = null, + Guid? libraryId = null, + string? coverPath = null, + MusicArtistMetadataDto? metadata = null, + string? website = null, + Guid? musicBrainzArtistId = null, + List? ipis = null, + List? isnis = null, + DateTime? createdOnUtc = null, + DateTime? updatedOnUtc = null, + List? contributors = null, + List? ratings = null, + List? albums = null, + bool includeCoverPath = true, + bool includeMetadata = true, + bool includeWebsite = true, + bool includeMusicBrainzArtistId = true, + bool includeIpis = true, + bool includeIsnis = true, + bool includeUpdatedOnUtc = true, + bool includeContributors = true, + bool includeRatings = true, + bool includeAlbums = true) + { + return new MusicArtistDto + { + Id = id ?? _faker.Random.Guid(), + LibraryId = libraryId ?? _faker.Random.Guid(), + CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null, + Metadata = includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null, + Website = includeWebsite ? (website ?? _faker.Internet.Url()) : null, + MusicBrainzArtistId = includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null, + Ipis = includeIpis ? (ipis ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(10, "0123456789"))]) : null, + Isnis = includeIsnis ? (isnis ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(16, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"))]) : null, + CreatedOnUtc = createdOnUtc ?? _faker.Date.Past(), + UpdatedOnUtc = includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent()) : null, + Contributors = includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Ratings = includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Albums = includeAlbums ? (albums ?? [.. _musicAlbumDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistLiteDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistLiteDtoFixture.cs new file mode 100644 index 00000000..37efe704 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistLiteDtoFixture.cs @@ -0,0 +1,51 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicArtistLiteDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The Id of the artist. + /// Optional. The name of the artist. + /// Optional. The path of the image representing the artist. + /// Whether the cover path should be included, or forced to . + /// A configured instance. + public MusicArtistLiteDto Create( + Guid? id = null, + string? name = null, + string? coverPath = null, + bool includeCoverPath = true) + { + return new MusicArtistLiteDto + { + Id = id ?? _faker.Random.Guid(), + Name = name ?? _faker.Name.FullName(), + CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistMetadataDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistMetadataDtoFixture.cs new file mode 100644 index 00000000..69e9b404 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicArtistMetadataDtoFixture.cs @@ -0,0 +1,120 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Common; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicArtistMetadataDtoFixture +{ + private readonly Faker _faker = new(); + private readonly MusicAreaDtoFixture _musicAreaDtoFixture = new(); + private readonly MusicArtistAliasDtoFixture _musicArtistAliasDtoFixture = new(); + private readonly TagDtoFixture _tagDtoFixture = new(); + private readonly GenreDtoFixture _genreDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The name of the artist. + /// Optional. The sort name of the artist. + /// Optional. The disambiguation comment of the artist. + /// Optional. The type of the artist. + /// Optional. The gender of the artist. + /// Optional. The ISO 3166-1 alpha-2 code of the country the artist is associated with. + /// Optional. The area the artist is primarily identified with. + /// Optional. The area the artist began in. + /// Optional. The area the artist ended in. + /// Optional. The date the artist started existing. + /// Optional. The date the artist stopped existing. + /// Optional. Whether the artist no longer exists. + /// Optional. The genres associated with the artist. + /// Optional. The tags that describe or categorize the artist. + /// Optional. The alternative names of the artist. + /// Whether the name should be included, or forced to . + /// Whether the sort name should be included, or forced to . + /// Whether the disambiguation should be included, or forced to . + /// Whether the type should be included, or forced to . + /// Whether the gender should be included, or forced to . + /// Whether the country should be included, or forced to . + /// Whether the area should be included, or forced to . + /// Whether the begin area should be included, or forced to . + /// Whether the end area should be included, or forced to . + /// Whether the life span begin date should be included, or forced to . + /// Whether the life span end date should be included, or forced to . + /// Whether the genres should be included, or forced to . + /// Whether the tags should be included, or forced to . + /// Whether the aliases should be included, or forced to . + /// A configured instance. + public MusicArtistMetadataDto Create( + string? name = null, + string? sortName = null, + string? disambiguation = null, + MusicArtistType? type = null, + MusicArtistGender? gender = null, + string? country = null, + MusicAreaDto? area = null, + MusicAreaDto? beginArea = null, + MusicAreaDto? endArea = null, + DateOnly? lifeSpanBegin = null, + DateOnly? lifeSpanEnd = null, + bool isEnded = false, + List? genres = null, + List? tags = null, + List? aliases = null, + bool includeName = true, + bool includeSortName = true, + bool includeDisambiguation = true, + bool includeType = true, + bool includeGender = true, + bool includeCountry = true, + bool includeArea = true, + bool includeBeginArea = true, + bool includeEndArea = true, + bool includeLifeSpanBegin = true, + bool includeLifeSpanEnd = true, + bool includeGenres = true, + bool includeTags = true, + bool includeAliases = true) + { + return new MusicArtistMetadataDto + { + Name = includeName ? (name ?? _faker.Name.FullName()) : null, + SortName = includeSortName ? (sortName ?? _faker.Name.LastName()) : null, + Disambiguation = includeDisambiguation ? (disambiguation ?? _faker.Lorem.Word()) : null, + Type = includeType ? (type ?? _faker.PickRandom()) : null, + Gender = includeGender ? (gender ?? _faker.PickRandom()) : null, + Country = includeCountry ? (country ?? _faker.Address.CountryCode()) : null, + Area = includeArea ? (area ?? _musicAreaDtoFixture.Create()) : null, + BeginArea = includeBeginArea ? (beginArea ?? _musicAreaDtoFixture.Create()) : null, + EndArea = includeEndArea ? (endArea ?? _musicAreaDtoFixture.Create()) : null, + LifeSpanBegin = includeLifeSpanBegin ? (lifeSpanBegin ?? DateOnly.FromDateTime(_faker.Date.Past())) : null, + LifeSpanEnd = includeLifeSpanEnd ? (lifeSpanEnd ?? DateOnly.FromDateTime(_faker.Date.Past())) : null, + IsEnded = isEnded, + Genres = includeGenres ? (genres ?? [.. _genreDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Tags = includeTags ? (tags ?? [.. _tagDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Aliases = includeAliases ? (aliases ?? [.. _musicArtistAliasDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackDtoFixture.cs new file mode 100644 index 00000000..899652d8 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackDtoFixture.cs @@ -0,0 +1,136 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Common; +using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicTrackDtoFixture +{ + private readonly Faker _faker = new(); + private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new(); + private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new(); + private readonly MoodDtoFixture _moodDtoFixture = new(); + private readonly IsrcDtoFixture _isrcDtoFixture = new(); + private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new(); + private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The Id of the track. + /// Optional. The Id of the album the track belongs to. + /// Optional. The Id of the media library this track belongs to. + /// Optional. The file system path of the track. + /// Optional. The audio metadata of the track. + /// Optional. The number of the track on its disc. + /// Optional. The number of the disc the track belongs to. + /// Optional. The script used by the language of the track. + /// Optional. The musical key of the track. + /// Optional. The tempo of the track in beats per minute. + /// Optional. The work the track is a recording of. + /// Optional. The MusicBrainz identifier of the recording. + /// Optional. The MusicBrainz identifier of the track. + /// Optional. The date and time when the track was created. + /// Optional. The date and time when the track was updated. + /// Optional. The moods of the track. + /// Optional. The ISRC codes of the track. + /// Optional. The references to the media contributors that performed on the track. + /// Optional. The ratings of the track. + /// Whether the metadata should be included, or forced to . + /// Whether the disc number should be included, or forced to . + /// Whether the script should be included, or forced to . + /// Whether the musical key should be included, or forced to . + /// Whether the tempo should be included, or forced to . + /// Whether the work should be included, or forced to . + /// Whether the MusicBrainz recording Id should be included, or forced to . + /// Whether the MusicBrainz track Id should be included, or forced to . + /// Whether the update date should be included, or forced to . + /// Whether the moods should be included, or forced to . + /// Whether the ISRC codes should be included, or forced to . + /// Whether the contributors should be included, or forced to . + /// Whether the ratings should be included, or forced to . + /// A configured instance. + public MusicTrackDto Create( + Guid? id = null, + Guid? albumId = null, + Guid? libraryId = null, + string? path = null, + MusicTrackMetadataDto? metadata = null, + int? trackNumber = null, + int? discNumber = null, + string? script = null, + MusicKey? key = null, + int? bpm = null, + MusicWorkDto? work = null, + Guid? musicBrainzRecordingId = null, + Guid? musicBrainzTrackId = null, + DateTime? createdOnUtc = null, + DateTime? updatedOnUtc = null, + List? moods = null, + List? isrcs = null, + List? contributors = null, + List? ratings = null, + bool includeMetadata = true, + bool includeDiscNumber = true, + bool includeScript = true, + bool includeKey = true, + bool includeBpm = true, + bool includeWork = true, + bool includeMusicBrainzRecordingId = true, + bool includeMusicBrainzTrackId = true, + bool includeUpdatedOnUtc = true, + bool includeMoods = true, + bool includeIsrcs = true, + bool includeContributors = true, + bool includeRatings = true) + { + return new MusicTrackDto + { + Id = id ?? _faker.Random.Guid(), + AlbumId = albumId ?? _faker.Random.Guid(), + LibraryId = libraryId ?? _faker.Random.Guid(), + Path = path ?? _faker.System.FilePath(), + Metadata = includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null, + TrackNumber = trackNumber ?? _faker.Random.Number(1, 30), + DiscNumber = includeDiscNumber ? (discNumber ?? _faker.Random.Number(1, 3)) : null, + Script = includeScript ? (script ?? _faker.Lorem.Word()) : null, + Key = includeKey ? (key ?? _faker.PickRandom()) : null, + Bpm = includeBpm ? (bpm ?? _faker.Random.Number(60, 200)) : null, + Work = includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null, + MusicBrainzRecordingId = includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null, + MusicBrainzTrackId = includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null, + CreatedOnUtc = createdOnUtc ?? _faker.Date.Past(), + UpdatedOnUtc = includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent()) : null, + Moods = includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Isrcs = includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Contributors = includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Ratings = includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackLiteDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackLiteDtoFixture.cs new file mode 100644 index 00000000..102db5f3 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackLiteDtoFixture.cs @@ -0,0 +1,57 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicTrackLiteDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The Id of the track. + /// Optional. The title of the track. + /// Optional. The number of the track on its disc. + /// Optional. The number of the disc the track belongs to. + /// Optional. The duration of the track in seconds. + /// Whether the disc number should be included, or forced to . + /// A configured instance. + public MusicTrackLiteDto Create( + Guid? id = null, + string? title = null, + int? trackNumber = null, + int? discNumber = null, + int? durationInSeconds = null, + bool includeDiscNumber = true) + { + return new MusicTrackLiteDto + { + Id = id ?? _faker.Random.Guid(), + Title = title ?? _faker.Lorem.Sentence(3), + TrackNumber = trackNumber ?? _faker.Random.Number(1, 30), + DiscNumber = includeDiscNumber ? (discNumber ?? _faker.Random.Number(1, 3)) : null, + DurationInSeconds = durationInSeconds ?? _faker.Random.Number(30, 600) + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackMetadataDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackMetadataDtoFixture.cs new file mode 100644 index 00000000..cf5227b9 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicTrackMetadataDtoFixture.cs @@ -0,0 +1,148 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Common; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicTrackMetadataDtoFixture +{ + private readonly Faker _faker = new(); + private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new(); + private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new(); + private readonly TagDtoFixture _tagDtoFixture = new(); + private readonly GenreDtoFixture _genreDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The title of the track. + /// Optional. The original title of the track. + /// Optional. A brief description of the track. + /// Optional. The disambiguation comment of the track. + /// Optional. The release information of the track. + /// Optional. The language of the track. + /// Optional. The original language of the track. + /// Optional. The tags that describe or categorize the track. + /// Optional. The genres associated with the track. + /// Optional. Whether the recording of the track is a video recording. + /// Optional. The duration of the audio of the track in seconds. + /// Optional. The sample rate of the audio of the track in Hz. + /// Optional. The number of audio channels of the track. + /// Optional. The bit depth of the audio of the track. + /// Optional. The audio codec used by the track. + /// Optional. The bitrate of the audio of the track in kbps. + /// Optional. The AcoustID fingerprint identifier of the audio file of the track. + /// Optional. The ReplayGain track gain of the track in decibels. + /// Optional. The ReplayGain track peak of the track. + /// Optional. The ReplayGain album gain of the track in decibels. + /// Optional. The ReplayGain album peak of the track. + /// Whether the title should be included, or forced to . + /// Whether the original title should be included, or forced to . + /// Whether the description should be included, or forced to . + /// Whether the disambiguation should be included, or forced to . + /// Whether the release information should be included, or forced to . + /// Whether the language should be included, or forced to . + /// Whether the original language should be included, or forced to . + /// Whether the tags should be included, or forced to . + /// Whether the genres should be included, or forced to . + /// Whether the duration should be included, or forced to . + /// Whether the sample rate should be included, or forced to . + /// Whether the channels should be included, or forced to . + /// Whether the bit depth should be included, or forced to . + /// Whether the audio codec should be included, or forced to . + /// Whether the bitrate should be included, or forced to . + /// Whether the AcoustID should be included, or forced to . + /// Whether the ReplayGain track gain should be included, or forced to . + /// Whether the ReplayGain track peak should be included, or forced to . + /// Whether the ReplayGain album gain should be included, or forced to . + /// Whether the ReplayGain album peak should be included, or forced to . + /// A configured instance. + public MusicTrackMetadataDto Create( + string? title = null, + string? originalTitle = null, + string? description = null, + string? disambiguation = null, + ReleaseInfoDto? releaseInfo = null, + LanguageInfoDto? language = null, + LanguageInfoDto? originalLanguage = null, + List? tags = null, + List? genres = null, + bool isVideo = false, + int? durationInSeconds = null, + int? sampleRate = null, + int? channels = null, + int? bitDepth = null, + string? audioCodec = null, + int? bitrate = null, + string? acoustId = null, + decimal? replayGainTrackGain = null, + decimal? replayGainTrackPeak = null, + decimal? replayGainAlbumGain = null, + decimal? replayGainAlbumPeak = null, + bool includeTitle = true, + bool includeOriginalTitle = true, + bool includeDescription = true, + bool includeDisambiguation = true, + bool includeReleaseInfo = true, + bool includeLanguage = true, + bool includeOriginalLanguage = true, + bool includeTags = true, + bool includeGenres = true, + bool includeDurationInSeconds = true, + bool includeSampleRate = true, + bool includeChannels = true, + bool includeBitDepth = true, + bool includeAudioCodec = true, + bool includeBitrate = true, + bool includeAcoustId = true, + bool includeReplayGainTrackGain = true, + bool includeReplayGainTrackPeak = true, + bool includeReplayGainAlbumGain = true, + bool includeReplayGainAlbumPeak = true) + { + return new MusicTrackMetadataDto + { + Title = includeTitle ? (title ?? _faker.Lorem.Sentence(3)) : null, + OriginalTitle = includeOriginalTitle ? (originalTitle ?? _faker.Lorem.Sentence(3)) : null, + Description = includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null, + Disambiguation = includeDisambiguation ? (disambiguation ?? _faker.Lorem.Word()) : null, + ReleaseInfo = includeReleaseInfo ? (releaseInfo ?? _releaseInfoDtoFixture.Create()) : null, + Language = includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null, + OriginalLanguage = includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null, + Tags = includeTags ? (tags ?? [.. _tagDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Genres = includeGenres ? (genres ?? [.. _genreDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + IsVideo = isVideo, + DurationInSeconds = includeDurationInSeconds ? (durationInSeconds ?? _faker.Random.Number(30, 600)) : null, + SampleRate = includeSampleRate ? (sampleRate ?? _faker.Random.Number(22050, 192000)) : null, + Channels = includeChannels ? (channels ?? _faker.Random.Number(1, 8)) : null, + BitDepth = includeBitDepth ? (bitDepth ?? _faker.Random.Number(8, 32)) : null, + AudioCodec = includeAudioCodec ? (audioCodec ?? _faker.Lorem.Word()) : null, + Bitrate = includeBitrate ? (bitrate ?? _faker.Random.Number(64, 1411)) : null, + AcoustId = includeAcoustId ? (acoustId ?? _faker.Random.String2(32, "0123456789abcdef")) : null, + ReplayGainTrackGain = includeReplayGainTrackGain ? (replayGainTrackGain ?? _faker.Random.Decimal(-20m, 0m)) : null, + ReplayGainTrackPeak = includeReplayGainTrackPeak ? (replayGainTrackPeak ?? _faker.Random.Decimal(0m, 1m)) : null, + ReplayGainAlbumGain = includeReplayGainAlbumGain ? (replayGainAlbumGain ?? _faker.Random.Decimal(-20m, 0m)) : null, + ReplayGainAlbumPeak = includeReplayGainAlbumPeak ? (replayGainAlbumPeak ?? _faker.Random.Decimal(0m, 1m)) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicWorkDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicWorkDtoFixture.cs new file mode 100644 index 00000000..e9ac977b --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/MusicWorkDtoFixture.cs @@ -0,0 +1,68 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Common; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicWorkDtoFixture +{ + private readonly Faker _faker = new(); + private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The MusicBrainz identifier of the work. + /// Optional. The title of the work. + /// Optional. The MusicBrainz type of the work. + /// Optional. The languages of the work. + /// Optional. The ISWC codes of the work. + /// Whether the MusicBrainz work Id should be included, or forced to . + /// Whether the title should be included, or forced to . + /// Whether the type should be included, or forced to . + /// Whether the languages should be included, or forced to . + /// Whether the ISWC codes should be included, or forced to . + /// A configured instance. + public MusicWorkDto Create( + Guid? musicBrainzWorkId = null, + string? title = null, + string? type = null, + List? languages = null, + List? iswcs = null, + bool includeMusicBrainzWorkId = true, + bool includeTitle = true, + bool includeType = true, + bool includeLanguages = true, + bool includeIswcs = true) + { + return new MusicWorkDto + { + MusicBrainzWorkId = includeMusicBrainzWorkId ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null, + Title = includeTitle ? (title ?? _faker.Lorem.Sentence(3)) : null, + Type = includeType ? (type ?? _faker.Lorem.Word()) : null, + Languages = includeLanguages ? (languages ?? [.. _languageInfoDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Iswcs = includeIswcs ? (iswcs ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => $"T{_faker.Random.Number(100000000, 999999999)}")]) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicAlbumLiteDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicAlbumLiteDtoFixture.cs new file mode 100644 index 00000000..a3d75dc1 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicAlbumLiteDtoFixture.cs @@ -0,0 +1,55 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class PaginatedMusicAlbumLiteDtoFixture +{ + private readonly Faker _faker = new(); + private readonly MusicAlbumLiteDtoFixture _musicAlbumLiteDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The collection of lightweight album elements. + /// Optional. The current page number in the paginated collection. + /// Optional. The number of items to include per page. + /// Optional. The total number of elements available in the result set. + /// Optional. The total number of pages available. + /// A configured instance. + public PaginatedMusicAlbumLiteDto Create( + IReadOnlyList? data = null, + int? currentPage = null, + int? perPage = null, + int? count = null, + int? numberOfPages = null) + { + return new PaginatedMusicAlbumLiteDto + { + Data = data ?? [.. _musicAlbumLiteDtoFixture.CreateMany(_faker.Random.Number(1, 3))], + CurrentPage = currentPage ?? _faker.Random.Int(1, 10), + PerPage = perPage ?? _faker.Random.Int(1, 100), + Count = count ?? _faker.Random.Int(0, 1000), + NumberOfPages = numberOfPages ?? _faker.Random.Int(1, 100) + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicArtistLiteDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicArtistLiteDtoFixture.cs new file mode 100644 index 00000000..dea5fd9e --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicArtistLiteDtoFixture.cs @@ -0,0 +1,55 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class PaginatedMusicArtistLiteDtoFixture +{ + private readonly Faker _faker = new(); + private readonly MusicArtistLiteDtoFixture _musicArtistLiteDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The collection of lightweight artist elements. + /// Optional. The current page number in the paginated collection. + /// Optional. The number of items to include per page. + /// Optional. The total number of elements available in the result set. + /// Optional. The total number of pages available. + /// A configured instance. + public PaginatedMusicArtistLiteDto Create( + IReadOnlyList? data = null, + int? currentPage = null, + int? perPage = null, + int? count = null, + int? numberOfPages = null) + { + return new PaginatedMusicArtistLiteDto + { + Data = data ?? [.. _musicArtistLiteDtoFixture.CreateMany(_faker.Random.Number(1, 3))], + CurrentPage = currentPage ?? _faker.Random.Int(1, 10), + PerPage = perPage ?? _faker.Random.Int(1, 100), + Count = count ?? _faker.Random.Int(0, 1000), + NumberOfPages = numberOfPages ?? _faker.Random.Int(1, 100) + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicTrackLiteDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicTrackLiteDtoFixture.cs new file mode 100644 index 00000000..c034f61c --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/PaginatedMusicTrackLiteDtoFixture.cs @@ -0,0 +1,55 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class PaginatedMusicTrackLiteDtoFixture +{ + private readonly Faker _faker = new(); + private readonly MusicTrackLiteDtoFixture _musicTrackLiteDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The collection of lightweight track elements. + /// Optional. The current page number in the paginated collection. + /// Optional. The number of items to include per page. + /// Optional. The total number of elements available in the result set. + /// Optional. The total number of pages available. + /// A configured instance. + public PaginatedMusicTrackLiteDto Create( + IReadOnlyList? data = null, + int? currentPage = null, + int? perPage = null, + int? count = null, + int? numberOfPages = null) + { + return new PaginatedMusicTrackLiteDto + { + Data = data ?? [.. _musicTrackLiteDtoFixture.CreateMany(_faker.Random.Number(1, 3))], + CurrentPage = currentPage ?? _faker.Random.Int(1, 10), + PerPage = perPage ?? _faker.Random.Int(1, 100), + Count = count ?? _faker.Random.Int(0, 1000), + NumberOfPages = numberOfPages ?? _faker.Random.Int(1, 100) + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/UpdateMusicCoverDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/UpdateMusicCoverDtoFixture.cs new file mode 100644 index 00000000..d1a1ba81 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/AudioLibrary/MusicLibrary/UpdateMusicCoverDtoFixture.cs @@ -0,0 +1,44 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateMusicCoverDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The relative path of the stored cover image. + /// Whether the cover path should be included, or forced to . + /// A configured instance. + public UpdateMusicCoverDto Create( + string? coverPath = null, + bool includeCoverPath = true) + { + return new UpdateMusicCoverDto + { + CoverPath = includeCoverPath ? (coverPath ?? _faker.System.FilePath()) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Common/MediaArtworkDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Common/MediaArtworkDtoFixture.cs new file mode 100644 index 00000000..1dfbdb91 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Common/MediaArtworkDtoFixture.cs @@ -0,0 +1,49 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.Enums.MediaLibrary; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Common; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MediaArtworkDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The type of the artwork. + /// Optional. The ordinal of the artwork within its type. + /// Optional. The relative path of the stored artwork file. + /// A configured instance. + public MediaArtworkDto Create( + ArtworkType? type = null, + int? ordinal = null, + string? path = null) + { + return new MediaArtworkDto + { + Type = type ?? _faker.PickRandom(), + Ordinal = ordinal ?? _faker.Random.Int(1, 10), + Path = path ?? _faker.System.FilePath() + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Common/MoodDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Common/MoodDtoFixture.cs new file mode 100644 index 00000000..11f69492 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/Common/MoodDtoFixture.cs @@ -0,0 +1,44 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.Common; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.Common; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MoodDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The name of the mood. + /// Whether the name should be included, or forced to . + /// A configured instance. + public MoodDto Create( + string? name = null, + bool includeName = true) + { + return new MoodDto + { + Name = includeName ? (name ?? _faker.Lorem.Word()) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/MediaContributors/MediaContributorReferenceDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/MediaContributors/MediaContributorReferenceDtoFixture.cs new file mode 100644 index 00000000..d130ec3b --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/MediaContributors/MediaContributorReferenceDtoFixture.cs @@ -0,0 +1,49 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.MediaContributors; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors; + +/// +/// Fixture class for the class. +/// +[ExcludeFromCodeCoverage] +public class MediaContributorReferenceDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The unique identifier of the media contributor. + /// Optional. The role the contributor played. + /// Whether the role should be included, or forced to . + /// A configured instance. + public MediaContributorReferenceDto Create( + Guid? contributorId = null, + MediaContributorRole? role = null, + bool includeRole = true) + { + return new MediaContributorReferenceDto + { + ContributorId = contributorId ?? _faker.Random.Guid(), + Role = includeRole ? (role ?? _faker.PickRandom()) : null + }; + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbumsLiteRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbumsLiteRequestFixture.cs new file mode 100644 index 00000000..ff47c388 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbumsLiteRequestFixture.cs @@ -0,0 +1,48 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class GetArtistAlbumsLiteRequestFixture +{ + /// + /// Creates a new instance with randomized test data. + /// + /// Optional Id of the artist whose albums are retrieved. + /// Optional Id of the media library the artist belongs to. + /// Optional page of results to retrieve. + /// Optional maximum number of albums to retrieve per page. + /// A configured instance. + public GetArtistAlbumsLiteRequest Create( + string? artistId = null, + Guid? libraryId = null, + int? currentPage = null, + int? perPage = null) + { + return new GetArtistAlbumsLiteRequest( + ArtistId: artistId ?? Guid.NewGuid().ToString(), + LibraryId: libraryId ?? Guid.NewGuid(), + CurrentPage: currentPage, + PerPage: perPage + ); + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbumViewRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbumViewRequestFixture.cs new file mode 100644 index 00000000..afa7bfcd --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbumViewRequestFixture.cs @@ -0,0 +1,44 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class GetMusicAlbumViewRequestFixture +{ + /// + /// Creates a new instance. + /// + /// Optional unique identifier of the artist the album belongs to. + /// Optional unique identifier of the album to retrieve. + /// Optional unique identifier of the media library the album belongs to. + /// A configured instance. + public GetMusicAlbumViewRequest Create( + string? artistId = null, + string? albumId = null, + Guid? libraryId = null) + { + return new GetMusicAlbumViewRequest( + artistId ?? Guid.NewGuid().ToString(), + albumId ?? Guid.NewGuid().ToString(), + libraryId ?? Guid.NewGuid()); + } + + /// + /// Creates a list of instances. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/UpdateMusicAlbumRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/UpdateMusicAlbumRequestFixture.cs new file mode 100644 index 00000000..b096d524 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Albums/UpdateMusicAlbumRequestFixture.cs @@ -0,0 +1,109 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class UpdateMusicAlbumRequestFixture +{ + private readonly Faker _faker = new(); + private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new(); + private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new(); + private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The album metadata of the album. + /// Optional. The physical or digital medium of the album. + /// Optional. The outermost physical packaging of the album. + /// Optional. The barcode of the album. + /// Optional. The catalog numbers of the album. + /// Optional. The name of the label that issued the album. + /// Optional. The ASIN of the album. + /// Optional. The MusicBrainz identifier of the release. + /// Optional. The MusicBrainz identifier of the release group. + /// Optional. The MusicBrainz identifier of the release artist. + /// Optional. The references to the media contributors that performed on the album. + /// Optional. The ratings of the album. + /// Whether the metadata should be included, or forced to . + /// Whether the media format should be included, or forced to . + /// Whether the packaging should be included, or forced to . + /// Whether the barcode should be included, or forced to . + /// Whether the catalog numbers should be included, or forced to . + /// Whether the label should be included, or forced to . + /// Whether the ASIN should be included, or forced to . + /// Whether the MusicBrainz release Id should be included, or forced to . + /// Whether the MusicBrainz release group Id should be included, or forced to . + /// Whether the MusicBrainz release artist Id should be included, or forced to . + /// Whether the contributors should be included, or forced to . + /// Whether the ratings should be included, or forced to . + /// A configured instance. + public UpdateMusicAlbumRequest Create( + MusicAlbumMetadataDto? metadata = null, + MusicMediaFormat? mediaFormat = null, + MusicReleasePackaging? packaging = null, + string? barcode = null, + List? catalogNumbers = null, + string? label = null, + string? asin = null, + Guid? musicBrainzReleaseId = null, + Guid? musicBrainzReleaseGroupId = null, + Guid? musicBrainzReleaseArtistId = null, + List? contributors = null, + List? ratings = null, + bool includeMetadata = true, + bool includeMediaFormat = true, + bool includePackaging = true, + bool includeBarcode = true, + bool includeCatalogNumbers = true, + bool includeLabel = true, + bool includeAsin = true, + bool includeMusicBrainzReleaseId = true, + bool includeMusicBrainzReleaseGroupId = true, + bool includeMusicBrainzReleaseArtistId = true, + bool includeContributors = true, + bool includeRatings = true) + { + return new UpdateMusicAlbumRequest( + Metadata: includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null, + MediaFormat: includeMediaFormat ? (mediaFormat ?? _faker.PickRandom()) : null, + Packaging: includePackaging ? (packaging ?? _faker.PickRandom()) : null, + Barcode: includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null, + CatalogNumbers: includeCatalogNumbers ? (catalogNumbers ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(10))]) : null, + Label: includeLabel ? (label ?? _faker.Company.CompanyName()) : null, + ASIN: includeAsin ? (asin ?? _faker.Random.String2(10)) : null, + MusicBrainzReleaseId: includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null, + MusicBrainzReleaseGroupId: includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null, + MusicBrainzReleaseArtistId: includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null, + Contributors: includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Ratings: includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null + ); + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistViewRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistViewRequestFixture.cs new file mode 100644 index 00000000..36680ecf --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistViewRequestFixture.cs @@ -0,0 +1,41 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class GetMusicArtistViewRequestFixture +{ + /// + /// Creates a new instance. + /// + /// Optional unique identifier of the artist to retrieve. + /// Optional unique identifier of the media library the artist belongs to. + /// A configured instance. + public GetMusicArtistViewRequest Create( + string? artistId = null, + Guid? libraryId = null) + { + return new GetMusicArtistViewRequest( + artistId ?? Guid.NewGuid().ToString(), + libraryId ?? Guid.NewGuid()); + } + + /// + /// Creates a list of instances. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsLiteRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsLiteRequestFixture.cs new file mode 100644 index 00000000..1667e201 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsLiteRequestFixture.cs @@ -0,0 +1,76 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.Enums.Common; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class GetMusicArtistsLiteRequestFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional Id of the media library whose artists are retrieved. + /// Optional page of results to retrieve. + /// Optional maximum number of artists to retrieve per page. + /// Optional search term used to filter the artists by name. + /// Optional alpha key used to filter the results by the first character of their name. + /// Optional whether the leading prefix of a name is ignored when computing the alpha key. + /// Optional name of the field by which to sort the results. + /// Optional direction in which to sort the results. + /// Whether the current page should be included, or forced to . + /// Whether the per page count should be included, or forced to . + /// Whether the search term should be included, or forced to . + /// Whether the alpha key should be included, or forced to . + /// Whether the sort field should be included, or forced to . + /// Whether the sort order should be included, or forced to . + /// A configured instance. + public GetMusicArtistsLiteRequest Create( + Guid? libraryId = null, + int? currentPage = null, + int? perPage = null, + string? searchTerm = null, + string? filterAlphaKey = null, + bool shouldIgnoreThePrefixForAlphaPicker = false, + string? sortBy = null, + SortOrder? sortOrder = null, + bool includeCurrentPage = true, + bool includePerPage = true, + bool includeSearchTerm = true, + bool includeFilterAlphaKey = true, + bool includeSortBy = true, + bool includeSortOrder = true) + { + return new GetMusicArtistsLiteRequest( + LibraryId: libraryId ?? _faker.Random.Guid(), + CurrentPage: includeCurrentPage ? (currentPage ?? _faker.Random.Int(1, 100)) : null, + PerPage: includePerPage ? (perPage ?? _faker.Random.Int(1, 100)) : null, + SearchTerm: includeSearchTerm ? (searchTerm ?? _faker.Lorem.Word()) : null, + FilterAlphaKey: includeFilterAlphaKey ? (filterAlphaKey ?? _faker.Random.String2(1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")) : null, + ShouldIgnoreThePrefixForAlphaPicker: shouldIgnoreThePrefixForAlphaPicker, + SortBy: includeSortBy ? (sortBy ?? _faker.Lorem.Word()) : null, + SortOrder: includeSortOrder ? (sortOrder ?? _faker.PickRandom()) : null + ); + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsViewRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsViewRequestFixture.cs new file mode 100644 index 00000000..3a024c9a --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtistsViewRequestFixture.cs @@ -0,0 +1,39 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class GetMusicArtistsViewRequestFixture +{ + /// + /// Creates a new instance. + /// + /// Optional unique identifier of the media library whose artists are browsed. + /// A configured instance. + public GetMusicArtistsViewRequest Create( + Guid? libraryId = null) + { + return new GetMusicArtistsViewRequest( + LibraryId: libraryId + ); + } + + /// + /// Creates multiple instances. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistAlbumRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistAlbumRequestFixture.cs new file mode 100644 index 00000000..cbe41aa7 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistAlbumRequestFixture.cs @@ -0,0 +1,120 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class UpdateMusicArtistAlbumRequestFixture +{ + private readonly Faker _faker = new(); + private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new(); + private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new(); + private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new(); + private readonly UpdateMusicArtistTrackRequestFixture _updateMusicArtistTrackRequestFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The Id of the album, when the album already exists. + /// Optional. The album metadata of the album. + /// Optional. The physical or digital medium of the album. + /// Optional. The outermost physical packaging of the album. + /// Optional. The barcode of the album. + /// Optional. The catalog numbers of the album. + /// Optional. The name of the label that issued the album. + /// Optional. The ASIN of the album. + /// Optional. The MusicBrainz identifier of the release. + /// Optional. The MusicBrainz identifier of the release group. + /// Optional. The MusicBrainz identifier of the release artist. + /// Optional. The references to the media contributors that performed on the album. + /// Optional. The ratings of the album. + /// Optional. The tracks of the album. + /// Whether the album Id should be included, or forced to . + /// Whether the metadata should be included, or forced to . + /// Whether the media format should be included, or forced to . + /// Whether the packaging should be included, or forced to . + /// Whether the barcode should be included, or forced to . + /// Whether the catalog numbers should be included, or forced to . + /// Whether the label should be included, or forced to . + /// Whether the ASIN should be included, or forced to . + /// Whether the MusicBrainz release Id should be included, or forced to . + /// Whether the MusicBrainz release group Id should be included, or forced to . + /// Whether the MusicBrainz release artist Id should be included, or forced to . + /// Whether the contributors should be included, or forced to . + /// Whether the ratings should be included, or forced to . + /// Whether the tracks should be included, or forced to . + /// A configured instance. + public UpdateMusicArtistAlbumRequest Create( + Guid? albumId = null, + MusicAlbumMetadataDto? metadata = null, + MusicMediaFormat? mediaFormat = null, + MusicReleasePackaging? packaging = null, + string? barcode = null, + List? catalogNumbers = null, + string? label = null, + string? asin = null, + Guid? musicBrainzReleaseId = null, + Guid? musicBrainzReleaseGroupId = null, + Guid? musicBrainzReleaseArtistId = null, + List? contributors = null, + List? ratings = null, + List? tracks = null, + bool includeAlbumId = true, + bool includeMetadata = true, + bool includeMediaFormat = true, + bool includePackaging = true, + bool includeBarcode = true, + bool includeCatalogNumbers = true, + bool includeLabel = true, + bool includeAsin = true, + bool includeMusicBrainzReleaseId = true, + bool includeMusicBrainzReleaseGroupId = true, + bool includeMusicBrainzReleaseArtistId = true, + bool includeContributors = true, + bool includeRatings = true, + bool includeTracks = true) + { + return new UpdateMusicArtistAlbumRequest( + AlbumId: includeAlbumId ? (albumId ?? _faker.Random.Guid()) : null, + Metadata: includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null, + MediaFormat: includeMediaFormat ? (mediaFormat ?? _faker.PickRandom()) : null, + Packaging: includePackaging ? (packaging ?? _faker.PickRandom()) : null, + Barcode: includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null, + CatalogNumbers: includeCatalogNumbers ? (catalogNumbers ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(10))]) : null, + Label: includeLabel ? (label ?? _faker.Company.CompanyName()) : null, + ASIN: includeAsin ? (asin ?? _faker.Random.String2(10)) : null, + MusicBrainzReleaseId: includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null, + MusicBrainzReleaseGroupId: includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null, + MusicBrainzReleaseArtistId: includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null, + Contributors: includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Ratings: includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Tracks: includeTracks ? (tracks ?? [.. _updateMusicArtistTrackRequestFixture.CreateMany(_faker.Random.Number(1, 3))]) : null + ); + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistRequestFixture.cs new file mode 100644 index 00000000..3000e5a7 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistRequestFixture.cs @@ -0,0 +1,89 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class UpdateMusicArtistRequestFixture +{ + private readonly Faker _faker = new(); + private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new(); + private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new(); + private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new(); + private readonly UpdateMusicArtistAlbumRequestFixture _updateMusicArtistAlbumRequestFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The metadata of the artist. + /// Optional. The website of the artist. + /// Optional. The MusicBrainz identifier of the artist. + /// Optional. The IPI codes of the artist. + /// Optional. The ISNI codes of the artist. + /// Optional. The references to the media contributors that make up the artist. + /// Optional. The ratings of the artist. + /// Optional. The albums of the artist, each with its own list of tracks. + /// Whether the metadata should be included, or forced to . + /// Whether the website should be included, or forced to . + /// Whether the MusicBrainz artist Id should be included, or forced to . + /// Whether the IPI codes should be included, or forced to . + /// Whether the ISNI codes should be included, or forced to . + /// Whether the contributors should be included, or forced to . + /// Whether the ratings should be included, or forced to . + /// Whether the albums should be included, or forced to . + /// A configured instance. + public UpdateMusicArtistRequest Create( + MusicArtistMetadataDto? metadata = null, + string? website = null, + Guid? musicBrainzArtistId = null, + List? ipis = null, + List? isnis = null, + List? contributors = null, + List? ratings = null, + List? albums = null, + bool includeMetadata = true, + bool includeWebsite = true, + bool includeMusicBrainzArtistId = true, + bool includeIpis = true, + bool includeIsnis = true, + bool includeContributors = true, + bool includeRatings = true, + bool includeAlbums = true) + { + return new UpdateMusicArtistRequest( + Metadata: includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null, + Website: includeWebsite ? (website ?? _faker.Internet.Url()) : null, + MusicBrainzArtistId: includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : null, + Ipis: includeIpis ? (ipis ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(10, "0123456789"))]) : null, + Isnis: includeIsnis ? (isnis ?? [.. Enumerable.Range(0, _faker.Random.Number(1, 3)).Select(_ => _faker.Random.String2(16, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"))]) : null, + Contributors: includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Ratings: includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Albums: includeAlbums ? (albums ?? [.. _updateMusicArtistAlbumRequestFixture.CreateMany(_faker.Random.Number(1, 3))]) : null + ); + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistTrackRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistTrackRequestFixture.cs new file mode 100644 index 00000000..9d1b6cf8 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Artists/UpdateMusicArtistTrackRequestFixture.cs @@ -0,0 +1,129 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Common; +using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class UpdateMusicArtistTrackRequestFixture +{ + private readonly Faker _faker = new(); + private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new(); + private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new(); + private readonly MoodDtoFixture _moodDtoFixture = new(); + private readonly IsrcDtoFixture _isrcDtoFixture = new(); + private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new(); + private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The Id of the track, when the track already exists. + /// Optional. The file system path of the track. + /// Optional. The audio metadata of the track. + /// Optional. The number of the track on its disc. + /// Optional. The number of the disc the track belongs to. + /// Optional. The script used by the language of the track. + /// Optional. The musical key of the track. + /// Optional. The tempo of the track in beats per minute. + /// Optional. The work the track is a recording of. + /// Optional. The MusicBrainz identifier of the recording. + /// Optional. The MusicBrainz identifier of the track. + /// Optional. The moods of the track. + /// Optional. The ISRC codes of the track. + /// Optional. The references to the media contributors that performed on the track. + /// Optional. The ratings of the track. + /// Whether the track Id should be included, or forced to . + /// Whether the path should be included, or forced to . + /// Whether the metadata should be included, or forced to . + /// Whether the track number should be included, or forced to . + /// Whether the disc number should be included, or forced to . + /// Whether the script should be included, or forced to . + /// Whether the key should be included, or forced to . + /// Whether the BPM should be included, or forced to . + /// Whether the work should be included, or forced to . + /// Whether the MusicBrainz recording Id should be included, or forced to . + /// Whether the MusicBrainz track Id should be included, or forced to . + /// Whether the moods should be included, or forced to . + /// Whether the ISRC codes should be included, or forced to . + /// Whether the contributors should be included, or forced to . + /// Whether the ratings should be included, or forced to . + /// A configured instance. + public UpdateMusicArtistTrackRequest Create( + Guid? trackId = null, + string? path = null, + MusicTrackMetadataDto? metadata = null, + int? trackNumber = null, + int? discNumber = null, + string? script = null, + MusicKey? key = null, + int? bpm = null, + MusicWorkDto? work = null, + Guid? musicBrainzRecordingId = null, + Guid? musicBrainzTrackId = null, + List? moods = null, + List? isrcs = null, + List? contributors = null, + List? ratings = null, + bool includeTrackId = true, + bool includePath = true, + bool includeMetadata = true, + bool includeTrackNumber = true, + bool includeDiscNumber = true, + bool includeScript = true, + bool includeKey = true, + bool includeBpm = true, + bool includeWork = true, + bool includeMusicBrainzRecordingId = true, + bool includeMusicBrainzTrackId = true, + bool includeMoods = true, + bool includeIsrcs = true, + bool includeContributors = true, + bool includeRatings = true) + { + return new UpdateMusicArtistTrackRequest( + TrackId: includeTrackId ? (trackId ?? _faker.Random.Guid()) : null, + Path: includePath ? (path ?? _faker.System.FilePath()) : null, + Metadata: includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null, + TrackNumber: includeTrackNumber ? (trackNumber ?? _faker.Random.Number(1, 30)) : null, + DiscNumber: includeDiscNumber ? (discNumber ?? _faker.Random.Number(1, 4)) : null, + Script: includeScript ? (script ?? _faker.Lorem.Word()) : null, + Key: includeKey ? (key ?? _faker.PickRandom()) : null, + Bpm: includeBpm ? (bpm ?? _faker.Random.Number(60, 200)) : null, + Work: includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null, + MusicBrainzRecordingId: includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null, + MusicBrainzTrackId: includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null, + Moods: includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Isrcs: includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Contributors: includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Ratings: includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null + ); + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracksLiteRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracksLiteRequestFixture.cs new file mode 100644 index 00000000..a40ce2fe --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracksLiteRequestFixture.cs @@ -0,0 +1,51 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class GetAlbumTracksLiteRequestFixture +{ + /// + /// Creates a new instance with randomized test data. + /// + /// Optional Id of the artist the album belongs to. + /// Optional Id of the album whose tracks are retrieved. + /// Optional Id of the media library the album belongs to. + /// Optional page of results to retrieve. + /// Optional maximum number of tracks to retrieve per page. + /// A configured instance. + public GetAlbumTracksLiteRequest Create( + string? artistId = null, + string? albumId = null, + Guid? libraryId = null, + int? currentPage = null, + int? perPage = null) + { + return new GetAlbumTracksLiteRequest( + ArtistId: artistId ?? Guid.NewGuid().ToString(), + AlbumId: albumId ?? Guid.NewGuid().ToString(), + LibraryId: libraryId ?? Guid.NewGuid(), + CurrentPage: currentPage, + PerPage: perPage + ); + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrackViewRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrackViewRequestFixture.cs new file mode 100644 index 00000000..d135d136 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrackViewRequestFixture.cs @@ -0,0 +1,47 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class GetMusicTrackViewRequestFixture +{ + /// + /// Creates a new instance. + /// + /// Optional unique identifier of the artist the album belongs to. + /// Optional unique identifier of the album the track belongs to. + /// Optional unique identifier of the track to retrieve. + /// Optional unique identifier of the media library the track belongs to. + /// A configured instance. + public GetMusicTrackViewRequest Create( + string? artistId = null, + string? albumId = null, + string? trackId = null, + Guid? libraryId = null) + { + return new GetMusicTrackViewRequest( + artistId ?? Guid.NewGuid().ToString(), + albumId ?? Guid.NewGuid().ToString(), + trackId ?? Guid.NewGuid().ToString(), + libraryId ?? Guid.NewGuid()); + } + + /// + /// Creates a list of instances. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/UpdateMusicTrackRequestFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/UpdateMusicTrackRequestFixture.cs new file mode 100644 index 00000000..b34db133 --- /dev/null +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/Requests/Library/AudioLibrary/MusicLibrary/Tracks/UpdateMusicTrackRequestFixture.cs @@ -0,0 +1,124 @@ +#region ========================================================================= USING ===================================================================================== +using Bogus; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.DTO.MediaContributors; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Common; +using Lumina.Presentation.Web.Fixtures.Common.DTO.MediaContributors; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class UpdateMusicTrackRequestFixture +{ + private readonly Faker _faker = new(); + private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new(); + private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new(); + private readonly MoodDtoFixture _moodDtoFixture = new(); + private readonly IsrcDtoFixture _isrcDtoFixture = new(); + private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new(); + private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new(); + + /// + /// Creates a new instance with randomized test data. + /// + /// Optional. The file system path of the track. + /// Optional. The audio metadata of the track. + /// Optional. The number of the track on its disc. + /// Optional. The number of the disc the track belongs to. + /// Optional. The script used by the language of the track. + /// Optional. The musical key of the track. + /// Optional. The tempo of the track in beats per minute. + /// Optional. The work the track is a recording of. + /// Optional. The MusicBrainz identifier of the recording. + /// Optional. The MusicBrainz identifier of the track. + /// Optional. The moods of the track. + /// Optional. The ISRC codes of the track. + /// Optional. The references to the media contributors that performed on the track. + /// Optional. The ratings of the track. + /// Whether the path should be included, or forced to . + /// Whether the metadata should be included, or forced to . + /// Whether the track number should be included, or forced to . + /// Whether the disc number should be included, or forced to . + /// Whether the script should be included, or forced to . + /// Whether the key should be included, or forced to . + /// Whether the BPM should be included, or forced to . + /// Whether the work should be included, or forced to . + /// Whether the MusicBrainz recording Id should be included, or forced to . + /// Whether the MusicBrainz track Id should be included, or forced to . + /// Whether the moods should be included, or forced to . + /// Whether the ISRC codes should be included, or forced to . + /// Whether the contributors should be included, or forced to . + /// Whether the ratings should be included, or forced to . + /// A configured instance. + public UpdateMusicTrackRequest Create( + string? path = null, + MusicTrackMetadataDto? metadata = null, + int? trackNumber = null, + int? discNumber = null, + string? script = null, + MusicKey? key = null, + int? bpm = null, + MusicWorkDto? work = null, + Guid? musicBrainzRecordingId = null, + Guid? musicBrainzTrackId = null, + List? moods = null, + List? isrcs = null, + List? contributors = null, + List? ratings = null, + bool includePath = true, + bool includeMetadata = true, + bool includeTrackNumber = true, + bool includeDiscNumber = true, + bool includeScript = true, + bool includeKey = true, + bool includeBpm = true, + bool includeWork = true, + bool includeMusicBrainzRecordingId = true, + bool includeMusicBrainzTrackId = true, + bool includeMoods = true, + bool includeIsrcs = true, + bool includeContributors = true, + bool includeRatings = true) + { + return new UpdateMusicTrackRequest( + Path: includePath ? (path ?? _faker.System.FilePath()) : null, + Metadata: includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null, + TrackNumber: includeTrackNumber ? (trackNumber ?? _faker.Random.Number(1, 30)) : null, + DiscNumber: includeDiscNumber ? (discNumber ?? _faker.Random.Number(1, 4)) : null, + Script: includeScript ? (script ?? _faker.Lorem.Word()) : null, + Key: includeKey ? (key ?? _faker.PickRandom()) : null, + Bpm: includeBpm ? (bpm ?? _faker.Random.Number(60, 200)) : null, + Work: includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null, + MusicBrainzRecordingId: includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null, + MusicBrainzTrackId: includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null, + Moods: includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Isrcs: includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Contributors: includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null, + Ratings: includeRatings ? (ratings ?? [.. _audioRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))]) : null + ); + } + + /// + /// Creates multiple instances with randomized test data. + /// + /// Number of instances to create. + /// List of configured instances. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs new file mode 100644 index 00000000..6db7f020 --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs @@ -0,0 +1,113 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.DeleteMusicAlbum; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.DeleteMusicAlbum; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicAlbumEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public DeleteMusicAlbumEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task DeleteMusicAlbum_WhenCalledByAuthenticatedUserWithAntiforgeryToken_ShouldForwardDeleteAndReturnSuccess() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + _apiFactory.ApiClientStub.RegisterDeleteSuccess($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}"); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(artistId, albumId, libraryId); + deleteRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Contains($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}", _apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicAlbum_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequest() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(artistId, albumId, libraryId); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.DoesNotContain($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}", _apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicAlbum_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + /// + /// Builds the delete request for the album identified by the route, with the owning library passed through the query string. + /// + /// The route Id of the artist the album belongs to. + /// The route Id of the album to delete. + /// The Id of the media library the album belongs to. + /// The configured delete request. + private static HttpRequestMessage CreateDeleteRequest(Guid artistId, Guid albumId, Guid libraryId) + { + HttpRequestMessage deleteRequest = new(HttpMethod.Delete, $"/en-us/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-delete-album?libraryId={libraryId}") + { + // The front-end sends the JSON content type even for DELETE requests, which triggers the antiforgery validation. + Content = new StringContent("{}", Encoding.UTF8, "application/json") + }; + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. + deleteRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + deleteRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return deleteRequest; + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointTests.cs new file mode 100644 index 00000000..4bac523a --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointTests.cs @@ -0,0 +1,54 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.EditMusicAlbum; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.EditMusicAlbum; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class EditMusicAlbumViewEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly MusicAlbumDtoFixture _musicAlbumDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public EditMusicAlbumViewEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task EditMusicAlbum_WhenCalledByAuthenticatedUser_ShouldRenderEditAlbumPage() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + MusicAlbumDto expectedAlbum = _musicAlbumDtoFixture.Create(); + expectedAlbum.Metadata!.Title = "An album"; + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{expectedAlbum.LibraryId}/artists/{expectedAlbum.ArtistId}/albums/{expectedAlbum.Id}", expectedAlbum); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/library/audio-library/music-library/artists/{expectedAlbum.ArtistId}/albums/{expectedAlbum.Id}?libraryId={expectedAlbum.LibraryId}"); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.Equal("text/html", response.Content.Headers.ContentType!.MediaType); + Assert.Contains("An album", content); + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs new file mode 100644 index 00000000..a67fd33a --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs @@ -0,0 +1,78 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetArtistAlbums; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetArtistAlbums; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetArtistAlbumsEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly PaginatedMusicAlbumLiteDtoFixture _paginatedMusicAlbumLiteDtoFixture = new(); + private readonly MusicAlbumLiteDtoFixture _musicAlbumLiteDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetArtistAlbumsEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetArtistAlbums_WhenCalledByAuthenticatedUser_ShouldReturnAlbumsFromApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + PaginatedMusicAlbumLiteDto expectedResponse = _paginatedMusicAlbumLiteDtoFixture.Create(data: [_musicAlbumLiteDtoFixture.Create(title: "Test Album")]); + string expectedEndpoint = $"libraries/{libraryId}/artists/{artistId}/albums/lite?currentPage=1&perPage=20"; + _apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, expectedResponse); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/library/audio-library/music-library/artists/{artistId}/albums/api-get-albums?libraryId={libraryId}¤tPage=1&perPage=20"); + getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(getRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(expectedResponse.Data.Count, json.RootElement.GetProperty("data").GetProperty("data").GetArrayLength()); + Assert.Contains(expectedEndpoint, _apiFactory.ApiClientStub.GetEndpointsCalled); + } + + [Fact] + public async Task GetArtistAlbums_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/albums/api-get-albums?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs new file mode 100644 index 00000000..aa8db69b --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs @@ -0,0 +1,77 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetMusicAlbum; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetMusicAlbum; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicAlbumEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly MusicAlbumDtoFixture _musicAlbumDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetMusicAlbumEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetMusicAlbum_WhenCalledByAuthenticatedUser_ShouldReturnAlbumFromApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + MusicAlbumDto expectedAlbum = _musicAlbumDtoFixture.Create(id: albumId, artistId: artistId, libraryId: libraryId); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}", expectedAlbum); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-get-album?libraryId={libraryId}"); + getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(getRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(albumId, json.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + Assert.Contains($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}", _apiFactory.ApiClientStub.GetEndpointsCalled); + } + + [Fact] + public async Task GetMusicAlbum_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/api-get-album?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs new file mode 100644 index 00000000..6ce099ed --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs @@ -0,0 +1,123 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.SaveMusicAlbum; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Http.Json; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.SaveMusicAlbum; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicAlbumEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly UpdateMusicAlbumRequestFixture _updateMusicAlbumRequestFixture = new(); + private readonly MusicAlbumDtoFixture _musicAlbumDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public SaveMusicAlbumEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task SaveMusicAlbum_WhenCalledByAuthenticatedUserWithAntiforgeryToken_ShouldForwardUpdateAndReturnSuccess() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + UpdateMusicAlbumRequest request = _updateMusicAlbumRequestFixture.Create(); + MusicAlbumDto expectedAlbum = _musicAlbumDtoFixture.Create(id: albumId, artistId: artistId, libraryId: libraryId); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}", expectedAlbum); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId, albumId, libraryId, request); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(albumId, json.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/albums/{albumId}" && putRequest.Data is UpdateMusicAlbumRequest forwarded && forwarded.Metadata!.Title == request.Metadata!.Title && forwarded.ASIN == request.ASIN); + } + + [Fact] + public async Task SaveMusicAlbum_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequest() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + UpdateMusicAlbumRequest request = _updateMusicAlbumRequestFixture.Create(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId, albumId, libraryId, request); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/albums/{albumId}"); + } + + [Fact] + public async Task SaveMusicAlbum_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), _updateMusicAlbumRequestFixture.Create()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + /// + /// Builds the save request that PUTs the given to the album identified by the route, + /// with the owning library passed through the query string. + /// + /// The route Id of the artist the album belongs to. + /// The route Id of the album to save. + /// The Id of the media library the album belongs to. + /// The album data to send. + /// The configured save request. + private static HttpRequestMessage CreateSaveRequest(Guid artistId, Guid albumId, Guid libraryId, UpdateMusicAlbumRequest request) + { + HttpRequestMessage saveRequest = new(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-save-album?libraryId={libraryId}") + { + Content = JsonContent.Create(request) + }; + saveRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + saveRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return saveRequest; + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs new file mode 100644 index 00000000..7bd00d69 --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs @@ -0,0 +1,154 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.Exceptions; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Common; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly ProblemDetailsDtoFixture _problemDetailsDtoFixture = new(); + private readonly UpdateMusicCoverDtoFixture _updateMusicCoverDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public UpdateAlbumCoverEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task UpdateAlbumCover_WhenCalledByAuthenticatedUserWithAntiforgeryToken_ShouldUploadCoverAndReturnSuccess() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + const string EXPECTED_PATH = "/media/albums/cover.png"; + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover", _updateMusicCoverDtoFixture.Create(coverPath: EXPECTED_PATH)); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(artistId, albumId, libraryId, "cover.png"); + uploadRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(EXPECTED_PATH, json.RootElement.GetProperty("data").GetString()); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover" && putRequest.Data as string == "cover.png"); + } + + [Fact] + public async Task UpdateAlbumCover_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequest() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(artistId, albumId, libraryId, "cover.png"); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover"); + } + + [Fact] + public async Task UpdateAlbumCover_WhenCalledWithoutUploadedFile_ShouldForwardRequestAndReturnFailure() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + ProblemDetailsDto problemDetails = _problemDetailsDtoFixture.Create(title: "General.Validation", detail: "AlbumCoverCannotBeNull"); + _apiFactory.ApiClientStub.RegisterPutException($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover", new ApiException(problemDetails, HttpStatusCode.UnprocessableEntity, $"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover")); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + MultipartFormDataContent noFileForm = []; + noFileForm.Add(new StringContent("unrelated-field")); + HttpRequestMessage uploadRequest = new(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-update-cover?libraryId={libraryId}") + { + Content = noFileForm + }; + uploadRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + uploadRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + // The web does not short-circuit the missing file; it forwards the request, and the API reports the missing cover + // with the same AlbumCoverCannotBeNull validation error any other client receives. + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover" && putRequest.Data == null); + using JsonDocument json = JsonDocument.Parse(content); + Assert.False(json.RootElement.GetProperty("success").GetBoolean()); + } + + [Fact] + public async Task UpdateAlbumCover_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), "cover.png"); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(uploadRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + /// + /// Builds the multipart PUT request that uploads a cover to the album identified by the route. + /// + /// The route Id of the artist the album belongs to. + /// The route Id of the album whose cover is uploaded. + /// The Id of the media library the album belongs to. + /// The name of the uploaded file. + /// The configured upload request. + private static HttpRequestMessage CreateUploadRequest(Guid artistId, Guid albumId, Guid libraryId, string fileName) + { + MultipartFormDataContent form = []; + ByteArrayContent fileContent = new(Encoding.UTF8.GetBytes("fake cover payload")); + fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + form.Add(fileContent, "cover", fileName); + return new HttpRequestMessage(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-update-cover?libraryId={libraryId}") + { + Content = form + }; + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs new file mode 100644 index 00000000..be8202b4 --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs @@ -0,0 +1,110 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.DeleteMusicArtist; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.DeleteMusicArtist; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicArtistEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public DeleteMusicArtistEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task DeleteMusicArtist_WhenCalledByAuthenticatedUserWithAntiforgeryToken_ShouldForwardDeleteAndReturnSuccess() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + _apiFactory.ApiClientStub.RegisterDeleteSuccess($"libraries/{libraryId}/artists/{artistId}"); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(artistId, libraryId); + deleteRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Contains($"libraries/{libraryId}/artists/{artistId}", _apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicArtist_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequest() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(artistId, libraryId); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.DoesNotContain($"libraries/{libraryId}/artists/{artistId}", _apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicArtist_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(Guid.NewGuid(), Guid.NewGuid()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + /// + /// Builds the delete request for the artist identified by the route, with the owning library passed through the query string. + /// + /// The route Id of the artist to delete. + /// The Id of the media library the artist belongs to. + /// The configured delete request. + private static HttpRequestMessage CreateDeleteRequest(Guid artistId, Guid libraryId) + { + HttpRequestMessage deleteRequest = new(HttpMethod.Delete, $"/en-us/library/audio-library/music-library/artists/{artistId}/api-delete-artist?libraryId={libraryId}") + { + // The front-end sends the JSON content type even for DELETE requests, which triggers the antiforgery validation. + Content = new StringContent("{}", Encoding.UTF8, "application/json") + }; + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. + deleteRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + deleteRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return deleteRequest; + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointTests.cs new file mode 100644 index 00000000..dacc0fc2 --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointTests.cs @@ -0,0 +1,69 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.EditMusicArtist; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.EditMusicArtist; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class EditMusicArtistViewEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly MusicArtistDtoFixture _musicArtistDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public EditMusicArtistViewEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task EditMusicArtist_WhenCalledByAuthenticatedUser_ShouldRenderEditArtistPage() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + MusicArtistDto expectedArtist = _musicArtistDtoFixture.Create(); + expectedArtist.Metadata!.Name = "An artist"; + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{expectedArtist.LibraryId}/artists/{expectedArtist.Id}", expectedArtist); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/library/audio-library/music-library/artists/{expectedArtist.Id}?libraryId={expectedArtist.LibraryId}"); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.Equal("text/html", response.Content.Headers.ContentType!.MediaType); + Assert.Contains("An artist", content); + } + + [Fact] + public async Task EditMusicArtist_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs new file mode 100644 index 00000000..1b355e59 --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs @@ -0,0 +1,76 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtist; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtist; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicArtistEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly MusicArtistDtoFixture _musicArtistDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetMusicArtistEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetMusicArtist_WhenCalledByAuthenticatedUser_ShouldReturnArtistFromApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + MusicArtistDto expectedArtist = _musicArtistDtoFixture.Create(id: artistId, libraryId: libraryId); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{artistId}", expectedArtist); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/library/audio-library/music-library/artists/{artistId}/api-get-artist?libraryId={libraryId}"); + getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(getRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(artistId, json.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + Assert.Contains($"libraries/{libraryId}/artists/{artistId}", _apiFactory.ApiClientStub.GetEndpointsCalled); + } + + [Fact] + public async Task GetMusicArtist_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/api-get-artist?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs new file mode 100644 index 00000000..035aac1a --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs @@ -0,0 +1,78 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtists; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtists; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicArtistsEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly PaginatedMusicArtistLiteDtoFixture _paginatedMusicArtistLiteDtoFixture = new(); + private readonly MusicArtistLiteDtoFixture _musicArtistLiteDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetMusicArtistsEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetMusicArtists_WhenCalledByAuthenticatedUser_ShouldReturnArtistsFromApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + const string EXPECTED_ENDPOINT = "libraries/{0}/artists/lite?currentPage=1&perPage=20&shouldIgnoreThePrefixForAlphaPicker=False"; + _apiFactory.ApiClientStub.RegisterGetResponse( + string.Format(EXPECTED_ENDPOINT, libraryId), + _paginatedMusicArtistLiteDtoFixture.Create(data: [_musicArtistLiteDtoFixture.Create(name: "Test Artist")], currentPage: 1, perPage: 20, count: 1, numberOfPages: 1)); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/library/audio-library/music-library/artists/api-get-artists?libraryId={libraryId}¤tPage=1&perPage=20&shouldIgnoreThePrefixForAlphaPicker=false"); + getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(getRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(1, json.RootElement.GetProperty("data").GetProperty("currentPage").GetInt32()); + Assert.Contains(string.Format(EXPECTED_ENDPOINT, libraryId), _apiFactory.ApiClientStub.GetEndpointsCalled); + } + + [Fact] + public async Task GetMusicArtists_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/api-get-artists?libraryId={Guid.NewGuid()}&shouldIgnoreThePrefixForAlphaPicker=false"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs new file mode 100644 index 00000000..fa91de51 --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs @@ -0,0 +1,70 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.Libraries; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.Index; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Libraries; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.Index; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicArtistsIndexViewEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly LibraryDtoFixture _libraryDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public MusicArtistsIndexViewEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task MusicArtistsIndex_WhenCalledByAuthenticatedUserWithLibraryId_ShouldRenderArtistsPage() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + LibraryDto expectedLibrary = _libraryDtoFixture.Create(id: libraryId, title: "Music"); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}", expectedLibrary); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/library/audio-library/music-library/artists?libraryId={libraryId}"); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.Equal("text/html", response.Content.Headers.ContentType!.MediaType); + Assert.Contains("search-input", content); + Assert.Contains($"libraries/{libraryId}", _apiFactory.ApiClientStub.GetEndpointsCalled); + } + + [Fact] + public async Task MusicArtistsIndex_WhenCalledByAuthenticatedUserWithoutLibraryId_ShouldRedirectToHome() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync("/en-us/library/audio-library/music-library/artists"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Contains("/en-us", response.Headers.Location!.ToString()); + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs new file mode 100644 index 00000000..3c69e033 --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs @@ -0,0 +1,120 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.SaveMusicArtist; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Http.Json; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.SaveMusicArtist; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicArtistEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly UpdateMusicArtistRequestFixture _updateMusicArtistRequestFixture = new(); + private readonly MusicArtistDtoFixture _musicArtistDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public SaveMusicArtistEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task SaveMusicArtist_WhenCalledByAuthenticatedUserWithAntiforgeryToken_ShouldForwardUpdateAndReturnSuccess() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + UpdateMusicArtistRequest request = _updateMusicArtistRequestFixture.Create(); + MusicArtistDto expectedArtist = _musicArtistDtoFixture.Create(id: artistId, libraryId: libraryId); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{artistId}", expectedArtist); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId, libraryId, request); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(artistId, json.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}" && putRequest.Data is UpdateMusicArtistRequest forwarded && forwarded.Metadata!.Name == request.Metadata!.Name); + } + + [Fact] + public async Task SaveMusicArtist_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequest() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + UpdateMusicArtistRequest request = _updateMusicArtistRequestFixture.Create(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId, libraryId, request); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}"); + } + + [Fact] + public async Task SaveMusicArtist_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(Guid.NewGuid(), Guid.NewGuid(), _updateMusicArtistRequestFixture.Create()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + /// + /// Builds the save request that PUTs the given to the artist identified by the route, + /// with the owning library passed through the query string. + /// + /// The route Id of the artist to save. + /// The Id of the media library the artist belongs to. + /// The artist data to send. + /// The configured save request. + private static HttpRequestMessage CreateSaveRequest(Guid artistId, Guid libraryId, UpdateMusicArtistRequest request) + { + HttpRequestMessage saveRequest = new(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{artistId}/api-save-artist?libraryId={libraryId}") + { + Content = JsonContent.Create(request) + }; + saveRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + saveRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return saveRequest; + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs new file mode 100644 index 00000000..b642d0df --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs @@ -0,0 +1,141 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly UpdateMusicCoverDtoFixture _updateMusicCoverDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public UpdateArtistCoverEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task UpdateArtistCover_WhenCalledByAuthenticatedUserWithAntiforgeryToken_ShouldUploadCoverAndReturnSuccess() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + const string EXPECTED_PATH = "/media/artists/cover.png"; + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{artistId}/cover", _updateMusicCoverDtoFixture.Create(coverPath: EXPECTED_PATH)); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(artistId, libraryId, "cover.png"); + uploadRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(EXPECTED_PATH, json.RootElement.GetProperty("data").GetString()); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/cover" && putRequest.Data as string == "cover.png"); + } + + [Fact] + public async Task UpdateArtistCover_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequest() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(artistId, libraryId, "cover.png"); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/cover"); + } + + [Fact] + public async Task UpdateArtistCover_WhenCalledWithoutUploadedFile_ShouldForwardRequestAndReturnFailure() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{artistId}/cover", _updateMusicCoverDtoFixture.Create(includeCoverPath: false)); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + MultipartFormDataContent noFileForm = []; + noFileForm.Add(new StringContent("unrelated-field")); + HttpRequestMessage uploadRequest = new(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{artistId}/api-update-cover?libraryId={libraryId}") + { + Content = noFileForm + }; + uploadRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + uploadRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + + // Assert + // The web does not short-circuit the missing file; it forwards the request without a file, so that the upstream API reports it. + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/cover" && putRequest.Data == null); + } + + [Fact] + public async Task UpdateArtistCover_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(Guid.NewGuid(), Guid.NewGuid(), "cover.png"); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(uploadRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + /// + /// Builds the multipart PUT request that uploads a cover to the artist identified by the route. + /// + /// The route Id of the artist whose cover is uploaded. + /// The Id of the media library the artist belongs to. + /// The name of the uploaded file. + /// The configured upload request. + private static HttpRequestMessage CreateUploadRequest(Guid artistId, Guid libraryId, string fileName) + { + MultipartFormDataContent form = []; + ByteArrayContent fileContent = new(Encoding.UTF8.GetBytes("fake cover payload")); + fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + form.Add(fileContent, "cover", fileName); + return new HttpRequestMessage(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{artistId}/api-update-cover?libraryId={libraryId}") + { + Content = form + }; + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs new file mode 100644 index 00000000..84ee603f --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs @@ -0,0 +1,116 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.DeleteMusicTrack; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.DeleteMusicTrack; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicTrackEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public DeleteMusicTrackEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task DeleteMusicTrack_WhenCalledByAuthenticatedUserWithAntiforgeryToken_ShouldForwardDeleteAndReturnSuccess() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + _apiFactory.ApiClientStub.RegisterDeleteSuccess($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}"); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(artistId, albumId, trackId, libraryId); + deleteRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Contains($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}", _apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicTrack_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequest() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(artistId, albumId, trackId, libraryId); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.DoesNotContain($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}", _apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicTrack_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + /// + /// Builds the delete request for the track identified by the route, with the owning library passed through the query string. + /// + /// The route Id of the artist the track belongs to. + /// The route Id of the album the track belongs to. + /// The route Id of the track to delete. + /// The Id of the media library the track belongs to. + /// The configured delete request. + private static HttpRequestMessage CreateDeleteRequest(Guid artistId, Guid albumId, Guid trackId, Guid libraryId) + { + HttpRequestMessage deleteRequest = new(HttpMethod.Delete, $"/en-us/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-delete-track?libraryId={libraryId}") + { + // The front-end sends the JSON content type even for DELETE requests, which triggers the antiforgery validation. + Content = new StringContent("{}", Encoding.UTF8, "application/json") + }; + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. + deleteRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + deleteRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return deleteRequest; + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointTests.cs new file mode 100644 index 00000000..6234e3f5 --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointTests.cs @@ -0,0 +1,78 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.EditMusicTrack; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.EditMusicTrack; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class EditMusicTrackViewEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly MusicTrackDtoFixture _musicTrackDtoFixture = new(); + private readonly MusicAlbumDtoFixture _musicAlbumDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public EditMusicTrackViewEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task EditMusicTrack_WhenCalledByAuthenticatedUser_ShouldRenderEditTrackPage() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + MusicTrackDto expectedTrack = _musicTrackDtoFixture.Create(id: trackId, albumId: albumId, libraryId: libraryId); + expectedTrack.Metadata!.Title = "A track"; + MusicAlbumDto expectedAlbum = _musicAlbumDtoFixture.Create(id: albumId, artistId: artistId, libraryId: libraryId); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}", expectedTrack); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}", expectedAlbum); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}?libraryId={libraryId}"); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.Equal("text/html", response.Content.Headers.ContentType!.MediaType); + Assert.Contains("A track", content); + Assert.Contains($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}", _apiFactory.ApiClientStub.GetEndpointsCalled); + Assert.Contains($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}", _apiFactory.ApiClientStub.GetEndpointsCalled); + } + + [Fact] + public async Task EditMusicTrack_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/tracks/{Guid.NewGuid()}?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs new file mode 100644 index 00000000..f3e18f1c --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs @@ -0,0 +1,79 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetAlbumTracks; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetAlbumTracks; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetAlbumTracksEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly PaginatedMusicTrackLiteDtoFixture _paginatedMusicTrackLiteDtoFixture = new(); + private readonly MusicTrackLiteDtoFixture _musicTrackLiteDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetAlbumTracksEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetAlbumTracks_WhenCalledByAuthenticatedUser_ShouldReturnTracksFromApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + PaginatedMusicTrackLiteDto expectedResponse = _paginatedMusicTrackLiteDtoFixture.Create(data: [_musicTrackLiteDtoFixture.Create(title: "Test Track")]); + string expectedEndpoint = $"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/lite?currentPage=1&perPage=20"; + _apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, expectedResponse); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/api-get-tracks?libraryId={libraryId}¤tPage=1&perPage=20"); + getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(getRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(expectedResponse.Data.Count, json.RootElement.GetProperty("data").GetProperty("data").GetArrayLength()); + Assert.Contains(expectedEndpoint, _apiFactory.ApiClientStub.GetEndpointsCalled); + } + + [Fact] + public async Task GetAlbumTracks_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/tracks/api-get-tracks?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs new file mode 100644 index 00000000..3159f970 --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs @@ -0,0 +1,78 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetMusicTrack; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetMusicTrack; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicTrackEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly MusicTrackDtoFixture _musicTrackDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetMusicTrackEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetMusicTrack_WhenCalledByAuthenticatedUser_ShouldReturnTrackFromApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + MusicTrackDto expectedTrack = _musicTrackDtoFixture.Create(id: trackId, albumId: albumId, libraryId: libraryId); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}", expectedTrack); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-get-track?libraryId={libraryId}"); + getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(getRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(trackId, json.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + Assert.Contains($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}", _apiFactory.ApiClientStub.GetEndpointsCalled); + } + + [Fact] + public async Task GetMusicTrack_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/tracks/{Guid.NewGuid()}/api-get-track?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } +} diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs new file mode 100644 index 00000000..91d20f5f --- /dev/null +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs @@ -0,0 +1,126 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.SaveMusicTrack; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.IntegrationTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Http.Json; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.IntegrationTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.SaveMusicTrack; + +/// +/// Contains integration tests for the class. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicTrackEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly UpdateMusicTrackRequestFixture _updateMusicTrackRequestFixture = new(); + private readonly MusicTrackDtoFixture _musicTrackDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public SaveMusicTrackEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task SaveMusicTrack_WhenCalledByAuthenticatedUserWithAntiforgeryToken_ShouldForwardUpdateAndReturnSuccess() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + UpdateMusicTrackRequest request = _updateMusicTrackRequestFixture.Create(); + MusicTrackDto expectedTrack = _musicTrackDtoFixture.Create(id: trackId, albumId: albumId, libraryId: libraryId); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}", expectedTrack); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId, albumId, trackId, libraryId, request); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using JsonDocument json = JsonDocument.Parse(content); + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(trackId, json.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}" && putRequest.Data is UpdateMusicTrackRequest forwarded && forwarded.Metadata!.Title == request.Metadata!.Title && forwarded.Path == request.Path); + } + + [Fact] + public async Task SaveMusicTrack_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequest() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + UpdateMusicTrackRequest request = _updateMusicTrackRequestFixture.Create(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId, albumId, trackId, libraryId, request); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}"); + } + + [Fact] + public async Task SaveMusicTrack_WhenNotAuthenticated_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), _updateMusicTrackRequestFixture.Create()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + /// + /// Builds the save request that PUTs the given to the track identified by the route, + /// with the owning library passed through the query string. + /// + /// The route Id of the artist the track belongs to. + /// The route Id of the album the track belongs to. + /// The route Id of the track to save. + /// The Id of the media library the track belongs to. + /// The track data to send. + /// The configured save request. + private static HttpRequestMessage CreateSaveRequest(Guid artistId, Guid albumId, Guid trackId, Guid libraryId, UpdateMusicTrackRequest request) + { + HttpRequestMessage saveRequest = new(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-save-track?libraryId={libraryId}") + { + Content = JsonContent.Create(request) + }; + saveRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + saveRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return saveRequest; + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs new file mode 100644 index 00000000..f91858f0 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs @@ -0,0 +1,113 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.DeleteMusicAlbum; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.DeleteMusicAlbum; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicAlbumEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public DeleteMusicAlbumEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Theory] + [InlineData("'; DROP TABLE Albums; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task DeleteMusicAlbum_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverDeleteAnotherAlbum(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterDeleteSuccess($"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}"); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(maliciousId, maliciousId, libraryId.ToString()); + deleteRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains($"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}", _apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicAlbum_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequestAndNotCallApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(artistId.ToString(), albumId.ToString(), libraryId.ToString()); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicAlbum_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + /// + /// Builds the delete request for the album identified by the route, with the owning library passed through the query string. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw query value of the library Id. + /// The configured delete request. + private static HttpRequestMessage CreateDeleteRequest(string artistId, string albumId, string libraryId) + { + HttpRequestMessage deleteRequest = new(HttpMethod.Delete, $"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(artistId)}/albums/{Uri.EscapeDataString(albumId)}/api-delete-album?libraryId={Uri.EscapeDataString(libraryId)}") + { + // The front-end sends the JSON content type even for DELETE requests, which triggers the antiforgery validation. + Content = new StringContent("{}", Encoding.UTF8, "application/json") + }; + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. + deleteRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + deleteRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return deleteRequest; + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointTests.cs new file mode 100644 index 00000000..befc3ecd --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/EditMusicAlbum/EditMusicAlbumViewEndpointTests.cs @@ -0,0 +1,43 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.EditMusicAlbum; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.EditMusicAlbum; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class EditMusicAlbumViewEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public EditMusicAlbumViewEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task EditMusicAlbum_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient client = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await client.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Equal("http://localhost/en-us/auth/login", response.Headers.Location!.ToString()); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs new file mode 100644 index 00000000..e678722a --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs @@ -0,0 +1,75 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetArtistAlbums; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetArtistAlbums; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetArtistAlbumsEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly PaginatedMusicAlbumLiteDtoFixture _paginatedMusicAlbumLiteDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetArtistAlbumsEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetArtistAlbums_WhenCalledWithoutAuthentication_ShouldRedirectToLoginWithoutCallingApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/albums/api-get-albums?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } + + [Theory] + [InlineData("'; DROP TABLE Albums; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task GetArtistAlbums_WithSQLInjectionInArtistId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{normalizedId}/albums/lite", _paginatedMusicAlbumLiteDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(maliciousId)}/albums/api-get-albums?libraryId={libraryId}"); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using (JsonDocument json = JsonDocument.Parse(content)) + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(maliciousId, content, StringComparison.Ordinal); + Assert.Contains(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint == $"libraries/{libraryId}/artists/{normalizedId}/albums/lite"); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs new file mode 100644 index 00000000..f84c387a --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs @@ -0,0 +1,79 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetMusicAlbum; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetMusicAlbum; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicAlbumEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly MusicAlbumDtoFixture _musicAlbumDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetMusicAlbumEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetMusicAlbum_WhenCalledWithoutAuthentication_ShouldRedirectToLoginWithoutCallingApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/api-get-album?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } + + [Theory] + [InlineData("'; DROP TABLE Albums; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task GetMusicAlbum_WithSQLInjectionInRouteId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + MusicAlbumDto expectedAlbum = _musicAlbumDtoFixture.Create(); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}", expectedAlbum); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(maliciousId)}/albums/{Uri.EscapeDataString(maliciousId)}/api-get-album?libraryId={libraryId}"); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + // The route values are normalized to Guids before they are substituted into the upstream URL, so a crafted route value can never escape + // its URL segment or reach a different album lookup; the Web layer must not fail local binding, leak stack traces or database details. + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using (JsonDocument json = JsonDocument.Parse(content)) + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(maliciousId, content, StringComparison.Ordinal); + Assert.Contains(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint == $"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}"); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs new file mode 100644 index 00000000..de55bc26 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs @@ -0,0 +1,179 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.SaveMusicAlbum; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Http.Json; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.SaveMusicAlbum; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicAlbumEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly UpdateMusicAlbumRequestFixture _updateMusicAlbumRequestFixture = new(); + private readonly MusicAlbumDtoFixture _musicAlbumDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public SaveMusicAlbumEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Theory] + [InlineData("'; DROP TABLE Albums; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task SaveMusicAlbum_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverCallAnotherAlbum(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}", _musicAlbumDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(maliciousId, maliciousId, libraryId.ToString(), _updateMusicAlbumRequestFixture.Create()); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + // The route is authoritative and its values are normalized to Guids before they are substituted into the upstream URL, so a crafted + // route value can never escape its URL segment or redirect the update to another album, and the response must not leak stack traces + // or database details. + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}"); + } + + [Theory] + [InlineData("'; DROP TABLE Albums; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task SaveMusicAlbum_WithSQLInjectionInLibraryQueryId_ShouldNormalizeTheLibraryId(string maliciousLibraryId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{normalizedId}/artists/{artistId}/albums/{albumId}", _musicAlbumDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId.ToString(), albumId.ToString(), maliciousLibraryId, _updateMusicAlbumRequestFixture.Create()); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{normalizedId}/artists/{artistId}/albums/{albumId}"); + } + + [Theory] + [InlineData("'; DROP TABLE Albums; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task SaveMusicAlbum_WithSQLInjectionInPostedTitle_ShouldNotLeakOrExecuteIt(string maliciousTitle) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + UpdateMusicAlbumRequest request = _updateMusicAlbumRequestFixture.Create(); + request.Metadata!.Title = maliciousTitle; + MusicAlbumDto expectedAlbum = _musicAlbumDtoFixture.Create(id: albumId); + expectedAlbum.Metadata!.Title = maliciousTitle; + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}", expectedAlbum); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId.ToString(), albumId.ToString(), libraryId.ToString(), request); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/albums/{albumId}" && putRequest.Data is UpdateMusicAlbumRequest forwarded && forwarded.Metadata!.Title == maliciousTitle); + } + + [Fact] + public async Task SaveMusicAlbum_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequestAndNotCallApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId.ToString(), albumId.ToString(), libraryId.ToString(), _updateMusicAlbumRequestFixture.Create()); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + [Fact] + public async Task SaveMusicAlbum_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), _updateMusicAlbumRequestFixture.Create()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + /// + /// Builds the save request that PUTs the given to the album identified by the route, + /// with the owning library passed through the query string. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw query value of the library Id. + /// The album data to send. + /// The configured save request. + private static HttpRequestMessage CreateSaveRequest(string artistId, string albumId, string libraryId, UpdateMusicAlbumRequest request) + { + HttpRequestMessage saveRequest = new(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(artistId)}/albums/{Uri.EscapeDataString(albumId)}/api-save-album?libraryId={Uri.EscapeDataString(libraryId)}") + { + Content = JsonContent.Create(request) + }; + saveRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + saveRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return saveRequest; + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs new file mode 100644 index 00000000..a4424354 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs @@ -0,0 +1,162 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly UpdateMusicCoverDtoFixture _updateMusicCoverDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public UpdateAlbumCoverEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Theory] + [InlineData("'; DROP TABLE Albums; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task UpdateAlbumCover_WithSQLInjectionInRouteId_ShouldNeverReachAnAlbumOrLeakData(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{Guid.Empty}/albums/{Guid.Empty}/cover", _updateMusicCoverDtoFixture.Create(coverPath: "/media/albums/cover.png")); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(maliciousId, maliciousId, libraryId.ToString(), "cover.png"); + uploadRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + // The route is authoritative: an unparseable route value becomes an empty album or artist Id, so the upload can never reach a real album. + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{Guid.Empty}/albums/{Guid.Empty}/cover"); + } + + [Theory] + [InlineData("'; DROP TABLE MusicArtwork; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task UpdateAlbumCover_WithSQLInjectionInLibraryQueryId_ShouldNormalizeItAndNotLeakData(string maliciousLibraryId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{Guid.Empty}/artists/{artistId}/albums/{albumId}/cover", _updateMusicCoverDtoFixture.Create(coverPath: "/media/albums/cover.png")); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(artistId.ToString(), albumId.ToString(), maliciousLibraryId, "cover.png"); + uploadRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + // The library id is normalized to a Guid before it is substituted into the upstream URL, so a crafted value can never escape its URL segment. + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(maliciousLibraryId, content, StringComparison.Ordinal); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{Guid.Empty}/artists/{artistId}/albums/{albumId}/cover"); + } + + [Fact] + public async Task UpdateAlbumCover_WithPathTraversalFileName_ShouldNotLeakData() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover", _updateMusicCoverDtoFixture.Create(coverPath: "/media/albums/cover.png")); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(artistId.ToString(), albumId.ToString(), libraryId.ToString(), "..\\..\\evil.png"); + uploadRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("..\\", content, StringComparison.Ordinal); + } + + [Fact] + public async Task UpdateAlbumCover_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequestAndNotCallApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(artistId.ToString(), albumId.ToString(), libraryId.ToString(), "cover.png"); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + [Fact] + public async Task UpdateAlbumCover_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), "cover.png"); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(uploadRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + /// + /// Builds the multipart PUT request that uploads a cover to the album identified by the route. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw query value of the library Id. + /// The name of the uploaded file. + /// The configured upload request. + private static HttpRequestMessage CreateUploadRequest(string artistId, string albumId, string libraryId, string fileName) + { + MultipartFormDataContent form = []; + ByteArrayContent fileContent = new(Encoding.UTF8.GetBytes("fake cover payload")); + fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + form.Add(fileContent, "cover", fileName); + return new HttpRequestMessage(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(artistId)}/albums/{Uri.EscapeDataString(albumId)}/api-update-cover?libraryId={Uri.EscapeDataString(libraryId)}") + { + Content = form + }; + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs new file mode 100644 index 00000000..377f1e60 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs @@ -0,0 +1,111 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.DeleteMusicArtist; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.DeleteMusicArtist; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicArtistEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public DeleteMusicArtistEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Theory] + [InlineData("'; DROP TABLE Artists; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task DeleteMusicArtist_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverDeleteAnotherArtist(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterDeleteSuccess($"libraries/{libraryId}/artists/{normalizedId}"); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(maliciousId, libraryId.ToString()); + deleteRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains($"libraries/{libraryId}/artists/{normalizedId}", _apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicArtist_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequestAndNotCallApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(artistId.ToString(), libraryId.ToString()); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicArtist_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + /// + /// Builds the delete request for the artist identified by the route, with the owning library passed through the query string. + /// + /// The raw route value of the artist Id. + /// The raw query value of the library Id. + /// The configured delete request. + private static HttpRequestMessage CreateDeleteRequest(string artistId, string libraryId) + { + HttpRequestMessage deleteRequest = new(HttpMethod.Delete, $"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(artistId)}/api-delete-artist?libraryId={Uri.EscapeDataString(libraryId)}") + { + // The front-end sends the JSON content type even for DELETE requests, which triggers the antiforgery validation. + Content = new StringContent("{}", Encoding.UTF8, "application/json") + }; + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. + deleteRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + deleteRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return deleteRequest; + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointTests.cs new file mode 100644 index 00000000..25391c57 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/EditMusicArtist/EditMusicArtistViewEndpointTests.cs @@ -0,0 +1,44 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.EditMusicArtist; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.EditMusicArtist; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class EditMusicArtistViewEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public EditMusicArtistViewEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task EditMusicArtist_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient client = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await client.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Equal("http://localhost/en-us/auth/login", response.Headers.Location!.ToString()); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs new file mode 100644 index 00000000..6cbdf0f7 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs @@ -0,0 +1,79 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtist; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtist; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicArtistEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly MusicArtistDtoFixture _musicArtistDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetMusicArtistEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetMusicArtist_WhenCalledWithoutAuthentication_ShouldRedirectToLoginWithoutCallingApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/api-get-artist?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } + + [Theory] + [InlineData("'; DROP TABLE Artists; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task GetMusicArtist_WithSQLInjectionInRouteId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + MusicArtistDto expectedArtist = _musicArtistDtoFixture.Create(); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{normalizedId}", expectedArtist); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(maliciousId)}/api-get-artist?libraryId={libraryId}"); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + // The route value is normalized to a Guid before it is substituted into the upstream URL, so a crafted route value can never escape + // its URL segment or reach a different artist lookup; the Web layer must not fail local binding, leak stack traces or database details. + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using (JsonDocument json = JsonDocument.Parse(content)) + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(maliciousId, content, StringComparison.Ordinal); + Assert.Contains($"libraries/{libraryId}/artists/{normalizedId}", _apiFactory.ApiClientStub.GetEndpointsCalled); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs new file mode 100644 index 00000000..358b78c1 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs @@ -0,0 +1,131 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtists; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtists; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicArtistsEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly PaginatedMusicArtistLiteDtoFixture _paginatedMusicArtistLiteDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetMusicArtistsEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetMusicArtists_WhenCalledWithoutAuthentication_ShouldRedirectToLoginWithoutCallingApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/api-get-artists?libraryId={Guid.NewGuid()}&shouldIgnoreThePrefixForAlphaPicker=false"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } + + [Theory] + [InlineData("'; DROP TABLE Artists--")] // destructive SQL injection + [InlineData("' OR '1'='1")] // basic SQL injection + public async Task GetMusicArtists_WhenCalledWithInjectionInSearchTerm_ShouldRemainSecure(string maliciousSearchTerm) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string expectedEndpoint = $"libraries/{libraryId}/artists/lite?searchTerm={Uri.EscapeDataString(maliciousSearchTerm)}&shouldIgnoreThePrefixForAlphaPicker=False"; + _apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, _paginatedMusicArtistLiteDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/library/audio-library/music-library/artists/api-get-artists?libraryId={libraryId}&searchTerm={Uri.EscapeDataString(maliciousSearchTerm)}&shouldIgnoreThePrefixForAlphaPicker=false"); + getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(getRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("stack trace", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("password", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("hash", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("salt", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(AppContext.BaseDirectory, content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(maliciousSearchTerm, content, StringComparison.Ordinal); + Assert.Contains(expectedEndpoint, _apiFactory.ApiClientStub.GetEndpointsCalled); + } + + [Theory] + [InlineData("'; DROP TABLE Artists--")] // destructive SQL injection + [InlineData("' OR '1'='1")] // basic SQL injection + public async Task GetMusicArtists_WhenCalledWithInjectionInFilterAlphaKey_ShouldRemainSecure(string maliciousAlphaKey) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string expectedEndpoint = $"libraries/{libraryId}/artists/lite?filterAlphaKey={Uri.EscapeDataString(maliciousAlphaKey)}&shouldIgnoreThePrefixForAlphaPicker=False"; + _apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, _paginatedMusicArtistLiteDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/library/audio-library/music-library/artists/api-get-artists?libraryId={libraryId}&filterAlphaKey={Uri.EscapeDataString(maliciousAlphaKey)}&shouldIgnoreThePrefixForAlphaPicker=false"); + getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(getRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(maliciousAlphaKey, content, StringComparison.Ordinal); + Assert.Contains(expectedEndpoint, _apiFactory.ApiClientStub.GetEndpointsCalled); + } + + [Theory] + [InlineData("'; DROP TABLE Artists--")] // destructive SQL injection + [InlineData("' OR '1'='1")] // basic SQL injection + public async Task GetMusicArtists_WhenCalledWithInjectionInSortBy_ShouldRemainSecure(string maliciousSortBy) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string expectedEndpoint = $"libraries/{libraryId}/artists/lite?shouldIgnoreThePrefixForAlphaPicker=False&sortBy={Uri.EscapeDataString(maliciousSortBy)}"; + _apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, _paginatedMusicArtistLiteDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage getRequest = new(HttpMethod.Get, $"/en-us/library/audio-library/music-library/artists/api-get-artists?libraryId={libraryId}&sortBy={Uri.EscapeDataString(maliciousSortBy)}&shouldIgnoreThePrefixForAlphaPicker=false"); + getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(getRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + response.EnsureSuccessStatusCode(); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(maliciousSortBy, content, StringComparison.Ordinal); + Assert.Contains(expectedEndpoint, _apiFactory.ApiClientStub.GetEndpointsCalled); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs new file mode 100644 index 00000000..3b8b3453 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs @@ -0,0 +1,45 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.Index; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.Index; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicArtistsIndexViewEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public MusicArtistsIndexViewEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task MusicArtistsIndex_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient client = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await client.GetAsync($"/en-us/library/audio-library/music-library/artists?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Equal("http://localhost/en-us/auth/login", response.Headers.Location!.ToString()); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.Ordinal)); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs new file mode 100644 index 00000000..5af3b5a0 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs @@ -0,0 +1,174 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.SaveMusicArtist; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Http.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.SaveMusicArtist; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicArtistEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly UpdateMusicArtistRequestFixture _updateMusicArtistRequestFixture = new(); + private readonly MusicArtistDtoFixture _musicArtistDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public SaveMusicArtistEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Theory] + [InlineData("'; DROP TABLE Artists; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task SaveMusicArtist_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverCallAnotherArtist(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{normalizedId}", _musicArtistDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(maliciousId, libraryId.ToString(), _updateMusicArtistRequestFixture.Create()); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + // The route is authoritative and its value is normalized to a Guid before it is substituted into the upstream URL, so a crafted + // route value can never escape its URL segment or redirect the update to another artist, and the response must not leak stack traces + // or database details. + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{normalizedId}"); + } + + [Theory] + [InlineData("'; DROP TABLE Artists; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task SaveMusicArtist_WithSQLInjectionInLibraryQueryId_ShouldNormalizeTheLibraryId(string maliciousLibraryId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid artistId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{normalizedId}/artists/{artistId}", _musicArtistDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId.ToString(), maliciousLibraryId, _updateMusicArtistRequestFixture.Create()); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{normalizedId}/artists/{artistId}"); + } + + [Theory] + [InlineData("'; DROP TABLE Artists; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task SaveMusicArtist_WithSQLInjectionInPostedName_ShouldNotLeakOrExecuteIt(string maliciousName) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + UpdateMusicArtistRequest request = _updateMusicArtistRequestFixture.Create(); + request.Metadata!.Name = maliciousName; + MusicArtistDto expectedArtist = _musicArtistDtoFixture.Create(id: artistId); + expectedArtist.Metadata!.Name = maliciousName; + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{artistId}", expectedArtist); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId.ToString(), libraryId.ToString(), request); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}" && putRequest.Data is UpdateMusicArtistRequest forwarded && forwarded.Metadata!.Name == maliciousName); + } + + [Fact] + public async Task SaveMusicArtist_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequestAndNotCallApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId.ToString(), libraryId.ToString(), _updateMusicArtistRequestFixture.Create()); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + [Fact] + public async Task SaveMusicArtist_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), _updateMusicArtistRequestFixture.Create()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + /// + /// Builds the save request that PUTs the given to the artist identified by the route, + /// with the owning library passed through the query string. + /// + /// The raw route value of the artist Id. + /// The raw query value of the library Id. + /// The artist data to send. + /// The configured save request. + private static HttpRequestMessage CreateSaveRequest(string artistId, string libraryId, UpdateMusicArtistRequest request) + { + HttpRequestMessage saveRequest = new(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(artistId)}/api-save-artist?libraryId={Uri.EscapeDataString(libraryId)}") + { + Content = JsonContent.Create(request) + }; + saveRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + saveRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return saveRequest; + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs new file mode 100644 index 00000000..31b778d2 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs @@ -0,0 +1,158 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly UpdateMusicCoverDtoFixture _updateMusicCoverDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public UpdateArtistCoverEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Theory] + [InlineData("'; DROP TABLE Artists; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task UpdateArtistCover_WithSQLInjectionInRouteId_ShouldNeverReachAnArtistOrLeakData(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{Guid.Empty}/cover", _updateMusicCoverDtoFixture.Create(coverPath: "/media/artists/cover.png")); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(maliciousId, libraryId.ToString(), "cover.png"); + uploadRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + // The route is authoritative: an unparseable route value becomes an empty artist Id, so the upload can never reach a real artist. + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{Guid.Empty}/cover"); + } + + [Theory] + [InlineData("'; DROP TABLE MusicArtwork; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task UpdateArtistCover_WithSQLInjectionInLibraryQueryId_ShouldNormalizeItAndNotLeakData(string maliciousLibraryId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid artistId = Guid.NewGuid(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{Guid.Empty}/artists/{artistId}/cover", _updateMusicCoverDtoFixture.Create(coverPath: "/media/artists/cover.png")); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(artistId.ToString(), maliciousLibraryId, "cover.png"); + uploadRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + // The library id is normalized to a Guid before it is substituted into the upstream URL, so a crafted value can never escape its URL segment. + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(maliciousLibraryId, content, StringComparison.Ordinal); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{Guid.Empty}/artists/{artistId}/cover"); + } + + [Fact] + public async Task UpdateArtistCover_WithPathTraversalFileName_ShouldNotLeakData() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{artistId}/cover", _updateMusicCoverDtoFixture.Create(coverPath: "/media/artists/cover.png")); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(artistId.ToString(), libraryId.ToString(), "..\\..\\evil.png"); + uploadRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("..\\", content, StringComparison.Ordinal); + } + + [Fact] + public async Task UpdateArtistCover_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequestAndNotCallApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(artistId.ToString(), libraryId.ToString(), "cover.png"); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(uploadRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + [Fact] + public async Task UpdateArtistCover_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage uploadRequest = CreateUploadRequest(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), "cover.png"); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(uploadRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + /// + /// Builds the multipart PUT request that uploads a cover to the artist identified by the route. + /// + /// The raw route value of the artist Id. + /// The raw query value of the library Id. + /// The name of the uploaded file. + /// The configured upload request. + private static HttpRequestMessage CreateUploadRequest(string artistId, string libraryId, string fileName) + { + MultipartFormDataContent form = []; + ByteArrayContent fileContent = new(Encoding.UTF8.GetBytes("fake cover payload")); + fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); + form.Add(fileContent, "cover", fileName); + return new HttpRequestMessage(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(artistId)}/api-update-cover?libraryId={Uri.EscapeDataString(libraryId)}") + { + Content = form + }; + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs new file mode 100644 index 00000000..9206fb16 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs @@ -0,0 +1,142 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.DeleteMusicTrack; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.DeleteMusicTrack; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicTrackEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public DeleteMusicTrackEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Theory] + [InlineData("'; DROP TABLE Tracks; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task DeleteMusicTrack_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverDeleteAnotherTrack(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterDeleteSuccess($"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}/tracks/{normalizedId}"); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(maliciousId, maliciousId, maliciousId, libraryId.ToString()); + deleteRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains($"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}/tracks/{normalizedId}", _apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Theory] + [InlineData("'; DROP TABLE Tracks; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task DeleteMusicTrack_WithSQLInjectionInLibraryQueryId_ShouldNormalizeTheLibraryId(string maliciousLibraryId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterDeleteSuccess($"libraries/{normalizedId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}"); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(artistId.ToString(), albumId.ToString(), trackId.ToString(), maliciousLibraryId); + deleteRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains($"libraries/{normalizedId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}", _apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicTrack_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequestAndNotCallApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(artistId.ToString(), albumId.ToString(), trackId.ToString(), libraryId.ToString()); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + [Fact] + public async Task DeleteMusicTrack_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage deleteRequest = CreateDeleteRequest(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(deleteRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.DeleteEndpointsCalled); + } + + /// + /// Builds the delete request for the track identified by the route, with the owning library passed through the query string. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw route value of the track Id. + /// The raw query value of the library Id. + /// The configured delete request. + private static HttpRequestMessage CreateDeleteRequest(string artistId, string albumId, string trackId, string libraryId) + { + HttpRequestMessage deleteRequest = new(HttpMethod.Delete, $"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(artistId)}/albums/{Uri.EscapeDataString(albumId)}/tracks/{Uri.EscapeDataString(trackId)}/api-delete-track?libraryId={Uri.EscapeDataString(libraryId)}") + { + // The front-end sends the JSON content type even for DELETE requests, which triggers the antiforgery validation. + Content = new StringContent("{}", Encoding.UTF8, "application/json") + }; + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. + deleteRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + deleteRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return deleteRequest; + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointTests.cs new file mode 100644 index 00000000..c15f28b4 --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/EditMusicTrack/EditMusicTrackViewEndpointTests.cs @@ -0,0 +1,78 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.EditMusicTrack; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.EditMusicTrack; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class EditMusicTrackViewEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly MusicTrackDtoFixture _musicTrackDtoFixture = new(); + private readonly MusicAlbumDtoFixture _musicAlbumDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public EditMusicTrackViewEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task EditMusicTrack_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient client = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await client.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/tracks/{Guid.NewGuid()}?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Equal("http://localhost/en-us/auth/login", response.Headers.Location!.ToString()); + } + + [Theory] + [InlineData("'; DROP TABLE Tracks; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task EditMusicTrack_WithSQLInjectionInRouteId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + MusicTrackDto expectedTrack = _musicTrackDtoFixture.Create(); + expectedTrack.Metadata!.Title = "A track"; + MusicAlbumDto expectedAlbum = _musicAlbumDtoFixture.Create(); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}/tracks/{normalizedId}", expectedTrack); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}", expectedAlbum); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(maliciousId)}/albums/{Uri.EscapeDataString(maliciousId)}/tracks/{Uri.EscapeDataString(maliciousId)}?libraryId={libraryId}"); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint == $"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}/tracks/{normalizedId}"); + Assert.Contains(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint == $"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}"); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs new file mode 100644 index 00000000..9949914d --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs @@ -0,0 +1,104 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetAlbumTracks; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetAlbumTracks; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetAlbumTracksEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly PaginatedMusicTrackLiteDtoFixture _paginatedMusicTrackLiteDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetAlbumTracksEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetAlbumTracks_WhenCalledWithoutAuthentication_ShouldRedirectToLoginWithoutCallingApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/tracks/api-get-tracks?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } + + [Theory] + [InlineData("'; DROP TABLE Tracks; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task GetAlbumTracks_WithSQLInjectionInArtistId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{normalizedId}/albums/{albumId}/tracks/lite", _paginatedMusicTrackLiteDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(maliciousId)}/albums/{albumId}/tracks/api-get-tracks?libraryId={libraryId}"); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using (JsonDocument json = JsonDocument.Parse(content)) + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(maliciousId, content, StringComparison.Ordinal); + Assert.Contains(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint == $"libraries/{libraryId}/artists/{normalizedId}/albums/{albumId}/tracks/lite"); + } + + [Theory] + [InlineData("'; DROP TABLE Tracks; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task GetAlbumTracks_WithSQLInjectionInAlbumId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{artistId}/albums/{normalizedId}/tracks/lite", _paginatedMusicTrackLiteDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/library/audio-library/music-library/artists/{artistId}/albums/{Uri.EscapeDataString(maliciousId)}/tracks/api-get-tracks?libraryId={libraryId}"); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using (JsonDocument json = JsonDocument.Parse(content)) + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(maliciousId, content, StringComparison.Ordinal); + Assert.Contains(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint == $"libraries/{libraryId}/artists/{artistId}/albums/{normalizedId}/tracks/lite"); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs new file mode 100644 index 00000000..71cd2b9b --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs @@ -0,0 +1,79 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetMusicTrack; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Text.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetMusicTrack; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicTrackEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly MusicTrackDtoFixture _musicTrackDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public GetMusicTrackEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Fact] + public async Task GetMusicTrack_WhenCalledWithoutAuthentication_ShouldRedirectToLoginWithoutCallingApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + + // Act + HttpResponseMessage response = await anonymousClient.GetAsync($"/en-us/library/audio-library/music-library/artists/{Guid.NewGuid()}/albums/{Guid.NewGuid()}/tracks/{Guid.NewGuid()}/api-get-track?libraryId={Guid.NewGuid()}"); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.DoesNotContain(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint.StartsWith("libraries/", StringComparison.OrdinalIgnoreCase)); + } + + [Theory] + [InlineData("'; DROP TABLE Tracks; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task GetMusicTrack_WithSQLInjectionInRouteId_ShouldNormalizeTheIdWithoutLeakingData(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + MusicTrackDto expectedTrack = _musicTrackDtoFixture.Create(); + _apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}/tracks/{normalizedId}", expectedTrack); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + + // Act + HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(maliciousId)}/albums/{Uri.EscapeDataString(maliciousId)}/tracks/{Uri.EscapeDataString(maliciousId)}/api-get-track?libraryId={libraryId}"); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + // The route values are normalized to Guids before they are substituted into the upstream URL, so a crafted route value can never escape + // its URL segment or reach a different track lookup; the Web layer must not fail local binding, leak stack traces or database details. + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + using (JsonDocument json = JsonDocument.Parse(content)) + Assert.True(json.RootElement.GetProperty("success").GetBoolean()); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain(maliciousId, content, StringComparison.Ordinal); + Assert.Contains(_apiFactory.ApiClientStub.GetEndpointsCalled, endpoint => endpoint == $"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}/tracks/{normalizedId}"); + } +} diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs new file mode 100644 index 00000000..2f7e8d4e --- /dev/null +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs @@ -0,0 +1,182 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.SaveMusicTrack; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Lumina.Presentation.Web.SecurityTests.Common.Setup; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Http.Json; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.SecurityTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.SaveMusicTrack; + +/// +/// Contains security tests for the class. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicTrackEndpointTests : IClassFixture +{ + private readonly LuminaWebFactory _apiFactory; + private readonly UpdateMusicTrackRequestFixture _updateMusicTrackRequestFixture = new(); + private readonly MusicTrackDtoFixture _musicTrackDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + /// Injected Web application factory. + public SaveMusicTrackEndpointTests(LuminaWebFactory apiFactory) + { + _apiFactory = apiFactory; + } + + [Theory] + [InlineData("'; DROP TABLE Tracks; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task SaveMusicTrack_WithSQLInjectionInRouteId_ShouldNormalizeTheIdAndNeverCallAnotherTrack(string maliciousId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}/tracks/{normalizedId}", _musicTrackDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(maliciousId, maliciousId, maliciousId, libraryId.ToString(), _updateMusicTrackRequestFixture.Create()); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + // The route is authoritative and its values are normalized to Guids before they are substituted into the upstream URL, so a crafted + // route value can never escape its URL segment or redirect the update to another track, and the response must not leak stack traces + // or database details. + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("at Lumina", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{normalizedId}/albums/{normalizedId}/tracks/{normalizedId}"); + } + + [Theory] + [InlineData("'; DROP TABLE Tracks; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task SaveMusicTrack_WithSQLInjectionInLibraryQueryId_ShouldNormalizeTheLibraryId(string maliciousLibraryId) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + string normalizedId = Guid.Empty.ToString(); + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{normalizedId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}", _musicTrackDtoFixture.Create()); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId.ToString(), albumId.ToString(), trackId.ToString(), maliciousLibraryId, _updateMusicTrackRequestFixture.Create()); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{normalizedId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}"); + } + + [Theory] + [InlineData("'; DROP TABLE Tracks; --")] // destructive injection + [InlineData("' OR '1'='1")] // boolean-based injection + public async Task SaveMusicTrack_WithSQLInjectionInPostedTitle_ShouldNotLeakOrExecuteIt(string maliciousTitle) + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + UpdateMusicTrackRequest request = _updateMusicTrackRequestFixture.Create(); + request.Metadata!.Title = maliciousTitle; + MusicTrackDto expectedTrack = _musicTrackDtoFixture.Create(id: trackId); + expectedTrack.Metadata!.Title = maliciousTitle; + _apiFactory.ApiClientStub.RegisterPutResponse($"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}", expectedTrack); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId.ToString(), albumId.ToString(), trackId.ToString(), libraryId.ToString(), request); + saveRequest.Headers.Add("RequestVerificationToken", webClient.AntiforgeryToken); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + string content = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("SqliteException", content, StringComparison.OrdinalIgnoreCase); + Assert.Contains(_apiFactory.ApiClientStub.PutRequests, putRequest => putRequest.Endpoint == $"libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}" && putRequest.Data is UpdateMusicTrackRequest forwarded && forwarded.Metadata!.Title == maliciousTitle); + } + + [Fact] + public async Task SaveMusicTrack_WhenCalledWithoutAntiforgeryToken_ShouldRejectRequestAndNotCallApi() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + Guid libraryId = Guid.NewGuid(); + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(artistId.ToString(), albumId.ToString(), trackId.ToString(), libraryId.ToString(), _updateMusicTrackRequestFixture.Create()); + + // Act + HttpResponseMessage response = await webClient.Client.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + [Fact] + public async Task SaveMusicTrack_WhenCalledWithoutAuthentication_ShouldRedirectToLogin() + { + // Arrange + _apiFactory.ApiClientStub.Reset(); + HttpClient anonymousClient = WebTestHelpers.CreateAnonymousClient(_apiFactory); + HttpRequestMessage saveRequest = CreateSaveRequest(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), _updateMusicTrackRequestFixture.Create()); + + // Act + HttpResponseMessage response = await anonymousClient.SendAsync(saveRequest); + + // Assert + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Empty(_apiFactory.ApiClientStub.PutRequests); + } + + /// + /// Builds the save request that PUTs the given to the track identified by the route, + /// with the owning library passed through the query string. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw route value of the track Id. + /// The raw query value of the library Id. + /// The track data to send. + /// The configured save request. + private static HttpRequestMessage CreateSaveRequest(string artistId, string albumId, string trackId, string libraryId, UpdateMusicTrackRequest request) + { + HttpRequestMessage saveRequest = new(HttpMethod.Put, $"/en-us/library/audio-library/music-library/artists/{Uri.EscapeDataString(artistId)}/albums/{Uri.EscapeDataString(albumId)}/tracks/{Uri.EscapeDataString(trackId)}/api-save-track?libraryId={Uri.EscapeDataString(libraryId)}") + { + Content = JsonContent.Create(request) + }; + saveRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + saveRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + return saveRequest; + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs new file mode 100644 index 00000000..6ac3d861 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/DeleteMusicAlbum/DeleteMusicAlbumEndpointTests.cs @@ -0,0 +1,145 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.DeleteMusicAlbum; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.DeleteMusicAlbum; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicAlbumEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly DeleteMusicAlbumEndpoint _sut; + + /// + /// Initializes a new instance of the class. + /// + public DeleteMusicAlbumEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalled_ShouldDeleteAlbumViaApiAndReturnSuccessWithoutData() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + ConfigureRequest(artistId.ToString(), albumId.ToString(), libraryId); + + // Act + IResult result = await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(libraryId, artistId, albumId), + Arg.Any()); + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.False(jsonDocument.RootElement.TryGetProperty("data", out JsonElement _)); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteIdsAreNotParseable_ShouldForwardGuidEmptyIdsToApi() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + ConfigureRequest("not-a-guid", "not-a-guid", libraryId); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(libraryId, Guid.Empty, Guid.Empty), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteIdsAreMissing_ShouldForwardGuidEmptyIdsToApi() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(libraryId, Guid.Empty, Guid.Empty), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryQueryIdIsNotParseable_ShouldForwardGuidEmptyLibraryIdToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + ConfigureRequest(artistId.ToString(), albumId.ToString(), "not-a-guid"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(Guid.Empty, artistId, albumId), + Arg.Any()); + } + + /// + /// Sets the route and query values the endpoint reads the album identities from. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw query value of the library Id. + private void ConfigureRequest(string artistId, string albumId, Guid libraryId) + { + ConfigureRequest(artistId, albumId, libraryId.ToString()); + } + + /// + /// Sets the route and query values the endpoint reads the album identities from. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw query value of the library Id. + private void ConfigureRequest(string artistId, string albumId, string libraryId) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId; + _sut.HttpContext.Request.RouteValues["albumId"] = albumId; + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + } + + /// + /// Builds the upstream endpoint the album deletion is expected to be sent to. + /// + /// The normalized Id of the media library. + /// The normalized Id of the artist. + /// The normalized Id of the album. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId, Guid artistId, Guid albumId) + { + return ApiRoutes.Music.DELETE_ALBUM + .Replace("{libraryId}", libraryId.ToString()) + .Replace("{artistId}", artistId.ToString()) + .Replace("{albumId}", albumId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs new file mode 100644 index 00000000..6fe7bda2 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetArtistAlbums/GetArtistAlbumsEndpointTests.cs @@ -0,0 +1,166 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetArtistAlbums; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetArtistAlbums; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetArtistAlbumsEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly GetArtistAlbumsEndpoint _sut; + private readonly GetArtistAlbumsLiteRequestFixture _getArtistAlbumsLiteRequestFixture = new(); + private readonly PaginatedMusicAlbumLiteDtoFixture _paginatedMusicAlbumLiteDtoFixture = new(); + private readonly MusicAlbumLiteDtoFixture _musicAlbumLiteDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public GetArtistAlbumsEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalledWithPagination_ShouldRequestAlbumsWithQueryParameters() + { + // Arrange + GetArtistAlbumsLiteRequest request = _getArtistAlbumsLiteRequestFixture.Create(currentPage: 2, perPage: 48); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicAlbumLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == $"{BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId))}?currentPage=2&perPage=48"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenCalledWithoutPagination_ShouldRequestAlbumsWithoutQueryParameters() + { + // Arrange + GetArtistAlbumsLiteRequest request = _getArtistAlbumsLiteRequestFixture.Create(); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicAlbumLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId))), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenOnlyCurrentPageIsProvided_ShouldAppendOnlyCurrentPage() + { + // Arrange + GetArtistAlbumsLiteRequest request = _getArtistAlbumsLiteRequestFixture.Create(currentPage: 3); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicAlbumLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == $"{BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId))}?currentPage=3"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenOnlyPerPageIsProvided_ShouldAppendOnlyPerPage() + { + // Arrange + GetArtistAlbumsLiteRequest request = _getArtistAlbumsLiteRequestFixture.Create(perPage: 24); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicAlbumLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == $"{BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId))}?perPage=24"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenArtistIdIsNotParseable_ShouldForwardGuidEmptyArtistIdToApi() + { + // Arrange + GetArtistAlbumsLiteRequest request = _getArtistAlbumsLiteRequestFixture.Create(artistId: "not-a-guid", currentPage: 1, perPage: 20); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicAlbumLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == $"{BuildExpectedEndpoint(request.LibraryId, Guid.Empty)}?currentPage=1&perPage=20"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenApiReturnsPaginatedAlbums_ShouldReturnSuccessJsonWithAlbums() + { + // Arrange + GetArtistAlbumsLiteRequest request = _getArtistAlbumsLiteRequestFixture.Create(); + PaginatedMusicAlbumLiteDto expectedResponse = _paginatedMusicAlbumLiteDtoFixture.Create( + data: [_musicAlbumLiteDtoFixture.Create(title: "Test Album")], + currentPage: 1, + perPage: 20, + count: 1, + numberOfPages: 1); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(expectedResponse); + + // Act + IResult result = await _sut.ExecuteAsync(request, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + JsonElement data = jsonDocument.RootElement.GetProperty("data"); + Assert.Equal(1, data.GetProperty("currentPage").GetInt32()); + Assert.Equal(1, data.GetProperty("data").GetArrayLength()); + } + + /// + /// Builds the upstream endpoint the artist album retrieval is expected to be sent to, without query parameters. + /// + /// The Id of the media library. + /// The normalized Id of the artist. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId, Guid artistId) + { + return ApiRoutes.Music.GET_ARTIST_ALBUMS_LITE + .Replace("{libraryId}", libraryId.ToString()) + .Replace("{artistId}", artistId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs new file mode 100644 index 00000000..a556f6f2 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/GetMusicAlbum/GetMusicAlbumEndpointTests.cs @@ -0,0 +1,127 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetMusicAlbum; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.GetMusicAlbum; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicAlbumEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly GetMusicAlbumEndpoint _sut; + private readonly GetMusicAlbumViewRequestFixture _getMusicAlbumViewRequestFixture = new(); + private readonly MusicAlbumDtoFixture _musicAlbumDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public GetMusicAlbumEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalled_ShouldRequestAlbumFromApiWithNormalizedIds() + { + // Arrange + GetMusicAlbumViewRequest request = _getMusicAlbumViewRequestFixture.Create(); + MusicAlbumDto expectedAlbum = _musicAlbumDtoFixture.Create(); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(expectedAlbum); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId), Guid.Parse(request.AlbumId))), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteIdsAreNotParseable_ShouldForwardGuidEmptyIdsToApi() + { + // Arrange + GetMusicAlbumViewRequest request = _getMusicAlbumViewRequestFixture.Create(artistId: "not-a-guid", albumId: "' OR '1'='1"); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_musicAlbumDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(request.LibraryId, Guid.Empty, Guid.Empty)), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteIdsAreEmpty_ShouldForwardGuidEmptyIdsToApi() + { + // Arrange + GetMusicAlbumViewRequest request = _getMusicAlbumViewRequestFixture.Create(artistId: string.Empty, albumId: string.Empty); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_musicAlbumDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(request.LibraryId, Guid.Empty, Guid.Empty)), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenApiReturnsAlbum_ShouldReturnSuccessJsonWithAlbum() + { + // Arrange + GetMusicAlbumViewRequest request = _getMusicAlbumViewRequestFixture.Create(); + MusicAlbumDto expectedAlbum = _musicAlbumDtoFixture.Create(); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(expectedAlbum); + + // Act + IResult result = await _sut.ExecuteAsync(request, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(expectedAlbum.Id, jsonDocument.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + } + + /// + /// Builds the upstream endpoint the album retrieval is expected to be sent to. + /// + /// The normalized Id of the media library. + /// The normalized Id of the artist. + /// The normalized Id of the album. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId, Guid artistId, Guid albumId) + { + return ApiRoutes.Music.GET_ALBUM + .Replace("{libraryId}", libraryId.ToString()) + .Replace("{artistId}", artistId.ToString()) + .Replace("{albumId}", albumId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs new file mode 100644 index 00000000..9495be24 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/SaveMusicAlbum/SaveMusicAlbumEndpointTests.cs @@ -0,0 +1,212 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.SaveMusicAlbum; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Albums; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.SaveMusicAlbum; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicAlbumEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly SaveMusicAlbumEndpoint _sut; + private readonly UpdateMusicAlbumRequestFixture _updateMusicAlbumRequestFixture = new(); + private readonly MusicAlbumDtoFixture _musicAlbumDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public SaveMusicAlbumEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalled_ShouldForwardUpdateMusicAlbumRequestToApiWithRouteAndQueryIds() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + UpdateMusicAlbumRequest request = _updateMusicAlbumRequestFixture.Create(); + MusicAlbumDto expectedAlbum = _musicAlbumDtoFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(expectedAlbum); + ConfigureRequest(artistId.ToString(), albumId.ToString(), libraryId); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, artistId, albumId)), + Arg.Is(forwardedRequest => forwardedRequest == request), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenArtistRouteIdIsNotParseable_ShouldForwardGuidEmptyArtistIdToApi() + { + // Arrange + const string MALICIOUS_ARTIST_ID = "not-a-guid"; + Guid albumId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + UpdateMusicAlbumRequest request = _updateMusicAlbumRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicAlbumDtoFixture.Create()); + ConfigureRequest(MALICIOUS_ARTIST_ID, albumId.ToString(), libraryId); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, Guid.Empty, albumId)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenAlbumRouteIdIsNotParseable_ShouldForwardGuidEmptyAlbumIdToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + const string MALICIOUS_ALBUM_ID = "' OR '1'='1"; + Guid libraryId = Guid.NewGuid(); + UpdateMusicAlbumRequest request = _updateMusicAlbumRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicAlbumDtoFixture.Create()); + ConfigureRequest(artistId.ToString(), MALICIOUS_ALBUM_ID, libraryId); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, artistId, Guid.Empty)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteIdsAreMissing_ShouldForwardGuidEmptyIdsToApi() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + UpdateMusicAlbumRequest request = _updateMusicAlbumRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicAlbumDtoFixture.Create()); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, Guid.Empty, Guid.Empty)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryQueryIdIsNotParseable_ShouldForwardGuidEmptyLibraryIdToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + const string MALICIOUS_LIBRARY_ID = "not-a-guid"; + UpdateMusicAlbumRequest request = _updateMusicAlbumRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicAlbumDtoFixture.Create()); + ConfigureRequest(artistId.ToString(), albumId.ToString(), MALICIOUS_LIBRARY_ID); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(Guid.Empty, artistId, albumId)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenApiReturnsUpdatedAlbum_ShouldReturnSuccessJsonWithAlbum() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + UpdateMusicAlbumRequest request = _updateMusicAlbumRequestFixture.Create(); + MusicAlbumDto expectedAlbum = _musicAlbumDtoFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(expectedAlbum); + ConfigureRequest(artistId.ToString(), albumId.ToString(), libraryId); + + // Act + IResult result = await _sut.ExecuteAsync(request, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(expectedAlbum.Id, jsonDocument.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + } + + /// + /// Sets the route and query values the endpoint reads the album identities from. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw query value of the library Id. + private void ConfigureRequest(string artistId, string albumId, Guid libraryId) + { + ConfigureRequest(artistId, albumId, libraryId.ToString()); + } + + /// + /// Sets the route and query values the endpoint reads the album identities from. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw query value of the library Id. + private void ConfigureRequest(string artistId, string albumId, string libraryId) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId; + _sut.HttpContext.Request.RouteValues["albumId"] = albumId; + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + } + + /// + /// Builds the upstream endpoint the album update is expected to be sent to. + /// + /// The normalized Id of the media library. + /// The normalized Id of the artist. + /// The normalized Id of the album. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId, Guid artistId, Guid albumId) + { + return ApiRoutes.Music.UPDATE_ALBUM + .Replace("{libraryId}", libraryId.ToString()) + .Replace("{artistId}", artistId.ToString()) + .Replace("{albumId}", albumId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs new file mode 100644 index 00000000..89ccaad1 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Albums/UpdateAlbumCover/UpdateAlbumCoverEndpointTests.cs @@ -0,0 +1,313 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Albums.UpdateAlbumCover; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateAlbumCoverEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly UpdateAlbumCoverEndpoint _sut; + private readonly UpdateMusicCoverDtoFixture _updateMusicCoverDtoFixture = new(); + private static readonly Guid s_libraryId = Guid.NewGuid(); + + /// + /// Initializes a new instance of the class. + /// + public UpdateAlbumCoverEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalledWithFile_ShouldUploadCoverToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: "/media/albums/cover.jpg")); + ConfigureRequest(artistId, albumId, [1, 2, 3], "cover.jpg"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(s_libraryId.ToString(), artistId, albumId)), + Arg.Any(), + Arg.Is(fileName => fileName == "cover.jpg"), + Arg.Is(fieldName => fieldName == "cover"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteIdsAreNotParseable_ShouldUploadCoverWithEmptyIds() + { + // Arrange + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: "/media/albums/cover.jpg")); + ConfigureRequest("not-a-guid", "not-a-guid", [1, 2, 3], "cover.jpg"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(s_libraryId.ToString(), Guid.Empty, Guid.Empty)), + Arg.Any(), + Arg.Any(), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryQueryIdIsNotParseable_ShouldUploadCoverWithEmptyLibraryId() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: "/media/albums/cover.jpg")); + ConfigureRequest(artistId, albumId, [1, 2, 3], "cover.jpg"); + // The query value is normalized to a Guid before it is substituted into the upstream URL, so a crafted value can never escape its segment. + _sut.HttpContext.Request.QueryString = new QueryString("?libraryId=not-a-library-guid"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(Guid.Empty.ToString(), artistId, albumId)), + Arg.Any(), + Arg.Any(), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryQueryIdIsMissing_ShouldUploadCoverWithEmptyLibraryId() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: "/media/albums/cover.jpg")); + ConfigureRequest(artistId, albumId, [1, 2, 3], "cover.jpg"); + _sut.HttpContext.Request.QueryString = new QueryString(string.Empty); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(Guid.Empty.ToString(), artistId, albumId)), + Arg.Any(), + Arg.Any(), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenApiReturnsCoverPath_ShouldReturnSuccessJsonWithPath() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + const string EXPECTED_PATH = "/media/albums/cover.jpg"; + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: EXPECTED_PATH)); + ConfigureRequest(artistId, albumId, [1, 2, 3], "cover.jpg"); + + // Act + IResult result = await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(EXPECTED_PATH, jsonDocument.RootElement.GetProperty("data").GetString()); + } + + [Fact] + public async Task ExecuteAsync_WhenFormHasNoFile_ShouldForwardRequestWithoutFileToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + const string EXPECTED_PATH = "/media/albums/cover.jpg"; + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: EXPECTED_PATH)); + ConfigureRequestWithoutFiles(artistId, albumId); + + // Act + IResult result = await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(s_libraryId.ToString(), artistId, albumId)), + Arg.Is(stream => stream == null), + Arg.Is(fileName => fileName == null), + Arg.Is(fieldName => fieldName == "cover"), + Arg.Any()); + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(EXPECTED_PATH, jsonDocument.RootElement.GetProperty("data").GetString()); + } + + [Fact] + public async Task ExecuteAsync_WhenRequestIsNotMultipart_ShouldForwardRequestWithoutFileToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + const string EXPECTED_PATH = "/media/albums/cover.jpg"; + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: EXPECTED_PATH)); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.RouteValues["albumId"] = albumId.ToString(); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={s_libraryId}"); + _sut.HttpContext.Request.ContentType = "application/json"; + + // Act + IResult result = await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(s_libraryId.ToString(), artistId, albumId)), + Arg.Is(stream => stream == null), + Arg.Is(fileName => fileName == null), + Arg.Is(fieldName => fieldName == "cover"), + Arg.Any()); + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(EXPECTED_PATH, jsonDocument.RootElement.GetProperty("data").GetString()); + } + + [Fact] + public async Task ExecuteAsync_WhenFormIsMalformed_ShouldForwardRequestWithoutFileToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + const string EXPECTED_PATH = "/media/albums/cover.jpg"; + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: EXPECTED_PATH)); + ConfigureMalformedRequest(artistId, albumId); + + // Act + IResult result = await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(s_libraryId.ToString(), artistId, albumId)), + Arg.Is(stream => stream == null), + Arg.Is(fileName => fileName == null), + Arg.Is(fieldName => fieldName == "cover"), + Arg.Any()); + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(EXPECTED_PATH, jsonDocument.RootElement.GetProperty("data").GetString()); + } + + /// + /// Configures a multipart form request carrying a single file. + /// + /// The route Id of the artist. + /// The route Id of the album whose cover is uploaded. + /// The bytes of the uploaded file. + /// The name of the uploaded file. + private void ConfigureRequest(Guid artistId, Guid albumId, byte[] content, string fileName) + { + ConfigureRequest(artistId.ToString(), albumId.ToString(), content, fileName); + } + + /// + /// Configures a multipart form request carrying a single file. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The bytes of the uploaded file. + /// The name of the uploaded file. + private void ConfigureRequest(string artistId, string albumId, byte[] content, string fileName) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId; + _sut.HttpContext.Request.RouteValues["albumId"] = albumId; + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={s_libraryId}"); + MemoryStream coverStream = new(content); + IFormFile formFile = new FormFile(coverStream, 0, content.Length, "cover", fileName); + FormFileCollection files = [formFile]; + IFormCollection form = new FormCollection([], files); + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + _sut.HttpContext.Features.Set(new FormFeature(form)); + } + + /// + /// Configures a multipart form request without any file. + /// + /// The route Id of the artist. + /// The route Id of the album whose cover is uploaded. + private void ConfigureRequestWithoutFiles(Guid artistId, Guid albumId) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.RouteValues["albumId"] = albumId.ToString(); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={s_libraryId}"); + IFormCollection form = new FormCollection([]); + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + _sut.HttpContext.Features.Set(new FormFeature(form)); + } + + /// + /// Configures a multipart form request whose body cannot be parsed. + /// + /// The route Id of the artist. + /// The route Id of the album whose cover is uploaded. + private void ConfigureMalformedRequest(Guid artistId, Guid albumId) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.RouteValues["albumId"] = albumId.ToString(); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={s_libraryId}"); + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + IFormCollection malformedForm = Substitute.For(); + malformedForm.Files.Returns(_ => throw new InvalidDataException("Malformed multipart body.")); + _sut.HttpContext.Features.Set(new FormFeature(malformedForm)); + } + + /// + /// Builds the upstream endpoint the cover upload is expected to be sent to. + /// + /// The raw Id of the media library. + /// The normalized Id of the artist. + /// The normalized Id of the album. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(string libraryId, Guid artistId, Guid albumId) + { + return ApiRoutes.Music.UPDATE_ALBUM_COVER + .Replace("{libraryId}", libraryId) + .Replace("{artistId}", artistId.ToString()) + .Replace("{albumId}", albumId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs new file mode 100644 index 00000000..ceb3550e --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/DeleteMusicArtist/DeleteMusicArtistEndpointTests.cs @@ -0,0 +1,128 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.DeleteMusicArtist; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.DeleteMusicArtist; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicArtistEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly DeleteMusicArtistEndpoint _sut; + + /// + /// Initializes a new instance of the class. + /// + public DeleteMusicArtistEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalled_ShouldDeleteArtistViaApiAndReturnSuccessWithoutData() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + ConfigureRequest(artistId.ToString(), libraryId.ToString()); + + // Act + IResult result = await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(libraryId, artistId), + Arg.Any()); + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.False(jsonDocument.RootElement.TryGetProperty("data", out JsonElement _)); + } + + [Fact] + public async Task ExecuteAsync_WhenArtistRouteIdIsNotParseable_ShouldForwardGuidEmptyArtistIdToApi() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + ConfigureRequest("not-a-guid", libraryId.ToString()); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(libraryId, Guid.Empty), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenArtistRouteIdIsMissing_ShouldForwardGuidEmptyArtistIdToApi() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(libraryId, Guid.Empty), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryQueryIdIsNotParseable_ShouldForwardGuidEmptyLibraryIdToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + ConfigureRequest(artistId.ToString(), "not-a-guid"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(Guid.Empty, artistId), + Arg.Any()); + } + + /// + /// Sets the route and query values the endpoint reads the artist identities from. + /// + /// The raw route value of the artist Id. + /// The raw query value of the library Id. + private void ConfigureRequest(string artistId, string libraryId) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId; + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + } + + /// + /// Builds the upstream endpoint the artist deletion is expected to be sent to. + /// + /// The normalized Id of the media library. + /// The normalized Id of the artist. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId, Guid artistId) + { + return ApiRoutes.Music.DELETE_ARTIST + .Replace("{libraryId}", libraryId.ToString()) + .Replace("{artistId}", artistId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs new file mode 100644 index 00000000..cd74891a --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtist/GetMusicArtistEndpointTests.cs @@ -0,0 +1,143 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtist; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtist; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicArtistEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly GetMusicArtistEndpoint _sut; + private readonly GetMusicArtistViewRequestFixture _getMusicArtistViewRequestFixture = new(); + private readonly MusicArtistDtoFixture _musicArtistDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public GetMusicArtistEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalled_ShouldRequestArtistFromApiWithNormalizedIds() + { + // Arrange + GetMusicArtistViewRequest request = _getMusicArtistViewRequestFixture.Create(); + MusicArtistDto expectedArtist = _musicArtistDtoFixture.Create(); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(expectedArtist); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId))), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteArtistIdIsNotParseable_ShouldForwardGuidEmptyArtistIdToApi() + { + // Arrange + GetMusicArtistViewRequest request = _getMusicArtistViewRequestFixture.Create(artistId: "not-a-guid"); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_musicArtistDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(request.LibraryId, Guid.Empty)), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteArtistIdIsMissing_ShouldForwardGuidEmptyArtistIdToApi() + { + // Arrange + GetMusicArtistViewRequest request = _getMusicArtistViewRequestFixture.Create(artistId: string.Empty); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_musicArtistDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(request.LibraryId, Guid.Empty)), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenApiReturnsArtist_ShouldReturnSuccessJsonWithArtist() + { + // Arrange + GetMusicArtistViewRequest request = _getMusicArtistViewRequestFixture.Create(); + MusicArtistDto expectedArtist = _musicArtistDtoFixture.Create(); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(expectedArtist); + + // Act + IResult result = await _sut.ExecuteAsync(request, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(expectedArtist.Id, jsonDocument.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + } + + [Fact] + public async Task ExecuteAsync_WhenCalled_ShouldForwardCancellationTokenToApi() + { + // Arrange + GetMusicArtistViewRequest request = _getMusicArtistViewRequestFixture.Create(); + using CancellationTokenSource cancellationTokenSource = new(); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_musicArtistDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, cancellationTokenSource.Token); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Any(), + Arg.Is(cancellationTokenSource.Token)); + } + + /// + /// Builds the upstream endpoint the artist retrieval is expected to be sent to. + /// + /// The Id of the media library the artist belongs to. + /// The normalized Id of the artist. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId, Guid artistId) + { + return ApiRoutes.Music.GET_ARTIST + .Replace("{libraryId}", libraryId.ToString()) + .Replace("{artistId}", artistId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs new file mode 100644 index 00000000..ec4f32dc --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/GetMusicArtists/GetMusicArtistsEndpointTests.cs @@ -0,0 +1,219 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Enums.Common; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtists; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.GetMusicArtists; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicArtistsEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly GetMusicArtistsEndpoint _sut; + private readonly GetMusicArtistsLiteRequestFixture _getMusicArtistsLiteRequestFixture = new(); + private readonly PaginatedMusicArtistLiteDtoFixture _paginatedMusicArtistLiteDtoFixture = new(); + private readonly MusicArtistLiteDtoFixture _musicArtistLiteDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public GetMusicArtistsEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalledWithAllParameters_ShouldBuildExactQueryString() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + const string SEARCH_TERM = " The Beatles "; + const string FILTER_ALPHA_KEY = "B"; + const string SORT_BY = "name asc"; + GetMusicArtistsLiteRequest request = _getMusicArtistsLiteRequestFixture.Create( + libraryId: libraryId, + currentPage: 2, + perPage: 48, + searchTerm: SEARCH_TERM, + filterAlphaKey: FILTER_ALPHA_KEY, + shouldIgnoreThePrefixForAlphaPicker: true, + sortBy: SORT_BY, + sortOrder: SortOrder.Descending); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicArtistLiteDtoFixture.Create()); + string expectedEndpoint = $"{BuildExpectedEndpoint(libraryId)}?currentPage=2&perPage=48" + + $"&searchTerm={Uri.EscapeDataString(SEARCH_TERM)}" + + $"&filterAlphaKey={Uri.EscapeDataString(FILTER_ALPHA_KEY)}" + + "&shouldIgnoreThePrefixForAlphaPicker=True" + + $"&sortBy={Uri.EscapeDataString(SORT_BY)}" + + "&sortOrder=Descending"; + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == expectedEndpoint), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenOptionalParametersAreOmitted_ShouldAppendOnlyTheIgnorePrefixFlag() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + GetMusicArtistsLiteRequest request = _getMusicArtistsLiteRequestFixture.Create( + libraryId: libraryId, + includeCurrentPage: false, + includePerPage: false, + includeSearchTerm: false, + includeFilterAlphaKey: false, + includeSortBy: false, + includeSortOrder: false); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicArtistLiteDtoFixture.Create()); + string expectedEndpoint = $"{BuildExpectedEndpoint(libraryId)}?shouldIgnoreThePrefixForAlphaPicker=False"; + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == expectedEndpoint), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenSearchTermHasSpecialCharacters_ShouldEscapeIt() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + const string SEARCH_TERM = "rock & roll"; + GetMusicArtistsLiteRequest request = _getMusicArtistsLiteRequestFixture.Create( + libraryId: libraryId, + searchTerm: SEARCH_TERM, + includeCurrentPage: false, + includePerPage: false, + includeFilterAlphaKey: false, + includeSortBy: false, + includeSortOrder: false); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicArtistLiteDtoFixture.Create()); + string expectedEndpoint = $"{BuildExpectedEndpoint(libraryId)}?searchTerm={Uri.EscapeDataString(SEARCH_TERM)}&shouldIgnoreThePrefixForAlphaPicker=False"; + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == expectedEndpoint), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenSearchTermAndAlphaKeyAndSortByAreWhitespace_ShouldOmitThem() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + GetMusicArtistsLiteRequest request = _getMusicArtistsLiteRequestFixture.Create( + libraryId: libraryId, + searchTerm: " ", + filterAlphaKey: " ", + sortBy: string.Empty, + includeCurrentPage: false, + includePerPage: false, + includeSortOrder: false); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicArtistLiteDtoFixture.Create()); + string expectedEndpoint = $"{BuildExpectedEndpoint(libraryId)}?shouldIgnoreThePrefixForAlphaPicker=False"; + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == expectedEndpoint), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenOnlyCurrentPageIsProvided_ShouldAppendOnlyCurrentPageAndTheIgnorePrefixFlag() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + GetMusicArtistsLiteRequest request = _getMusicArtistsLiteRequestFixture.Create( + libraryId: libraryId, + currentPage: 3, + includePerPage: false, + includeSearchTerm: false, + includeFilterAlphaKey: false, + includeSortBy: false, + includeSortOrder: false); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicArtistLiteDtoFixture.Create()); + string expectedEndpoint = $"{BuildExpectedEndpoint(libraryId)}?currentPage=3&shouldIgnoreThePrefixForAlphaPicker=False"; + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == expectedEndpoint), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenApiReturnsPaginatedArtists_ShouldReturnSuccessJsonWithArtists() + { + // Arrange + GetMusicArtistsLiteRequest request = _getMusicArtistsLiteRequestFixture.Create(); + PaginatedMusicArtistLiteDto expectedResponse = _paginatedMusicArtistLiteDtoFixture.Create( + data: [_musicArtistLiteDtoFixture.Create(name: "Test Artist")], + currentPage: 1, + perPage: 20, + count: 1, + numberOfPages: 1); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(expectedResponse); + + // Act + IResult result = await _sut.ExecuteAsync(request, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + JsonElement data = jsonDocument.RootElement.GetProperty("data"); + Assert.Equal(1, data.GetProperty("currentPage").GetInt32()); + Assert.Equal(1, data.GetProperty("data").GetArrayLength()); + } + + /// + /// Builds the upstream endpoint the artist retrieval is expected to be sent to, without query parameters. + /// + /// The Id of the media library whose artists are retrieved. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId) + { + return ApiRoutes.Music.GET_ARTISTS_LITE.Replace("{libraryId}", libraryId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs new file mode 100644 index 00000000..9dc17eff --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/Index/MusicArtistsIndexViewEndpointTests.cs @@ -0,0 +1,146 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.Libraries; +using Lumina.Presentation.Web.Common.DTO.Themes; +using Lumina.Presentation.Web.Common.Http; +using Lumina.Presentation.Web.Common.Primitives; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Common.Services; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.Index; +using Lumina.Presentation.Web.Core.Themes; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Libraries; +using Lumina.Presentation.Web.Fixtures.Common.DTO.Themes; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Antiforgery; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.HttpResults; +using Microsoft.Extensions.Localization; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.Index; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class MusicArtistsIndexViewEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly IUrlService _mockUrlService; + private readonly ThemePageRenderer _mockThemePageRenderer; + private readonly IAntiforgery _mockAntiforgery; + private readonly IStringLocalizerFactory _mockStringLocalizerFactory; + private readonly IStringLocalizer _mockStringLocalizer; + private readonly MusicArtistsIndexViewEndpoint _sut; + private readonly LibraryDtoFixture _libraryDtoFixture = new(); + private readonly GetMusicArtistsViewRequestFixture _getMusicArtistsViewRequestFixture = new(); + private readonly ThemePageRenderResultDtoFixture _themePageRenderResultDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public MusicArtistsIndexViewEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _mockUrlService = Substitute.For(); + _mockThemePageRenderer = Substitute.For(new ThemeService(_mockApiHttpClient), new ThemeTemplateEngine()); + _mockAntiforgery = Substitute.For(); + _mockAntiforgery.GetAndStoreTokens(Arg.Any()) + .Returns(new AntiforgeryTokenSet("request-token", "cookie-token", "__RequestVerificationToken", "RequestVerificationToken")); + _mockStringLocalizer = Substitute.For(); + _mockStringLocalizer.GetAllStrings(Arg.Any()).Returns(new LocalizedString[] { new("Search", "Search") }); + _mockStringLocalizerFactory = Substitute.For(); + _mockStringLocalizerFactory.Create(Arg.Any(), Arg.Any()).Returns(_mockStringLocalizer); + _sut = Factory.Create(_mockApiHttpClient, _mockUrlService, _mockThemePageRenderer, _mockAntiforgery, _mockStringLocalizerFactory); + TestHttpContextFactory.ConfigureSession(_sut.HttpContext, TestHttpContextFactory.CreateSession()); + _sut.HttpContext.Request.Path = "/en-us/library/audio-library/music-library/artists"; + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryIdIsNull_ShouldRedirectToHome() + { + // Arrange + _mockUrlService.GetAbsoluteUrl(WebRoutes.Home.INDEX_CULTURED).Returns("http://localhost/en-us"); + + // Act + IResult result = await _sut.ExecuteAsync(_getMusicArtistsViewRequestFixture.Create(libraryId: null), CancellationToken.None); + + // Assert + RedirectHttpResult redirectResult = Assert.IsType(result); + Assert.Equal("http://localhost/en-us", redirectResult.Url); + await _mockApiHttpClient.DidNotReceive().GetAsync(Arg.Any(), Arg.Any()); + await _mockThemePageRenderer.DidNotReceive().RenderAsync(Arg.Any(), Arg.Any(), Arg.Any()); + _mockAntiforgery.DidNotReceive().GetAndStoreTokens(Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryIdProvided_ShouldRenderThemedPageThroughTheSharedView() + { + // Arrange + LibraryDto expectedLibrary = _libraryDtoFixture.Create(); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(expectedLibrary); + _mockUrlService.GetAbsoluteUrl(WebRoutes.Music.GET_ARTISTS).Returns("http://localhost/en-us/library/audio-library/music-library/artists/api-get-artists"); + _mockUrlService.GetAbsoluteUrl(WebRoutes.Settings.GET_USER_SETTINGS).Returns("http://localhost/en-us/tools/settings/api-get-user-settings"); + _mockUrlService.GetAbsoluteUrl(WebRoutes.Music.ARTIST, Arg.Any()).Returns("http://localhost/en-us/library/audio-library/music-library/artists/00000000-0000-0000-0000-000000000000"); + _mockUrlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_ARTIST, Arg.Any()).Returns("http://localhost/en-us/library/audio-library/music-library/artists/00000000-0000-0000-0000-000000000000/api-delete-artist"); + _mockThemePageRenderer.RenderAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.From(_themePageRenderResultDtoFixture.Create(content: "
content
", script: ""))); + + // Act + IResult result = await _sut.ExecuteAsync(_getMusicArtistsViewRequestFixture.Create(libraryId: expectedLibrary.Id), CancellationToken.None); + + // Assert + Assert.IsType(result); + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == ApiRoutes.Libraries.GET_LIBRARY_BY_ID.Replace("{id}", expectedLibrary.Id.ToString())), + Arg.Any()); + await _mockThemePageRenderer.Received(1).RenderAsync( + Arg.Is(page => + page.PageKey == "library/audio-library/music-library/artists/index" && + page.Title == expectedLibrary.Title && + page.PageData.ContainsKey("libraryId") && + page.PageData.ContainsKey("settingsUrl") && + page.PageData.ContainsKey("strings") && + string.Equals( + page.PageData["itemsUrl"] as string, + "http://localhost/en-us/library/audio-library/music-library/artists/api-get-artists", + StringComparison.Ordinal) && + string.Equals( + page.PageData["artistUrl"] as string, + "http://localhost/en-us/library/audio-library/music-library/artists/00000000-0000-0000-0000-000000000000", + StringComparison.Ordinal) && + string.Equals( + page.PageData["deleteUrl"] as string, + "http://localhost/en-us/library/audio-library/music-library/artists/00000000-0000-0000-0000-000000000000/api-delete-artist", + StringComparison.Ordinal)), + Arg.Is(requestedThemeId => requestedThemeId == null), + Arg.Any()); + _mockAntiforgery.Received(1).GetAndStoreTokens(Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenThemeRenderingFails_ShouldFallBackToRazorView() + { + // Arrange + LibraryDto expectedLibrary = _libraryDtoFixture.Create(); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(expectedLibrary); + _mockThemePageRenderer.RenderAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(Result.Failure(Error.Failure("Theme.Render", "The page could not be rendered."))); + + // Act + IResult result = await _sut.ExecuteAsync(_getMusicArtistsViewRequestFixture.Create(libraryId: expectedLibrary.Id), CancellationToken.None); + + // Assert + Assert.IsType(result); + await _mockThemePageRenderer.Received(1).RenderAsync(Arg.Any(), Arg.Any(), Arg.Any()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs new file mode 100644 index 00000000..4ce780f2 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/SaveMusicArtist/SaveMusicArtistEndpointTests.cs @@ -0,0 +1,181 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.SaveMusicArtist; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Artists; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.SaveMusicArtist; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicArtistEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly SaveMusicArtistEndpoint _sut; + private readonly UpdateMusicArtistRequestFixture _updateMusicArtistRequestFixture = new(); + private readonly MusicArtistDtoFixture _musicArtistDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public SaveMusicArtistEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalled_ShouldForwardUpdateMusicArtistRequestToApiWithRouteAndQueryIds() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + UpdateMusicArtistRequest request = _updateMusicArtistRequestFixture.Create(); + MusicArtistDto expectedArtist = _musicArtistDtoFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(expectedArtist); + ConfigureRequest(artistId.ToString(), libraryId); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, artistId)), + Arg.Is(forwardedRequest => forwardedRequest == request), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenArtistRouteIdIsNotParseable_ShouldForwardGuidEmptyArtistIdToApi() + { + // Arrange + const string MALICIOUS_ARTIST_ID = "not-a-guid"; + Guid libraryId = Guid.NewGuid(); + UpdateMusicArtistRequest request = _updateMusicArtistRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicArtistDtoFixture.Create()); + ConfigureRequest(MALICIOUS_ARTIST_ID, libraryId); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, Guid.Empty)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenArtistRouteIdIsMissing_ShouldForwardGuidEmptyArtistIdToApi() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + UpdateMusicArtistRequest request = _updateMusicArtistRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicArtistDtoFixture.Create()); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, Guid.Empty)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryQueryIdIsNotParseable_ShouldForwardGuidEmptyLibraryIdToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + const string MALICIOUS_LIBRARY_ID = "not-a-guid"; + UpdateMusicArtistRequest request = _updateMusicArtistRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicArtistDtoFixture.Create()); + ConfigureRequest(artistId.ToString(), MALICIOUS_LIBRARY_ID); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(Guid.Empty, artistId)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenApiReturnsUpdatedArtist_ShouldReturnSuccessJsonWithArtist() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + UpdateMusicArtistRequest request = _updateMusicArtistRequestFixture.Create(); + MusicArtistDto expectedArtist = _musicArtistDtoFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(expectedArtist); + ConfigureRequest(artistId.ToString(), libraryId); + + // Act + IResult result = await _sut.ExecuteAsync(request, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(expectedArtist.Id, jsonDocument.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + } + + /// + /// Sets the route and query values the endpoint reads the artist identities from. + /// + /// The raw route value of the artist Id. + /// The raw query value of the library Id. + private void ConfigureRequest(string artistId, Guid libraryId) + { + ConfigureRequest(artistId, libraryId.ToString()); + } + + /// + /// Sets the route and query values the endpoint reads the artist identities from. + /// + /// The raw route value of the artist Id. + /// The raw query value of the library Id. + private void ConfigureRequest(string artistId, string libraryId) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId; + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + } + + /// + /// Builds the upstream endpoint the artist update is expected to be sent to. + /// + /// The normalized Id of the media library. + /// The normalized Id of the artist. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId, Guid artistId) + { + return ApiRoutes.Music.UPDATE_ARTIST + .Replace("{libraryId}", libraryId.ToString()) + .Replace("{artistId}", artistId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs new file mode 100644 index 00000000..b71df8c9 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Artists/UpdateArtistCover/UpdateArtistCoverEndpointTests.cs @@ -0,0 +1,297 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Artists.UpdateArtistCover; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class UpdateArtistCoverEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly UpdateArtistCoverEndpoint _sut; + private readonly UpdateMusicCoverDtoFixture _updateMusicCoverDtoFixture = new(); + private static readonly Guid s_libraryId = Guid.NewGuid(); + + /// + /// Initializes a new instance of the class. + /// + public UpdateArtistCoverEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalledWithFile_ShouldUploadCoverToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: "/media/artists/cover.jpg")); + ConfigureRequest(artistId, [1, 2, 3], "cover.jpg"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(s_libraryId.ToString(), artistId)), + Arg.Any(), + Arg.Is(fileName => fileName == "cover.jpg"), + Arg.Is(fieldName => fieldName == "cover"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenArtistRouteIdIsNotParseable_ShouldUploadCoverWithEmptyId() + { + // Arrange + const string MALICIOUS_ARTIST_ID = "not-a-guid"; + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: "/media/artists/cover.jpg")); + ConfigureRequest(MALICIOUS_ARTIST_ID, [1, 2, 3], "cover.jpg"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(s_libraryId.ToString(), Guid.Empty)), + Arg.Any(), + Arg.Any(), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryQueryIdIsNotParseable_ShouldUploadCoverWithEmptyLibraryId() + { + // Arrange + Guid artistId = Guid.NewGuid(); + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: "/media/artists/cover.jpg")); + ConfigureRequest(artistId, [1, 2, 3], "cover.jpg"); + // The query value is normalized to a Guid before it is substituted into the upstream URL, so a crafted value can never escape its segment. + _sut.HttpContext.Request.QueryString = new QueryString("?libraryId=not-a-library-guid"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(Guid.Empty.ToString(), artistId)), + Arg.Any(), + Arg.Any(), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryQueryIdIsMissing_ShouldUploadCoverWithEmptyLibraryId() + { + // Arrange + Guid artistId = Guid.NewGuid(); + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: "/media/artists/cover.jpg")); + ConfigureRequest(artistId, [1, 2, 3], "cover.jpg"); + _sut.HttpContext.Request.QueryString = new QueryString(string.Empty); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(Guid.Empty.ToString(), artistId)), + Arg.Any(), + Arg.Any(), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenApiReturnsCoverPath_ShouldReturnSuccessJsonWithPath() + { + // Arrange + Guid artistId = Guid.NewGuid(); + const string EXPECTED_PATH = "/media/artists/cover.jpg"; + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: EXPECTED_PATH)); + ConfigureRequest(artistId, [1, 2, 3], "cover.jpg"); + + // Act + IResult result = await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(EXPECTED_PATH, jsonDocument.RootElement.GetProperty("data").GetString()); + } + + [Fact] + public async Task ExecuteAsync_WhenFormHasNoFile_ShouldForwardRequestWithoutFileToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + const string EXPECTED_PATH = "/media/artists/cover.jpg"; + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: EXPECTED_PATH)); + ConfigureRequestWithoutFiles(artistId); + + // Act + IResult result = await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(s_libraryId.ToString(), artistId)), + Arg.Is(stream => stream == null), + Arg.Is(fileName => fileName == null), + Arg.Is(fieldName => fieldName == "cover"), + Arg.Any()); + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(EXPECTED_PATH, jsonDocument.RootElement.GetProperty("data").GetString()); + } + + [Fact] + public async Task ExecuteAsync_WhenRequestIsNotMultipart_ShouldForwardRequestWithoutFileToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + const string EXPECTED_PATH = "/media/artists/cover.jpg"; + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: EXPECTED_PATH)); + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={s_libraryId}"); + _sut.HttpContext.Request.ContentType = "application/json"; + + // Act + IResult result = await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(s_libraryId.ToString(), artistId)), + Arg.Is(stream => stream == null), + Arg.Is(fileName => fileName == null), + Arg.Is(fieldName => fieldName == "cover"), + Arg.Any()); + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(EXPECTED_PATH, jsonDocument.RootElement.GetProperty("data").GetString()); + } + + [Fact] + public async Task ExecuteAsync_WhenFormIsMalformed_ShouldForwardRequestWithoutFileToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + const string EXPECTED_PATH = "/media/artists/cover.jpg"; + _mockApiHttpClient.PutMultipartAsync(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_updateMusicCoverDtoFixture.Create(coverPath: EXPECTED_PATH)); + ConfigureMalformedRequest(artistId); + + // Act + IResult result = await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + await _mockApiHttpClient.Received(1).PutMultipartAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(s_libraryId.ToString(), artistId)), + Arg.Is(stream => stream == null), + Arg.Is(fileName => fileName == null), + Arg.Is(fieldName => fieldName == "cover"), + Arg.Any()); + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(EXPECTED_PATH, jsonDocument.RootElement.GetProperty("data").GetString()); + } + + /// + /// Configures a multipart form request carrying a single file. + /// + /// The route Id of the artist whose cover is uploaded. + /// The bytes of the uploaded file. + /// The name of the uploaded file. + private void ConfigureRequest(Guid artistId, byte[] content, string fileName) + { + ConfigureRequest(artistId.ToString(), content, fileName); + } + + /// + /// Configures a multipart form request carrying a single file. + /// + /// The raw route value of the artist Id. + /// The bytes of the uploaded file. + /// The name of the uploaded file. + private void ConfigureRequest(string artistId, byte[] content, string fileName) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId; + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={s_libraryId}"); + MemoryStream coverStream = new(content); + IFormFile formFile = new FormFile(coverStream, 0, content.Length, "cover", fileName); + FormFileCollection files = [formFile]; + IFormCollection form = new FormCollection([], files); + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + _sut.HttpContext.Features.Set(new FormFeature(form)); + } + + /// + /// Configures a multipart form request without any file. + /// + /// The route Id of the artist whose cover is uploaded. + private void ConfigureRequestWithoutFiles(Guid artistId) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={s_libraryId}"); + IFormCollection form = new FormCollection([]); + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + _sut.HttpContext.Features.Set(new FormFeature(form)); + } + + /// + /// Configures a multipart form request whose body cannot be parsed. + /// + /// The route Id of the artist whose cover is uploaded. + private void ConfigureMalformedRequest(Guid artistId) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId.ToString(); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={s_libraryId}"); + _sut.HttpContext.Request.ContentType = "multipart/form-data; boundary=----test"; + IFormCollection malformedForm = Substitute.For(); + malformedForm.Files.Returns(_ => throw new InvalidDataException("Malformed multipart body.")); + _sut.HttpContext.Features.Set(new FormFeature(malformedForm)); + } + + /// + /// Builds the upstream endpoint the cover upload is expected to be sent to. + /// + /// The raw Id of the media library. + /// The normalized Id of the artist. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(string libraryId, Guid artistId) + { + return ApiRoutes.Music.UPDATE_ARTIST_COVER + .Replace("{libraryId}", libraryId) + .Replace("{artistId}", artistId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs new file mode 100644 index 00000000..d58bd4e3 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/DeleteMusicTrack/DeleteMusicTrackEndpointTests.cs @@ -0,0 +1,152 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.DeleteMusicTrack; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.DeleteMusicTrack; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class DeleteMusicTrackEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly DeleteMusicTrackEndpoint _sut; + + /// + /// Initializes a new instance of the class. + /// + public DeleteMusicTrackEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalled_ShouldDeleteTrackViaApiAndReturnSuccessWithoutData() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + ConfigureRequest(artistId.ToString(), albumId.ToString(), trackId.ToString(), libraryId); + + // Act + IResult result = await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(libraryId, artistId, albumId, trackId), + Arg.Any()); + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.False(jsonDocument.RootElement.TryGetProperty("data", out JsonElement _)); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteIdsAreNotParseable_ShouldForwardGuidEmptyIdsToApi() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + ConfigureRequest("not-a-guid", "not-a-guid", "not-a-guid", libraryId); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(libraryId, Guid.Empty, Guid.Empty, Guid.Empty), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteIdsAreMissing_ShouldForwardGuidEmptyIdsToApi() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(libraryId, Guid.Empty, Guid.Empty, Guid.Empty), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryQueryIdIsNotParseable_ShouldForwardGuidEmptyLibraryIdToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + ConfigureRequest(artistId.ToString(), albumId.ToString(), trackId.ToString(), "not-a-guid"); + + // Act + await _sut.ExecuteAsync(EmptyRequest.Instance, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).DeleteAsync( + BuildExpectedEndpoint(Guid.Empty, artistId, albumId, trackId), + Arg.Any()); + } + + /// + /// Sets the route and query values the endpoint reads the track identities from. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw route value of the track Id. + /// The raw query value of the library Id. + private void ConfigureRequest(string artistId, string albumId, string trackId, Guid libraryId) + { + ConfigureRequest(artistId, albumId, trackId, libraryId.ToString()); + } + + /// + /// Sets the route and query values the endpoint reads the track identities from. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw route value of the track Id. + /// The raw query value of the library Id. + private void ConfigureRequest(string artistId, string albumId, string trackId, string libraryId) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId; + _sut.HttpContext.Request.RouteValues["albumId"] = albumId; + _sut.HttpContext.Request.RouteValues["trackId"] = trackId; + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + } + + /// + /// Builds the upstream endpoint the track deletion is expected to be sent to. + /// + /// The normalized Id of the media library. + /// The normalized Id of the artist. + /// The normalized Id of the album. + /// The normalized Id of the track. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId, Guid artistId, Guid albumId, Guid trackId) + { + return ApiRoutes.Music.DELETE_TRACK + .Replace("{libraryId}", libraryId.ToString()) + .Replace("{artistId}", artistId.ToString()) + .Replace("{albumId}", albumId.ToString()) + .Replace("{trackId}", trackId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs new file mode 100644 index 00000000..ed6020ad --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetAlbumTracks/GetAlbumTracksEndpointTests.cs @@ -0,0 +1,202 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetAlbumTracks; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetAlbumTracks; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetAlbumTracksEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly GetAlbumTracksEndpoint _sut; + private readonly GetAlbumTracksLiteRequestFixture _getAlbumTracksLiteRequestFixture = new(); + private readonly PaginatedMusicTrackLiteDtoFixture _paginatedMusicTrackLiteDtoFixture = new(); + private readonly MusicTrackLiteDtoFixture _musicTrackLiteDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public GetAlbumTracksEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalledWithPagination_ShouldRequestTracksWithQueryParameters() + { + // Arrange + GetAlbumTracksLiteRequest request = _getAlbumTracksLiteRequestFixture.Create(currentPage: 2, perPage: 48); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicTrackLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == $"{BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId), Guid.Parse(request.AlbumId))}?currentPage=2&perPage=48"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenCalledWithoutPagination_ShouldRequestTracksWithoutQueryParameters() + { + // Arrange + GetAlbumTracksLiteRequest request = _getAlbumTracksLiteRequestFixture.Create(); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicTrackLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId), Guid.Parse(request.AlbumId))), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenOnlyCurrentPageIsProvided_ShouldAppendOnlyCurrentPage() + { + // Arrange + GetAlbumTracksLiteRequest request = _getAlbumTracksLiteRequestFixture.Create(currentPage: 3); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicTrackLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == $"{BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId), Guid.Parse(request.AlbumId))}?currentPage=3"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenOnlyPerPageIsProvided_ShouldAppendOnlyPerPage() + { + // Arrange + GetAlbumTracksLiteRequest request = _getAlbumTracksLiteRequestFixture.Create(perPage: 24); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicTrackLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == $"{BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId), Guid.Parse(request.AlbumId))}?perPage=24"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenArtistIdIsNotParseable_ShouldForwardGuidEmptyArtistIdToApi() + { + // Arrange + GetAlbumTracksLiteRequest request = _getAlbumTracksLiteRequestFixture.Create(artistId: "not-a-guid", currentPage: 1, perPage: 20); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicTrackLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == $"{BuildExpectedEndpoint(request.LibraryId, Guid.Empty, Guid.Parse(request.AlbumId))}?currentPage=1&perPage=20"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenAlbumIdIsNotParseable_ShouldForwardGuidEmptyAlbumIdToApi() + { + // Arrange + GetAlbumTracksLiteRequest request = _getAlbumTracksLiteRequestFixture.Create(albumId: "' OR '1'='1", currentPage: 1, perPage: 20); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicTrackLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == $"{BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId), Guid.Empty)}?currentPage=1&perPage=20"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenArtistIdAndAlbumIdAreMissing_ShouldForwardGuidEmptyIdsToApi() + { + // Arrange + GetAlbumTracksLiteRequest request = _getAlbumTracksLiteRequestFixture.Create(artistId: string.Empty, albumId: string.Empty, currentPage: 1, perPage: 20); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_paginatedMusicTrackLiteDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == $"{BuildExpectedEndpoint(request.LibraryId, Guid.Empty, Guid.Empty)}?currentPage=1&perPage=20"), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenApiReturnsPaginatedTracks_ShouldReturnSuccessJsonWithTracks() + { + // Arrange + GetAlbumTracksLiteRequest request = _getAlbumTracksLiteRequestFixture.Create(); + PaginatedMusicTrackLiteDto expectedResponse = _paginatedMusicTrackLiteDtoFixture.Create( + data: [_musicTrackLiteDtoFixture.Create(title: "Test Track")], + currentPage: 1, + perPage: 20, + count: 1, + numberOfPages: 1); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(expectedResponse); + + // Act + IResult result = await _sut.ExecuteAsync(request, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + JsonElement data = jsonDocument.RootElement.GetProperty("data"); + Assert.Equal(1, data.GetProperty("currentPage").GetInt32()); + Assert.Equal(1, data.GetProperty("data").GetArrayLength()); + } + + /// + /// Builds the upstream endpoint the album track retrieval is expected to be sent to, without query parameters. + /// + /// The Id of the media library. + /// The normalized Id of the artist. + /// The normalized Id of the album. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId, Guid artistId, Guid albumId) + { + return ApiRoutes.Music.GET_ALBUM_TRACKS_LITE + .Replace("{libraryId}", libraryId.ToString()) + .Replace("{artistId}", artistId.ToString()) + .Replace("{albumId}", albumId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs new file mode 100644 index 00000000..ddf9c687 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetMusicTrack/GetMusicTrackEndpointTests.cs @@ -0,0 +1,129 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetMusicTrack; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.GetMusicTrack; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class GetMusicTrackEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly GetMusicTrackEndpoint _sut; + private readonly GetMusicTrackViewRequestFixture _getMusicTrackViewRequestFixture = new(); + private readonly MusicTrackDtoFixture _musicTrackDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public GetMusicTrackEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalled_ShouldRequestTrackFromApiWithNormalizedIds() + { + // Arrange + GetMusicTrackViewRequest request = _getMusicTrackViewRequestFixture.Create(); + MusicTrackDto expectedTrack = _musicTrackDtoFixture.Create(); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(expectedTrack); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(request.LibraryId, Guid.Parse(request.ArtistId), Guid.Parse(request.AlbumId), Guid.Parse(request.TrackId))), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteIdsAreNotParseable_ShouldForwardGuidEmptyIdsToApi() + { + // Arrange + GetMusicTrackViewRequest request = _getMusicTrackViewRequestFixture.Create(artistId: "not-a-guid", albumId: "' OR '1'='1", trackId: "'; DROP TABLE Tracks; --"); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_musicTrackDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(request.LibraryId, Guid.Empty, Guid.Empty, Guid.Empty)), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteIdsAreEmpty_ShouldForwardGuidEmptyIdsToApi() + { + // Arrange + GetMusicTrackViewRequest request = _getMusicTrackViewRequestFixture.Create(artistId: string.Empty, albumId: string.Empty, trackId: string.Empty); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(_musicTrackDtoFixture.Create()); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).GetAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(request.LibraryId, Guid.Empty, Guid.Empty, Guid.Empty)), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenApiReturnsTrack_ShouldReturnSuccessJsonWithTrack() + { + // Arrange + GetMusicTrackViewRequest request = _getMusicTrackViewRequestFixture.Create(); + MusicTrackDto expectedTrack = _musicTrackDtoFixture.Create(); + _mockApiHttpClient.GetAsync(Arg.Any(), Arg.Any()) + .Returns(expectedTrack); + + // Act + IResult result = await _sut.ExecuteAsync(request, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(expectedTrack.Id, jsonDocument.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + } + + /// + /// Builds the upstream endpoint the track retrieval is expected to be sent to. + /// + /// The normalized Id of the media library. + /// The normalized Id of the artist. + /// The normalized Id of the album. + /// The normalized Id of the track. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId, Guid artistId, Guid albumId, Guid trackId) + { + return ApiRoutes.Music.GET_TRACK + .Replace("{libraryId}", libraryId.ToString()) + .Replace("{artistId}", artistId.ToString()) + .Replace("{albumId}", albumId.ToString()) + .Replace("{trackId}", trackId.ToString()); + } +} diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs new file mode 100644 index 00000000..ded9d594 --- /dev/null +++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/SaveMusicTrack/SaveMusicTrackEndpointTests.cs @@ -0,0 +1,245 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.SaveMusicTrack; +using Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary; +using Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks; +using Lumina.Presentation.Web.Fixtures.Common.TestHelpers; +using Microsoft.AspNetCore.Http; +using NSubstitute; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.UnitTests.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.SaveMusicTrack; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class SaveMusicTrackEndpointTests +{ + private readonly IApiHttpClient _mockApiHttpClient; + private readonly SaveMusicTrackEndpoint _sut; + private readonly UpdateMusicTrackRequestFixture _updateMusicTrackRequestFixture = new(); + private readonly MusicTrackDtoFixture _musicTrackDtoFixture = new(); + + /// + /// Initializes a new instance of the class. + /// + public SaveMusicTrackEndpointTests() + { + _mockApiHttpClient = Substitute.For(); + _sut = Factory.Create(_mockApiHttpClient); + } + + [Fact] + public async Task ExecuteAsync_WhenCalled_ShouldForwardUpdateMusicTrackRequestToApiWithRouteAndQueryIds() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + UpdateMusicTrackRequest request = _updateMusicTrackRequestFixture.Create(); + MusicTrackDto expectedTrack = _musicTrackDtoFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(expectedTrack); + ConfigureRequest(artistId.ToString(), albumId.ToString(), trackId.ToString(), libraryId); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, artistId, albumId, trackId)), + Arg.Is(forwardedRequest => forwardedRequest == request), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenArtistRouteIdIsNotParseable_ShouldForwardGuidEmptyArtistIdToApi() + { + // Arrange + const string MALICIOUS_ARTIST_ID = "not-a-guid"; + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + UpdateMusicTrackRequest request = _updateMusicTrackRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicTrackDtoFixture.Create()); + ConfigureRequest(MALICIOUS_ARTIST_ID, albumId.ToString(), trackId.ToString(), libraryId); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, Guid.Empty, albumId, trackId)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenAlbumRouteIdIsNotParseable_ShouldForwardGuidEmptyAlbumIdToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + const string MALICIOUS_ALBUM_ID = "' OR '1'='1"; + Guid trackId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + UpdateMusicTrackRequest request = _updateMusicTrackRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicTrackDtoFixture.Create()); + ConfigureRequest(artistId.ToString(), MALICIOUS_ALBUM_ID, trackId.ToString(), libraryId); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, artistId, Guid.Empty, trackId)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenTrackRouteIdIsNotParseable_ShouldForwardGuidEmptyTrackIdToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + const string MALICIOUS_TRACK_ID = "'; DROP TABLE Tracks; --"; + Guid libraryId = Guid.NewGuid(); + UpdateMusicTrackRequest request = _updateMusicTrackRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicTrackDtoFixture.Create()); + ConfigureRequest(artistId.ToString(), albumId.ToString(), MALICIOUS_TRACK_ID, libraryId); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, artistId, albumId, Guid.Empty)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenRouteIdsAreMissing_ShouldForwardGuidEmptyIdsToApi() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + UpdateMusicTrackRequest request = _updateMusicTrackRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicTrackDtoFixture.Create()); + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(libraryId, Guid.Empty, Guid.Empty, Guid.Empty)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenLibraryQueryIdIsNotParseable_ShouldForwardGuidEmptyLibraryIdToApi() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + const string MALICIOUS_LIBRARY_ID = "not-a-guid"; + UpdateMusicTrackRequest request = _updateMusicTrackRequestFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(_musicTrackDtoFixture.Create()); + ConfigureRequest(artistId.ToString(), albumId.ToString(), trackId.ToString(), MALICIOUS_LIBRARY_ID); + + // Act + await _sut.ExecuteAsync(request, CancellationToken.None); + + // Assert + await _mockApiHttpClient.Received(1).PutAsync( + Arg.Is(endpoint => endpoint == BuildExpectedEndpoint(Guid.Empty, artistId, albumId, trackId)), + Arg.Any(), + Arg.Any()); + } + + [Fact] + public async Task ExecuteAsync_WhenApiReturnsUpdatedTrack_ShouldReturnSuccessJsonWithTrack() + { + // Arrange + Guid artistId = Guid.NewGuid(); + Guid albumId = Guid.NewGuid(); + Guid trackId = Guid.NewGuid(); + Guid libraryId = Guid.NewGuid(); + UpdateMusicTrackRequest request = _updateMusicTrackRequestFixture.Create(); + MusicTrackDto expectedTrack = _musicTrackDtoFixture.Create(); + _mockApiHttpClient.PutAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(expectedTrack); + ConfigureRequest(artistId.ToString(), albumId.ToString(), trackId.ToString(), libraryId); + + // Act + IResult result = await _sut.ExecuteAsync(request, CancellationToken.None); + string body = await JsonResultTestHelper.GetResponseBodyAsync(result); + + // Assert + using JsonDocument jsonDocument = JsonDocument.Parse(body); + Assert.True(jsonDocument.RootElement.GetProperty("success").GetBoolean()); + Assert.Equal(expectedTrack.Id, jsonDocument.RootElement.GetProperty("data").GetProperty("id").GetGuid()); + } + + /// + /// Sets the route and query values the endpoint reads the track identities from. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw route value of the track Id. + /// The raw query value of the library Id. + private void ConfigureRequest(string artistId, string albumId, string trackId, Guid libraryId) + { + ConfigureRequest(artistId, albumId, trackId, libraryId.ToString()); + } + + /// + /// Sets the route and query values the endpoint reads the track identities from. + /// + /// The raw route value of the artist Id. + /// The raw route value of the album Id. + /// The raw route value of the track Id. + /// The raw query value of the library Id. + private void ConfigureRequest(string artistId, string albumId, string trackId, string libraryId) + { + _sut.HttpContext.Request.RouteValues["artistId"] = artistId; + _sut.HttpContext.Request.RouteValues["albumId"] = albumId; + _sut.HttpContext.Request.RouteValues["trackId"] = trackId; + _sut.HttpContext.Request.QueryString = new QueryString($"?libraryId={libraryId}"); + } + + /// + /// Builds the upstream endpoint the track update is expected to be sent to. + /// + /// The normalized Id of the media library. + /// The normalized Id of the artist. + /// The normalized Id of the album. + /// The normalized Id of the track. + /// The expected upstream endpoint. + private static string BuildExpectedEndpoint(Guid libraryId, Guid artistId, Guid albumId, Guid trackId) + { + return ApiRoutes.Music.UPDATE_TRACK + .Replace("{libraryId}", libraryId.ToString()) + .Replace("{artistId}", artistId.ToString()) + .Replace("{albumId}", albumId.ToString()) + .Replace("{trackId}", trackId.ToString()); + } +} From 33603e63c7734a4e5f88431bdedc11375f61e195 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:27:36 +0300 Subject: [PATCH 14/19] Adds the Performer contributor role and editable genre and tag rows to the book pages. --- .../MediaContributors/MediaContributorRole.cs | 7 +- .../BookLibrary/Books/Item.ar-SA.resx | 39 ++++++- .../BookLibrary/Books/Item.de-DE.resx | 39 ++++++- .../BookLibrary/Books/Item.en-US.resx | 39 ++++++- .../BookLibrary/Books/Item.es-ES.resx | 39 ++++++- .../BookLibrary/Books/Item.fr-FR.resx | 39 ++++++- .../BookLibrary/Books/Item.it-IT.resx | 39 ++++++- .../BookLibrary/Books/Item.ja-JP.resx | 39 ++++++- .../BookLibrary/Books/Item.resx | 39 ++++++- .../BookLibrary/Books/Item.ro-RO.resx | 39 ++++++- .../BookLibrary/Books/Item.uk-UA.resx | 39 ++++++- .../BookLibrary/Books/Item.zh-CN.resx | 39 ++++++- .../BookLibrary/Books/Item.cshtml | 109 ++++++++++++++---- 13 files changed, 487 insertions(+), 58 deletions(-) diff --git a/src/Lumina.Presentation.Web/Common/Enums/MediaContributors/MediaContributorRole.cs b/src/Lumina.Presentation.Web/Common/Enums/MediaContributors/MediaContributorRole.cs index 85935017..e0c2c77d 100644 --- a/src/Lumina.Presentation.Web/Common/Enums/MediaContributors/MediaContributorRole.cs +++ b/src/Lumina.Presentation.Web/Common/Enums/MediaContributors/MediaContributorRole.cs @@ -171,5 +171,10 @@ public enum MediaContributorRole /// /// The contributor orchestrated the music of the media item. /// - Orchestrator + Orchestrator, + + /// + /// The contributor performed the media item, without a more specific role being known. + /// + Performer } diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ar-SA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ar-SA.resx index 61785310..4f656122 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ar-SA.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ar-SA.resx @@ -1,4 +1,4 @@ - + text/microsoft-resx @@ -94,7 +94,7 @@ الأنواع - أنواع الكتاب، مفصولة بفواصل. + الأنواع الموسيقية الخاصة بالكتاب. المعرّف الرقمي للكتاب على Goodreads. @@ -304,7 +304,7 @@ الوسوم - وسوم الكتاب، مفصولة بفواصل. + الوسوم الخاصة بالكتاب. العنوان @@ -1051,4 +1051,37 @@ منسق الأوركسترا + + مؤدٍ + + + معرّف المساهم + + + الدور + + + آخر + + + MusicBrainz + + + Discogs + + + Last.fm + + + النوع + + + إضافة نوع + + + وسم + + + إضافة وسم + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.de-DE.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.de-DE.resx index 6d329eac..f1f7d6b3 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.de-DE.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.de-DE.resx @@ -1,4 +1,4 @@ - + text/microsoft-resx @@ -94,7 +94,7 @@ Genres - Die Genres des Buches, durch Kommas getrennt. + Die Genres des Buchs. Die numerische Kennung des Buches bei Goodreads. @@ -304,7 +304,7 @@ Schlagwörter - Die Schlagwörter des Buches, durch Kommas getrennt. + Die Tags des Buchs. Titel @@ -1051,4 +1051,37 @@ Orchestrator + + Interpret + + + Mitwirkenden-Id + + + Rolle + + + Sonstige + + + MusicBrainz + + + Discogs + + + Last.fm + + + Genre + + + Genre hinzufügen + + + Schlagwort + + + Schlagwort hinzufügen + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.en-US.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.en-US.resx index 1c2ea00e..74c6b4b1 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.en-US.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.en-US.resx @@ -1,4 +1,4 @@ - + text/microsoft-resx @@ -253,10 +253,10 @@ The native name of the original language of the book. - The genres of the book, separated by commas. + The genres of the book. - The tags of the book, separated by commas. + The tags of the book. The Amazon Standard Identification Number of the book. @@ -1051,4 +1051,37 @@ Orchestrator + + Performer + + + Contributor Id + + + Role + + + Other + + + MusicBrainz + + + Discogs + + + Last.fm + + + Genre + + + Add genre + + + Tag + + + Add tag + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.es-ES.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.es-ES.resx index 18483a5a..da9d9f76 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.es-ES.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.es-ES.resx @@ -1,4 +1,4 @@ - + text/microsoft-resx @@ -94,7 +94,7 @@ Géneros - Los géneros del libro, separados por comas. + Los géneros del libro. El identificador numérico del libro en Goodreads. @@ -304,7 +304,7 @@ Etiquetas - Las etiquetas del libro, separadas por comas. + Las etiquetas del libro. Título @@ -1051,4 +1051,37 @@ Orquestador + + Intérprete + + + Id de colaborador + + + Rol + + + Otro + + + MusicBrainz + + + Discogs + + + Last.fm + + + Género + + + Añadir género + + + Etiqueta + + + Añadir etiqueta + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.fr-FR.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.fr-FR.resx index 996ef9fa..dbd947a3 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.fr-FR.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.fr-FR.resx @@ -1,4 +1,4 @@ - + text/microsoft-resx @@ -94,7 +94,7 @@ Genres - Les genres du livre, séparés par des virgules. + Les genres du livre. L'identifiant numérique du livre sur Goodreads. @@ -304,7 +304,7 @@ Étiquettes - Les étiquettes du livre, séparées par des virgules. + Les étiquettes du livre. Titre @@ -1051,4 +1051,37 @@ Orchestrateur + + Interprète + + + Id du contributeur + + + Rôle + + + Autre + + + MusicBrainz + + + Discogs + + + Last.fm + + + Genre + + + Ajouter un genre + + + Étiquette + + + Ajouter une étiquette + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.it-IT.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.it-IT.resx index 1e8fe8fe..49563b81 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.it-IT.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.it-IT.resx @@ -1,4 +1,4 @@ - + text/microsoft-resx @@ -94,7 +94,7 @@ Generi - I generi del libro, separati da virgole. + I generi del libro. L'identificatore numerico del libro su Goodreads. @@ -304,7 +304,7 @@ Etichette - Le etichette del libro, separate da virgole. + I tag del libro. Titolo @@ -1051,4 +1051,37 @@ Orchestratore + + Interprete + + + Id collaboratore + + + Ruolo + + + Altro + + + MusicBrainz + + + Discogs + + + Last.fm + + + Genere + + + Aggiungi genere + + + Etichetta + + + Aggiungi etichetta + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ja-JP.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ja-JP.resx index 27d13c76..c4e14af4 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ja-JP.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ja-JP.resx @@ -1,4 +1,4 @@ - + text/microsoft-resx @@ -94,7 +94,7 @@ ジャンル - 本のジャンル。カンマ区切り。 + 本のジャンル。 Goodreads上の本の数値ID。 @@ -304,7 +304,7 @@ タグ - 本のタグ。カンマ区切り。 + 本のタグ。 タイトル @@ -1051,4 +1051,37 @@ オーケストレーター + + パフォーマー + + + 貢献者 Id + + + 役割 + + + その他 + + + MusicBrainz + + + Discogs + + + Last.fm + + + ジャンル + + + ジャンルを追加 + + + タグ + + + タグを追加 + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.resx index 55db7171..32921a56 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.resx @@ -1,4 +1,4 @@ - + text/microsoft-resx @@ -253,10 +253,10 @@ The native name of the original language of the book. - The genres of the book, separated by commas. + The genres of the book. - The tags of the book, separated by commas. + The tags of the book. The Amazon Standard Identification Number of the book. @@ -1050,4 +1050,37 @@ Orchestrator + + Performer + + + Contributor Id + + + Role + + + Other + + + MusicBrainz + + + Discogs + + + Last.fm + + + Genre + + + Add genre + + + Tag + + + Add tag + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ro-RO.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ro-RO.resx index 557439a8..6308c039 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ro-RO.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.ro-RO.resx @@ -1,4 +1,4 @@ - + text/microsoft-resx @@ -94,7 +94,7 @@ Genuri - Genurile cărții, separate prin virgule. + Genurile cărții. Identificatorul numeric al cărții pe Goodreads. @@ -304,7 +304,7 @@ Etichete - Etichetele cărții, separate prin virgule. + Etichetele cărții. Titlu @@ -1051,4 +1051,37 @@ Orchestrator + + Interpret + + + Id contribuitor + + + Rol + + + Altele + + + MusicBrainz + + + Discogs + + + Last.fm + + + Gen + + + Adaugă gen + + + Etichetă + + + Adaugă etichetă + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.uk-UA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.uk-UA.resx index 3b61a2ae..2ec59fb9 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.uk-UA.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.uk-UA.resx @@ -1,4 +1,4 @@ - + text/microsoft-resx @@ -94,7 +94,7 @@ Жанри - Жанри книги, розділені комами. + Жанри книги. Числовий ідентифікатор книги на Goodreads. @@ -304,7 +304,7 @@ Теги - Теги книги, розділені комами. + Теги книги. Назва @@ -1051,4 +1051,37 @@ Оркестратор + + Виконавець + + + Ідентифікатор учасника + + + Роль + + + Інше + + + MusicBrainz + + + Discogs + + + Last.fm + + + Жанр + + + Додати жанр + + + Тег + + + Додати тег + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.zh-CN.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.zh-CN.resx index 81807621..9795406a 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.zh-CN.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.zh-CN.resx @@ -1,4 +1,4 @@ - + text/microsoft-resx @@ -94,7 +94,7 @@ 体裁 - 图书的体裁,以逗号分隔。 + 书籍的流派。 图书在 Goodreads 上的数字标识。 @@ -304,7 +304,7 @@ 标签 - 图书的标签,以逗号分隔。 + 书籍的标签。 标题 @@ -1051,4 +1051,37 @@ 配器师 + + 表演者 + + + 贡献者 Id + + + 角色 + + + 其他 + + + MusicBrainz + + + Discogs + + + Last.fm + + + 流派 + + + 添加流派 + + + 标签 + + + 添加标签 + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.cshtml b/src/Lumina.Presentation.Web/Core/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.cshtml index 37bf2d59..0a76120b 100644 --- a/src/Lumina.Presentation.Web/Core/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.cshtml +++ b/src/Lumina.Presentation.Web/Core/Views/Library/WrittenContentLibrary/BookLibrary/Books/Item.cshtml @@ -305,19 +305,47 @@

@_localizer["Genres"]

-
:
-
- genre.Name)))" /> -
+ + + + + + + + + @foreach (var genre in genres) + { + + + + + } + +
@_localizer["Genre"]
@_localizer[
+ @_localizer["GenresDescription"]

@_localizer["Tags"]

-
:
-
- tag.Name)))" /> -
+ + + + + + + + + @foreach (var tag in tags) + { + + + + + } + +
@_localizer["Tag"]
@_localizer[
+ @_localizer["TagsDescription"]
@@ -373,9 +401,9 @@ - - - + + + @@ -413,9 +441,9 @@
@_localizer["IsbnValue"]@_localizer["IsbnFormat"]@_localizer["IsbnValue"]@_localizer["IsbnFormat"]
- - - + + + @@ -454,11 +482,11 @@
@_localizer["ContributorName"]@_localizer["Role"]@_localizer["ContributorName"]@_localizer["Role"]
- - - - - + + + + + @@ -529,9 +557,13 @@ const isbnsBody = document.getElementById('isbns-body'); const contributorsBody = document.getElementById('contributors-body'); const ratingsBody = document.getElementById('ratings-body'); + const genresBody = document.getElementById('genres-body'); + const tagsBody = document.getElementById('tags-body'); const btnAddIsbn = document.getElementById('btn-add-isbn'); const btnAddContributor = document.getElementById('btn-add-contributor'); const btnAddRating = document.getElementById('btn-add-rating'); + const btnAddGenre = document.getElementById('btn-add-genre'); + const btnAddTag = document.getElementById('btn-add-tag'); const jsLocalizedStrings = { bookSaved: @Json.Serialize(_localizer["BookSaved"].Value), @@ -569,9 +601,12 @@ return Number.isNaN(parsed) ? null : parsed; } - // Splits a comma separated list into trimmed values. - function splitList(value) { - return value.split(',').map(item => item.trim()).filter(item => item !== ''); + // Builds a list of name valued entries from the rows of a table, skipping the rows whose name is empty. + function buildNameList(body, rowSelector, inputSelector) { + return Array.from(body.querySelectorAll(rowSelector)) + .map(row => row.querySelector(inputSelector).value.trim()) + .filter(name => name !== '') + .map(name => ({ Name: name })); } // Builds the payload of the edited book, matching the update request of the API. @@ -619,8 +654,8 @@ ReleaseCountry: readComboboxValue('release-country-combobox') || null, ReleaseVersion: readValue('release-version-input') || null }, - Genres: splitList(readValue('genres-input')).map(name => ({ Name: name })), - Tags: splitList(readValue('tags-input')).map(name => ({ Name: name })), + Genres: buildNameList(genresBody, '.genre-row', '.genre-name'), + Tags: buildNameList(tagsBody, '.tag-row', '.tag-name'), Language: buildLanguage('language-code-input', 'language-name-input', 'language-native-name-input'), OriginalLanguage: buildLanguage('original-language-code-input', 'original-language-name-input', 'original-language-native-name-input') } @@ -819,6 +854,24 @@ `); } + // Adds a blank genre row. + function addGenreRow() { + genresBody.insertAdjacentHTML('beforeend', ` + + + + `); + } + + // Adds a blank tag row. + function addTagRow() { + tagsBody.insertAdjacentHTML('beforeend', ` + + + + `); + } + // Removes the row of the clicked remove icon. function handleRowRemoval(event) { if (event.target.matches('.remove-form-table-row-icon')) @@ -833,9 +886,13 @@ btnAddIsbn.addEventListener('click', addIsbnRow); btnAddContributor.addEventListener('click', addContributorRow); btnAddRating.addEventListener('click', addRatingRow); + btnAddGenre.addEventListener('click', addGenreRow); + btnAddTag.addEventListener('click', addTagRow); isbnsBody.addEventListener('click', handleRowRemoval); contributorsBody.addEventListener('click', handleRowRemoval); ratingsBody.addEventListener('click', handleRowRemoval); + genresBody.addEventListener('click', handleRowRemoval); + tagsBody.addEventListener('click', handleRowRemoval); document.addEventListener('DOMContentLoaded', InitializeAsync); // Register cleanup for these listeners. @@ -847,9 +904,13 @@ btnAddIsbn.removeEventListener('click', addIsbnRow); btnAddContributor.removeEventListener('click', addContributorRow); btnAddRating.removeEventListener('click', addRatingRow); + btnAddGenre.removeEventListener('click', addGenreRow); + btnAddTag.removeEventListener('click', addTagRow); isbnsBody.removeEventListener('click', handleRowRemoval); contributorsBody.removeEventListener('click', handleRowRemoval); ratingsBody.removeEventListener('click', handleRowRemoval); + genresBody.removeEventListener('click', handleRowRemoval); + tagsBody.removeEventListener('click', handleRowRemoval); document.removeEventListener('DOMContentLoaded', InitializeAsync); }); From 5a5042bea781329fd6ebc757afb16593680322b5 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:27:42 +0300 Subject: [PATCH 15/19] Adds stored cover examples to the book API reference. --- .../written-content-library/book-library/Api.Books.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/technical/api/library/written-content-library/book-library/Api.Books.md b/docs/technical/api/library/written-content-library/book-library/Api.Books.md index ef7a6afb..8d386d2e 100644 --- a/docs/technical/api/library/written-content-library/book-library/Api.Books.md +++ b/docs/technical/api/library/written-content-library/book-library/Api.Books.md @@ -237,7 +237,7 @@ POST api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/books "metadataProvider": null, "createdOnUtc": "2025-01-01T12:00:00.0000000Z", "updatedOnUtc": null, - "coverPath": null + "coverPath": "/media/books/tolkien/the-fellowship-of-the-ring/cover.jpg" } ``` @@ -353,7 +353,7 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/books/{bookId} "metadataProvider": null, "createdOnUtc": "2025-01-01T12:00:00.0000000Z", "updatedOnUtc": null, - "coverPath": null + "coverPath": "/media/books/tolkien/the-fellowship-of-the-ring/cover.jpg" } ``` @@ -467,7 +467,7 @@ GET api/v1/libraries/3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a/books?currentPage=1&pe "metadataProvider": null, "createdOnUtc": "2025-01-01T12:00:00.0000000Z", "updatedOnUtc": null, - "coverPath": null + "coverPath": "/media/books/tolkien/the-fellowship-of-the-ring/cover.jpg" } ], "currentPage": 1, From 34199cc35b859a7a1921a7c7cdd21d1360121ce5 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:27:51 +0300 Subject: [PATCH 16/19] Refactors the integration tests to deserialize problem details and to use collection expressions. --- .../Tracks/GetTrack/GetTrackEndpointTests.cs | 31 ++++++----- .../UpdateTrack/UpdateTrackEndpointTests.cs | 16 +++--- .../Books/AddBook/AddBookEndpointTests.cs | 5 +- .../Books/GetBook/GetBookEndpointTests.cs | 21 +++++--- .../Books/GetBooks/GetBooksEndpointTests.cs | 22 ++++---- .../GetBooksLite/GetBooksLiteEndpointTests.cs | 6 ++- .../GetReadingAvailabilityEndpointTests.cs | 11 ++-- .../GetReadingManifestEndpointTests.cs | 17 ++++-- .../GetReadingResourceEndpointTests.cs | 17 ++++-- .../GetReadingSectionEndpointTests.cs | 17 ++++-- .../UpdateBook/UpdateBookEndpointTests.cs | 24 +++++---- .../UpdateBookCoverEndpointTests.cs | 52 ++++++++++++------- .../CancelLibrariesScanEndpointTests.cs | 2 +- .../CancelLibraryScanEndpointTests.cs | 2 +- .../DeleteLibraryEndpointTests.cs | 4 +- .../ScanLibrariesEndpointTests.cs | 2 +- .../ScanLibrary/ScanLibraryEndpointTests.cs | 2 +- .../CancelLibrariesScanEndpointTests.cs | 2 +- .../CancelLibraryScanEndpointTests.cs | 2 +- .../DeleteLibraryEndpointTests.cs | 4 +- .../ScanLibrariesEndpointTests.cs | 2 +- .../ScanLibrary/ScanLibraryEndpointTests.cs | 6 +-- 22 files changed, 167 insertions(+), 100 deletions(-) diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrack/GetTrackEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrack/GetTrackEndpointTests.cs index 8a0237fa..520d06de 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrack/GetTrackEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/GetTrack/GetTrackEndpointTests.cs @@ -12,6 +12,7 @@ using Lumina.Presentation.Api.Core.Endpoints.Library.AudioLibrary.MusicLibrary.T using Lumina.Presentation.Api.IntegrationTests.Common.Setup; using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; @@ -203,10 +204,12 @@ public class GetTrackEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Unauthorized", problemDetails!["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); + Assert.DoesNotContain("Exception", content, StringComparison.Ordinal); } [Fact] @@ -232,8 +235,9 @@ public class GetTrackEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("LibraryIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } @@ -246,8 +250,9 @@ public class GetTrackEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("ArtistIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } @@ -260,8 +265,9 @@ public class GetTrackEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("AlbumIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } @@ -274,8 +280,9 @@ public class GetTrackEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("TrackIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs index c7fb34a1..c7f0ebc8 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/AudioLibrary/MusicLibrary/Tracks/UpdateTrack/UpdateTrackEndpointTests.cs @@ -197,9 +197,10 @@ public class UpdateTrackEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Unauthorized", problemDetails!["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); } [Fact] @@ -1032,13 +1033,14 @@ public class UpdateTrackEndpointTests : IClassFixture /// The HTTP response to assert. /// The expected detail of the problem details. - private static async Task AssertNotFoundAsync(HttpResponseMessage response, string expectedDetail) + private async Task AssertNotFoundAsync(HttpResponseMessage response, string expectedDetail) { Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); string content = await response.Content.ReadAsStringAsync(); - using JsonDocument problemDetails = JsonDocument.Parse(content); - Assert.Equal("General.NotFound", problemDetails.RootElement.GetProperty("title").GetString()); - Assert.Equal(expectedDetail, problemDetails.RootElement.GetProperty("detail").GetString()); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.NotFound", problemDetails!["title"].GetString()); + Assert.Equal(expectedDetail, problemDetails["detail"].GetString()); } /// diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs index 5f2b7c40..df680fd4 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/AddBook/AddBookEndpointTests.cs @@ -1745,8 +1745,9 @@ public class AddBookEndpointTests : IClassFixture // command validator reports a clean validation error instead of failing the request binding. Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode); string content = await response.Content.ReadAsStringAsync(); - using JsonDocument problemDetails = JsonDocument.Parse(content); - Assert.Equal("General.Validation", problemDetails.RootElement.GetProperty("title").GetString()); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("LibraryIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs index 22677a26..e3b53e60 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBook/GetBookEndpointTests.cs @@ -13,6 +13,7 @@ using Lumina.Presentation.Api.IntegrationTests.Common.Setup; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; @@ -130,10 +131,12 @@ public class GetBookEndpointTests : IClassFixture // Assert Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode); - using JsonDocument problemDetails = JsonDocument.Parse(await response.Content.ReadAsStringAsync()); - Assert.Equal("General.Unauthorized", problemDetails.RootElement.GetProperty("title").GetString()); - Assert.Equal("NotAuthorized", problemDetails.RootElement.GetProperty("detail").GetString()); - Assert.DoesNotContain("Exception", problemDetails.RootElement.GetRawText(), StringComparison.Ordinal); + string content = await response.Content.ReadAsStringAsync(); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Unauthorized", problemDetails!["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); + Assert.DoesNotContain("Exception", content, StringComparison.Ordinal); } [Fact] @@ -160,8 +163,9 @@ public class GetBookEndpointTests : IClassFixture // validation error instead of failing the request binding. Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode); string content = await response.Content.ReadAsStringAsync(); - using JsonDocument problemDetails = JsonDocument.Parse(content); - Assert.Equal("General.Validation", problemDetails.RootElement.GetProperty("title").GetString()); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("LibraryIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } @@ -176,8 +180,9 @@ public class GetBookEndpointTests : IClassFixture // validation error instead of failing the request binding. Assert.Equal(HttpStatusCode.UnprocessableEntity, response.StatusCode); string content = await response.Content.ReadAsStringAsync(); - using JsonDocument problemDetails = JsonDocument.Parse(content); - Assert.Equal("General.Validation", problemDetails.RootElement.GetProperty("title").GetString()); + Dictionary? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("BookIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs index cfea63fd..22a2ff98 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooks/GetBooksEndpointTests.cs @@ -14,6 +14,7 @@ using Lumina.Presentation.Api.IntegrationTests.Common.Setup; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; @@ -262,11 +263,11 @@ public class GetBooksEndpointTests : IClassFixture tag.Name), book.Metadata.Tags.Select(tag => tag.Name)); - Assert.Equal(seededBook.Genres.Select(genre => genre.Name), book.Metadata.Genres.Select(genre => genre.Name)); - Assert.Equal(seededBook.ISBNs.Select(isbn => isbn.Value), book.ISBNs.Select(isbn => isbn.Value)); - Assert.Equal(seededBook.Ratings.Select(rating => rating.Value), book.Ratings.Select(rating => rating.Value)); - Assert.Equal(seededBook.Ratings.Single().Source, book.Ratings.Single().Source); + Assert.Equal(seededBook.Tags.Select(tag => tag.Name), book?.Metadata?.Tags?.Select(tag => tag.Name)); + Assert.Equal(seededBook.Genres.Select(genre => genre.Name), book?.Metadata?.Genres?.Select(genre => genre.Name)); + Assert.Equal(seededBook.ISBNs.Select(isbn => isbn.Value), book?.ISBNs?.Select(isbn => isbn.Value)); + Assert.Equal(seededBook.Ratings.Select(rating => rating.Value), book?.Ratings?.Select(rating => rating.Value)); + Assert.Equal(seededBook.Ratings.Single().Source, book?.Ratings?.Single().Source); } [Fact] @@ -280,8 +281,9 @@ public class GetBooksEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("LibraryIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } @@ -303,7 +305,7 @@ public class GetBooksEndpointTests : IClassFixture? paginatedBooks = await response.Content.ReadFromJsonAsync>(_jsonOptions); Assert.NotNull(paginatedBooks); - Assert.Equal(new[] { "Book A", "Book B", "Book C" }, paginatedBooks!.Data.Select(book => book.Metadata.Title)); + Assert.Equal(["Book A", "Book B", "Book C"], paginatedBooks!.Data.Select(book => book.Metadata.Title)); } [Fact] @@ -324,7 +326,7 @@ public class GetBooksEndpointTests : IClassFixture? paginatedBooks = await response.Content.ReadFromJsonAsync>(_jsonOptions); Assert.NotNull(paginatedBooks); - Assert.Equal(new[] { "Book C", "Book B", "Book A" }, paginatedBooks!.Data.Select(book => book.Metadata.Title)); + Assert.Equal(["Book C", "Book B", "Book A"], paginatedBooks!.Data.Select(book => book.Metadata.Title)); } [Fact] @@ -410,7 +412,7 @@ public class GetBooksEndpointTests : IClassFixture? paginatedBooks = await response.Content.ReadFromJsonAsync>(_jsonOptions); Assert.NotNull(paginatedBooks); - Assert.Equal(new[] { "Book A", "Book B", "Book C" }, paginatedBooks!.Data.Select(book => book.Metadata.Title)); + Assert.Equal(["Book A", "Book B", "Book C"], paginatedBooks!.Data.Select(book => book.Metadata.Title)); } [Fact] diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs index 43c7516e..e11603f0 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/GetBooksLite/GetBooksLiteEndpointTests.cs @@ -11,6 +11,7 @@ using Lumina.Presentation.Api.IntegrationTests.Common.Setup; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; @@ -351,8 +352,9 @@ public class GetBooksLiteEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("LibraryIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs index 44190a99..13a110f8 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingAvailability/GetReadingAvailabilityEndpointTests.cs @@ -10,6 +10,7 @@ using Lumina.DataAccess.Core.UoW; using Lumina.Presentation.Api.IntegrationTests.Common.Setup; using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; @@ -105,10 +106,12 @@ public class GetReadingAvailabilityEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Unauthorized", problemDetails!["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); + Assert.DoesNotContain("Exception", content, StringComparison.Ordinal); } [Fact] diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs index 5ab28583..953afde3 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingManifest/GetReadingManifestEndpointTests.cs @@ -9,11 +9,13 @@ using Lumina.DataAccess.Core.UoW; using Lumina.Presentation.Api.IntegrationTests.Common.Setup; using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; using System.Net.Http; using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading.Tasks; #endregion @@ -27,6 +29,11 @@ public class GetReadingManifestEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Unauthorized", problemDetails!["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); + Assert.DoesNotContain("Exception", content, StringComparison.Ordinal); } [Fact] diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs index a47ca9e1..4369a753 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingResource/GetReadingResourceEndpointTests.cs @@ -9,11 +9,13 @@ using Lumina.DataAccess.Core.UoW; using Lumina.Presentation.Api.IntegrationTests.Common.Setup; using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; using System.Net.Http; using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading.Tasks; #endregion @@ -27,6 +29,11 @@ public class GetReadingResourceEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Unauthorized", problemDetails!["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); + Assert.DoesNotContain("Exception", content, StringComparison.Ordinal); } [Fact] diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs index 50094847..5bb46cc1 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/Reading/GetReadingSection/GetReadingSectionEndpointTests.cs @@ -9,11 +9,13 @@ using Lumina.DataAccess.Core.UoW; using Lumina.Presentation.Api.IntegrationTests.Common.Setup; using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; using System.Net.Http; using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading.Tasks; #endregion @@ -27,6 +29,11 @@ public class GetReadingSectionEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Unauthorized", problemDetails!["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); + Assert.DoesNotContain("Exception", content, StringComparison.Ordinal); } [Fact] diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBook/UpdateBookEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBook/UpdateBookEndpointTests.cs index 72e69c41..61d74367 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBook/UpdateBookEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBook/UpdateBookEndpointTests.cs @@ -181,8 +181,9 @@ public class UpdateBookEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("BookIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } @@ -199,9 +200,10 @@ public class UpdateBookEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.NotFound", problemDetails!["title"].GetString()); + Assert.Equal("BookNotFound", problemDetails["detail"].GetString()); } [Fact] @@ -218,9 +220,10 @@ public class UpdateBookEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Unauthorized", problemDetails!["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); } [Fact] @@ -237,8 +240,9 @@ public class UpdateBookEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("TitleCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } diff --git a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs index b4a1f722..79ba6bc2 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Api.IntegrationTests/Core/Endpoints/Library/WrittenContentLibrary/BookLibrary/Books/UpdateBookCover/UpdateBookCoverEndpointTests.cs @@ -14,12 +14,14 @@ using Lumina.Presentation.Api.Core.Endpoints.Library.WrittenContentLibrary.BookL using Lumina.Presentation.Api.IntegrationTests.Common.Setup; using Microsoft.Extensions.DependencyInjection; using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading.Tasks; #endregion @@ -33,6 +35,11 @@ public class UpdateBookCoverEndpointTests : IClassFixture(content, new JsonSerializerOptions { PropertyNameCaseInsensitive = true })!.CoverPath; + string storedPath = JsonSerializer.Deserialize(content, _jsonOptions)!.CoverPath; Assert.False(string.IsNullOrWhiteSpace(storedPath)); Assert.Contains("cover.png", storedPath, StringComparison.OrdinalIgnoreCase); @@ -95,7 +102,7 @@ public class UpdateBookCoverEndpointTests : IClassFixture(content, new JsonSerializerOptions { PropertyNameCaseInsensitive = true })!.CoverPath; + string storedPath = JsonSerializer.Deserialize(content, _jsonOptions)!.CoverPath; Assert.False(string.IsNullOrWhiteSpace(storedPath)); using IServiceScope scope = _apiFactory.Services.CreateScope(); @@ -115,9 +122,10 @@ public class UpdateBookCoverEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.NotFound", problemDetails!["title"].GetString()); + Assert.Equal("BookNotFound", problemDetails["detail"].GetString()); } [Fact] @@ -129,8 +137,9 @@ public class UpdateBookCoverEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("BookIdCannotBeEmpty", content, StringComparison.OrdinalIgnoreCase); } @@ -147,9 +156,10 @@ public class UpdateBookCoverEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Unauthorized", problemDetails!["title"].GetString()); + Assert.Equal("NotAuthorized", problemDetails["detail"].GetString()); } [Fact] @@ -166,9 +176,10 @@ public class UpdateBookCoverEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.NotFound", problemDetails!["title"].GetString()); + Assert.Equal("BookNotFound", problemDetails["detail"].GetString()); } [Fact] @@ -197,8 +208,9 @@ public class UpdateBookCoverEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("BookCoverCannotBeNull", content, StringComparison.OrdinalIgnoreCase); } @@ -216,8 +228,9 @@ public class UpdateBookCoverEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("CoverFileMustBeAnImage", content, StringComparison.OrdinalIgnoreCase); } @@ -245,8 +258,9 @@ public class UpdateBookCoverEndpointTests : IClassFixture? problemDetails = JsonSerializer.Deserialize>(content, _jsonOptions); + Assert.NotNull(problemDetails); + Assert.Equal("General.Validation", problemDetails!["title"].GetString()); Assert.Contains("FileTooLarge", content, StringComparison.OrdinalIgnoreCase); } diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs index 52c3d142..fc6e1bdc 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs @@ -63,7 +63,7 @@ public class CancelLibrariesScanEndpointTests : IClassFixture { Content = new StringContent("{}", Encoding.UTF8, "application/json") }; - // the antiforgery middleware matches the content type exactly, so the charset suffix must be omitted + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. cancelRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); cancelRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return cancelRequest; diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs index f5331ad0..f34bd3e2 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs @@ -66,7 +66,7 @@ public class CancelLibraryScanEndpointTests : IClassFixture { Content = new StringContent("{}", Encoding.UTF8, "application/json") }; - // the antiforgery middleware matches the content type exactly, so the charset suffix must be omitted + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. cancelRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); cancelRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return cancelRequest; diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs index 23f206c3..50e93317 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs @@ -63,10 +63,10 @@ public class DeleteLibraryEndpointTests : IClassFixture { HttpRequestMessage deleteRequest = new(HttpMethod.Delete, $"/en-us/libraries/manage/api-item/{libraryId}") { - // the front-end sends the JSON content type even for DELETE requests, which triggers the antiforgery validation + // The front-end sends the JSON content type even for DELETE requests, which triggers the antiforgery validation. Content = new StringContent("{}", Encoding.UTF8, "application/json") }; - // the antiforgery middleware matches the content type exactly, so the charset suffix must be omitted + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. deleteRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); deleteRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return deleteRequest; diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs index ade53321..b7e01907 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs @@ -73,7 +73,7 @@ public class ScanLibrariesEndpointTests : IClassFixture { Content = new StringContent("{}", Encoding.UTF8, "application/json") }; - // the antiforgery middleware matches the content type exactly, so the charset suffix must be omitted + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. scanRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); scanRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return scanRequest; diff --git a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs index 9e7d202a..8ae3deb7 100644 --- a/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs +++ b/tests/IntegrationTests/Lumina.Presentation.Web.IntegrationTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs @@ -70,7 +70,7 @@ public class ScanLibraryEndpointTests : IClassFixture { Content = new StringContent("{}", Encoding.UTF8, "application/json") }; - // the antiforgery middleware matches the content type exactly, so the charset suffix must be omitted + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. scanRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); scanRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return scanRequest; diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs index 9f6237c9..cecbd974 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/CancelLibrariesScan/CancelLibrariesScanEndpointTests.cs @@ -72,7 +72,7 @@ public class CancelLibrariesScanEndpointTests : IClassFixture { Content = new StringContent("{}", Encoding.UTF8, "application/json") }; - // the antiforgery middleware matches the content type exactly, so the charset suffix must be omitted + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. cancelRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); cancelRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return cancelRequest; diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs index fc1fdd81..c244839f 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/CancelLibraryScan/CancelLibraryScanEndpointTests.cs @@ -77,7 +77,7 @@ public class CancelLibraryScanEndpointTests : IClassFixture { Content = new StringContent("{}", Encoding.UTF8, "application/json") }; - // the antiforgery middleware matches the content type exactly, so the charset suffix must be omitted + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. cancelRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); cancelRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return cancelRequest; diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs index 410bf983..b0718dd1 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/DeleteLibrary/DeleteLibraryEndpointTests.cs @@ -73,10 +73,10 @@ public class DeleteLibraryEndpointTests : IClassFixture { HttpRequestMessage deleteRequest = new(HttpMethod.Delete, $"/en-us/libraries/manage/api-item/{libraryId}") { - // the front-end sends the JSON content type even for DELETE requests, which triggers the antiforgery validation + // The front-end sends the JSON content type even for DELETE requests, which triggers the antiforgery validation. Content = new StringContent("{}", Encoding.UTF8, "application/json") }; - // the antiforgery middleware matches the content type exactly, so the charset suffix must be omitted + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. deleteRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); deleteRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return deleteRequest; diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs index 64422453..7097284e 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/ScanLibraries/ScanLibrariesEndpointTests.cs @@ -72,7 +72,7 @@ public class ScanLibrariesEndpointTests : IClassFixture { Content = new StringContent("{}", Encoding.UTF8, "application/json") }; - // the antiforgery middleware matches the content type exactly, so the charset suffix must be omitted + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. scanRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); scanRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return scanRequest; diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs index 121e7df0..aaef8c91 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/Library/Management/ScanLibrary/ScanLibraryEndpointTests.cs @@ -81,8 +81,8 @@ public class ScanLibraryEndpointTests : IClassFixture string content = await response.Content.ReadAsStringAsync(); // Assert - // note: the {id} route parameter is Guid-typed, so the malicious value fails model binding and never reaches - // the handler; the Web application reports the binding failure as a 200 response carrying success=false + // Note: the {id} route parameter is Guid-typed, so the malicious value fails model binding and never reaches + // the handler; the Web application reports the binding failure as a 200 response carrying success=false. using JsonDocument json = JsonDocument.Parse(content); Assert.False(json.RootElement.GetProperty("success").GetBoolean()); Assert.DoesNotContain("Exception", content, StringComparison.OrdinalIgnoreCase); @@ -105,7 +105,7 @@ public class ScanLibraryEndpointTests : IClassFixture { Content = new StringContent("{}", Encoding.UTF8, "application/json") }; - // the antiforgery middleware matches the content type exactly, so the charset suffix must be omitted + // The antiforgery middleware matches the content type exactly, so the charset suffix must be omitted. scanRequest.Content!.Headers.ContentType = new MediaTypeHeaderValue("application/json"); scanRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return scanRequest; From 8557556b5739448e7d29711d59f2e87e38722263 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:27:58 +0300 Subject: [PATCH 17/19] Moves the data access tests that need a real database into the integration test project. --- .../BookAlphaFilterSpecificationTests.cs | 6 +- .../MusicArtworkRepositoryTests.cs | 140 +++++++++++++++++- ...cLibraryScanItemMetadataRepositoryTests.cs | 26 +++- 3 files changed, 162 insertions(+), 10 deletions(-) rename tests/{UnitTests/Lumina.DataAccess.UnitTests => IntegrationTests/Lumina.DataAccess.IntegrationTests}/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecificationTests.cs (95%) rename tests/{UnitTests/Lumina.DataAccess.UnitTests => IntegrationTests/Lumina.DataAccess.IntegrationTests}/Core/Repositories/MusicLibrary/MusicArtworkRepositoryTests.cs (55%) rename tests/{UnitTests/Lumina.DataAccess.UnitTests => IntegrationTests/Lumina.DataAccess.IntegrationTests}/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepositoryTests.cs (79%) diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecificationTests.cs b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecificationTests.cs similarity index 95% rename from tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecificationTests.cs rename to tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecificationTests.cs index 349b200b..6d224521 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecificationTests.cs +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecificationTests.cs @@ -12,10 +12,10 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; #endregion -namespace Lumina.DataAccess.UnitTests.Core.Repositories.BookLibrary.Specifications; +namespace Lumina.DataAccess.IntegrationTests.Core.Repositories.BookLibrary.Specifications; /// -/// Contains unit tests for the class. +/// Contains integration tests for the class, exercising it against a real SQLite database. /// [ExcludeFromCodeCoverage] public class BookAlphaFilterSpecificationTests : IDisposable @@ -29,7 +29,7 @@ public class BookAlphaFilterSpecificationTests : IDisposable /// public BookAlphaFilterSpecificationTests() { - // the specification translates to the SQLite glob() function, so it can only be exercised against a real SQLite database + // The specification translates to the SQLite glob() function, so it can only be exercised against a real SQLite database. _connection = new SqliteConnection("Data Source=:memory:"); _connection.Open(); _context = new LuminaDbContext(new DbContextOptionsBuilder().UseSqlite(_connection).Options); diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/MusicArtworkRepositoryTests.cs b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/MusicArtworkRepositoryTests.cs similarity index 55% rename from tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/MusicArtworkRepositoryTests.cs rename to tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/MusicArtworkRepositoryTests.cs index 4fb1496f..cf31c7ad 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/MusicArtworkRepositoryTests.cs +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/MusicArtworkRepositoryTests.cs @@ -16,10 +16,10 @@ using System.Threading; using System.Threading.Tasks; #endregion -namespace Lumina.DataAccess.UnitTests.Core.Repositories.MusicLibrary; +namespace Lumina.DataAccess.IntegrationTests.Core.Repositories.MusicLibrary; /// -/// Contains unit tests for the class. +/// Contains integration tests for the class, exercising it against a real SQLite database. /// [ExcludeFromCodeCoverage] public class MusicArtworkRepositoryTests : IDisposable @@ -37,7 +37,7 @@ public class MusicArtworkRepositoryTests : IDisposable /// public MusicArtworkRepositoryTests() { - // the repository deletes and updates in bulk, which translates to SQL, so it can only be exercised against a real SQLite database + // The repository deletes and updates in bulk, which translates to SQL, so the tests exercise it against a real SQLite database. _connection = new SqliteConnection("Data Source=:memory:"); _connection.Open(); _context = new LuminaDbContext(new DbContextOptionsBuilder().UseSqlite(_connection).Options); @@ -168,7 +168,7 @@ public class MusicArtworkRepositoryTests : IDisposable // Assert Assert.False(result.IsFailure); Assert.Equal(Result.Updated, result.Value); - // the bulk update bypasses the change tracker, so the tracked entities are detached before the stored values are read back + // The bulk update bypasses the change tracker, so the tracked entities are detached before the stored values are read back. _context.ChangeTracker.Clear(); Assert.Equal(ArtworkStatus.Pending, (await _context.MusicArtwork.FindAsync(artistArtwork.Id))!.Status); Assert.Equal(ArtworkStatus.Pending, (await _context.MusicArtwork.FindAsync(albumArtwork.Id))!.Status); @@ -176,6 +176,138 @@ public class MusicArtworkRepositoryTests : IDisposable Assert.Equal(ArtworkStatus.Enriched, (await _context.MusicArtwork.FindAsync(artworkOfAnotherLibrary.Id))!.Status); } + [Fact] + public async Task DeleteByLibraryIdAsync_WhenCalled_ShouldDeleteOnlyTheArtworkOfTheLibraryItems() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + ArtistEntity artist = _artistEntityFixture.Create(libraryId: libraryId, includeAlbums: false, includeContributors: false); + AlbumEntity album = _albumEntityFixture.Create(artistId: artist.Id, libraryId: libraryId, includeTracks: false, includeMetadata: false); + TrackEntity track = _trackEntityFixture.Create(albumId: album.Id, libraryId: libraryId, includeMetadata: false); + ArtistEntity artistOfAnotherLibrary = _artistEntityFixture.Create(includeAlbums: false, includeContributors: false); + AlbumEntity albumOfAnotherLibrary = _albumEntityFixture.Create( + artistId: artistOfAnotherLibrary.Id, libraryId: artistOfAnotherLibrary.LibraryId, includeTracks: false, includeMetadata: false); + TrackEntity trackOfAnotherLibrary = _trackEntityFixture.Create( + albumId: albumOfAnotherLibrary.Id, libraryId: artistOfAnotherLibrary.LibraryId, includeMetadata: false); + _context.Artists.AddRange(artist, artistOfAnotherLibrary); + _context.Albums.AddRange(album, albumOfAnotherLibrary); + _context.Tracks.AddRange(track, trackOfAnotherLibrary); + MusicArtworkEntity artistArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, ownerId: artist.Id); + MusicArtworkEntity albumArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Album, ownerId: album.Id); + MusicArtworkEntity trackArtwork = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Track, ownerId: track.Id); + MusicArtworkEntity artworkOfAnotherLibrary = _musicArtworkEntityFixture.Create(ownerType: MusicArtworkOwnerType.Artist, ownerId: artistOfAnotherLibrary.Id); + _context.MusicArtwork.AddRange(artistArtwork, albumArtwork, trackArtwork, artworkOfAnotherLibrary); + await _context.SaveChangesAsync(); + + // Act + Result result = await _sut.DeleteByLibraryIdAsync(libraryId, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(Result.Deleted, result.Value); + _context.ChangeTracker.Clear(); + // Every artwork owned by an artist, album or track of the library is deleted, while the artwork of another library survives. + MusicArtworkEntity remainingArtwork = Assert.Single(await _context.MusicArtwork.ToListAsync()); + Assert.Equal(artworkOfAnotherLibrary.Id, remainingArtwork.Id); + } + + [Fact] + public async Task DeleteByLibraryIdAsync_WhenTheLibraryHasNoArtwork_ShouldReturnDeleted() + { + // Act + Result result = await _sut.DeleteByLibraryIdAsync(Guid.NewGuid(), CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(Result.Deleted, result.Value); + } + + [Fact] + public async Task UpsertCoverAsync_WhenNoCoverExists_ShouldInsertANewCoverArtwork() + { + // Arrange + Guid ownerId = Guid.NewGuid(); + DateTime before = DateTime.UtcNow; + + // Act + Result result = await _sut.UpsertCoverAsync(MusicArtworkOwnerType.Album, ownerId, "covers/new.jpg", CancellationToken.None); + await _context.SaveChangesAsync(); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(Result.Updated, result.Value); + MusicArtworkEntity cover = Assert.Single(await _context.MusicArtwork.ToListAsync()); + Assert.Equal(MusicArtworkOwnerType.Album, cover.OwnerType); + Assert.Equal(ownerId, cover.OwnerId); + Assert.Equal(ArtworkType.Cover, cover.ArtworkType); + Assert.Equal(0, cover.Ordinal); + Assert.Equal("covers/new.jpg", cover.FileName); + Assert.Equal(ArtworkStatus.Enriched, cover.Status); + Assert.Equal(Guid.Empty, cover.CreatedBy); + Assert.True(cover.CreatedOnUtc >= before); + Assert.Null(cover.UpdatedBy); + } + + [Fact] + public async Task UpsertCoverAsync_WhenCoverExists_ShouldUpdateItInPlace() + { + // Arrange + Guid ownerId = Guid.NewGuid(); + MusicArtworkEntity existingCover = _musicArtworkEntityFixture.Create( + ownerType: MusicArtworkOwnerType.Album, ownerId: ownerId, artworkType: ArtworkType.Cover, ordinal: 0, fileName: "covers/old.jpg", + status: ArtworkStatus.Pending, includeLastUpdateUtc: false); + _context.MusicArtwork.Add(existingCover); + await _context.SaveChangesAsync(); + Guid existingCoverId = existingCover.Id; + Guid existingCreatedBy = existingCover.CreatedBy; + DateTime existingCreatedOnUtc = existingCover.CreatedOnUtc; + _context.ChangeTracker.Clear(); + + // Act + Result result = await _sut.UpsertCoverAsync(MusicArtworkOwnerType.Album, ownerId, "covers/new.jpg", CancellationToken.None); + await _context.SaveChangesAsync(); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(Result.Updated, result.Value); + // The existing cover is updated in place, so no new row is inserted and the creation audit columns are preserved. + MusicArtworkEntity cover = Assert.Single(await _context.MusicArtwork.ToListAsync()); + Assert.Equal(existingCoverId, cover.Id); + Assert.Equal("covers/new.jpg", cover.FileName); + Assert.Equal(ArtworkStatus.Enriched, cover.Status); + Assert.NotNull(cover.LastUpdateUtc); + Assert.Equal(existingCreatedBy, cover.CreatedBy); + Assert.Equal(existingCreatedOnUtc, cover.CreatedOnUtc); + } + + [Fact] + public async Task UpsertCoverAsync_WhenTheCoverHasANonZeroOrdinal_ShouldUpdateItInPlaceInsteadOfInsertingASecondCover() + { + // Arrange + Guid ownerId = Guid.NewGuid(); + // The callers resolve the existing cover by artwork type only, so a cover stored with an ordinal other than zero must still be the one replaced. + MusicArtworkEntity existingCover = _musicArtworkEntityFixture.Create( + ownerType: MusicArtworkOwnerType.Album, ownerId: ownerId, artworkType: ArtworkType.Cover, ordinal: 3, fileName: "covers/old.jpg", + status: ArtworkStatus.Pending, includeLastUpdateUtc: false); + _context.MusicArtwork.Add(existingCover); + await _context.SaveChangesAsync(); + Guid existingCoverId = existingCover.Id; + _context.ChangeTracker.Clear(); + + // Act + Result result = await _sut.UpsertCoverAsync(MusicArtworkOwnerType.Album, ownerId, "covers/new.jpg", CancellationToken.None); + await _context.SaveChangesAsync(); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(Result.Updated, result.Value); + MusicArtworkEntity cover = Assert.Single(await _context.MusicArtwork.ToListAsync()); + Assert.Equal(existingCoverId, cover.Id); + Assert.Equal(3, cover.Ordinal); + Assert.Equal("covers/new.jpg", cover.FileName); + Assert.Equal(ArtworkStatus.Enriched, cover.Status); + } + /// /// Disposes the database context and its underlying connection. /// diff --git a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepositoryTests.cs b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepositoryTests.cs similarity index 79% rename from tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepositoryTests.cs rename to tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepositoryTests.cs index b9c417ed..c4e19b4f 100644 --- a/tests/UnitTests/Lumina.DataAccess.UnitTests/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepositoryTests.cs +++ b/tests/IntegrationTests/Lumina.DataAccess.IntegrationTests/Core/Repositories/MusicLibrary/MusicLibraryScanItemMetadataRepositoryTests.cs @@ -14,10 +14,10 @@ using System.Threading; using System.Threading.Tasks; #endregion -namespace Lumina.DataAccess.UnitTests.Core.Repositories.MusicLibrary; +namespace Lumina.DataAccess.IntegrationTests.Core.Repositories.MusicLibrary; /// -/// Contains unit tests for the class. +/// Contains integration tests for the class, exercising it against a real SQLite database. /// [ExcludeFromCodeCoverage] public class MusicLibraryScanItemMetadataRepositoryTests : IDisposable @@ -32,7 +32,7 @@ public class MusicLibraryScanItemMetadataRepositoryTests : IDisposable /// public MusicLibraryScanItemMetadataRepositoryTests() { - // the repository deletes in bulk, which translates to SQL, so it can only be exercised against a real SQLite database + // The repository deletes in bulk, which translates to SQL, so the tests exercise it against a real SQLite database. _connection = new SqliteConnection("Data Source=:memory:"); _connection.Open(); _context = new LuminaDbContext(new DbContextOptionsBuilder().UseSqlite(_connection).Options); @@ -119,6 +119,26 @@ public class MusicLibraryScanItemMetadataRepositoryTests : IDisposable Assert.Equal(itemOfAnotherScan.Id, remainingItem.Id); } + [Fact] + public async Task DeleteByLibraryIdAsync_WhenCalled_ShouldDeleteOnlyThatLibrariesStagedMetadata() + { + // Arrange + Guid libraryId = Guid.NewGuid(); + MusicLibraryScanItemMetadataEntity itemOfLibrary = _musicLibraryScanItemMetadataEntityFixture.Create(libraryId: libraryId, path: "/music/queen/bohemian-rhapsody.flac"); + MusicLibraryScanItemMetadataEntity itemOfAnotherLibrary = _musicLibraryScanItemMetadataEntityFixture.Create(path: "/music/queen/love-of-my-life.flac"); + _context.MusicLibraryScanItemMetadata.AddRange(itemOfLibrary, itemOfAnotherLibrary); + await _context.SaveChangesAsync(); + + // Act + Result result = await _sut.DeleteByLibraryIdAsync(libraryId, CancellationToken.None); + + // Assert + Assert.False(result.IsFailure); + Assert.Equal(Result.Deleted, result.Value); + MusicLibraryScanItemMetadataEntity remainingItem = Assert.Single(await _context.MusicLibraryScanItemMetadata.ToListAsync()); + Assert.Equal(itemOfAnotherLibrary.Id, remainingItem.Id); + } + /// /// Disposes the database context and its underlying connection. /// From 9e570f163832a052141401f6fa657c435a921b8a Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Tue, 13 Oct 2026 13:28:03 +0300 Subject: [PATCH 18/19] Turns the remaining lowercase comments into sentences. --- .../Specifications/BookAlphaFilterSpecification.cs | 8 ++++---- .../Common/TestHelpers/WebTestHelpers.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Lumina.DataAccess/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecification.cs b/src/Lumina.DataAccess/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecification.cs index 790cd379..f84fa553 100644 --- a/src/Lumina.DataAccess/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecification.cs +++ b/src/Lumina.DataAccess/Core/Repositories/BookLibrary/Specifications/BookAlphaFilterSpecification.cs @@ -42,7 +42,7 @@ internal sealed class BookAlphaFilterSpecification : FilterSpecificationAn expression tree that can be used to evaluate whether a satisfies the specification criteria. public override Expression> ToExpression() { - // when no alpha key was requested, every book matches + // When no alpha key was requested, every book matches. if (_filterAlphaKey is null) return book => true; @@ -55,7 +55,7 @@ internal sealed class BookAlphaFilterSpecification : FilterSpecification Date: Tue, 13 Oct 2026 13:28:05 +0300 Subject: [PATCH 19/19] Removes a duplicate project reference from the API project. --- src/Lumina.Presentation.Api/Lumina.Presentation.Api.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Lumina.Presentation.Api/Lumina.Presentation.Api.csproj b/src/Lumina.Presentation.Api/Lumina.Presentation.Api.csproj index aa341593..891bdb5e 100644 --- a/src/Lumina.Presentation.Api/Lumina.Presentation.Api.csproj +++ b/src/Lumina.Presentation.Api/Lumina.Presentation.Api.csproj @@ -68,7 +68,6 @@ -
@_localizer["RatingValue"]@_localizer["RatingMaxValue"]@_localizer["RatingSource"]@_localizer["RatingVoteCount"]@_localizer["RatingValue"]@_localizer["RatingMaxValue"]@_localizer["RatingSource"]@_localizer["RatingVoteCount"]
${jsLocalizedStrings.remove}
${jsLocalizedStrings.remove}