This commit is contained in:
@@ -1,201 +0,0 @@
|
||||
using LiteCharms.Features.Shop.CartPackages.Models;
|
||||
using LiteCharms.Features.Shop.Customers.Models;
|
||||
using LiteCharms.Features.Shop.Leads.Models;
|
||||
using LiteCharms.Features.Shop.Notifications.Models;
|
||||
using LiteCharms.Features.Shop.Orders.Models;
|
||||
using LiteCharms.Features.Shop.Products.Models;
|
||||
using LiteCharms.Features.Shop.Quotes.Models;
|
||||
using LiteCharms.Features.Shop.ShoppingCarts.Models;
|
||||
|
||||
namespace LiteCharms.Features.Extensions;
|
||||
|
||||
public static class EntityModeMappers
|
||||
{
|
||||
public static ShoppingCartPackage ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCartPackage entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
PackageId = entity.PackageId,
|
||||
ShoppingCartId = entity.ShoppingCartId
|
||||
};
|
||||
|
||||
public static PackageItem ToModel(this Features.Shop.CartPackages.Entities.PackageItem entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
Active = entity.Active,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
PackageId = entity.PackageId,
|
||||
ProductPriceId = entity.ProductPriceId
|
||||
};
|
||||
|
||||
public static Package ToModel(this Features.Shop.CartPackages.Entities.Package entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
Active = entity.Active,
|
||||
Description = entity.Description,
|
||||
Name = entity.Name,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
ImageUrl = entity.ImageUrl,
|
||||
Summary = entity.Summary
|
||||
};
|
||||
|
||||
public static ShoppingCartItem ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCartItem entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
ProductPriceId = entity.ProductPriceId,
|
||||
Quantity = entity.Quantity,
|
||||
ShoppingCartId = entity.ShoppingCartId
|
||||
};
|
||||
|
||||
public static ShoppingCart ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCart entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
CustomerId = entity.CustomerId,
|
||||
OrderId = entity.OrderId
|
||||
};
|
||||
|
||||
public static Quote ToModel(this Features.Shop.Quotes.Entities.Quote entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
CustomerId = entity.CustomerId,
|
||||
ExpiredAt = entity.ExpiredAt,
|
||||
Reason = entity.Reason,
|
||||
ShoppingCartId = entity.ShoppingCartId,
|
||||
Status = entity.Status,
|
||||
InvoiceUrl = entity.InvoiceUrl,
|
||||
OrderId = entity.OrderId
|
||||
};
|
||||
|
||||
public static Notification ToModel(this Features.Shop.Notifications.Entities.Notification entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
Message = entity.Message,
|
||||
Direction = entity.Direction,
|
||||
CorrelationId = entity.CorrelationId,
|
||||
CorrelationIdType = entity.CorrelationIdType,
|
||||
IsInternal = entity.IsInternal,
|
||||
SenderAddress = entity.SenderAddress,
|
||||
Platform = entity.Platform,
|
||||
RecipientName = entity.RecipientName,
|
||||
Subject = entity.Subject,
|
||||
Processed = entity.Processed,
|
||||
SenderName = entity.SenderName,
|
||||
RecipientAddress = entity.RecipientAddress,
|
||||
Priority = entity.Priority,
|
||||
UpdatedAt = entity?.UpdatedAt,
|
||||
IsHtml = entity!.IsHtml,
|
||||
HasError = entity.HasError,
|
||||
Errors = entity.Errors
|
||||
};
|
||||
|
||||
public static Customer ToModel(this Features.Shop.Customers.Entities.Customer entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
Active = entity.Active,
|
||||
Address = entity.Address,
|
||||
City = entity.City,
|
||||
Company = entity.Company,
|
||||
Country = entity.Country,
|
||||
Discord = entity.Discord,
|
||||
Email = entity.Email,
|
||||
LastName = entity.LastName,
|
||||
LinkedIn = entity.LinkedIn,
|
||||
Name = entity.Name,
|
||||
Phone = entity.Phone,
|
||||
PostalCode = entity.PostalCode,
|
||||
Region = entity.Region,
|
||||
Slack = entity.Slack,
|
||||
Tax = entity.Tax,
|
||||
Website = entity.Website,
|
||||
Whatsapp = entity.Whatsapp
|
||||
};
|
||||
|
||||
public static Lead ToModel(this Features.Shop.Leads.Entities.Lead entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
AdGroupId = entity.AdGroupId,
|
||||
AdName = entity.AdName,
|
||||
AppClickId = entity.AppClickId,
|
||||
AttributionHash = entity.AttributionHash,
|
||||
CampaignId = entity.CampaignId,
|
||||
ClickLocation = entity.ClickLocation,
|
||||
CustomerId = entity.CustomerId,
|
||||
FeedItemId = entity.FeedItemId,
|
||||
Source = entity.Source,
|
||||
ClickId = entity.ClickId,
|
||||
TargetId = entity.TargetId,
|
||||
WebClickId = entity.WebClickId,
|
||||
Status = entity.Status
|
||||
};
|
||||
|
||||
public static Order ToModel(this Features.Shop.Orders.Entities.Order entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
CustomerId = entity.CustomerId,
|
||||
Notes = entity.Notes,
|
||||
Status = entity.Status,
|
||||
Requirements = entity.Requirements,
|
||||
Terms = entity.Terms,
|
||||
InvoiceUrl = entity.InvoiceUrl
|
||||
};
|
||||
|
||||
public static OrderRefund ToModel(this Features.Shop.Orders.Entities.OrderRefund entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
OrderId = entity.OrderId,
|
||||
Reason = entity.Reason,
|
||||
Amount = entity.Amount
|
||||
};
|
||||
|
||||
public static Product ToModel(this Features.Shop.Products.Entities.Product entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
Name = entity.Name,
|
||||
Description = entity.Description,
|
||||
Active = entity.Active,
|
||||
Summary = entity.Summary,
|
||||
ImageUrl = entity.ImageUrl,
|
||||
Thumbnails = entity.Thumbnails,
|
||||
Metadata = entity.Metadata,
|
||||
};
|
||||
|
||||
public static ProductPrice ToModel(this Features.Shop.Products.Entities.ProductPrice entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
ProductId = entity.ProductId,
|
||||
Price = entity.Price,
|
||||
Active = entity.Active,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
Discount = entity.Discount,
|
||||
UpdatedAt = entity.UpdatedAt
|
||||
};
|
||||
}
|
||||
@@ -5,13 +5,6 @@ namespace LiteCharms.Features.Extensions;
|
||||
|
||||
public static class HealthChecks
|
||||
{
|
||||
public static IServiceCollection AddShopQuartzHealthCheck(this IServiceCollection services)
|
||||
{
|
||||
services.AddHealthChecks().AddCheck<ShopQuartzHealthCheck>("ShopQuartz");
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddMidrandShopQuartzHealthCheck(this IServiceCollection services)
|
||||
{
|
||||
services.AddHealthChecks().AddCheck<MidrandShopQuartzHealthCheck>("MidrandShopQuartz");
|
||||
@@ -19,13 +12,6 @@ public static class HealthChecks
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddShopPostgresHealthCheck(this IServiceCollection services)
|
||||
{
|
||||
services.AddHealthChecks().AddCheck<PostgresShopHealthCheck>(ShopDbConfigName);
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddMidrandShopPostgresHealthCheck(this IServiceCollection services)
|
||||
{
|
||||
services.AddHealthChecks().AddCheck<PostgresMidrandShopHealthCheck>(MidrandShopDbConfigName);
|
||||
|
||||
@@ -1,22 +1,12 @@
|
||||
using LiteCharms.Features.MidrandShop.Postgres;
|
||||
using LiteCharms.Features.Shop.Postgres;
|
||||
|
||||
namespace LiteCharms.Features.Extensions;
|
||||
|
||||
public static class Postgres
|
||||
{
|
||||
public const string MidrandShopDbConfigName = "PostgresMidrandShop";
|
||||
public const string ShopDbConfigName = "PostgresShop";
|
||||
public const string SchedulerDbConfigName = "PostgresScheduler";
|
||||
|
||||
public static IServiceCollection AddShopDatabase(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddPooledDbContextFactory<ShopDbContext>(options =>
|
||||
options.UseNpgsql(configuration.GetConnectionString(ShopDbConfigName)));
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddMidrandShopDatabase(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddPooledDbContextFactory<MidrandShopDbContext>(options =>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
using LiteCharms.Features.Shop.CartPackages;
|
||||
using LiteCharms.Features.Shop.Customers;
|
||||
using LiteCharms.Features.Shop.Leads;
|
||||
using LiteCharms.Features.Shop.Notifications;
|
||||
using LiteCharms.Features.Shop.Orders;
|
||||
using LiteCharms.Features.Shop.Products;
|
||||
using LiteCharms.Features.Shop.Quotes;
|
||||
using LiteCharms.Features.Shop.ShoppingCarts;
|
||||
|
||||
namespace LiteCharms.Features.Extensions;
|
||||
|
||||
public static class Shop
|
||||
{
|
||||
public static IServiceCollection AddShopServices(this IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<PackageService>()
|
||||
.AddSingleton<LeadService>()
|
||||
.AddSingleton<NotificationService>()
|
||||
.AddSingleton<OrderService>()
|
||||
.AddSingleton<ProductService>()
|
||||
.AddSingleton<QuoteService>()
|
||||
.AddSingleton<ShoppingCartService>()
|
||||
.AddSingleton<CustomerService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user