feat: 桌码管理支持区域、批量生成与二维码导出
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using FluentValidation;
|
||||
using TakeoutSaaS.Application.App.Stores.Commands;
|
||||
|
||||
namespace TakeoutSaaS.Application.App.Stores.Validators;
|
||||
|
||||
/// <summary>
|
||||
/// 创建桌台区域命令验证器。
|
||||
/// </summary>
|
||||
public sealed class CreateStoreTableAreaCommandValidator : AbstractValidator<CreateStoreTableAreaCommand>
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化验证规则。
|
||||
/// </summary>
|
||||
public CreateStoreTableAreaCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.StoreId).GreaterThan(0);
|
||||
RuleFor(x => x.Name).NotEmpty().MaximumLength(64);
|
||||
RuleFor(x => x.Description).MaximumLength(256);
|
||||
RuleFor(x => x.SortOrder).GreaterThanOrEqualTo(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using FluentValidation;
|
||||
using TakeoutSaaS.Application.App.Stores.Commands;
|
||||
|
||||
namespace TakeoutSaaS.Application.App.Stores.Validators;
|
||||
|
||||
/// <summary>
|
||||
/// 批量生成桌码命令验证器。
|
||||
/// </summary>
|
||||
public sealed class GenerateStoreTablesCommandValidator : AbstractValidator<GenerateStoreTablesCommand>
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化验证规则。
|
||||
/// </summary>
|
||||
public GenerateStoreTablesCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.StoreId).GreaterThan(0);
|
||||
RuleFor(x => x.TableCodePrefix).NotEmpty().MaximumLength(16);
|
||||
RuleFor(x => x.StartNumber).GreaterThan(0);
|
||||
RuleFor(x => x.Count).GreaterThan(0).LessThanOrEqualTo(500);
|
||||
RuleFor(x => x.DefaultCapacity).GreaterThan(0).LessThanOrEqualTo(50);
|
||||
RuleFor(x => x.Tags).MaximumLength(128);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using FluentValidation;
|
||||
using TakeoutSaaS.Application.App.Stores.Commands;
|
||||
|
||||
namespace TakeoutSaaS.Application.App.Stores.Validators;
|
||||
|
||||
/// <summary>
|
||||
/// 更新桌台区域命令验证器。
|
||||
/// </summary>
|
||||
public sealed class UpdateStoreTableAreaCommandValidator : AbstractValidator<UpdateStoreTableAreaCommand>
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化验证规则。
|
||||
/// </summary>
|
||||
public UpdateStoreTableAreaCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.AreaId).GreaterThan(0);
|
||||
RuleFor(x => x.StoreId).GreaterThan(0);
|
||||
RuleFor(x => x.Name).NotEmpty().MaximumLength(64);
|
||||
RuleFor(x => x.Description).MaximumLength(256);
|
||||
RuleFor(x => x.SortOrder).GreaterThanOrEqualTo(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using FluentValidation;
|
||||
using TakeoutSaaS.Application.App.Stores.Commands;
|
||||
|
||||
namespace TakeoutSaaS.Application.App.Stores.Validators;
|
||||
|
||||
/// <summary>
|
||||
/// 更新桌码命令验证器。
|
||||
/// </summary>
|
||||
public sealed class UpdateStoreTableCommandValidator : AbstractValidator<UpdateStoreTableCommand>
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化验证规则。
|
||||
/// </summary>
|
||||
public UpdateStoreTableCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.StoreId).GreaterThan(0);
|
||||
RuleFor(x => x.TableId).GreaterThan(0);
|
||||
RuleFor(x => x.TableCode).NotEmpty().MaximumLength(32);
|
||||
RuleFor(x => x.Capacity).GreaterThan(0).LessThanOrEqualTo(50);
|
||||
RuleFor(x => x.Tags).MaximumLength(128);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user