initial commit

This commit is contained in:
2026-07-21 14:35:37 +07:00
commit 0027997ff9
798 changed files with 59083 additions and 0 deletions
@@ -0,0 +1,90 @@
using Indotalent.ConfigBackEnd.Extensions;
using Indotalent.Data.Entities;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Infrastructure.Database.Demo;
public static class EmployeeSeeder
{
public static async Task GenerateDataAsync(AppDbContext context)
{
if (await context.Employee.AnyAsync()) return;
var fohCategory = await context.EmployeeCategory.FirstOrDefaultAsync(x => x.Name == "Front of House");
var bohCategory = await context.EmployeeCategory.FirstOrDefaultAsync(x => x.Name == "Back of House");
var groups = await context.EmployeeGroup.ToListAsync();
if (fohCategory == null || bohCategory == null || !groups.Any()) return;
var streets = new string[] { "Main St", "Broadway", "Oak Avenue", "Maple Drive", "Park Avenue", "Washington Blvd", "Lakeview Dr", "Sunset Blvd" };
var cities = new string[] { "New York", "Los Angeles", "Chicago", "Miami", "Seattle" };
var states = new string[] { "NY", "CA", "IL", "FL", "WA" };
var zipCodes = new string[] { "10001", "90210", "60601", "33101", "98101" };
var random = new Random();
var entityName = nameof(Employee);
var employeeData = new List<(string Name, string Title, string GroupName, string CategoryName, decimal Commission)>
{
("Robert Sterling", "Senior Membership Advisor", "Sales & Membership Advisors", "Front of House", 0.05m),
("Jennifer Adams", "Wellness Consultant", "Sales & Membership Advisors", "Front of House", 0.03m),
("Michael Vance", "Front Desk Lead", "Front Desk & Guest Services", "Front of House", 0.00m),
("Sarah Mitchell", "Guest Relations Specialist", "Front Desk & Guest Services", "Front of House", 0.00m),
("David Miller", "Senior Massage Therapist", "Licensed Massage Therapists", "Back of House", 0.25m),
("Jessica Taylor", "Deep Tissue Specialist", "Licensed Massage Therapists", "Back of House", 0.20m),
("Amanda Williams", "Master Esthetician", "Professional Estheticians", "Back of House", 0.15m),
("Christopher Moore", "Skin Care Specialist", "Professional Estheticians", "Back of House", 0.15m),
("Kevin Anderson", "Elite Personal Trainer", "Certified Personal Trainers", "Back of House", 0.30m),
("Samantha White", "Fitness Performance Coach", "Certified Personal Trainers", "Back of House", 0.25m),
("Ashley Johnson", "Yoga Lead Instructor", "Group Exercise Instructors", "Back of House", 0.10m),
("Matthew Davis", "Pilates Master Coach", "Group Exercise Instructors", "Back of House", 0.10m),
("Lauren Martinez", "Nutrition & Wellness Coach", "Holistic Wellness Coaches", "Back of House", 0.15m),
("Jonathan Wilson", "Holistic Health Advisor", "Holistic Wellness Coaches", "Back of House", 0.15m),
("Stephanie Rodriguez", "Clinical Physiotherapist", "Clinical Physical Therapists", "Back of House", 0.20m),
("Nicholas Thomas", "Sports Rehab Specialist", "Clinical Physical Therapists", "Back of House", 0.20m),
("Jason Hernandez", "Facility Director", "Facility & Operations Team", "Back of House", 0.00m),
("Olivia Jackson", "Operations Manager", "Facility & Operations Team", "Back of House", 0.00m),
("Alexander Smith", "General Manager", "Executive Management Team", "Front of House", 0.00m),
("Elizabeth Brown", "Club Director", "Executive Management Team", "Front of House", 0.00m)
};
foreach (var data in employeeData)
{
var group = groups.FirstOrDefault(x => x.Name == data.GroupName);
var categoryId = data.CategoryName == "Front of House" ? fohCategory.Id : bohCategory.Id;
var autoNo = await context.GenerateAutoNumberAsync(
entityName: entityName,
prefixTemplate: $"EMP-{{Year}}-"
);
var employee = new Employee
{
Name = data.Name,
AutoNumber = autoNo,
EmployeeNumber = $"ID-{random.Next(1000, 9999)}",
JobTitle = data.Title,
CommissionRate = data.Commission,
EmployeeGroupId = group?.Id,
EmployeeCategoryId = categoryId,
Street = $"{random.Next(100, 999)} {GetRandomString(streets, random)}",
City = GetRandomString(cities, random),
State = GetRandomString(states, random),
ZipCode = GetRandomString(zipCodes, random),
Country = "United States",
PhoneNumber = $"+1-{random.Next(200, 999)}-{random.Next(100, 999)}-{random.Next(1000, 9999)}",
EmailAddress = $"{data.Name.Replace(" ", ".").ToLower()}@swm-wellness.us",
Description = $"Professional {data.Title} based in the {data.CategoryName} division."
};
await context.Employee.AddAsync(employee);
}
await context.SaveChangesAsync();
}
private static string GetRandomString(string[] array, Random random)
{
return array[random.Next(array.Length)];
}
}