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>
44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using LittleShop.Enums;
|
|
|
|
namespace LittleShop.Models;
|
|
|
|
public class Product
|
|
{
|
|
[Key]
|
|
public Guid Id { get; set; }
|
|
|
|
[Required]
|
|
[StringLength(200)]
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
public string Description { get; set; } = string.Empty;
|
|
|
|
[Column(TypeName = "decimal(18,2)")]
|
|
public decimal Price { get; set; }
|
|
|
|
[Column(TypeName = "decimal(18,4)")]
|
|
public decimal Weight { get; set; }
|
|
|
|
public ProductWeightUnit WeightUnit { get; set; } = ProductWeightUnit.Kilogram;
|
|
|
|
public int StockQuantity { get; set; } = 0;
|
|
|
|
public Guid CategoryId { get; set; }
|
|
|
|
public bool IsActive { get; set; } = true;
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
// Navigation properties
|
|
public virtual Category Category { get; set; } = null!;
|
|
public virtual ICollection<ProductPhoto> Photos { get; set; } = new List<ProductPhoto>();
|
|
public virtual ICollection<ProductMultiBuy> MultiBuys { get; set; } = new List<ProductMultiBuy>();
|
|
public virtual ICollection<ProductVariant> Variants { get; set; } = new List<ProductVariant>();
|
|
public virtual ICollection<BotActivity> Activities { get; set; } = new List<BotActivity>();
|
|
public virtual ICollection<OrderItem> OrderItems { get; set; } = new List<OrderItem>();
|
|
public virtual ICollection<Review> Reviews { get; set; } = new List<Review>();
|
|
} |