style: 命令不可变化与规范补充

This commit is contained in:
2025-12-02 12:09:46 +08:00
parent 3e01943727
commit 541b75ecd8
13 changed files with 217 additions and 186 deletions

View File

@@ -7,100 +7,100 @@ namespace TakeoutSaaS.Application.App.Products.Commands;
/// <summary>
/// 更新商品命令。
/// </summary>
public sealed class UpdateProductCommand : IRequest<ProductDto?>
public sealed record UpdateProductCommand : IRequest<ProductDto?>
{
/// <summary>
/// 商品 ID。
/// </summary>
public long ProductId { get; set; }
public long ProductId { get; init; }
/// <summary>
/// 门店 ID。
/// </summary>
public long StoreId { get; set; }
public long StoreId { get; init; }
/// <summary>
/// 分类 ID。
/// </summary>
public long CategoryId { get; set; }
public long CategoryId { get; init; }
/// <summary>
/// 商品编码。
/// </summary>
public string SpuCode { get; set; } = string.Empty;
public string SpuCode { get; init; } = string.Empty;
/// <summary>
/// 名称。
/// </summary>
public string Name { get; set; } = string.Empty;
public string Name { get; init; } = string.Empty;
/// <summary>
/// 副标题。
/// </summary>
public string? Subtitle { get; set; }
public string? Subtitle { get; init; }
/// <summary>
/// 单位。
/// </summary>
public string? Unit { get; set; }
public string? Unit { get; init; }
/// <summary>
/// 现价。
/// </summary>
public decimal Price { get; set; }
public decimal Price { get; init; }
/// <summary>
/// 原价。
/// </summary>
public decimal? OriginalPrice { get; set; }
public decimal? OriginalPrice { get; init; }
/// <summary>
/// 库存数量。
/// </summary>
public int? StockQuantity { get; set; }
public int? StockQuantity { get; init; }
/// <summary>
/// 每单限购。
/// </summary>
public int? MaxQuantityPerOrder { get; set; }
public int? MaxQuantityPerOrder { get; init; }
/// <summary>
/// 状态。
/// </summary>
public ProductStatus Status { get; set; } = ProductStatus.Draft;
public ProductStatus Status { get; init; } = ProductStatus.Draft;
/// <summary>
/// 主图。
/// </summary>
public string? CoverImage { get; set; }
public string? CoverImage { get; init; }
/// <summary>
/// 图集。
/// </summary>
public string? GalleryImages { get; set; }
public string? GalleryImages { get; init; }
/// <summary>
/// 描述。
/// </summary>
public string? Description { get; set; }
public string? Description { get; init; }
/// <summary>
/// 支持堂食。
/// </summary>
public bool EnableDineIn { get; set; } = true;
public bool EnableDineIn { get; init; } = true;
/// <summary>
/// 支持自提。
/// </summary>
public bool EnablePickup { get; set; } = true;
public bool EnablePickup { get; init; } = true;
/// <summary>
/// 支持配送。
/// </summary>
public bool EnableDelivery { get; set; } = true;
public bool EnableDelivery { get; init; } = true;
/// <summary>
/// 是否推荐。
/// </summary>
public bool IsFeatured { get; set; }
public bool IsFeatured { get; init; }
}