Fixed package references and namespaces

Refactored mappers
This commit is contained in:
Khwezi Mngoma
2026-05-13 20:15:21 +02:00
parent a42c51d7b2
commit 42001998d6
9 changed files with 56 additions and 50 deletions
@@ -1,29 +1,36 @@
using LiteCharms.Models;
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.Extensions;
namespace LiteCharms.Features.Extensions;
public static class EntityModeMappers
{
public static ShoppingCartPackage ToModel(this Entities.ShoppingCartPackage entity) =>
public static ShoppingCartPackage ToModel(this Shop.ShoppingCarts.Entities.ShoppingCartPackage entity) =>
new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
PackageId = entity.PackageId,
ShoppingCartId = entity.ShoppingCartId
ShoppingCartId = entity.ShoppingCartId
};
public static PackageItem ToModel(this Entities.PackageItem entity) =>
public static PackageItem ToModel(this Shop.CartPackages.Entities.PackageItem entity) =>
new()
{
Id = entity.Id,
Active = entity.Active,
CreatedAt = entity.CreatedAt,
PackageId = entity.PackageId,
ProductPriceId = entity.ProductPriceId
ProductPriceId = entity.ProductPriceId
};
public static Package ToModel(this Entities.Package entity) =>
public static Package ToModel(this Shop.CartPackages.Entities.Package entity) =>
new()
{
Id = entity.Id,
@@ -31,10 +38,12 @@ public static class EntityModeMappers
Active = entity.Active,
Description = entity.Description,
Name = entity.Name,
UpdatedAt = entity.UpdatedAt
UpdatedAt = entity.UpdatedAt,
ImageUrl = entity.ImageUrl,
Summary = entity.Summary
};
public static ShoppingCartItem ToModel(this Entities.ShoppingCartItem entity) =>
public static ShoppingCartItem ToModel(this Shop.ShoppingCarts.Entities.ShoppingCartItem entity) =>
new()
{
Id = entity.Id,
@@ -42,21 +51,20 @@ public static class EntityModeMappers
UpdatedAt = entity.UpdatedAt,
ProductPriceId = entity.ProductPriceId,
Quantity = entity.Quantity,
ShoppingCartId = entity.ShoppingCartId
ShoppingCartId = entity.ShoppingCartId
};
public static ShoppingCart ToModel(this Entities.ShoppingCart entity) =>
public static ShoppingCart ToModel(this Shop.ShoppingCarts.Entities.ShoppingCart entity) =>
new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
UpdatedAt = entity.UpdatedAt,
CustomerId = entity.CustomerId,
OrderId = entity.OrderId,
QuoteId = entity.QuoteId
OrderId = entity.OrderId
};
public static Quote ToModel(this Entities.Quote entity) =>
public static Quote ToModel(this Shop.Quotes.Entities.Quote entity) =>
new()
{
Id = entity.Id,
@@ -66,10 +74,12 @@ public static class EntityModeMappers
ExpiredAt = entity.ExpiredAt,
Reason = entity.Reason,
ShoppingCartId = entity.ShoppingCartId,
Status = entity.Status
Status = entity.Status,
InvoiceUrl = entity.InvoiceUrl,
OrderId = entity.OrderId
};
public static Notification ToModel(this Entities.Notification entity) =>
public static Notification ToModel(this Shop.Notifications.Entities.Notification entity) =>
new()
{
Id = entity.Id,
@@ -93,7 +103,7 @@ public static class EntityModeMappers
Errors = entity.Errors
};
public static Customer ToModel(this Entities.Customer entity) =>
public static Customer ToModel(this Shop.Customers.Entities.Customer entity) =>
new()
{
Id = entity.Id,
@@ -118,7 +128,7 @@ public static class EntityModeMappers
Whatsapp = entity.Whatsapp
};
public static Lead ToModel(this Entities.Lead entity) =>
public static Lead ToModel(this Shop.Leads.Entities.Lead entity) =>
new()
{
Id = entity.Id,
@@ -136,10 +146,10 @@ public static class EntityModeMappers
ClickId = entity.ClickId,
TargetId = entity.TargetId,
WebClickId = entity.WebClickId,
Status = entity.Status
Status = entity.Status
};
public static Order ToModel(this Entities.Order entity) =>
public static Order ToModel(this Shop.Orders.Entities.Order entity) =>
new()
{
Id = entity.Id,
@@ -147,35 +157,35 @@ public static class EntityModeMappers
UpdatedAt = entity.UpdatedAt,
CustomerId = entity.CustomerId,
Notes = entity.Notes,
RefundId = entity.RefundId,
QuoteId = entity.QuoteId,
Status = entity.Status,
ShoppingCartId = entity.ShoppingCartId,
DepositRequired = entity.DepositRequired,
Requirements = entity.Requirements,
Terms = entity.Terms
Terms = entity.Terms,
InvoiceUrl = entity.InvoiceUrl
};
public static OrderRefund ToModel(this Entities.OrderRefund entity) =>
public static OrderRefund ToModel(this Shop.Orders.Entities.OrderRefund entity) =>
new()
{
Id = entity.Id,
CreatedAt = entity.CreatedAt,
OrderId = entity.OrderId,
Reason = entity.Reason,
Amount = entity.Amount
Amount = entity.Amount
};
public static Product ToModel(this Entities.Product entity) =>
public static Product ToModel(this Shop.Products.Entities.Product entity) =>
new()
{
Id = entity.Id,
Name = entity.Name,
Description = entity.Description,
Active = entity.Active
Active = entity.Active,
Summary = entity.Summary,
ImageUrl = entity.ImageUrl,
Thumbnails = entity.Thumbnails
};
public static ProductPrice ToModel(this Entities.ProductPrice entity) =>
public static ProductPrice ToModel(this Shop.Products.Entities.ProductPrice entity) =>
new()
{
Id = entity.Id,
@@ -184,6 +194,6 @@ public static class EntityModeMappers
Active = entity.Active,
CreatedAt = entity.CreatedAt,
Discount = entity.Discount,
UpdatedAt = entity.UpdatedAt
UpdatedAt = entity.UpdatedAt
};
}