Redo entities and configs, plus dummy aspnet identity config

This commit is contained in:
lumijiez
2025-05-26 13:10:38 +03:00
parent 03daae5b50
commit e8c5fbb5cc
33 changed files with 3986 additions and 5 deletions

View File

@@ -0,0 +1,10 @@
namespace Printbase.Domain.Entities;
public abstract class EntityBase
{
public Guid Id { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime ModifiedAt { get; set; }
public string CreatedBy { get; set; }
public string ModifiedBy { get; set; }
}

View File

@@ -0,0 +1,17 @@
namespace Printbase.Domain.Entities;
public class Order : EntityBase
{
public string UserId { get; set; }
public DateTime OrderDate { get; set; }
public decimal TotalPrice { get; set; }
public int OrderStatusId { get; set; }
public int ShippingStatusId { get; set; }
public string OrderNumber { get; set; }
public string Notes { get; set; }
public virtual OrderStatus OrderStatus { get; set; }
public virtual ShippingStatus ShippingStatus { get; set; }
public virtual OrderAddress OrderAddress { get; set; }
public virtual ICollection<OrderItem> OrderItems { get; set; } = new List<OrderItem>();
}

View File

@@ -0,0 +1,13 @@
namespace Printbase.Domain.Entities;
public class OrderAddress : EntityBase
{
public Guid OrderId { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string State { get; set; }
public string PostalCode { get; set; }
public string Country { get; set; }
public virtual Order Order { get; set; }
}

View File

@@ -0,0 +1,17 @@
namespace Printbase.Domain.Entities;
public class OrderItem : EntityBase
{
public Guid OrderId { get; set; }
public Guid ProductId { get; set; }
public Guid? ProductVariantId { get; set; }
public int Quantity { get; set; }
public decimal UnitPrice { get; set; }
public decimal TotalPrice { get; set; }
public string CustomizationImageUrl { get; set; }
public string CustomizationDescription { get; set; }
public virtual Order Order { get; set; }
public virtual Product Product { get; set; }
public virtual ProductVariant ProductVariant { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace Printbase.Domain.Entities;
public class OrderStatus
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Order> Orders { get; set; } = new List<Order>();
}

View File

@@ -0,0 +1,9 @@
namespace Printbase.Domain.Entities;
public class ShippingStatus
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Order> Orders { get; set; } = new List<Order>();
}

View File

@@ -0,0 +1,15 @@
namespace Printbase.Domain.Entities;
public class Category : EntityBase
{
public string Name { get; set; }
public string Description { get; set; }
public string ImageUrl { get; set; }
public int SortOrder { get; set; }
public bool IsActive { get; set; }
public Guid? ParentCategoryId { get; set; }
public virtual Category ParentCategory { get; set; }
public virtual ICollection<Category> SubCategories { get; set; } = new List<Category>();
public virtual ICollection<Product> Products { get; set; } = new List<Product>();
}

View File

@@ -0,0 +1,16 @@
namespace Printbase.Domain.Entities;
public class Product : EntityBase
{
public string Name { get; set; }
public string Description { get; set; }
public decimal BasePrice { get; set; }
public bool IsCustomizable { get; set; }
public bool IsActive { get; set; }
public string ImageUrl { get; set; }
public Guid? CategoryId { get; set; }
public virtual Category Category { get; set; }
public virtual ICollection<ProductVariant> ProductVariants { get; set; } = new List<ProductVariant>();
public virtual ICollection<OrderItem> OrderItems { get; set; } = new List<OrderItem>();
}

View File

@@ -0,0 +1,16 @@
namespace Printbase.Domain.Entities;
public class ProductVariant : EntityBase
{
public Guid ProductId { get; set; }
public string Size { get; set; }
public string Color { get; set; }
public decimal Price { get; set; }
public string ImageUrl { get; set; }
public string SKU { get; set; }
public int StockQuantity { get; set; }
public bool IsActive { get; set; }
public virtual Product Product { get; set; }
public virtual ICollection<OrderItem> OrderItems { get; set; } = new List<OrderItem>();
}

View File

@@ -0,0 +1,14 @@
namespace Printbase.Domain.Entities;
public class Address : EntityBase
{
public string UserId { get; set; }
public string AddressType { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string State { get; set; }
public string PostalCode { get; set; }
public string Country { get; set; }
public bool IsDefault { get; set; }
public bool IsActive { get; set; }
}

View File

@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Identity;
public class ApplicationRole : IdentityRole
{
public string Description { get; set; }
public DateTime CreatedAt { get; set; }
public bool IsActive { get; set; }
public ApplicationRole() : base()
{
}
public ApplicationRole(string roleName) : base(roleName)
{
}
}

View File

@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Identity;
namespace Printbase.Domain.Entities.Users;
public class ApplicationUser : IdentityUser
{
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime? DateOfBirth { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime LastLoginAt { get; set; }
public bool IsActive { get; set; }
public string ProfileImageUrl { get; set; }
public virtual ICollection<Address> Addresses { get; set; } = new List<Address>();
public virtual ICollection<Order> Orders { get; set; } = new List<Order>();
}