Rebadge the rest of the files

This commit is contained in:
lumijiez
2025-06-03 18:24:40 +03:00
parent 1b6f69fcf9
commit 6a675ac111
77 changed files with 5931 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
namespace Imprink.Domain.Common.Models;
public class PagedResult<T>
{
public IEnumerable<T> Items { get; set; } = new List<T>();
public int TotalCount { get; set; }
public int PageNumber { get; set; }
public int PageSize { get; set; }
public int TotalPages => (int)Math.Ceiling((double)TotalCount / PageSize);
public bool HasPreviousPage => PageNumber > 1;
public bool HasNextPage => PageNumber < TotalPages;
}

View File

@@ -0,0 +1,15 @@
namespace Imprink.Domain.Common.Models;
public class ProductFilterParameters
{
public int PageNumber { get; set; } = 1;
public int PageSize { get; set; } = 10;
public string? SearchTerm { get; set; }
public Guid? CategoryId { get; set; }
public decimal? MinPrice { get; set; }
public decimal? MaxPrice { get; set; }
public bool? IsActive { get; set; } = true;
public bool? IsCustomizable { get; set; }
public string SortBy { get; set; } = "Name";
public string SortDirection { get; set; } = "ASC";
}

View File

@@ -0,0 +1,10 @@
namespace Imprink.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 Imprink.Domain.Entities.Orders;
public class Order : EntityBase
{
public string UserId { get; set; } = null!;
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; } = null!;
public string Notes { get; set; } = null!;
public OrderStatus OrderStatus { get; set; } = null!;
public ShippingStatus ShippingStatus { get; set; } = null!;
public OrderAddress OrderAddress { get; set; } = null!;
public virtual ICollection<OrderItem> OrderItems { get; set; } = new List<OrderItem>();
}

View File

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

View File

@@ -0,0 +1,19 @@
using Imprink.Domain.Entities.Product;
namespace Imprink.Domain.Entities.Orders;
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; } = null!;
public string CustomizationDescription { get; set; } = null!;
public Order Order { get; set; } = null!;
public Product.Product Product { get; set; } = null!;
public ProductVariant ProductVariant { get; set; } = null!;
}

View File

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

View File

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

View File

@@ -0,0 +1,15 @@
namespace Imprink.Domain.Entities.Product;
public class Category : EntityBase
{
public string Name { get; set; } = null!;
public string Description { get; set; } = null!;
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,18 @@
using Imprink.Domain.Entities.Orders;
namespace Imprink.Domain.Entities.Product;
public class Product : EntityBase
{
public required string Name { get; set; }
public string? Description { get; set; }
public required decimal BasePrice { get; set; }
public required bool IsCustomizable { get; set; }
public required bool IsActive { get; set; }
public string? ImageUrl { get; set; }
public Guid? CategoryId { get; set; }
public virtual required 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,18 @@
using Imprink.Domain.Entities.Orders;
namespace Imprink.Domain.Entities.Product;
public class ProductVariant : EntityBase
{
public required Guid ProductId { get; set; }
public required string Size { get; set; }
public string? Color { get; set; }
public required decimal Price { get; set; }
public string? ImageUrl { get; set; }
public required string Sku { get; set; }
public int StockQuantity { get; set; }
public bool IsActive { get; set; }
public virtual required Imprink.Domain.Entities.Product.Product Product { get; set; }
public virtual ICollection<OrderItem> OrderItems { get; set; } = new List<OrderItem>();
}

View File

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

View File

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

View File

@@ -0,0 +1,18 @@
using Imprink.Domain.Entities.Orders;
using Microsoft.AspNetCore.Identity;
namespace Imprink.Domain.Entities.Users;
public sealed class ApplicationUser : IdentityUser
{
public required string FirstName { get; set; }
public required 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 ICollection<Address> Addresses { get; set; } = new List<Address>();
public ICollection<Order> Orders { get; set; } = new List<Order>();
}

View File

@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Common\Enums\" />
<Folder Include="Exceptions\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="9.0.4" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,20 @@
using Imprink.Domain.Entities.Product;
namespace Imprink.Domain.Repositories;
public interface ICategoryRepository
{
Task<Category?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);
Task<Category?> GetByIdWithSubCategoriesAsync(Guid id, CancellationToken cancellationToken = default);
Task<Category?> GetByIdWithProductsAsync(Guid id, CancellationToken cancellationToken = default);
Task<IEnumerable<Category>> GetAllAsync(CancellationToken cancellationToken = default);
Task<IEnumerable<Category>> GetActiveAsync(CancellationToken cancellationToken = default);
Task<IEnumerable<Category>> GetRootCategoriesAsync(CancellationToken cancellationToken = default);
Task<IEnumerable<Category>> GetSubCategoriesAsync(Guid parentCategoryId, CancellationToken cancellationToken = default);
Task<Category> AddAsync(Category category, CancellationToken cancellationToken = default);
Task<Category> UpdateAsync(Category category, CancellationToken cancellationToken = default);
Task DeleteAsync(Guid id, CancellationToken cancellationToken = default);
Task<bool> ExistsAsync(Guid id, CancellationToken cancellationToken = default);
Task<bool> HasSubCategoriesAsync(Guid categoryId, CancellationToken cancellationToken = default);
Task<bool> HasProductsAsync(Guid categoryId, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,19 @@
using Imprink.Domain.Common.Models;
using Imprink.Domain.Entities.Product;
namespace Imprink.Domain.Repositories;
public interface IProductRepository
{
Task<Product?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);
Task<Product?> GetByIdWithVariantsAsync(Guid id, CancellationToken cancellationToken = default);
Task<Product?> GetByIdWithCategoryAsync(Guid id, CancellationToken cancellationToken = default);
Task<Product?> GetByIdFullAsync(Guid id, CancellationToken cancellationToken = default);
Task<PagedResult<Product>> GetPagedAsync(ProductFilterParameters filterParameters, CancellationToken cancellationToken = default);
Task<IEnumerable<Product>> GetByCategoryAsync(Guid categoryId, CancellationToken cancellationToken = default);
Task<IEnumerable<Product>> GetCustomizableAsync(CancellationToken cancellationToken = default);
Task<Product> AddAsync(Product product, CancellationToken cancellationToken = default);
Task<Product> UpdateAsync(Product product, CancellationToken cancellationToken = default);
Task DeleteAsync(Guid id, CancellationToken cancellationToken = default);
Task<bool> ExistsAsync(Guid id, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,19 @@
using Imprink.Domain.Entities.Product;
namespace Imprink.Domain.Repositories;
public interface IProductVariantRepository
{
Task<ProductVariant?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);
Task<ProductVariant?> GetByIdWithProductAsync(Guid id, CancellationToken cancellationToken = default);
Task<ProductVariant?> GetBySkuAsync(string sku, CancellationToken cancellationToken = default);
Task<IEnumerable<ProductVariant>> GetByProductIdAsync(Guid productId, CancellationToken cancellationToken = default);
Task<IEnumerable<ProductVariant>> GetActiveByProductIdAsync(Guid productId, CancellationToken cancellationToken = default);
Task<IEnumerable<ProductVariant>> GetInStockByProductIdAsync(Guid productId, CancellationToken cancellationToken = default);
Task<ProductVariant> AddAsync(ProductVariant productVariant, CancellationToken cancellationToken = default);
Task<ProductVariant> UpdateAsync(ProductVariant productVariant, CancellationToken cancellationToken = default);
Task DeleteAsync(Guid id, CancellationToken cancellationToken = default);
Task<bool> ExistsAsync(Guid id, CancellationToken cancellationToken = default);
Task<bool> SkuExistsAsync(string sku, Guid? excludeId = null, CancellationToken cancellationToken = default);
Task UpdateStockQuantityAsync(Guid id, int quantity, CancellationToken cancellationToken = default);
}