feat(store): auto-generate store code on create and make update code optional
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 44s

This commit is contained in:
2026-02-18 08:27:37 +08:00
parent 1b185af718
commit b3429e2a0d
6 changed files with 56 additions and 35 deletions

View File

@@ -15,7 +15,6 @@ public sealed class CreateStoreCommandValidator : AbstractValidator<CreateStoreC
{
// 1. 校验核心字段
RuleFor(command => command.Name).NotEmpty().MaximumLength(128);
RuleFor(command => command.Code).NotEmpty().MaximumLength(32);
RuleFor(command => command.ContactPhone).NotEmpty().MaximumLength(32);
RuleFor(command => command.ManagerName).NotEmpty().MaximumLength(64);
RuleFor(command => command.Address).NotEmpty().MaximumLength(256);

View File

@@ -16,7 +16,10 @@ public sealed class UpdateStoreCommandValidator : AbstractValidator<UpdateStoreC
// 1. 校验标识与核心字段
RuleFor(command => command.Id).GreaterThan(0);
RuleFor(command => command.Name).NotEmpty().MaximumLength(128);
RuleFor(command => command.Code).NotEmpty().MaximumLength(32);
RuleFor(command => command.Code)
.NotEmpty()
.MaximumLength(32)
.When(command => command.Code is not null);
RuleFor(command => command.ContactPhone).NotEmpty().MaximumLength(32);
RuleFor(command => command.ManagerName).NotEmpty().MaximumLength(64);
RuleFor(command => command.Address).NotEmpty().MaximumLength(256);