littleshop/LittleShop.Client/Models/Product.cs
SysAdmin 034b8facee Implement product multi-buys and variants system
Major restructuring of product variations:
- Renamed ProductVariation to ProductMultiBuy for quantity-based pricing (e.g., "3 for £25")
- Added new ProductVariant model for string-based options (colors, flavors)
- Complete separation of multi-buy pricing from variant selection

Features implemented:
- Multi-buy deals with automatic price-per-unit calculation
- Product variants for colors/flavors/sizes with stock tracking
- TeleBot checkout supports both multi-buys and variant selection
- Shopping cart correctly calculates multi-buy bundle prices
- Order system tracks selected variants and multi-buy choices
- Real-time bot activity monitoring with SignalR
- Public bot directory page with QR codes for Telegram launch
- Admin dashboard shows multi-buy and variant metrics

Technical changes:
- Updated all DTOs, services, and controllers
- Fixed cart total calculation for multi-buy bundles
- Comprehensive test coverage for new functionality
- All existing tests passing with new features

Database changes:
- Migrated ProductVariations to ProductMultiBuys
- Added ProductVariants table
- Updated OrderItems to track variants

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 00:30:12 +01:00

51 lines
1.7 KiB
C#

namespace LittleShop.Client.Models;
public class Product
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public decimal Price { get; set; }
public decimal Weight { get; set; }
public int WeightUnit { get; set; }
public Guid CategoryId { get; set; }
public string? CategoryName { get; set; }
public bool IsActive { get; set; }
public List<ProductPhoto> Photos { get; set; } = new();
public List<ProductMultiBuy> MultiBuys { get; set; } = new();
public List<ProductVariant> Variants { get; set; } = new();
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
public class ProductPhoto
{
public Guid Id { get; set; }
public string Url { get; set; } = string.Empty;
public string? AltText { get; set; }
public int SortOrder { get; set; }
}
public class ProductMultiBuy
{
public Guid Id { get; set; }
public Guid ProductId { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public int Quantity { get; set; }
public decimal Price { get; set; }
public decimal PricePerUnit { get; set; }
public int SortOrder { get; set; }
public bool IsActive { get; set; }
}
public class ProductVariant
{
public Guid Id { get; set; }
public Guid ProductId { get; set; }
public string Name { get; set; } = string.Empty; // e.g., "Red", "Blue", "Vanilla"
public string VariantType { get; set; } = "Standard"; // e.g., "Color", "Flavor"
public int SortOrder { get; set; }
public int StockLevel { get; set; }
public bool IsActive { get; set; }
}