feature: Approval and Promotion to VigilCareClinical

This commit is contained in:
voltsrage
2026-06-26 14:04:52 +08:00
parent 7121520926
commit 470df683dd
21 changed files with 2638 additions and 4 deletions
+8 -3
View File
@@ -4,9 +4,10 @@ public static class DataSeeder
{
public static async Task SeedAsync(AppDbContext db)
{
if (await db.Users.AnyAsync()) return;
var existing = await db.Users.Select(u => u.Username).ToListAsync();
if (existing.Count >= 12) return;
var users = new[]
var all = new[]
{
CreateUser("intake1", "Intake Clerk 1", UserRole.IntakeClerk),
CreateUser("intake2", "Intake Clerk 2", UserRole.IntakeClerk),
@@ -22,7 +23,11 @@ public static class DataSeeder
CreateUser("admin2", "Administrator 2", UserRole.Administrator),
};
db.Users.AddRange(users);
var existingSet = existing.ToHashSet();
var missing = all.Where(u => !existingSet.Contains(u.Username)).ToArray();
if (missing.Length == 0) return;
db.Users.AddRange(missing);
await db.SaveChangesAsync();
}