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");
}
}