mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 14:11:10 +00:00
Converts the web client request objects from classes to records.
This commit is contained in:
1 parent
5a27c22109
commit
defbd9176f
26 files changed
+247
-383
No files matched your search
@@ -9,48 +9,26 @@ namespace Lumina.Presentation.Web.Common.Requests.Libraries;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a request to get the lightweight details of the books of a media library.
|
/// Represents a request to get the lightweight details of the books of a media library.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="LibraryId">The Id of the media library whose books are retrieved. Required.</param>
|
||||||
|
/// <param name="CurrentPage">The page of results to retrieve. Optional.</param>
|
||||||
|
/// <param name="PerPage">The maximum number of books to retrieve per page. Optional.</param>
|
||||||
|
/// <param name="SearchTerm">The search term used to filter results. Optional.</param>
|
||||||
|
/// <param name="FilterAlphaKey">
|
||||||
|
/// The alpha key used to filter the results by the first character of their title, for the alpha picker. Optional.
|
||||||
|
/// Can be <see langword="null"/> 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.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="ShouldIgnoreThePrefixForAlphaPicker">Whether the leading "The " prefix of a title is ignored when computing the alpha key, or not. Optional.</param>
|
||||||
|
/// <param name="SortBy">The name of the field by which to sort the results. Optional.</param>
|
||||||
|
/// <param name="SortOrder">The direction in which to sort the results. Optional.</param>
|
||||||
[DebuggerDisplay("LibraryId: {LibraryId}")]
|
[DebuggerDisplay("LibraryId: {LibraryId}")]
|
||||||
public class GetBooksLiteRequest
|
public record GetBooksLiteRequest(
|
||||||
{
|
Guid LibraryId,
|
||||||
/// <summary>
|
int? CurrentPage,
|
||||||
/// Gets or sets the Id of the media library whose books are retrieved.
|
int? PerPage,
|
||||||
/// </summary>
|
string? SearchTerm,
|
||||||
public Guid LibraryId { get; set; }
|
string? FilterAlphaKey,
|
||||||
|
bool ShouldIgnoreThePrefixForAlphaPicker,
|
||||||
/// <summary>
|
string? SortBy,
|
||||||
/// Gets or sets the page of results to retrieve.
|
SortOrder? SortOrder
|
||||||
/// </summary>
|
);
|
||||||
public int? CurrentPage { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the maximum number of books to retrieve per page.
|
|
||||||
/// </summary>
|
|
||||||
public int? PerPage { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the search term used to filter results.
|
|
||||||
/// </summary>
|
|
||||||
public string? SearchTerm { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the alpha key used to filter the results by the first character of their title, for the alpha picker.
|
|
||||||
/// Can be <see langword="null"/> 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.
|
|
||||||
/// </summary>
|
|
||||||
public string? FilterAlphaKey { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets whether the leading "The " prefix of a title is ignored when computing the alpha key, or not.
|
|
||||||
/// </summary>
|
|
||||||
public bool ShouldIgnoreThePrefixForAlphaPicker { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the name of the field by which to sort the results.
|
|
||||||
/// </summary>
|
|
||||||
public string? SortBy { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the direction in which to sort the results.
|
|
||||||
/// </summary>
|
|
||||||
public SortOrder? SortOrder { get; set; }
|
|
||||||
}
|
|
||||||
+40
-97
@@ -13,101 +13,44 @@ namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a request to update an existing book.
|
/// Represents a request to update an existing book.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="BookId">The Id of the book to update, taken from the route. Required.</param>
|
||||||
|
/// <param name="LibraryId">The Id of the media library the book belongs to. Required.</param>
|
||||||
|
/// <param name="Metadata">The written content metadata of the book. Required.</param>
|
||||||
|
/// <param name="Format">The format of the book (e.g., Hardcover, Paperback). Optional.</param>
|
||||||
|
/// <param name="Edition">The edition of the book. Optional.</param>
|
||||||
|
/// <param name="VolumeNumber">The volume or book number in the series. Optional.</param>
|
||||||
|
/// <param name="Series">The series the book is part of. Optional.</param>
|
||||||
|
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the book. Optional.</param>
|
||||||
|
/// <param name="GoodreadsId">The Goodreads Id of the book. Optional.</param>
|
||||||
|
/// <param name="LCCN">The Library of Congress Control Number (LCCN) of the book. Optional.</param>
|
||||||
|
/// <param name="OCLCNumber">The OCLC Number (WorldCat identifier) of the book. Optional.</param>
|
||||||
|
/// <param name="OpenLibraryId">The Open Library Id of the book. Optional.</param>
|
||||||
|
/// <param name="LibraryThingId">The LibraryThing Id of the book. Optional.</param>
|
||||||
|
/// <param name="GoogleBooksId">The Google Books Id of the book. Optional.</param>
|
||||||
|
/// <param name="BarnesAndNobleId">The Barnes & Noble Id of the book. Optional.</param>
|
||||||
|
/// <param name="AppleBooksId">The Apple Books Id of the book. Optional.</param>
|
||||||
|
/// <param name="ISBNs">The list of ISBN (International Standard Book Number) of the book. Required.</param>
|
||||||
|
/// <param name="Contributors">The list of media contributors of the book. Required.</param>
|
||||||
|
/// <param name="Ratings">The list of ratings of the book. Required.</param>
|
||||||
[DebuggerDisplay("Title: {Metadata?.Title}")]
|
[DebuggerDisplay("Title: {Metadata?.Title}")]
|
||||||
public class UpdateBookRequest
|
public record UpdateBookRequest(
|
||||||
{
|
string? BookId,
|
||||||
/// <summary>
|
Guid LibraryId,
|
||||||
/// Gets or sets the Id of the book to update, taken from the route.
|
WrittenContentMetadataDto? Metadata,
|
||||||
/// </summary>
|
BookFormat? Format,
|
||||||
public string? BookId { get; set; }
|
string? Edition,
|
||||||
|
float? VolumeNumber,
|
||||||
/// <summary>
|
BookSeriesDto? Series,
|
||||||
/// Gets or sets the Id of the media library the book belongs to.
|
string? ASIN,
|
||||||
/// </summary>
|
string? GoodreadsId,
|
||||||
public Guid LibraryId { get; set; }
|
string? LCCN,
|
||||||
|
string? OCLCNumber,
|
||||||
/// <summary>
|
string? OpenLibraryId,
|
||||||
/// Gets or sets the written content metadata of the book.
|
string? LibraryThingId,
|
||||||
/// </summary>
|
string? GoogleBooksId,
|
||||||
public WrittenContentMetadataDto? Metadata { get; set; }
|
string? BarnesAndNobleId,
|
||||||
|
string? AppleBooksId,
|
||||||
/// <summary>
|
List<IsbnDto>? ISBNs,
|
||||||
/// Gets or sets the format of the book (e.g., Hardcover, Paperback), if applicable.
|
List<MediaContributorDto>? Contributors,
|
||||||
/// </summary>
|
List<BookRatingDto>? Ratings
|
||||||
public BookFormat? Format { get; set; }
|
);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the edition of the book, if applicable.
|
|
||||||
/// </summary>
|
|
||||||
public string? Edition { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the volume or book number in the series, if applicable.
|
|
||||||
/// </summary>
|
|
||||||
public float? VolumeNumber { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the series name, if the book is part of a series.
|
|
||||||
/// </summary>
|
|
||||||
public BookSeriesDto? Series { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the ASIN (Amazon Standard Identification Number) of the book, if applicable.
|
|
||||||
/// </summary>
|
|
||||||
public string? ASIN { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Goodreads Id of the book, if applicable.
|
|
||||||
/// </summary>
|
|
||||||
public string? GoodreadsId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Library of Congress Control Number (LCCN) of the book, if applicable.
|
|
||||||
/// </summary>
|
|
||||||
public string? LCCN { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the OCLC Number (WorldCat identifier) of the book, if applicable.
|
|
||||||
/// </summary>
|
|
||||||
public string? OCLCNumber { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Open Library Id of the book, if applicable.
|
|
||||||
/// </summary>
|
|
||||||
public string? OpenLibraryId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the LibraryThing Id of the book, if applicable.
|
|
||||||
/// </summary>
|
|
||||||
public string? LibraryThingId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Google Books Id of the book, if applicable.
|
|
||||||
/// </summary>
|
|
||||||
public string? GoogleBooksId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Barnes & Noble Id of the book, if applicable.
|
|
||||||
/// </summary>
|
|
||||||
public string? BarnesAndNobleId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Apple Books Id of the book, if applicable.
|
|
||||||
/// </summary>
|
|
||||||
public string? AppleBooksId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the list of ISBN (International Standard Book Number) of the book.
|
|
||||||
/// </summary>
|
|
||||||
public List<IsbnDto>? ISBNs { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the list of media contributors of the book. Required.
|
|
||||||
/// </summary>
|
|
||||||
public List<MediaContributorDto>? Contributors { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the list of ratings of the book.
|
|
||||||
/// </summary>
|
|
||||||
public List<BookRatingDto>? Ratings { get; set; }
|
|
||||||
}
|
|
||||||
+6
-12
@@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a request to reorder the artwork providers of a media library.
|
/// Represents a request to reorder the artwork providers of a media library.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="LibraryId">The Id of the media library whose artwork providers are reordered. Required.</param>
|
||||||
|
/// <param name="PluginIds">The plugin Ids in the new order, from highest to lowest rank. Required.</param>
|
||||||
[DebuggerDisplay("LibraryId: {LibraryId}")]
|
[DebuggerDisplay("LibraryId: {LibraryId}")]
|
||||||
public class ReorderLibraryArtworkProvidersRequest
|
public record ReorderLibraryArtworkProvidersRequest(
|
||||||
{
|
Guid LibraryId,
|
||||||
/// <summary>
|
List<Guid> PluginIds
|
||||||
/// Gets or sets the Id of the media library whose artwork providers are reordered.
|
);
|
||||||
/// </summary>
|
|
||||||
public Guid LibraryId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the plugin Ids in the new order, from highest to lowest rank.
|
|
||||||
/// </summary>
|
|
||||||
public List<Guid> PluginIds { get; set; } = [];
|
|
||||||
}
|
|
||||||
+6
-12
@@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a request to reorder the metadata providers of a media library.
|
/// Represents a request to reorder the metadata providers of a media library.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="LibraryId">The Id of the media library whose metadata providers are reordered. Required.</param>
|
||||||
|
/// <param name="PluginIds">The plugin Ids in the new order, from highest to lowest rank. Required.</param>
|
||||||
[DebuggerDisplay("LibraryId: {LibraryId}")]
|
[DebuggerDisplay("LibraryId: {LibraryId}")]
|
||||||
public class ReorderLibraryMetadataProvidersRequest
|
public record ReorderLibraryMetadataProvidersRequest(
|
||||||
{
|
Guid LibraryId,
|
||||||
/// <summary>
|
List<Guid> PluginIds
|
||||||
/// Gets or sets the Id of the media library whose metadata providers are reordered.
|
);
|
||||||
/// </summary>
|
|
||||||
public Guid LibraryId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the plugin Ids in the new order, from highest to lowest rank.
|
|
||||||
/// </summary>
|
|
||||||
public List<Guid> PluginIds { get; set; } = [];
|
|
||||||
}
|
|
||||||
@@ -8,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a request to enable or disable a book reader for a media library.
|
/// Represents a request to enable or disable a book reader for a media library.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="LibraryId">The Id of the media library whose book reader is enabled or disabled. Required.</param>
|
||||||
|
/// <param name="PluginId">The unique identifier of the plugin providing the book reader. Required.</param>
|
||||||
|
/// <param name="IsEnabled">Whether the book reader should be enabled for the media library. Required.</param>
|
||||||
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
|
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
|
||||||
public class SetBookReaderEnabledRequest
|
public record SetBookReaderEnabledRequest(
|
||||||
{
|
Guid LibraryId,
|
||||||
/// <summary>
|
Guid PluginId,
|
||||||
/// Gets or sets the Id of the media library whose book reader is enabled or disabled. Required.
|
bool IsEnabled
|
||||||
/// </summary>
|
);
|
||||||
public Guid LibraryId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the unique identifier of the plugin providing the book reader. Required.
|
|
||||||
/// </summary>
|
|
||||||
public Guid PluginId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets whether the book reader should be enabled for the media library. Required.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsEnabled { get; set; }
|
|
||||||
}
|
|
||||||
+8
-17
@@ -8,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a request to enable or disable an artwork provider for a media library.
|
/// Represents a request to enable or disable an artwork provider for a media library.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="LibraryId">The Id of the media library whose artwork provider is enabled or disabled. Required.</param>
|
||||||
|
/// <param name="PluginId">The unique identifier of the plugin providing the artwork. Required.</param>
|
||||||
|
/// <param name="IsEnabled">Whether the artwork provider should be enabled for the media library. Required.</param>
|
||||||
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
|
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
|
||||||
public class SetLibraryArtworkProviderEnabledRequest
|
public record SetLibraryArtworkProviderEnabledRequest(
|
||||||
{
|
Guid LibraryId,
|
||||||
/// <summary>
|
Guid PluginId,
|
||||||
/// Gets or sets the Id of the media library whose artwork provider is enabled or disabled.
|
bool IsEnabled
|
||||||
/// </summary>
|
);
|
||||||
public Guid LibraryId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the unique identifier of the plugin providing the artwork.
|
|
||||||
/// </summary>
|
|
||||||
public Guid PluginId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets whether the artwork provider should be enabled for the media library.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsEnabled { get; set; }
|
|
||||||
}
|
|
||||||
+8
-18
@@ -1,6 +1,5 @@
|
|||||||
#region ========================================================================= USING =====================================================================================
|
#region ========================================================================= USING =====================================================================================
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -9,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a request to enable or disable a metadata provider for a media library.
|
/// Represents a request to enable or disable a metadata provider for a media library.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="LibraryId">The Id of the media library whose metadata provider is enabled or disabled. Required.</param>
|
||||||
|
/// <param name="PluginId">The unique identifier of the plugin providing the metadata. Required.</param>
|
||||||
|
/// <param name="IsEnabled">Whether the metadata provider should be enabled for the media library. Required.</param>
|
||||||
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
|
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
|
||||||
public class SetLibraryMetadataProviderEnabledRequest
|
public record SetLibraryMetadataProviderEnabledRequest(
|
||||||
{
|
Guid LibraryId,
|
||||||
/// <summary>
|
Guid PluginId,
|
||||||
/// Gets or sets the Id of the media library whose metadata provider is enabled or disabled.
|
bool IsEnabled
|
||||||
/// </summary>
|
);
|
||||||
public Guid LibraryId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the unique identifier of the plugin providing the metadata.
|
|
||||||
/// </summary>
|
|
||||||
public Guid PluginId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets whether the metadata provider should be enabled for the media library.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsEnabled { get; set; }
|
|
||||||
}
|
|
||||||
@@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a request to update the settings of a plugin.
|
/// Represents a request to update the settings of a plugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="PluginId">The unique identifier of the plugin. Required.</param>
|
||||||
|
/// <param name="Settings">The settings of the plugin. Optional.</param>
|
||||||
[DebuggerDisplay("PluginId: {PluginId}")]
|
[DebuggerDisplay("PluginId: {PluginId}")]
|
||||||
public class UpdatePluginSettingsRequest
|
public record UpdatePluginSettingsRequest(
|
||||||
{
|
Guid PluginId,
|
||||||
/// <summary>
|
Dictionary<string, string>? Settings
|
||||||
/// Gets or sets the unique identifier of the plugin.
|
);
|
||||||
/// </summary>
|
|
||||||
public Guid PluginId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the settings of the plugin.
|
|
||||||
/// </summary>
|
|
||||||
public Dictionary<string, string>? Settings { get; set; }
|
|
||||||
}
|
|
||||||
+5
-5
@@ -22,12 +22,12 @@ public class ReorderArtworkProvidersEndpointSummary : Summary<ReorderArtworkProv
|
|||||||
Summary = "Reorders the artwork providers of a media library.";
|
Summary = "Reorders the artwork providers of a media library.";
|
||||||
Description = "Reorders the artwork providers of the media library identified by the route, in the provided order.";
|
Description = "Reorders the artwork providers of the media library identified by the route, in the provided order.";
|
||||||
RequestParam(r => r.LibraryId, "The Id of the media library whose artwork providers are reordered. Required.");
|
RequestParam(r => 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
|
ExampleRequest = new ReorderLibraryArtworkProvidersRequest(
|
||||||
{
|
LibraryId: Guid.NewGuid(),
|
||||||
LibraryId = Guid.NewGuid(),
|
PluginIds: [Guid.NewGuid(), Guid.NewGuid()]
|
||||||
PluginIds = [Guid.NewGuid(), Guid.NewGuid()]
|
);
|
||||||
};
|
|
||||||
|
|
||||||
Response(200, "The artwork providers of the media library are reordered.", example: new SuccessResponse(true));
|
Response(200, "The artwork providers of the media library are reordered.", example: new SuccessResponse(true));
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -25,14 +25,14 @@ public class ReorderMetadataProvidersEndpointSummary : Summary<ReorderMetadataPr
|
|||||||
RequestParam(r => r.LibraryId, "The Id of the media library whose metadata providers are reordered. Required.");
|
RequestParam(r => 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.");
|
RequestParam(r => r.PluginIds, "The plugin Ids in the new order, from highest to lowest rank. Required.");
|
||||||
|
|
||||||
ExampleRequest = new ReorderLibraryMetadataProvidersRequest
|
ExampleRequest = new ReorderLibraryMetadataProvidersRequest(
|
||||||
{
|
LibraryId: Guid.NewGuid(),
|
||||||
LibraryId = Guid.NewGuid(),
|
PluginIds:
|
||||||
PluginIds = [
|
[
|
||||||
Guid.NewGuid(),
|
Guid.NewGuid(),
|
||||||
Guid.NewGuid(),
|
Guid.NewGuid(),
|
||||||
]
|
]
|
||||||
};
|
);
|
||||||
|
|
||||||
Response(200, "The metadata providers of the media library are reordered.", example: new SuccessResponse(true));
|
Response(200, "The metadata providers of the media library are reordered.", example: new SuccessResponse(true));
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -25,12 +25,11 @@ public class SetArtworkProviderEnabledEndpointSummary : Summary<SetArtworkProvid
|
|||||||
RequestParam(r => r.PluginId, "The unique identifier of the plugin providing the artwork. Required.");
|
RequestParam(r => 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.");
|
RequestParam(r => r.IsEnabled, "Whether the artwork provider should be enabled for the media library, or not. Required.");
|
||||||
|
|
||||||
ExampleRequest = new SetLibraryArtworkProviderEnabledRequest
|
ExampleRequest = new SetLibraryArtworkProviderEnabledRequest(
|
||||||
{
|
LibraryId: Guid.NewGuid(),
|
||||||
LibraryId = Guid.NewGuid(),
|
PluginId: Guid.NewGuid(),
|
||||||
PluginId = Guid.NewGuid(),
|
IsEnabled: true
|
||||||
IsEnabled = true
|
);
|
||||||
};
|
|
||||||
|
|
||||||
Response(200, "The artwork provider of the media library is enabled or disabled.", example: new SuccessResponse(true));
|
Response(200, "The artwork provider of the media library is enabled or disabled.", example: new SuccessResponse(true));
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -25,12 +25,11 @@ public class SetBookReaderEnabledEndpointSummary : Summary<SetBookReaderEnabledE
|
|||||||
RequestParam(r => r.PluginId, "The unique identifier of the plugin providing the book reader. Required.");
|
RequestParam(r => 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.");
|
RequestParam(r => r.IsEnabled, "Whether the book reader should be enabled for the media library, or not. Required.");
|
||||||
|
|
||||||
ExampleRequest = new SetBookReaderEnabledRequest
|
ExampleRequest = new SetBookReaderEnabledRequest(
|
||||||
{
|
LibraryId: Guid.NewGuid(),
|
||||||
LibraryId = Guid.NewGuid(),
|
PluginId: Guid.NewGuid(),
|
||||||
PluginId = Guid.NewGuid(),
|
IsEnabled: true
|
||||||
IsEnabled = true
|
);
|
||||||
};
|
|
||||||
|
|
||||||
Response(200, "The book reader of the media library is enabled or disabled.", example: new SuccessResponse(true));
|
Response(200, "The book reader of the media library is enabled or disabled.", example: new SuccessResponse(true));
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -25,12 +25,11 @@ public class SetMetadataProviderEnabledEndpointSummary : Summary<SetMetadataProv
|
|||||||
RequestParam(r => r.PluginId, "The unique identifier of the plugin providing the metadata. Required.");
|
RequestParam(r => 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.");
|
RequestParam(r => r.IsEnabled, "Whether the metadata provider should be enabled for the media library, or not. Required.");
|
||||||
|
|
||||||
ExampleRequest = new SetLibraryMetadataProviderEnabledRequest
|
ExampleRequest = new SetLibraryMetadataProviderEnabledRequest(
|
||||||
{
|
LibraryId: Guid.NewGuid(),
|
||||||
LibraryId = Guid.NewGuid(),
|
PluginId: Guid.NewGuid(),
|
||||||
PluginId = Guid.NewGuid(),
|
IsEnabled: true
|
||||||
IsEnabled = true
|
);
|
||||||
};
|
|
||||||
|
|
||||||
Response(200, "The metadata provider of the media library is enabled or disabled.", example: new SuccessResponse(true));
|
Response(200, "The metadata provider of the media library is enabled or disabled.", example: new SuccessResponse(true));
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-11
@@ -33,17 +33,16 @@ public class GetLibraryItemsEndpointSummary : Summary<GetLibraryItemsEndpoint, G
|
|||||||
RequestParam(r => r.SortBy, "The name of the field by which to sort the results. 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.");
|
RequestParam(r => r.SortOrder, "The direction in which to sort the results. Optional.");
|
||||||
|
|
||||||
ExampleRequest = new GetBooksLiteRequest
|
ExampleRequest = new GetBooksLiteRequest(
|
||||||
{
|
LibraryId: Guid.NewGuid(),
|
||||||
LibraryId = Guid.NewGuid(),
|
CurrentPage: 1,
|
||||||
CurrentPage = 1,
|
PerPage: 48,
|
||||||
PerPage = 48,
|
SearchTerm: "fellowship",
|
||||||
SearchTerm = "fellowship",
|
FilterAlphaKey: "f",
|
||||||
FilterAlphaKey = "f",
|
ShouldIgnoreThePrefixForAlphaPicker: true,
|
||||||
ShouldIgnoreThePrefixForAlphaPicker = true,
|
SortBy: "title",
|
||||||
SortBy = "title",
|
SortOrder: SortOrder.Ascending
|
||||||
SortOrder = SortOrder.Ascending
|
);
|
||||||
};
|
|
||||||
|
|
||||||
Response(200, "The lightweight details of the books of the media library are returned.", example: new SuccessResponse<PaginatedBookLiteDto>(true, default));
|
Response(200, "The lightweight details of the books of the media library are returned.", example: new SuccessResponse<PaginatedBookLiteDto>(true, default));
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-5
@@ -50,14 +50,15 @@ public class SaveBookEndpoint : BaseEndpoint<UpdateBookRequest, IResult>
|
|||||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||||
public override async Task<IResult> ExecuteAsync(UpdateBookRequest request, CancellationToken cancellationToken)
|
public override async Task<IResult> 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 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; the value is normalized to a Guid before it is substituted into the upstream URL, so that a crafted
|
// the update to another book; both ids 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 book id.
|
// 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;
|
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<BookDetailsDto, UpdateBookRequest>(
|
BookDetailsDto book = await _apiHttpClient.PutAsync<BookDetailsDto, UpdateBookRequest>(
|
||||||
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);
|
return JsonSuccess(book);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+21
-22
@@ -72,11 +72,10 @@ public class SaveBookEndpointSummary : Summary<SaveBookEndpoint, UpdateBookReque
|
|||||||
RequestParam(r => r.Contributors, "The list of media contributors of the book. Required.");
|
RequestParam(r => r.Contributors, "The list of media contributors of the book. Required.");
|
||||||
RequestParam(r => r.Ratings, "The list of ratings of the book. Required.");
|
RequestParam(r => r.Ratings, "The list of ratings of the book. Required.");
|
||||||
|
|
||||||
ExampleRequest = new UpdateBookRequest
|
ExampleRequest = new UpdateBookRequest(
|
||||||
{
|
BookId: Guid.NewGuid().ToString(),
|
||||||
BookId = Guid.NewGuid().ToString(),
|
LibraryId: Guid.NewGuid(),
|
||||||
LibraryId = Guid.NewGuid(),
|
Metadata: new WrittenContentMetadataDto
|
||||||
Metadata = new WrittenContentMetadataDto
|
|
||||||
{
|
{
|
||||||
Title = "The Fellowship of the Ring",
|
Title = "The Fellowship of the Ring",
|
||||||
OriginalTitle = "The Fellowship of the Ring",
|
OriginalTitle = "The Fellowship of the Ring",
|
||||||
@@ -117,28 +116,28 @@ public class SaveBookEndpointSummary : Summary<SaveBookEndpoint, UpdateBookReque
|
|||||||
Publisher = "Houghton Mifflin",
|
Publisher = "Houghton Mifflin",
|
||||||
PageCount = 398
|
PageCount = 398
|
||||||
},
|
},
|
||||||
Format = BookFormat.Paperback,
|
Format: BookFormat.Paperback,
|
||||||
Edition = "50th Anniversary Edition",
|
Edition: "50th Anniversary Edition",
|
||||||
VolumeNumber = 1,
|
VolumeNumber: 1,
|
||||||
Series = new BookSeriesDto
|
Series: new BookSeriesDto
|
||||||
{
|
{
|
||||||
Title = "The Lord of the Rings"
|
Title = "The Lord of the Rings"
|
||||||
},
|
},
|
||||||
ASIN = "B007978NPG",
|
ASIN: "B007978NPG",
|
||||||
GoodreadsId = "3",
|
GoodreadsId: "3",
|
||||||
LCCN = "54009621",
|
LCCN: "54009621",
|
||||||
OCLCNumber = "ocm00012345",
|
OCLCNumber: "ocm00012345",
|
||||||
OpenLibraryId = "OL7603910M",
|
OpenLibraryId: "OL7603910M",
|
||||||
LibraryThingId = "3203347",
|
LibraryThingId: "3203347",
|
||||||
GoogleBooksId = "aWZzLPhY4o0C",
|
GoogleBooksId: "aWZzLPhY4o0C",
|
||||||
BarnesAndNobleId = "1100307790",
|
BarnesAndNobleId: "1100307790",
|
||||||
AppleBooksId = "id395211",
|
AppleBooksId: "id395211",
|
||||||
ISBNs =
|
ISBNs:
|
||||||
[
|
[
|
||||||
new IsbnDto { Value = "0395272238", Format = IsbnFormat.Isbn10 },
|
new IsbnDto { Value = "0395272238", Format = IsbnFormat.Isbn10 },
|
||||||
new IsbnDto { Value = "9780395272237", Format = IsbnFormat.Isbn13 }
|
new IsbnDto { Value = "9780395272237", Format = IsbnFormat.Isbn13 }
|
||||||
],
|
],
|
||||||
Contributors =
|
Contributors:
|
||||||
[
|
[
|
||||||
new MediaContributorDto
|
new MediaContributorDto
|
||||||
{
|
{
|
||||||
@@ -151,12 +150,12 @@ public class SaveBookEndpointSummary : Summary<SaveBookEndpoint, UpdateBookReque
|
|||||||
Role = MediaContributorRole.Illustrator
|
Role = MediaContributorRole.Illustrator
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
Ratings =
|
Ratings:
|
||||||
[
|
[
|
||||||
new BookRatingDto { Source = BookRatingSource.GoogleBooks, Value = 4.36M, MaxValue = 5, VoteCount = 2345678 },
|
new BookRatingDto { Source = BookRatingSource.GoogleBooks, Value = 4.36M, MaxValue = 5, VoteCount = 2345678 },
|
||||||
new BookRatingDto { Source = BookRatingSource.Amazon, Value = 4.7M, MaxValue = 5, VoteCount = 87654 }
|
new BookRatingDto { Source = BookRatingSource.Amazon, Value = 4.7M, MaxValue = 5, VoteCount = 87654 }
|
||||||
]
|
]
|
||||||
};
|
);
|
||||||
|
|
||||||
Response(200, "The updated book is returned.", example: new SuccessResponse<BookDetailsDto>(true, default));
|
Response(200, "The updated book is returned.", example: new SuccessResponse<BookDetailsDto>(true, default));
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-5
@@ -25,15 +25,14 @@ public class UpdatePluginSettingsEndpointSummary : Summary<UpdatePluginSettingsE
|
|||||||
RequestParam(r => r.PluginId, "The unique identifier of the plugin. Required.");
|
RequestParam(r => r.PluginId, "The unique identifier of the plugin. Required.");
|
||||||
RequestParam(r => r.Settings, "The settings of the plugin. Optional.");
|
RequestParam(r => r.Settings, "The settings of the plugin. Optional.");
|
||||||
|
|
||||||
ExampleRequest = new UpdatePluginSettingsRequest
|
ExampleRequest = new UpdatePluginSettingsRequest(
|
||||||
{
|
PluginId: Guid.NewGuid(),
|
||||||
PluginId = Guid.NewGuid(),
|
Settings: new Dictionary<string, string>
|
||||||
Settings = new Dictionary<string, string>
|
|
||||||
{
|
{
|
||||||
{ "preferredLanguage", "fr" },
|
{ "preferredLanguage", "fr" },
|
||||||
{ "selectionStrategy", "first" }
|
{ "selectionStrategy", "first" }
|
||||||
}
|
}
|
||||||
};
|
);
|
||||||
|
|
||||||
Response(200, "The settings of the plugin are updated.", example: new SuccessResponse(true));
|
Response(200, "The settings of the plugin are updated.", example: new SuccessResponse(true));
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-12
@@ -10,7 +10,7 @@ using System.Linq;
|
|||||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Libraries;
|
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Libraries;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fixture class for the <see cref="GetBooksLiteRequest"/> class.
|
/// Fixture class for the <see cref="GetBooksLiteRequest"/> record.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ExcludeFromCodeCoverage]
|
[ExcludeFromCodeCoverage]
|
||||||
public class GetBooksLiteRequestFixture
|
public class GetBooksLiteRequestFixture
|
||||||
@@ -37,17 +37,16 @@ public class GetBooksLiteRequestFixture
|
|||||||
string? sortBy = null,
|
string? sortBy = null,
|
||||||
SortOrder? sortOrder = null)
|
SortOrder? sortOrder = null)
|
||||||
{
|
{
|
||||||
return new GetBooksLiteRequest
|
return new GetBooksLiteRequest(
|
||||||
{
|
LibraryId: libraryId ?? Guid.NewGuid(),
|
||||||
LibraryId = libraryId ?? Guid.NewGuid(),
|
CurrentPage: currentPage,
|
||||||
CurrentPage = currentPage,
|
PerPage: perPage,
|
||||||
PerPage = perPage,
|
SearchTerm: searchTerm,
|
||||||
SearchTerm = searchTerm,
|
FilterAlphaKey: filterAlphaKey,
|
||||||
FilterAlphaKey = filterAlphaKey,
|
ShouldIgnoreThePrefixForAlphaPicker: shouldIgnoreThePrefixForAlphaPicker,
|
||||||
ShouldIgnoreThePrefixForAlphaPicker = shouldIgnoreThePrefixForAlphaPicker,
|
SortBy: sortBy,
|
||||||
SortBy = sortBy,
|
SortOrder: sortOrder
|
||||||
SortOrder = sortOrder
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+22
-23
@@ -15,7 +15,7 @@ using System.Linq;
|
|||||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books;
|
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.WrittenContentLibrary.BookLibrary.Books;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fixture class for the <see cref="UpdateBookRequest"/> class.
|
/// Fixture class for the <see cref="UpdateBookRequest"/> record.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ExcludeFromCodeCoverage]
|
[ExcludeFromCodeCoverage]
|
||||||
public class UpdateBookRequestFixture
|
public class UpdateBookRequestFixture
|
||||||
@@ -73,28 +73,27 @@ public class UpdateBookRequestFixture
|
|||||||
bool includeContributors = true,
|
bool includeContributors = true,
|
||||||
bool includeRatings = true)
|
bool includeRatings = true)
|
||||||
{
|
{
|
||||||
return new UpdateBookRequest
|
return new UpdateBookRequest(
|
||||||
{
|
BookId: id?.ToString() ?? Guid.NewGuid().ToString(),
|
||||||
BookId = id?.ToString() ?? Guid.NewGuid().ToString(),
|
LibraryId: libraryId ?? Guid.NewGuid(),
|
||||||
LibraryId = libraryId ?? Guid.NewGuid(),
|
Metadata: includeMetadata ? (metadata ?? _writtenContentMetadataDtoFixture.Create()) : null,
|
||||||
Metadata = includeMetadata ? (metadata ?? _writtenContentMetadataDtoFixture.Create()) : null,
|
Format: includeFormat ? _faker.PickRandom<BookFormat>() : null,
|
||||||
Format = includeFormat ? _faker.PickRandom<BookFormat>() : null,
|
Edition: includeEdition ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null,
|
||||||
Edition = includeEdition ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null,
|
VolumeNumber: includeVolumeNumber ? _faker.Random.Number(1, 3) : null,
|
||||||
VolumeNumber = includeVolumeNumber ? _faker.Random.Number(1, 3) : null,
|
Series: includeSeries ? _bookSeriesDtoFixture.Create() : null,
|
||||||
Series = includeSeries ? _bookSeriesDtoFixture.Create() : null,
|
ASIN: includeAsin ? _faker.Random.String2(10) : null,
|
||||||
ASIN = includeAsin ? _faker.Random.String2(10) : null,
|
GoodreadsId: includeGoodreadsId ? _faker.Random.Number(100000, 500000).ToString() : null,
|
||||||
GoodreadsId = includeGoodreadsId ? _faker.Random.Number(100000, 500000).ToString() : null,
|
LCCN: includeLccn ? "n78890351" : null,
|
||||||
LCCN = includeLccn ? "n78890351" : null,
|
OCLCNumber: includeOclcNumber ? "ocm12345678" : null,
|
||||||
OCLCNumber = includeOclcNumber ? "ocm12345678" : null,
|
OpenLibraryId: includeOpenLibraryId ? "OL123456M" : null,
|
||||||
OpenLibraryId = includeOpenLibraryId ? "OL123456M" : null,
|
LibraryThingId: includeLibraryThingId ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null,
|
||||||
LibraryThingId = includeLibraryThingId ? _faker.Random.String2(_faker.Random.Number(1, 50)) : null,
|
GoogleBooksId: includeGoogleBooksId ? CreateGoogleBooksId() : null,
|
||||||
GoogleBooksId = includeGoogleBooksId ? CreateGoogleBooksId() : null,
|
BarnesAndNobleId: includeBarnesAndNobleId ? _faker.Random.String2(10, "0123456789") : null,
|
||||||
BarnesAndNobleId = includeBarnesAndNobleId ? _faker.Random.String2(10, "0123456789") : null,
|
AppleBooksId: includeAppleBooksId ? $"id{_faker.Random.Number(1, 999999)}" : null,
|
||||||
AppleBooksId = includeAppleBooksId ? $"id{_faker.Random.Number(1, 999999)}" : null,
|
ISBNs: includeIsbns ? [.. _isbnDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null,
|
||||||
ISBNs = includeIsbns ? [.. _isbnDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null,
|
Contributors: includeContributors ? [.. _mediaContributorDtoFixture.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
|
||||||
Ratings = includeRatings ? [.. _bookRatingDtoFixture.CreateMany(_faker.Random.Number(1, 3))] : null
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+5
-6
@@ -10,7 +10,7 @@ using System.Linq;
|
|||||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fixture class for the <see cref="ReorderLibraryArtworkProvidersRequest"/> class.
|
/// Fixture class for the <see cref="ReorderLibraryArtworkProvidersRequest"/> record.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ExcludeFromCodeCoverage]
|
[ExcludeFromCodeCoverage]
|
||||||
public class ReorderLibraryArtworkProvidersRequestFixture
|
public class ReorderLibraryArtworkProvidersRequestFixture
|
||||||
@@ -27,11 +27,10 @@ public class ReorderLibraryArtworkProvidersRequestFixture
|
|||||||
Guid? libraryId = null,
|
Guid? libraryId = null,
|
||||||
List<Guid>? pluginIds = null)
|
List<Guid>? pluginIds = null)
|
||||||
{
|
{
|
||||||
return new ReorderLibraryArtworkProvidersRequest
|
return new ReorderLibraryArtworkProvidersRequest(
|
||||||
{
|
LibraryId: libraryId ?? Guid.NewGuid(),
|
||||||
LibraryId = libraryId ?? Guid.NewGuid(),
|
PluginIds: pluginIds ?? [_faker.Random.Guid(), _faker.Random.Guid()]
|
||||||
PluginIds = pluginIds ?? [_faker.Random.Guid(), _faker.Random.Guid()]
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+5
-6
@@ -10,7 +10,7 @@ using System.Linq;
|
|||||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fixture class for the <see cref="ReorderLibraryMetadataProvidersRequest"/> class.
|
/// Fixture class for the <see cref="ReorderLibraryMetadataProvidersRequest"/> record.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ExcludeFromCodeCoverage]
|
[ExcludeFromCodeCoverage]
|
||||||
public class ReorderLibraryMetadataProvidersRequestFixture
|
public class ReorderLibraryMetadataProvidersRequestFixture
|
||||||
@@ -27,11 +27,10 @@ public class ReorderLibraryMetadataProvidersRequestFixture
|
|||||||
Guid? libraryId = null,
|
Guid? libraryId = null,
|
||||||
List<Guid>? pluginIds = null)
|
List<Guid>? pluginIds = null)
|
||||||
{
|
{
|
||||||
return new ReorderLibraryMetadataProvidersRequest
|
return new ReorderLibraryMetadataProvidersRequest(
|
||||||
{
|
LibraryId: libraryId ?? Guid.NewGuid(),
|
||||||
LibraryId = libraryId ?? Guid.NewGuid(),
|
PluginIds: pluginIds ?? [_faker.Random.Guid(), _faker.Random.Guid()]
|
||||||
PluginIds = pluginIds ?? [_faker.Random.Guid(), _faker.Random.Guid()]
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+6
-7
@@ -9,7 +9,7 @@ using System.Linq;
|
|||||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fixture class for the <see cref="SetBookReaderEnabledRequest"/> class.
|
/// Fixture class for the <see cref="SetBookReaderEnabledRequest"/> record.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ExcludeFromCodeCoverage]
|
[ExcludeFromCodeCoverage]
|
||||||
public class SetBookReaderEnabledRequestFixture
|
public class SetBookReaderEnabledRequestFixture
|
||||||
@@ -26,12 +26,11 @@ public class SetBookReaderEnabledRequestFixture
|
|||||||
Guid? pluginId = null,
|
Guid? pluginId = null,
|
||||||
bool? isEnabled = null)
|
bool? isEnabled = null)
|
||||||
{
|
{
|
||||||
return new SetBookReaderEnabledRequest
|
return new SetBookReaderEnabledRequest(
|
||||||
{
|
LibraryId: libraryId ?? Guid.NewGuid(),
|
||||||
LibraryId = libraryId ?? Guid.NewGuid(),
|
PluginId: pluginId ?? Guid.NewGuid(),
|
||||||
PluginId = pluginId ?? Guid.NewGuid(),
|
IsEnabled: isEnabled ?? true
|
||||||
IsEnabled = isEnabled ?? true
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+6
-7
@@ -10,7 +10,7 @@ using System.Linq;
|
|||||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fixture class for the <see cref="SetLibraryArtworkProviderEnabledRequest"/> class.
|
/// Fixture class for the <see cref="SetLibraryArtworkProviderEnabledRequest"/> record.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ExcludeFromCodeCoverage]
|
[ExcludeFromCodeCoverage]
|
||||||
public class SetLibraryArtworkProviderEnabledRequestFixture
|
public class SetLibraryArtworkProviderEnabledRequestFixture
|
||||||
@@ -29,12 +29,11 @@ public class SetLibraryArtworkProviderEnabledRequestFixture
|
|||||||
Guid? pluginId = null,
|
Guid? pluginId = null,
|
||||||
bool? isEnabled = null)
|
bool? isEnabled = null)
|
||||||
{
|
{
|
||||||
return new SetLibraryArtworkProviderEnabledRequest
|
return new SetLibraryArtworkProviderEnabledRequest(
|
||||||
{
|
LibraryId: libraryId ?? Guid.NewGuid(),
|
||||||
LibraryId = libraryId ?? Guid.NewGuid(),
|
PluginId: pluginId ?? Guid.NewGuid(),
|
||||||
PluginId = pluginId ?? Guid.NewGuid(),
|
IsEnabled: isEnabled ?? _faker.Random.Bool()
|
||||||
IsEnabled = isEnabled ?? _faker.Random.Bool()
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+6
-7
@@ -10,7 +10,7 @@ using System.Linq;
|
|||||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fixture class for the <see cref="SetLibraryMetadataProviderEnabledRequest"/> class.
|
/// Fixture class for the <see cref="SetLibraryMetadataProviderEnabledRequest"/> record.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ExcludeFromCodeCoverage]
|
[ExcludeFromCodeCoverage]
|
||||||
public class SetLibraryMetadataProviderEnabledRequestFixture
|
public class SetLibraryMetadataProviderEnabledRequestFixture
|
||||||
@@ -29,12 +29,11 @@ public class SetLibraryMetadataProviderEnabledRequestFixture
|
|||||||
Guid? pluginId = null,
|
Guid? pluginId = null,
|
||||||
bool? isEnabled = null)
|
bool? isEnabled = null)
|
||||||
{
|
{
|
||||||
return new SetLibraryMetadataProviderEnabledRequest
|
return new SetLibraryMetadataProviderEnabledRequest(
|
||||||
{
|
LibraryId: libraryId ?? Guid.NewGuid(),
|
||||||
LibraryId = libraryId ?? Guid.NewGuid(),
|
PluginId: pluginId ?? Guid.NewGuid(),
|
||||||
PluginId = pluginId ?? Guid.NewGuid(),
|
IsEnabled: isEnabled ?? _faker.Random.Bool()
|
||||||
IsEnabled = isEnabled ?? _faker.Random.Bool()
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+5
-6
@@ -10,7 +10,7 @@ using System.Linq;
|
|||||||
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Plugins;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fixture class for the <see cref="UpdatePluginSettingsRequest"/> class.
|
/// Fixture class for the <see cref="UpdatePluginSettingsRequest"/> record.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ExcludeFromCodeCoverage]
|
[ExcludeFromCodeCoverage]
|
||||||
public class UpdatePluginSettingsRequestFixture
|
public class UpdatePluginSettingsRequestFixture
|
||||||
@@ -27,11 +27,10 @@ public class UpdatePluginSettingsRequestFixture
|
|||||||
Guid? pluginId = null,
|
Guid? pluginId = null,
|
||||||
Dictionary<string, string>? settings = null)
|
Dictionary<string, string>? settings = null)
|
||||||
{
|
{
|
||||||
return new UpdatePluginSettingsRequest
|
return new UpdatePluginSettingsRequest(
|
||||||
{
|
PluginId: pluginId ?? Guid.NewGuid(),
|
||||||
PluginId = pluginId ?? Guid.NewGuid(),
|
Settings: settings ?? new Dictionary<string, string> { [_faker.Lorem.Word()] = _faker.Lorem.Word() }
|
||||||
Settings = settings ?? new Dictionary<string, string> { [_faker.Lorem.Word()] = _faker.Lorem.Word() }
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+11
-9
@@ -45,6 +45,7 @@ public class SaveBookEndpointTests
|
|||||||
// Arrange
|
// Arrange
|
||||||
string routeId = Guid.NewGuid().ToString();
|
string routeId = Guid.NewGuid().ToString();
|
||||||
UpdateBookRequest request = _updateBookRequestFixture.Create();
|
UpdateBookRequest request = _updateBookRequestFixture.Create();
|
||||||
|
string originalBookId = request.BookId!;
|
||||||
BookDetailsDto expectedBook = _bookDetailsDtoFixture.Create();
|
BookDetailsDto expectedBook = _bookDetailsDtoFixture.Create();
|
||||||
_mockApiHttpClient.PutAsync<BookDetailsDto, UpdateBookRequest>(Arg.Any<string>(), Arg.Any<UpdateBookRequest>(), Arg.Any<CancellationToken>())
|
_mockApiHttpClient.PutAsync<BookDetailsDto, UpdateBookRequest>(Arg.Any<string>(), Arg.Any<UpdateBookRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(expectedBook);
|
.Returns(expectedBook);
|
||||||
@@ -56,8 +57,9 @@ public class SaveBookEndpointTests
|
|||||||
// Assert
|
// Assert
|
||||||
await _mockApiHttpClient.Received(1).PutAsync<BookDetailsDto, UpdateBookRequest>(
|
await _mockApiHttpClient.Received(1).PutAsync<BookDetailsDto, UpdateBookRequest>(
|
||||||
Arg.Is<string>(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", routeId)),
|
Arg.Is<string>(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", routeId)),
|
||||||
Arg.Is<UpdateBookRequest>(forwardedRequest => forwardedRequest == request && forwardedRequest.BookId == routeId),
|
Arg.Is<UpdateBookRequest>(forwardedRequest => forwardedRequest.BookId == routeId),
|
||||||
Arg.Any<CancellationToken>());
|
Arg.Any<CancellationToken>());
|
||||||
|
Assert.Equal(originalBookId, request.BookId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -66,8 +68,7 @@ public class SaveBookEndpointTests
|
|||||||
// Arrange
|
// Arrange
|
||||||
string routeId = Guid.NewGuid().ToString();
|
string routeId = Guid.NewGuid().ToString();
|
||||||
string bodyId = Guid.NewGuid().ToString();
|
string bodyId = Guid.NewGuid().ToString();
|
||||||
UpdateBookRequest request = _updateBookRequestFixture.Create();
|
UpdateBookRequest request = _updateBookRequestFixture.Create() with { BookId = bodyId };
|
||||||
request.BookId = bodyId;
|
|
||||||
BookDetailsDto expectedBook = _bookDetailsDtoFixture.Create();
|
BookDetailsDto expectedBook = _bookDetailsDtoFixture.Create();
|
||||||
_mockApiHttpClient.PutAsync<BookDetailsDto, UpdateBookRequest>(Arg.Any<string>(), Arg.Any<UpdateBookRequest>(), Arg.Any<CancellationToken>())
|
_mockApiHttpClient.PutAsync<BookDetailsDto, UpdateBookRequest>(Arg.Any<string>(), Arg.Any<UpdateBookRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(expectedBook);
|
.Returns(expectedBook);
|
||||||
@@ -79,8 +80,9 @@ public class SaveBookEndpointTests
|
|||||||
// Assert
|
// Assert
|
||||||
await _mockApiHttpClient.Received(1).PutAsync<BookDetailsDto, UpdateBookRequest>(
|
await _mockApiHttpClient.Received(1).PutAsync<BookDetailsDto, UpdateBookRequest>(
|
||||||
Arg.Is<string>(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", routeId)),
|
Arg.Is<string>(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", routeId)),
|
||||||
Arg.Is<UpdateBookRequest>(forwardedRequest => forwardedRequest == request && forwardedRequest.BookId == routeId && forwardedRequest.BookId != bodyId),
|
Arg.Is<UpdateBookRequest>(forwardedRequest => forwardedRequest.BookId == routeId && forwardedRequest.BookId != bodyId),
|
||||||
Arg.Any<CancellationToken>());
|
Arg.Any<CancellationToken>());
|
||||||
|
Assert.Equal(bodyId, request.BookId);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -101,7 +103,7 @@ public class SaveBookEndpointTests
|
|||||||
// Assert
|
// Assert
|
||||||
await _mockApiHttpClient.Received(1).PutAsync<BookDetailsDto, UpdateBookRequest>(
|
await _mockApiHttpClient.Received(1).PutAsync<BookDetailsDto, UpdateBookRequest>(
|
||||||
Arg.Is<string>(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", expectedId)),
|
Arg.Is<string>(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", expectedId)),
|
||||||
Arg.Is<UpdateBookRequest>(forwardedRequest => forwardedRequest == request && forwardedRequest.BookId == expectedId),
|
Arg.Is<UpdateBookRequest>(forwardedRequest => forwardedRequest.BookId == expectedId),
|
||||||
Arg.Any<CancellationToken>());
|
Arg.Any<CancellationToken>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +124,7 @@ public class SaveBookEndpointTests
|
|||||||
// Assert
|
// Assert
|
||||||
await _mockApiHttpClient.Received(1).PutAsync<BookDetailsDto, UpdateBookRequest>(
|
await _mockApiHttpClient.Received(1).PutAsync<BookDetailsDto, UpdateBookRequest>(
|
||||||
Arg.Is<string>(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", expectedId)),
|
Arg.Is<string>(endpoint => endpoint == ApiRoutes.Books.UPDATE_BOOK.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{bookId}", expectedId)),
|
||||||
Arg.Is<UpdateBookRequest>(forwardedRequest => forwardedRequest == request && forwardedRequest.BookId == expectedId),
|
Arg.Is<UpdateBookRequest>(forwardedRequest => forwardedRequest.BookId == expectedId),
|
||||||
Arg.Any<CancellationToken>());
|
Arg.Any<CancellationToken>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +150,7 @@ public class SaveBookEndpointTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the <c>id</c> route value the endpoint reads the book Id from.
|
/// Sets the <c>bookId</c> route value the endpoint reads the book Id from.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="routeId">The raw route value of the book Id.</param>
|
/// <param name="routeId">The raw route value of the book Id.</param>
|
||||||
private void ConfigureRequest(string routeId)
|
private void ConfigureRequest(string routeId)
|
||||||
@@ -157,10 +159,10 @@ public class SaveBookEndpointTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Leaves the <c>id</c> route value unset.
|
/// Leaves the <c>bookId</c> route value unset.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ConfigureRequestWithoutId()
|
private void ConfigureRequestWithoutId()
|
||||||
{
|
{
|
||||||
_sut.HttpContext.Request.RouteValues.Remove("id");
|
_sut.HttpContext.Request.RouteValues.Remove("bookId");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user