- 新建 modules/platform 三层模块(Domain/Application/Infrastructure) - 搬入 8 个实体(User/Role/Permission/UserRole/RolePermission/RefreshToken/Menu/Notification) - 新建 PlatformDbContext(连 platform 库)+ 8 个 EF 配置 + SeedData - 搬入 92 个 Application CQRS 文件 + 57 个 Host Endpoints - RagDbContext 瘦身:只留 RAG 专属表(KnowledgeBase/Document/ChatMessage/Conversation) - Handler 注入改为 PlatformDbContext - appsettings 新增 DatabaseNames:Platform - BuildFlowHostModule 注册 PlatformDbContext + DependsOn PlatformApplicationModule - Conversation 实体去掉 User 导航(跨模块不直接引用实体) - rag SeedData 清空(平台种子归 platform) - 暂移除测 platform 功能的 Rag.Tests(后续建 platform 测试项目) - build 0/0
25 lines
898 B
C#
25 lines
898 B
C#
namespace BuildFlow.Host.Endpoints.rag.Permissions;
|
|
|
|
/// <summary>
|
|
/// 更新权限请求校验。
|
|
/// </summary>
|
|
public class UpdatePermissionEndpointRequestValidator : Validator<UpdatePermissionEndpointRequest>
|
|
{
|
|
public UpdatePermissionEndpointRequestValidator()
|
|
{
|
|
RuleFor(x => x.Id).NotEmpty().WithMessage("权限 ID 不能为空");
|
|
When(x => x.Name is not null, () =>
|
|
{
|
|
RuleFor(x => x.Name!).Length(2, 50).WithMessage("权限名称长度 2-50 个字符");
|
|
});
|
|
When(x => x.Description is not null, () =>
|
|
{
|
|
RuleFor(x => x.Description!).MaximumLength(500).WithMessage("权限描述长度不能超过 500 个字符");
|
|
});
|
|
When(x => x.Group is not null, () =>
|
|
{
|
|
RuleFor(x => x.Group!).MaximumLength(50).WithMessage("权限分组长度不能超过 50 个字符");
|
|
});
|
|
}
|
|
}
|