feat(store): 扩展临时时段配置

This commit is contained in:
2026-01-20 18:41:34 +08:00
parent 3385674490
commit 32f5bbbd43
15 changed files with 7871 additions and 33 deletions

View File

@@ -15,6 +15,27 @@ public sealed class CreateStoreHolidayCommandValidator : AbstractValidator<Creat
{
RuleFor(x => x.StoreId).GreaterThan(0);
RuleFor(x => x.Date).NotEmpty();
RuleFor(x => x.Reason).MaximumLength(256);
RuleFor(x => x.EndDate)
.GreaterThanOrEqualTo(x => x.Date)
.When(x => x.EndDate.HasValue)
.WithMessage("结束日期不能早于开始日期");
RuleFor(x => x.StartTime)
.NotNull()
.When(x => !x.IsAllDay)
.WithMessage("非全天模式下必须填写开始时间");
RuleFor(x => x.EndTime)
.NotNull()
.When(x => !x.IsAllDay)
.WithMessage("非全天模式下必须填写结束时间");
RuleFor(x => x.EndTime)
.GreaterThan(x => x.StartTime)
.When(x => !x.IsAllDay && x.StartTime.HasValue && x.EndTime.HasValue)
.WithMessage("结束时间必须晚于开始时间");
RuleFor(x => x.Reason).MaximumLength(200);
}
}

View File

@@ -16,6 +16,27 @@ public sealed class UpdateStoreHolidayCommandValidator : AbstractValidator<Updat
RuleFor(x => x.HolidayId).GreaterThan(0);
RuleFor(x => x.StoreId).GreaterThan(0);
RuleFor(x => x.Date).NotEmpty();
RuleFor(x => x.Reason).MaximumLength(256);
RuleFor(x => x.EndDate)
.GreaterThanOrEqualTo(x => x.Date)
.When(x => x.EndDate.HasValue)
.WithMessage("结束日期不能早于开始日期");
RuleFor(x => x.StartTime)
.NotNull()
.When(x => !x.IsAllDay)
.WithMessage("非全天模式下必须填写开始时间");
RuleFor(x => x.EndTime)
.NotNull()
.When(x => !x.IsAllDay)
.WithMessage("非全天模式下必须填写结束时间");
RuleFor(x => x.EndTime)
.GreaterThan(x => x.StartTime)
.When(x => !x.IsAllDay && x.StartTime.HasValue && x.EndTime.HasValue)
.WithMessage("结束时间必须晚于开始时间");
RuleFor(x => x.Reason).MaximumLength(200);
}
}