using Fake.Data.Seeding; using Fake.Rbac.Application.Dtos.Role; using Fake.Rbac.Application.Services; namespace SimpleAdmin.Api.Auth; public class CustomerRoleSeedContributor(RoleService roleService) : IDataSeedContributor { public const string CustomerRoleCode = "Customer"; public const string CustomerRoleName = "客户"; public async Task SeedAsync() { var roles = await roleService.GetAllRolesAsync(); if (roles.Any(x => string.Equals(x.Code, CustomerRoleCode, StringComparison.OrdinalIgnoreCase))) { return; } await roleService.CreateAsync(new RoleCreateDto { Code = CustomerRoleCode, Name = CustomerRoleName, Permissions = [] }); } }