Implement complete e-commerce functionality with shipping and order management
Features Added: - Standard e-commerce properties (Price, Weight, shipping fields) - Order management with Create/Edit views and shipping information - ShippingRates system for weight-based shipping calculations - Comprehensive test coverage with JWT authentication tests - Sample data seeder with 5 orders demonstrating full workflow - Photo upload functionality for products - Multi-cryptocurrency payment support (BTC, XMR, USDT, etc.) Database Changes: - Added ShippingRates table - Added shipping fields to Orders (Name, Address, City, PostCode, Country) - Renamed properties to standard names (BasePrice to Price, ProductWeight to Weight) - Added UpdatedAt timestamps to models UI Improvements: - Added Create/Edit views for Orders - Added ShippingRates management UI - Updated navigation menu with Shipping option - Enhanced Order Details view with shipping information Sample Data: - 3 Categories (Electronics, Clothing, Books) - 5 Products with various prices - 5 Shipping rates (Royal Mail options) - 5 Orders in different statuses (Pending to Delivered) - 3 Crypto payments demonstrating payment flow Security: - All API endpoints secured with JWT authentication - No public endpoints - client apps must authenticate - Privacy-focused design with minimal data collection Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
81
LittleShop/DTOs/ProductDto.cs
Normal file
81
LittleShop/DTOs/ProductDto.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using LittleShop.Enums;
|
||||
|
||||
namespace LittleShop.DTOs;
|
||||
|
||||
public class ProductDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public decimal Price { get; set; }
|
||||
public decimal Weight { get; set; }
|
||||
public ProductWeightUnit WeightUnit { get; set; }
|
||||
public Guid CategoryId { get; set; }
|
||||
public string CategoryName { get; set; } = string.Empty;
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public List<ProductPhotoDto> Photos { get; set; } = new();
|
||||
}
|
||||
|
||||
public class ProductPhotoDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string FilePath { get; set; } = string.Empty;
|
||||
public string? AltText { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
}
|
||||
|
||||
public class CreateProductDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(200)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[Range(0.01, double.MaxValue)]
|
||||
public decimal Price { get; set; }
|
||||
|
||||
public decimal Weight { get; set; }
|
||||
|
||||
public ProductWeightUnit WeightUnit { get; set; }
|
||||
|
||||
[Required]
|
||||
public Guid CategoryId { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateProductDto
|
||||
{
|
||||
[StringLength(200)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
[Range(0.01, double.MaxValue)]
|
||||
public decimal? Price { get; set; }
|
||||
|
||||
public decimal? Weight { get; set; }
|
||||
|
||||
public ProductWeightUnit? WeightUnit { get; set; }
|
||||
|
||||
public Guid? CategoryId { get; set; }
|
||||
|
||||
public bool? IsActive { get; set; }
|
||||
}
|
||||
|
||||
public class CreateProductPhotoDto
|
||||
{
|
||||
[Required]
|
||||
public Guid ProductId { get; set; }
|
||||
|
||||
[Required]
|
||||
public string PhotoUrl { get; set; } = string.Empty;
|
||||
|
||||
public string? AltText { get; set; }
|
||||
|
||||
public int DisplayOrder { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user