campus-errand/server/Models/Dtos/ShopDtos.cs
2026-03-01 05:01:47 +08:00

132 lines
3.6 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace CampusErrand.Models.Dtos;
/// <summary>
/// 门店列表响应
/// </summary>
public class ShopListResponse
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Photo { get; set; } = string.Empty;
public string Location { get; set; } = string.Empty;
/// <summary>店内美食种类数量</summary>
public int DishCount { get; set; }
}
/// <summary>
/// 门店详情响应(含菜品)
/// </summary>
public class ShopDetailResponse
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Photo { get; set; } = string.Empty;
public string Location { get; set; } = string.Empty;
public string? Notice { get; set; }
public string PackingFeeType { get; set; } = string.Empty;
public decimal PackingFeeAmount { get; set; }
public bool IsEnabled { get; set; }
public List<ShopBannerResponse> Banners { get; set; } = [];
public List<DishResponse> Dishes { get; set; } = [];
}
/// <summary>
/// 门店 Banner 响应
/// </summary>
public class ShopBannerResponse
{
public int Id { get; set; }
public string ImageUrl { get; set; } = string.Empty;
public int SortOrder { get; set; }
}
/// <summary>
/// 菜品响应
/// </summary>
public class DishResponse
{
public int Id { get; set; }
public int ShopId { get; set; }
public string Name { get; set; } = string.Empty;
public string Photo { get; set; } = string.Empty;
public decimal Price { get; set; }
public bool IsEnabled { get; set; }
}
/// <summary>
/// 管理端门店创建/更新请求
/// </summary>
public class ShopRequest
{
[Required(ErrorMessage = "门店名称不能为空")]
[MaxLength(64)]
public string Name { get; set; } = string.Empty;
[Required(ErrorMessage = "门店照片不能为空")]
[MaxLength(512)]
public string Photo { get; set; } = string.Empty;
[Required(ErrorMessage = "门店位置不能为空")]
[MaxLength(256)]
public string Location { get; set; } = string.Empty;
[MaxLength(1024)]
public string? Notice { get; set; }
[Required(ErrorMessage = "打包费类型不能为空")]
public string PackingFeeType { get; set; } = string.Empty;
public decimal PackingFeeAmount { get; set; }
public bool IsEnabled { get; set; } = true;
}
/// <summary>
/// 管理端菜品创建/更新请求
/// </summary>
public class DishRequest
{
[Required(ErrorMessage = "菜品名称不能为空")]
[MaxLength(64)]
public string Name { get; set; } = string.Empty;
[Required(ErrorMessage = "菜品照片不能为空")]
[MaxLength(512)]
public string Photo { get; set; } = string.Empty;
public decimal Price { get; set; }
public bool IsEnabled { get; set; } = true;
}
/// <summary>
/// 管理端门店 Banner 创建/更新请求
/// </summary>
public class ShopBannerRequest
{
[Required(ErrorMessage = "图片地址不能为空")]
[MaxLength(512)]
public string ImageUrl { get; set; } = string.Empty;
public int SortOrder { get; set; }
}
/// <summary>
/// 管理端门店响应(含完整信息)
/// </summary>
public class AdminShopResponse
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Photo { get; set; } = string.Empty;
public string Location { get; set; } = string.Empty;
public string? Notice { get; set; }
public string PackingFeeType { get; set; } = string.Empty;
public decimal PackingFeeAmount { get; set; }
public bool IsEnabled { get; set; }
public int DishCount { get; set; }
}