seed/data Seeder WorkHours
This commit is contained in:
parent
6f756f33d0
commit
fd8d2ef73a
4 changed files with 25 additions and 56 deletions
|
|
@ -2011,6 +2011,10 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
||||||
Description = $"{listFormName}.Description",
|
Description = $"{listFormName}.Description",
|
||||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.WorkHour)),
|
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.WorkHour)),
|
||||||
|
SeedFilePath = SeedPathResolver.GetDataFilePath(listFormName),
|
||||||
|
SeedSyncInsert = false,
|
||||||
|
SeedSyncUpdate = false,
|
||||||
|
SeedSyncDelete = false,
|
||||||
KeyFieldName = "Id",
|
KeyFieldName = "Id",
|
||||||
KeyFieldDbSourceType = DbType.Guid,
|
KeyFieldDbSourceType = DbType.Guid,
|
||||||
DefaultFilter = DefaultFilterJson,
|
DefaultFilter = DefaultFilterJson,
|
||||||
|
|
|
||||||
|
|
@ -391,21 +391,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"WorkHours": [
|
|
||||||
{
|
|
||||||
"Name": "00:00-23:59",
|
|
||||||
"StartTime": "1970-01-01T00:00:00",
|
|
||||||
"EndTime": "1970-01-01T23:59:59",
|
|
||||||
"IsFixed": false,
|
|
||||||
"Monday": true,
|
|
||||||
"Tuesday": true,
|
|
||||||
"Wednesday": true,
|
|
||||||
"Thursday": true,
|
|
||||||
"Friday": true,
|
|
||||||
"Saturday": true,
|
|
||||||
"Sunday": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Departments": [
|
"Departments": [
|
||||||
{
|
{
|
||||||
"Id": "8f14e45f-ea2d-4d9f-9f1d-1a2b3c4d5e6f",
|
"Id": "8f14e45f-ea2d-4d9f-9f1d-1a2b3c4d5e6f",
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ public class TenantSeederDto
|
||||||
public List<SequenceSeedDto> Sequences { get; set; }
|
public List<SequenceSeedDto> Sequences { get; set; }
|
||||||
|
|
||||||
//Definitions
|
//Definitions
|
||||||
public List<WorkHourSeedDto> WorkHours { get; set; }
|
|
||||||
public List<DepartmentSeedDto> Departments { get; set; }
|
public List<DepartmentSeedDto> Departments { get; set; }
|
||||||
public List<JobPositionSeedDto> JobPositions { get; set; }
|
public List<JobPositionSeedDto> JobPositions { get; set; }
|
||||||
|
|
||||||
|
|
@ -287,21 +286,6 @@ public class HomeSolutionSeedDto
|
||||||
public string StyleClass { get; set; }
|
public string StyleClass { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WorkHourSeedDto
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public DateTime StartTime { get; set; }
|
|
||||||
public DateTime EndTime { get; set; }
|
|
||||||
public bool? IsFixed { get; set; }
|
|
||||||
public bool? Monday { get; set; }
|
|
||||||
public bool? Tuesday { get; set; }
|
|
||||||
public bool? Wednesday { get; set; }
|
|
||||||
public bool? Thursday { get; set; }
|
|
||||||
public bool? Friday { get; set; }
|
|
||||||
public bool? Saturday { get; set; }
|
|
||||||
public bool? Sunday { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ContactSeedDto
|
public class ContactSeedDto
|
||||||
{
|
{
|
||||||
public string Address { get; set; }
|
public string Address { get; set; }
|
||||||
|
|
@ -323,7 +307,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
private readonly IRepository<Service, Guid> _servicesRepository;
|
private readonly IRepository<Service, Guid> _servicesRepository;
|
||||||
private readonly IRepository<Contact, Guid> _contactRepository;
|
private readonly IRepository<Contact, Guid> _contactRepository;
|
||||||
private readonly IRepository<ForumCategory, Guid> _forumCategoryRepository;
|
private readonly IRepository<ForumCategory, Guid> _forumCategoryRepository;
|
||||||
private readonly IRepository<WorkHour, Guid> _workHourRepository;
|
|
||||||
private readonly IIdentityUserRepository _repositoryUser;
|
private readonly IIdentityUserRepository _repositoryUser;
|
||||||
private readonly IRepository<Department, Guid> _departmentRepository;
|
private readonly IRepository<Department, Guid> _departmentRepository;
|
||||||
private readonly IRepository<JobPosition, Guid> _jobPositionRepository;
|
private readonly IRepository<JobPosition, Guid> _jobPositionRepository;
|
||||||
|
|
@ -351,7 +334,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
IRepository<About, Guid> aboutRepository,
|
IRepository<About, Guid> aboutRepository,
|
||||||
IRepository<Service, Guid> servicesRepository,
|
IRepository<Service, Guid> servicesRepository,
|
||||||
IRepository<Contact, Guid> contactRepository,
|
IRepository<Contact, Guid> contactRepository,
|
||||||
IRepository<WorkHour, Guid> workHourRepository,
|
|
||||||
IRepository<ForumCategory, Guid> forumCategoryRepository,
|
IRepository<ForumCategory, Guid> forumCategoryRepository,
|
||||||
IRepository<Department, Guid> departmentRepository,
|
IRepository<Department, Guid> departmentRepository,
|
||||||
IRepository<JobPosition, Guid> jobPositionRepository,
|
IRepository<JobPosition, Guid> jobPositionRepository,
|
||||||
|
|
@ -378,7 +360,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
_servicesRepository = servicesRepository;
|
_servicesRepository = servicesRepository;
|
||||||
_aboutRepository = aboutRepository;
|
_aboutRepository = aboutRepository;
|
||||||
_contactRepository = contactRepository;
|
_contactRepository = contactRepository;
|
||||||
_workHourRepository = workHourRepository;
|
|
||||||
_forumCategoryRepository = forumCategoryRepository;
|
_forumCategoryRepository = forumCategoryRepository;
|
||||||
_departmentRepository = departmentRepository;
|
_departmentRepository = departmentRepository;
|
||||||
_jobPositionRepository = jobPositionRepository;
|
_jobPositionRepository = jobPositionRepository;
|
||||||
|
|
@ -504,28 +485,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var item in items.WorkHours)
|
|
||||||
{
|
|
||||||
var exists = await _workHourRepository.AnyAsync(x => x.Name == item.Name);
|
|
||||||
|
|
||||||
if (!exists)
|
|
||||||
{
|
|
||||||
await _workHourRepository.InsertAsync(new WorkHour
|
|
||||||
{
|
|
||||||
Name = item.Name,
|
|
||||||
StartTime = item.StartTime,
|
|
||||||
EndTime = item.EndTime,
|
|
||||||
Monday = item.Monday,
|
|
||||||
Tuesday = item.Tuesday,
|
|
||||||
Wednesday = item.Wednesday,
|
|
||||||
Thursday = item.Thursday,
|
|
||||||
Friday = item.Friday,
|
|
||||||
Saturday = item.Saturday,
|
|
||||||
Sunday = item.Sunday,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var item in items.Departments)
|
foreach (var item in items.Departments)
|
||||||
{
|
{
|
||||||
var exists = await _departmentRepository.AnyAsync(x => x.Name == item.Name);
|
var exists = await _departmentRepository.AnyAsync(x => x.Name == item.Name);
|
||||||
|
|
|
||||||
21
configs/seeds/host/data/App.Restrictions.WorkHour.json
Normal file
21
configs/seeds/host/data/App.Restrictions.WorkHour.json
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"ListFormCode": "App.Restrictions.WorkHour",
|
||||||
|
"KeyFieldName": "Id",
|
||||||
|
"GeneratedAt": "2026-09-04T00:00:00Z",
|
||||||
|
"Order": 0,
|
||||||
|
"Rows": [
|
||||||
|
{
|
||||||
|
"Id": "8980c495-f3b7-5c8b-8e05-17bf4f966967",
|
||||||
|
"Name": "00:00-23:59",
|
||||||
|
"StartTime": "1970-01-01T00:00:00",
|
||||||
|
"EndTime": "1970-01-01T23:59:59",
|
||||||
|
"Monday": true,
|
||||||
|
"Tuesday": true,
|
||||||
|
"Wednesday": true,
|
||||||
|
"Thursday": true,
|
||||||
|
"Friday": true,
|
||||||
|
"Saturday": true,
|
||||||
|
"Sunday": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue