seed/data Seeder Departments
This commit is contained in:
parent
fd8d2ef73a
commit
4bf6b4c257
5 changed files with 102 additions and 138 deletions
|
|
@ -2648,6 +2648,10 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
|||
Description = $"{listFormName}.Description",
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Department)),
|
||||
SeedFilePath = SeedPathResolver.GetDataFilePath(listFormName),
|
||||
SeedSyncInsert = false,
|
||||
SeedSyncUpdate = false,
|
||||
SeedSyncDelete = false,
|
||||
KeyFieldName = "Id",
|
||||
KeyFieldDbSourceType = DbType.Guid,
|
||||
DefaultFilter = DefaultFilterJson,
|
||||
|
|
@ -2767,6 +2771,10 @@ public class ListFormSeeder_Administration : IDataSeedContributor, ITransientDep
|
|||
Description = $"{listFormName}.Description",
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.JobPosition)),
|
||||
SeedFilePath = SeedPathResolver.GetDataFilePath(listFormName),
|
||||
SeedSyncInsert = false,
|
||||
SeedSyncUpdate = false,
|
||||
SeedSyncDelete = false,
|
||||
KeyFieldName = "Id",
|
||||
KeyFieldDbSourceType = DbType.Guid,
|
||||
DefaultFilter = DefaultFilterJson,
|
||||
|
|
|
|||
|
|
@ -391,86 +391,6 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"Departments": [
|
||||
{
|
||||
"Id": "8f14e45f-ea2d-4d9f-9f1d-1a2b3c4d5e6f",
|
||||
"Name": "Yönetim"
|
||||
},
|
||||
{
|
||||
"Id": "2c1743a3-91b7-4b57-a6c8-7d8e9f0a1b2c",
|
||||
"Name": "Üretim",
|
||||
"ParentName": "Yönetim"
|
||||
},
|
||||
{
|
||||
"Id": "987bcab0-1b92-4a4e-8d7f-3c2b1a0f9e8d",
|
||||
"Name": "Satış",
|
||||
"ParentName": "Yönetim"
|
||||
},
|
||||
{
|
||||
"Id": "05b048d7-2f44-4f9d-b5a1-6e7f8a9b0c1d",
|
||||
"Name": "Finans",
|
||||
"ParentName": "Yönetim"
|
||||
},
|
||||
{
|
||||
"Id": "051048d7-2f44-4f9d-b5a1-6e7f8a9b0c1d",
|
||||
"Name": "Muhasebe",
|
||||
"ParentName": "Finans"
|
||||
},
|
||||
{
|
||||
"Id": "3cd38ab3-7e6f-4b8d-9c0a-5f4e3d2c1b0a",
|
||||
"Name": "Bilgi İşlem",
|
||||
"ParentName": "Yönetim"
|
||||
}
|
||||
],
|
||||
"JobPositions": [
|
||||
{
|
||||
"Id": "d1f7c6a2-3b4e-4c8d-9f0a-1b2c3d4e5f60",
|
||||
"DepartmentName": "Yönetim",
|
||||
"Name": "Genel Müdür"
|
||||
},
|
||||
{
|
||||
"Id": "b7c8d9e0-f1a2-4b3c-8d9e-0f1a2b3c4d2e",
|
||||
"DepartmentName": "Bilgi İşlem",
|
||||
"Name": "Bilgi İşlem Müdürü",
|
||||
"ParentName": "Genel Müdür"
|
||||
},
|
||||
{
|
||||
"Id": "b7c8d9e0-f1b2-4b3c-1d9e-0f1a2b3c4d2e",
|
||||
"DepartmentName": "Satış",
|
||||
"Name": "İhracat Müdürü",
|
||||
"ParentName": "Genel Müdür"
|
||||
},
|
||||
{
|
||||
"Id": "b2c8d9e0-f1b2-4b3c-1d9e-0f1a2b3c4d2e",
|
||||
"DepartmentName": "Satış",
|
||||
"Name": "İç Piyasa Müdürü",
|
||||
"ParentName": "Genel Müdür"
|
||||
},
|
||||
{
|
||||
"Id": "b2c8d9e0-f1b2-2b3c-1d9e-0f1a2b3c4d2e",
|
||||
"DepartmentName": "Üretim",
|
||||
"Name": "Üretim Müdürü",
|
||||
"ParentName": "Genel Müdür"
|
||||
},
|
||||
{
|
||||
"Id": "b7c8d9e0-f1a2-4b3c-1d9e-0f1a2b3c4d2e",
|
||||
"DepartmentName": "Finans",
|
||||
"Name": "Finans Müdürü",
|
||||
"ParentName": "Genel Müdür"
|
||||
},
|
||||
{
|
||||
"Id": "b7c8d9e0-f1a2-4b3c-8d9e-0f1a2b3c4d5e",
|
||||
"DepartmentName": "Muhasebe",
|
||||
"Name": "Muhasebe Müdürü",
|
||||
"ParentName": "Finans Müdürü"
|
||||
},
|
||||
{
|
||||
"Id": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
|
||||
"DepartmentName": "Muhasebe",
|
||||
"Name": "Muhasebe Şefi",
|
||||
"ParentName": "Muhasebe Müdürü"
|
||||
}
|
||||
],
|
||||
"Announcements": [
|
||||
{
|
||||
"title": "🎉 Yeni Ofis Açılışı",
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ public class TenantSeederDto
|
|||
public List<SequenceSeedDto> Sequences { get; set; }
|
||||
|
||||
//Definitions
|
||||
public List<DepartmentSeedDto> Departments { get; set; }
|
||||
public List<JobPositionSeedDto> JobPositions { get; set; }
|
||||
|
||||
//Public
|
||||
public List<HomeSeedDto> Homes { get; set; }
|
||||
|
|
@ -193,23 +191,6 @@ public class AnnouncementSeedDto
|
|||
public string DepartmentNames { get; set; }
|
||||
}
|
||||
|
||||
public class JobPositionSeedDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string DepartmentName { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string BranchCode { get; set; }
|
||||
public string ParentName { get; set; }
|
||||
}
|
||||
|
||||
public class DepartmentSeedDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string BranchCode { get; set; }
|
||||
public string ParentName { get; set; }
|
||||
}
|
||||
|
||||
public class ForumCategorySeedDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
|
@ -308,8 +289,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
private readonly IRepository<Contact, Guid> _contactRepository;
|
||||
private readonly IRepository<ForumCategory, Guid> _forumCategoryRepository;
|
||||
private readonly IIdentityUserRepository _repositoryUser;
|
||||
private readonly IRepository<Department, Guid> _departmentRepository;
|
||||
private readonly IRepository<JobPosition, Guid> _jobPositionRepository;
|
||||
private readonly IRepository<Announcement, Guid> _announcementRepository;
|
||||
private readonly IRepository<Survey, Guid> _surveyRepository;
|
||||
private readonly IRepository<SurveyQuestion, Guid> _surveyQuestionRepository;
|
||||
|
|
@ -335,8 +314,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
IRepository<Service, Guid> servicesRepository,
|
||||
IRepository<Contact, Guid> contactRepository,
|
||||
IRepository<ForumCategory, Guid> forumCategoryRepository,
|
||||
IRepository<Department, Guid> departmentRepository,
|
||||
IRepository<JobPosition, Guid> jobPositionRepository,
|
||||
|
||||
IRepository<Announcement, Guid> announcementRepository,
|
||||
IRepository<Survey, Guid> surveyRepository,
|
||||
|
|
@ -361,8 +338,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
_aboutRepository = aboutRepository;
|
||||
_contactRepository = contactRepository;
|
||||
_forumCategoryRepository = forumCategoryRepository;
|
||||
_departmentRepository = departmentRepository;
|
||||
_jobPositionRepository = jobPositionRepository;
|
||||
_announcementRepository = announcementRepository;
|
||||
_surveyRepository = surveyRepository;
|
||||
_surveyQuestionRepository = surveyQuestionRepository;
|
||||
|
|
@ -485,39 +460,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
}
|
||||
}
|
||||
|
||||
foreach (var item in items.Departments)
|
||||
{
|
||||
var exists = await _departmentRepository.AnyAsync(x => x.Name == item.Name);
|
||||
if (exists)
|
||||
continue;
|
||||
|
||||
var branch = await _branchRepository.FirstOrDefaultAsync(x => x.Code == item.BranchCode);
|
||||
var parent = await _departmentRepository.FirstOrDefaultAsync(x => x.Name == item.ParentName);
|
||||
|
||||
await _departmentRepository.InsertAsync(new Department(item.Id)
|
||||
{
|
||||
Name = item.Name,
|
||||
ParentId = parent?.Id
|
||||
}, autoSave: true);
|
||||
}
|
||||
|
||||
foreach (var item in items.JobPositions)
|
||||
{
|
||||
var exists = await _jobPositionRepository.AnyAsync(x => x.Name == item.Name);
|
||||
if (exists)
|
||||
continue;
|
||||
|
||||
var department = await _departmentRepository.FirstOrDefaultAsync(x => x.Name == item.DepartmentName);
|
||||
var parent = await _jobPositionRepository.FirstOrDefaultAsync(x => x.Name == item.ParentName);
|
||||
|
||||
await _jobPositionRepository.InsertAsync(new JobPosition(item.Id)
|
||||
{
|
||||
Name = item.Name,
|
||||
DepartmentId = department.Id,
|
||||
ParentId = parent?.Id
|
||||
}, autoSave: true);
|
||||
}
|
||||
|
||||
foreach (var item in items.Announcements)
|
||||
{
|
||||
var exists = await _announcementRepository.AnyAsync(x => x.Title == item.Title);
|
||||
|
|
|
|||
38
configs/seeds/host/data/App.Definitions.Department.json
Normal file
38
configs/seeds/host/data/App.Definitions.Department.json
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ListFormCode": "App.Definitions.Department",
|
||||
"KeyFieldName": "Id",
|
||||
"GeneratedAt": "2026-09-04T00:00:00Z",
|
||||
"Order": 10,
|
||||
"Rows": [
|
||||
{
|
||||
"Id": "8f14e45f-ea2d-4d9f-9f1d-1a2b3c4d5e6f",
|
||||
"Name": "Yönetim",
|
||||
"ParentId": null
|
||||
},
|
||||
{
|
||||
"Id": "2c1743a3-91b7-4b57-a6c8-7d8e9f0a1b2c",
|
||||
"Name": "Üretim",
|
||||
"ParentId": "8f14e45f-ea2d-4d9f-9f1d-1a2b3c4d5e6f"
|
||||
},
|
||||
{
|
||||
"Id": "987bcab0-1b92-4a4e-8d7f-3c2b1a0f9e8d",
|
||||
"Name": "Satış",
|
||||
"ParentId": "8f14e45f-ea2d-4d9f-9f1d-1a2b3c4d5e6f"
|
||||
},
|
||||
{
|
||||
"Id": "05b048d7-2f44-4f9d-b5a1-6e7f8a9b0c1d",
|
||||
"Name": "Finans",
|
||||
"ParentId": "8f14e45f-ea2d-4d9f-9f1d-1a2b3c4d5e6f"
|
||||
},
|
||||
{
|
||||
"Id": "051048d7-2f44-4f9d-b5a1-6e7f8a9b0c1d",
|
||||
"Name": "Muhasebe",
|
||||
"ParentId": "05b048d7-2f44-4f9d-b5a1-6e7f8a9b0c1d"
|
||||
},
|
||||
{
|
||||
"Id": "3cd38ab3-7e6f-4b8d-9c0a-5f4e3d2c1b0a",
|
||||
"Name": "Bilgi İşlem",
|
||||
"ParentId": "8f14e45f-ea2d-4d9f-9f1d-1a2b3c4d5e6f"
|
||||
}
|
||||
]
|
||||
}
|
||||
56
configs/seeds/host/data/App.Definitions.JobPosition.json
Normal file
56
configs/seeds/host/data/App.Definitions.JobPosition.json
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"ListFormCode": "App.Definitions.JobPosition",
|
||||
"KeyFieldName": "Id",
|
||||
"GeneratedAt": "2026-09-04T00:00:00Z",
|
||||
"Order": 20,
|
||||
"Rows": [
|
||||
{
|
||||
"Id": "d1f7c6a2-3b4e-4c8d-9f0a-1b2c3d4e5f60",
|
||||
"Name": "Genel Müdür",
|
||||
"DepartmentId": "8f14e45f-ea2d-4d9f-9f1d-1a2b3c4d5e6f",
|
||||
"ParentId": null
|
||||
},
|
||||
{
|
||||
"Id": "b7c8d9e0-f1a2-4b3c-8d9e-0f1a2b3c4d2e",
|
||||
"Name": "Bilgi İşlem Müdürü",
|
||||
"DepartmentId": "3cd38ab3-7e6f-4b8d-9c0a-5f4e3d2c1b0a",
|
||||
"ParentId": "d1f7c6a2-3b4e-4c8d-9f0a-1b2c3d4e5f60"
|
||||
},
|
||||
{
|
||||
"Id": "b7c8d9e0-f1b2-4b3c-1d9e-0f1a2b3c4d2e",
|
||||
"Name": "İhracat Müdürü",
|
||||
"DepartmentId": "987bcab0-1b92-4a4e-8d7f-3c2b1a0f9e8d",
|
||||
"ParentId": "d1f7c6a2-3b4e-4c8d-9f0a-1b2c3d4e5f60"
|
||||
},
|
||||
{
|
||||
"Id": "b2c8d9e0-f1b2-4b3c-1d9e-0f1a2b3c4d2e",
|
||||
"Name": "İç Piyasa Müdürü",
|
||||
"DepartmentId": "987bcab0-1b92-4a4e-8d7f-3c2b1a0f9e8d",
|
||||
"ParentId": "d1f7c6a2-3b4e-4c8d-9f0a-1b2c3d4e5f60"
|
||||
},
|
||||
{
|
||||
"Id": "b2c8d9e0-f1b2-2b3c-1d9e-0f1a2b3c4d2e",
|
||||
"Name": "Üretim Müdürü",
|
||||
"DepartmentId": "2c1743a3-91b7-4b57-a6c8-7d8e9f0a1b2c",
|
||||
"ParentId": "d1f7c6a2-3b4e-4c8d-9f0a-1b2c3d4e5f60"
|
||||
},
|
||||
{
|
||||
"Id": "b7c8d9e0-f1a2-4b3c-1d9e-0f1a2b3c4d2e",
|
||||
"Name": "Finans Müdürü",
|
||||
"DepartmentId": "05b048d7-2f44-4f9d-b5a1-6e7f8a9b0c1d",
|
||||
"ParentId": "d1f7c6a2-3b4e-4c8d-9f0a-1b2c3d4e5f60"
|
||||
},
|
||||
{
|
||||
"Id": "b7c8d9e0-f1a2-4b3c-8d9e-0f1a2b3c4d5e",
|
||||
"Name": "Muhasebe Müdürü",
|
||||
"DepartmentId": "051048d7-2f44-4f9d-b5a1-6e7f8a9b0c1d",
|
||||
"ParentId": "b7c8d9e0-f1a2-4b3c-1d9e-0f1a2b3c4d2e"
|
||||
},
|
||||
{
|
||||
"Id": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
|
||||
"Name": "Muhasebe Şefi",
|
||||
"DepartmentId": "051048d7-2f44-4f9d-b5a1-6e7f8a9b0c1d",
|
||||
"ParentId": "b7c8d9e0-f1a2-4b3c-8d9e-0f1a2b3c4d5e"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in a new issue