Created Author, Book, AuthorBook, Page and Product with Price
This commit is contained in:
@@ -15,7 +15,7 @@ public static class HealthChecks
|
||||
|
||||
public static IServiceCollection AddMidrandShopPostgresHealthCheck(this IServiceCollection services)
|
||||
{
|
||||
services.AddHealthChecks().AddCheck<PostgresMidrandShopHealthCheck>(MidrandShopDbConfigName);
|
||||
services.AddHealthChecks().AddCheck<PostgresMidrandShopHealthCheck>(MidrandBooksDbConfigName);
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
using LiteCharms.Features.MidrandBooks.AuthorBooks.Models;
|
||||
using LiteCharms.Features.MidrandBooks.Authors.Models;
|
||||
using LiteCharms.Features.MidrandBooks.Pages.Models;
|
||||
using LiteCharms.Features.MidrandBooks.Products.Models;
|
||||
|
||||
namespace LiteCharms.Features.MidrandBooks.Extensions;
|
||||
|
||||
public static class Mappers
|
||||
{
|
||||
public static BookPage ToModel(this Pages.Entities.BookPage entity) => new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
AuthorBookId = entity.AuthorBookId,
|
||||
Content = entity.Content,
|
||||
ContentType = entity.ContentType,
|
||||
Number = entity.Number,
|
||||
Enabled = entity.Enabled,
|
||||
Notes = entity.Notes,
|
||||
References = entity.References,
|
||||
Type = entity.Type
|
||||
};
|
||||
|
||||
public static AuthorBook ToModel(this AuthorBooks.Entities.AuthorBook entity) => new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
ProductId = entity.ProductId,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
AuthorId = entity.AuthorId,
|
||||
Ranking = entity.Ranking,
|
||||
Rating = entity.Rating,
|
||||
Enabled = entity.Enabled
|
||||
};
|
||||
|
||||
public static ProductPrice ToModel(this Products.Entities.ProductPrice entity) => new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
ProductId = entity.ProductId,
|
||||
Amount = entity.Amount,
|
||||
Discount = entity.Discount,
|
||||
Enabled = entity.Enabled
|
||||
};
|
||||
|
||||
public static Product ToModel(this Products.Entities.Product entity)
|
||||
{
|
||||
return new Product
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
Name = entity.Name,
|
||||
Summary = entity.Summary,
|
||||
Description = entity.Description,
|
||||
Type = entity.Type,
|
||||
ImageUrl = entity.ImageUrl,
|
||||
ThumbnailUrls = entity.ThumbnailUrls,
|
||||
Metadata = entity.Metadata,
|
||||
Categories = entity.Categories,
|
||||
Enabled = entity.Enabled
|
||||
};
|
||||
}
|
||||
|
||||
public static Author ToModel(this Authors.Entities.Author entity) => new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
Name = entity.Name,
|
||||
LastName = entity.LastName,
|
||||
Biography = entity.Biography,
|
||||
Email = entity.Email,
|
||||
Website = entity.Website,
|
||||
ImageUrl = entity.ImageUrl,
|
||||
ThumbnailImageUrl = entity.ThumbnailImageUrl,
|
||||
SocialMedia = entity.SocialMedia,
|
||||
Enabled = entity.Enabled,
|
||||
Company = entity.Company,
|
||||
PublisherType = entity.PublisherType,
|
||||
VatNumber = entity.VatNumber
|
||||
};
|
||||
}
|
||||
@@ -4,12 +4,12 @@ namespace LiteCharms.Features.MidrandBooks.Extensions;
|
||||
|
||||
public static class Postgres
|
||||
{
|
||||
public const string MidrandShopDbConfigName = "PostgresMidrandBooks";
|
||||
public const string MidrandBooksDbConfigName = "PostgresMidrandBooks";
|
||||
|
||||
public static IServiceCollection AddMidrandShopDatabase(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddPooledDbContextFactory<MidrandShopDbContext>(options =>
|
||||
options.UseNpgsql(configuration.GetConnectionString(MidrandShopDbConfigName)));
|
||||
services.AddPooledDbContextFactory<MidrandBooksDbContext>(options =>
|
||||
options.UseNpgsql(configuration.GetConnectionString(MidrandBooksDbConfigName)));
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user