feat: 门店员工与排班管理上线

This commit is contained in:
2025-12-04 09:32:03 +08:00
parent 1a5209a8b1
commit 19422df0f1
31 changed files with 1265 additions and 7 deletions

View File

@@ -0,0 +1,22 @@
using FluentValidation;
using TakeoutSaaS.Application.App.Stores.Commands;
namespace TakeoutSaaS.Application.App.Stores.Validators;
/// <summary>
/// 创建排班命令验证器。
/// </summary>
public sealed class CreateStoreEmployeeShiftCommandValidator : AbstractValidator<CreateStoreEmployeeShiftCommand>
{
/// <summary>
/// 初始化验证规则。
/// </summary>
public CreateStoreEmployeeShiftCommandValidator()
{
RuleFor(x => x.StoreId).GreaterThan(0);
RuleFor(x => x.StaffId).GreaterThan(0);
RuleFor(x => x.ShiftDate).NotEmpty();
RuleFor(x => x.StartTime).LessThan(x => x.EndTime).WithMessage("结束时间必须晚于开始时间");
RuleFor(x => x.Notes).MaximumLength(256);
}
}

View File

@@ -0,0 +1,21 @@
using FluentValidation;
using TakeoutSaaS.Application.App.Stores.Commands;
namespace TakeoutSaaS.Application.App.Stores.Validators;
/// <summary>
/// 创建门店员工命令验证器。
/// </summary>
public sealed class CreateStoreStaffCommandValidator : AbstractValidator<CreateStoreStaffCommand>
{
/// <summary>
/// 初始化验证规则。
/// </summary>
public CreateStoreStaffCommandValidator()
{
RuleFor(x => x.StoreId).GreaterThan(0);
RuleFor(x => x.Name).NotEmpty().MaximumLength(64);
RuleFor(x => x.Phone).NotEmpty().MaximumLength(32);
RuleFor(x => x.Email).EmailAddress().When(x => !string.IsNullOrWhiteSpace(x.Email));
}
}

View File

@@ -0,0 +1,23 @@
using FluentValidation;
using TakeoutSaaS.Application.App.Stores.Commands;
namespace TakeoutSaaS.Application.App.Stores.Validators;
/// <summary>
/// 更新排班命令验证器。
/// </summary>
public sealed class UpdateStoreEmployeeShiftCommandValidator : AbstractValidator<UpdateStoreEmployeeShiftCommand>
{
/// <summary>
/// 初始化验证规则。
/// </summary>
public UpdateStoreEmployeeShiftCommandValidator()
{
RuleFor(x => x.ShiftId).GreaterThan(0);
RuleFor(x => x.StoreId).GreaterThan(0);
RuleFor(x => x.StaffId).GreaterThan(0);
RuleFor(x => x.ShiftDate).NotEmpty();
RuleFor(x => x.StartTime).LessThan(x => x.EndTime).WithMessage("结束时间必须晚于开始时间");
RuleFor(x => x.Notes).MaximumLength(256);
}
}

View File

@@ -0,0 +1,22 @@
using FluentValidation;
using TakeoutSaaS.Application.App.Stores.Commands;
namespace TakeoutSaaS.Application.App.Stores.Validators;
/// <summary>
/// 更新门店员工命令验证器。
/// </summary>
public sealed class UpdateStoreStaffCommandValidator : AbstractValidator<UpdateStoreStaffCommand>
{
/// <summary>
/// 初始化验证规则。
/// </summary>
public UpdateStoreStaffCommandValidator()
{
RuleFor(x => x.StaffId).GreaterThan(0);
RuleFor(x => x.StoreId).GreaterThan(0);
RuleFor(x => x.Name).NotEmpty().MaximumLength(64);
RuleFor(x => x.Phone).NotEmpty().MaximumLength(32);
RuleFor(x => x.Email).EmailAddress().When(x => !string.IsNullOrWhiteSpace(x.Email));
}
}