Completed refactor
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using LiteCharms.Features.Email;
|
||||
using LiteCharms.Features.Email.Configuration;
|
||||
|
||||
namespace LiteCharms.Features.Extensions;
|
||||
|
||||
public static class Email
|
||||
{
|
||||
public static IServiceCollection AddEmailServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.Configure<SmtpSettings>(configuration.GetSection("Email"));
|
||||
|
||||
services.AddSingleton<EmailService>();
|
||||
|
||||
services.AddOpenTelemetry()
|
||||
.WithTracing(tracing => tracing.AddSource("LiteCharms.EmailService"))
|
||||
.WithMetrics(metrics => metrics.AddMeter("LiteCharms.EmailService"));
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ namespace LiteCharms.Features.Extensions;
|
||||
|
||||
public static class EntityModeMappers
|
||||
{
|
||||
public static ShoppingCartPackage ToModel(this Shop.ShoppingCarts.Entities.ShoppingCartPackage entity) =>
|
||||
public static ShoppingCartPackage ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCartPackage entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -20,7 +20,7 @@ public static class EntityModeMappers
|
||||
ShoppingCartId = entity.ShoppingCartId
|
||||
};
|
||||
|
||||
public static PackageItem ToModel(this Shop.CartPackages.Entities.PackageItem entity) =>
|
||||
public static PackageItem ToModel(this Features.Shop.CartPackages.Entities.PackageItem entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -30,7 +30,7 @@ public static class EntityModeMappers
|
||||
ProductPriceId = entity.ProductPriceId
|
||||
};
|
||||
|
||||
public static Package ToModel(this Shop.CartPackages.Entities.Package entity) =>
|
||||
public static Package ToModel(this Features.Shop.CartPackages.Entities.Package entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -43,7 +43,7 @@ public static class EntityModeMappers
|
||||
Summary = entity.Summary
|
||||
};
|
||||
|
||||
public static ShoppingCartItem ToModel(this Shop.ShoppingCarts.Entities.ShoppingCartItem entity) =>
|
||||
public static ShoppingCartItem ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCartItem entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -54,7 +54,7 @@ public static class EntityModeMappers
|
||||
ShoppingCartId = entity.ShoppingCartId
|
||||
};
|
||||
|
||||
public static ShoppingCart ToModel(this Shop.ShoppingCarts.Entities.ShoppingCart entity) =>
|
||||
public static ShoppingCart ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCart entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -64,7 +64,7 @@ public static class EntityModeMappers
|
||||
OrderId = entity.OrderId
|
||||
};
|
||||
|
||||
public static Quote ToModel(this Shop.Quotes.Entities.Quote entity) =>
|
||||
public static Quote ToModel(this Features.Shop.Quotes.Entities.Quote entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -79,7 +79,7 @@ public static class EntityModeMappers
|
||||
OrderId = entity.OrderId
|
||||
};
|
||||
|
||||
public static Notification ToModel(this Shop.Notifications.Entities.Notification entity) =>
|
||||
public static Notification ToModel(this Features.Shop.Notifications.Entities.Notification entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -89,9 +89,9 @@ public static class EntityModeMappers
|
||||
CorrelationId = entity.CorrelationId,
|
||||
CorrelationIdType = entity.CorrelationIdType,
|
||||
IsInternal = entity.IsInternal,
|
||||
Sender = entity.Sender,
|
||||
SenderAddress = entity.SenderAddress,
|
||||
Platform = entity.Platform,
|
||||
Recipient = entity.Recipient,
|
||||
RecipientName = entity.RecipientName,
|
||||
Subject = entity.Subject,
|
||||
Processed = entity.Processed,
|
||||
SenderName = entity.SenderName,
|
||||
@@ -103,7 +103,7 @@ public static class EntityModeMappers
|
||||
Errors = entity.Errors
|
||||
};
|
||||
|
||||
public static Customer ToModel(this Shop.Customers.Entities.Customer entity) =>
|
||||
public static Customer ToModel(this Features.Shop.Customers.Entities.Customer entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -128,7 +128,7 @@ public static class EntityModeMappers
|
||||
Whatsapp = entity.Whatsapp
|
||||
};
|
||||
|
||||
public static Lead ToModel(this Shop.Leads.Entities.Lead entity) =>
|
||||
public static Lead ToModel(this Features.Shop.Leads.Entities.Lead entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -149,7 +149,7 @@ public static class EntityModeMappers
|
||||
Status = entity.Status
|
||||
};
|
||||
|
||||
public static Order ToModel(this Shop.Orders.Entities.Order entity) =>
|
||||
public static Order ToModel(this Features.Shop.Orders.Entities.Order entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -163,7 +163,7 @@ public static class EntityModeMappers
|
||||
InvoiceUrl = entity.InvoiceUrl
|
||||
};
|
||||
|
||||
public static OrderRefund ToModel(this Shop.Orders.Entities.OrderRefund entity) =>
|
||||
public static OrderRefund ToModel(this Features.Shop.Orders.Entities.OrderRefund entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -173,7 +173,7 @@ public static class EntityModeMappers
|
||||
Amount = entity.Amount
|
||||
};
|
||||
|
||||
public static Product ToModel(this Shop.Products.Entities.Product entity) =>
|
||||
public static Product ToModel(this Features.Shop.Products.Entities.Product entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
@@ -185,7 +185,7 @@ public static class EntityModeMappers
|
||||
Thumbnails = entity.Thumbnails
|
||||
};
|
||||
|
||||
public static ProductPrice ToModel(this Shop.Products.Entities.ProductPrice entity) =>
|
||||
public static ProductPrice ToModel(this Features.Shop.Products.Entities.ProductPrice entity) =>
|
||||
new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
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