mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 08:01:10 +00:00
Adds in the Web app the required deserialization DTOs for interaction with the books API endpoint
This commit is contained in:
1 parent
511802948f
commit
0b8b67182c
19 files changed
+521
-6
No files matched your search
@@ -0,0 +1,33 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Models.Books;
|
||||
using Lumina.Presentation.Web.Common.Models.Contributors;
|
||||
using Lumina.Presentation.Web.Common.Enums;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Contracts.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to add a book.
|
||||
/// </summary>
|
||||
public class AddBookRequest
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
public WrittenContentMetadataDto? Metadata { get; set; }
|
||||
public BookFormat? Format { get; set; }
|
||||
public string? Edition { get; set; }
|
||||
public int? VolumeNumber { get; set; }
|
||||
public BookSeriesDto? Series { get; set; }
|
||||
public string? ASIN { get; set; }
|
||||
public string? GoodreadsId { get; set; }
|
||||
public string? LCCN { get; set; }
|
||||
public string? OCLCNumber { get; set; }
|
||||
public string? OpenLibraryId { get; set; }
|
||||
public string? LibraryThingId { get; set; }
|
||||
public string? GoogleBooksId { get; set; }
|
||||
public string? BarnesAndNobleId { get; set; }
|
||||
public string? AppleBooksId { get; set; }
|
||||
public List<IsbnDto>? ISBNs { get; set; }
|
||||
public List<MediaContributorDto>? Contributors { get; set; }
|
||||
public List<BookRatingDto>? Ratings { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the various sources of audio ratings.
|
||||
/// </summary>
|
||||
public enum AudioRatingSource
|
||||
{
|
||||
/// <summary>
|
||||
/// Ratings provided by users of the Lumina media library.
|
||||
/// </summary>
|
||||
User,
|
||||
|
||||
/// <summary>
|
||||
/// Ratings sourced from MusicBrainz, an open music encyclopedia that collects music metadata.
|
||||
/// </summary>
|
||||
MusicBrainz,
|
||||
|
||||
/// <summary>
|
||||
/// Ratings obtained from Discogs, a database and marketplace for music recordings.
|
||||
/// </summary>
|
||||
Discogs,
|
||||
|
||||
/// <summary>
|
||||
/// Ratings from Last.fm, a music website that provides music recommendations based on user listening habits.
|
||||
/// </summary>
|
||||
LastFm,
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for various book formats.
|
||||
/// </summary>
|
||||
public enum BookFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// A book bound with rigid protective covers (typically cardboard covered with cloth, heavy paper, or leather).
|
||||
/// </summary>
|
||||
Hardcover,
|
||||
|
||||
/// <summary>
|
||||
/// A book with a flexible paper cover, typically less durable than a hardcover.
|
||||
/// </summary>
|
||||
Paperback,
|
||||
|
||||
/// <summary>
|
||||
/// A small, usually non-illustrated, and inexpensive paperback book.
|
||||
/// </summary>
|
||||
MassMarketPaperback,
|
||||
|
||||
/// <summary>
|
||||
/// A larger, often higher-quality paperback book, typically used for literary fiction and nonfiction.
|
||||
/// </summary>
|
||||
TradePaperback,
|
||||
|
||||
/// <summary>
|
||||
/// A digital version of a book that can be read on electronic devices.
|
||||
/// </summary>
|
||||
eBook,
|
||||
|
||||
/// <summary>
|
||||
/// A recorded audio version of a book, either on physical media or as a digital file.
|
||||
/// </summary>
|
||||
Audiobook,
|
||||
|
||||
/// <summary>
|
||||
/// A book printed with larger text for easier reading, often used by those with visual impairments.
|
||||
/// </summary>
|
||||
LargePrint,
|
||||
|
||||
/// <summary>
|
||||
/// A sturdy book with thick cardboard pages, typically designed for young children.
|
||||
/// </summary>
|
||||
BoardBook,
|
||||
|
||||
/// <summary>
|
||||
/// A book bound with a spiral wire or plastic coil, allowing it to lay flat when open.
|
||||
/// </summary>
|
||||
SpiralBound,
|
||||
|
||||
/// <summary>
|
||||
/// A reinforced binding designed for frequent use, often used in schools and public libraries.
|
||||
/// </summary>
|
||||
LibraryBinding,
|
||||
|
||||
/// <summary>
|
||||
/// A book bound in leather, often used for luxury or collector's editions.
|
||||
/// </summary>
|
||||
LeatherBound,
|
||||
|
||||
/// <summary>
|
||||
/// A book with three-dimensional paper engineering, creating pop-up or movable parts.
|
||||
/// </summary>
|
||||
PopupBook
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the various sources of book ratings.
|
||||
/// </summary>
|
||||
public enum BookRatingSource
|
||||
{
|
||||
/// <summary>
|
||||
/// Ratings provided by users of the Lumina system.
|
||||
/// </summary>
|
||||
User,
|
||||
|
||||
/// <summary>
|
||||
/// Ratings sourced from Goodreads, a social network for book readers that provides book recommendations and reviews.
|
||||
/// </summary>
|
||||
Goodreads,
|
||||
|
||||
/// <summary>
|
||||
/// Ratings obtained from Amazon, an e-commerce platform that includes customer reviews and ratings for books.
|
||||
/// </summary>
|
||||
Amazon,
|
||||
|
||||
/// <summary>
|
||||
/// Ratings from Google Books, a service that searches the full text of books and magazines that Google has scanned and converted to text.
|
||||
/// </summary>
|
||||
GoogleBooks,
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the different ISBN (International Standard Book Number) formats.
|
||||
/// </summary>
|
||||
public enum IsbnFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// The 10-digit ISBN format used for books published before 2007.
|
||||
/// Example: 0-306-40615-2
|
||||
/// </summary>
|
||||
Isbn10,
|
||||
|
||||
/// <summary>
|
||||
/// The 13-digit ISBN format introduced in 2007, now the standard for all new books.
|
||||
/// Example: 978-0-306-40615-7
|
||||
/// </summary>
|
||||
Isbn13
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the various sources of video ratings.
|
||||
/// </summary>
|
||||
public enum VideoRatingSource
|
||||
{
|
||||
/// <summary>
|
||||
/// Ratings provided by users of the Lumina media library.
|
||||
/// </summary>
|
||||
User,
|
||||
|
||||
/// <summary>
|
||||
/// Ratings sourced from IMDb (Internet Movie Database), an online database of information related to films, TV programs, and video games.
|
||||
/// </summary>
|
||||
Imdb,
|
||||
|
||||
/// <summary>
|
||||
/// Ratings obtained from TheTVDB, an open database for television shows, including episode information and user ratings.
|
||||
/// </summary>
|
||||
TheTvDb,
|
||||
|
||||
/// <summary>
|
||||
/// Ratings from The Movie Database (TMDb), a community-built movie and TV database.
|
||||
/// </summary>
|
||||
TheMovieDb,
|
||||
|
||||
/// <summary>
|
||||
/// Ratings from Rotten Tomatoes, a review-aggregation website for film and television.
|
||||
/// </summary>
|
||||
RottenTomatoes,
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Models.Common;
|
||||
using Lumina.Presentation.Web.Common.Enums;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a book rating.
|
||||
/// </summary>
|
||||
public class BookRatingDto : RatingDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the optional source of the rating (e.g., "Goodreads", "Amazon").
|
||||
/// </summary>
|
||||
public BookRatingSource? Source { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get book series information.
|
||||
/// </summary>
|
||||
public class BookSeriesDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the title of the book series.
|
||||
/// </summary>
|
||||
public string? Title { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get ISBN information.
|
||||
/// </summary>
|
||||
public class IsbnDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the value of the ISBN.
|
||||
/// </summary>
|
||||
public string? Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the format of the ISBN.
|
||||
/// </summary>
|
||||
public IsbnFormat? Format { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Models.Common;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Models.Books;
|
||||
|
||||
/// <summary>
|
||||
/// Represents written content metadata.
|
||||
/// </summary>
|
||||
public class WrittenContentMetadataDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the title of the media item.
|
||||
/// </summary>
|
||||
public string? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the original title of the media item.
|
||||
/// </summary>
|
||||
public string? OriginalTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional description of the media item.
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the release information of the media item.
|
||||
/// </summary>
|
||||
public ReleaseInfoDto? ReleaseInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of genres associated with the media item.
|
||||
/// </summary>
|
||||
public List<GenreDto>? Genres { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of tags associated with the media item.
|
||||
/// </summary>
|
||||
public List<TagDto>? Tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional language of the media item.
|
||||
/// </summary>
|
||||
public LanguageInfoDto? Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional original language of the media item.
|
||||
/// </summary>
|
||||
public LanguageInfoDto? OriginalLanguage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the publisher of the written content.
|
||||
/// </summary>
|
||||
public string? Publisher { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of pages in the written content.
|
||||
/// </summary>
|
||||
public int? PageCount { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get genre information.
|
||||
/// </summary>
|
||||
public class GenreDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the name of the genre element of the media item.
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get language information.
|
||||
/// </summary>
|
||||
public class LanguageInfoDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the ISO 639-1 two-letter language code.
|
||||
/// </summary>
|
||||
public string? LanguageCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full name of the language in English.
|
||||
/// </summary>
|
||||
public string? LanguageName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets an optional native name of the language.
|
||||
/// </summary>
|
||||
public string? NativeName { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a rating.
|
||||
/// </summary>
|
||||
public abstract class RatingDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the numeric value of the rating.
|
||||
/// </summary>
|
||||
public decimal? Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the maximum possible rating value.
|
||||
/// </summary>
|
||||
public decimal? MaxValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional number of votes or reviews this rating is based on.
|
||||
/// </summary>
|
||||
public int? VoteCount { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get release information.
|
||||
/// </summary>
|
||||
public class ReleaseInfoDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the optional original release date of the media item.
|
||||
/// </summary>
|
||||
public DateOnly? OriginalReleaseDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional original release year of the media item.
|
||||
/// This is useful when only the year of original release is known.
|
||||
/// </summary>
|
||||
public int? OriginalReleaseYear { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional re-release or reissue date of the media item.
|
||||
/// </summary>
|
||||
public DateOnly? ReReleaseDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional re-release or reissue year of the media item.
|
||||
/// </summary>
|
||||
public int? ReReleaseYear { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional country or region of release.
|
||||
/// </summary>
|
||||
public string? ReleaseCountry { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0")
|
||||
/// </summary>
|
||||
public string? ReleaseVersion { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to get tag information.
|
||||
/// </summary>
|
||||
public class TagDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the name of the tag element of the media item.
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Contributors;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a media contributor.
|
||||
/// </summary>
|
||||
public class MediaContributorDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the name of the contributor.
|
||||
/// </summary>
|
||||
public MediaContributorNameDto? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the role of the contributor.
|
||||
/// </summary>
|
||||
public MediaContributorRoleDto? Role { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Contributors;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a media contributor name.
|
||||
/// </summary>
|
||||
public class MediaContributorNameDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the name by which the contributor is popularly known.
|
||||
/// </summary>
|
||||
public string? DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the legal name of the contributor.
|
||||
/// </summary>
|
||||
public string? LegalName { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Lumina.Presentation.Web.Common.Models.Contributors;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a media contributor role.
|
||||
/// </summary>
|
||||
public class MediaContributorRoleDto
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the value representing this object.
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the category of this object.
|
||||
/// </summary>
|
||||
public string? Category { get; set; }
|
||||
#endregion
|
||||
}
|
||||
@@ -1,11 +1,29 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using Lumina.Presentation.Web;
|
||||
#endregion
|
||||
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
namespace Lumina.Presentation.Web;
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
||||
/// <summary>
|
||||
/// Application entry point, contains the composition root module, wires up all dependencies of the application.
|
||||
/// </summary>
|
||||
public class Program
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Application entry point.
|
||||
/// </summary>
|
||||
/// <param name="args">Optional command line arguments.</param>
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in new issue
Block a user