seed/data Seeder CustomEndpoints
This commit is contained in:
parent
a1a76b1a95
commit
a0491f9db8
4 changed files with 22 additions and 64 deletions
|
|
@ -6872,6 +6872,10 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
|
|||
Description = $"{listFormName}.Description",
|
||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.CustomEndpoint)),
|
||||
SeedFilePath = SeedPathResolver.GetDataFilePath(listFormName),
|
||||
SeedSyncInsert = false,
|
||||
SeedSyncUpdate = false,
|
||||
SeedSyncDelete = false,
|
||||
KeyFieldName = "Id",
|
||||
KeyFieldDbSourceType = DbType.Guid,
|
||||
DefaultFilter = DefaultFilterJson,
|
||||
|
|
|
|||
|
|
@ -33,35 +33,6 @@
|
|||
"IsActive": true
|
||||
}
|
||||
],
|
||||
"CustomEndpoints": [
|
||||
{
|
||||
"Name": "Langugage",
|
||||
"Description": "https://localhost:44344/api/app/custom-endpoint/dil/en",
|
||||
"Url": "/dil/",
|
||||
"Method": "GET",
|
||||
"DataSourceCode": "Default",
|
||||
"Sql": "SELECT * FROM Sas_H_Language WHERE IsEnabled = @IsEnabled AND CultureName = @CultureName",
|
||||
"ParametersJson": [
|
||||
{
|
||||
"Type": "Path",
|
||||
"Name": "CultureName",
|
||||
"DefaultValue": "ar",
|
||||
"Path": "/dil/:CultureName/"
|
||||
},
|
||||
{
|
||||
"Type": "Static",
|
||||
"Name": "IsEnabled",
|
||||
"DefaultValue": "true"
|
||||
}
|
||||
],
|
||||
"PermissionsJson": [
|
||||
{
|
||||
"ResourceType": "User",
|
||||
"ResourceId": "system@sozsoft.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Abouts": [
|
||||
{
|
||||
"stats": [
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ namespace Sozsoft.Platform.Data.Seeds;
|
|||
public class TenantSeederDto
|
||||
{
|
||||
//Saas
|
||||
public List<CustomEndpointSeedDto> CustomEndpoints { get; set; }
|
||||
public List<SequenceSeedDto> Sequences { get; set; }
|
||||
|
||||
//Definitions
|
||||
|
|
@ -269,18 +268,6 @@ public class ForumCategorySeedDto
|
|||
public bool IsActive { get; set; }
|
||||
}
|
||||
|
||||
public class CustomEndpointSeedDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string Method { get; set; }
|
||||
public string DataSourceCode { get; set; }
|
||||
public string Sql { get; set; }
|
||||
public List<CustomEndpointParameter> ParametersJson { get; set; }
|
||||
public List<CustomEndpointPermission> PermissionsJson { get; set; }
|
||||
}
|
||||
|
||||
public class PaymentMethodSeedDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
|
@ -420,7 +407,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
{
|
||||
private readonly ILookupNormalizer _lookupNormalizer;
|
||||
private readonly IRepository<Branch, Guid> _branchRepository;
|
||||
private readonly IRepository<CustomEndpoint, Guid> _customEndpointRepository;
|
||||
private readonly IRepository<ReportCategory, Guid> _reportCategoriesRepository;
|
||||
private readonly IRepository<ReportTemplate, Guid> _reportTemplatesRepository;
|
||||
private readonly IRepository<Home, Guid> _homeRepository;
|
||||
|
|
@ -465,7 +451,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
IRepository<SkillType, string> skillTypeRepository,
|
||||
IRepository<Skill, string> skillRepository,
|
||||
IRepository<SkillLevel, string> skillLevelRepository,
|
||||
IRepository<CustomEndpoint, Guid> customEndpointRepository,
|
||||
IRepository<ReportCategory, Guid> reportCategoriesRepository,
|
||||
IRepository<ReportTemplate, Guid> reportTemplatesRepository,
|
||||
IRepository<Home, Guid> homeRepository,
|
||||
|
|
@ -503,7 +488,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
_skillTypeRepository = skillTypeRepository;
|
||||
_skillRepository = skillRepository;
|
||||
_skillLevelRepository = skillLevelRepository;
|
||||
_customEndpointRepository = customEndpointRepository;
|
||||
_productRepository = productRepository;
|
||||
_paymentMethodRepository = paymentMethodRepository;
|
||||
_installmentOptionRepository = installmentOptionRepository;
|
||||
|
|
@ -646,25 +630,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
}
|
||||
}
|
||||
|
||||
foreach (var item in items.CustomEndpoints)
|
||||
{
|
||||
var exists = await _customEndpointRepository.AnyAsync(x => x.Name == item.Name);
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
await _customEndpointRepository.InsertAsync(new CustomEndpoint(
|
||||
item.Name,
|
||||
item.Description,
|
||||
item.Url,
|
||||
item.Method,
|
||||
item.DataSourceCode,
|
||||
item.Sql,
|
||||
JsonSerializer.Serialize(item.ParametersJson),
|
||||
JsonSerializer.Serialize(item.PermissionsJson)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in items.PaymentMethods)
|
||||
{
|
||||
var exists = await _paymentMethodRepository.AnyAsync(x => x.Name == item.Name);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"ListFormCode": "App.DeveloperKit.CustomEndpoints",
|
||||
"KeyFieldName": "Id",
|
||||
"GeneratedAt": "2026-09-04T00:00:00Z",
|
||||
"Rows": [
|
||||
{
|
||||
"Id": "22cdbe14-f7dc-5771-8553-927ad017db9e",
|
||||
"Name": "Langugage",
|
||||
"Description": "https://localhost:44344/api/app/custom-endpoint/dil/en",
|
||||
"Url": "/dil/",
|
||||
"Method": "GET",
|
||||
"DataSourceCode": "Default",
|
||||
"Sql": "SELECT * FROM Sas_H_Language WHERE IsEnabled = @IsEnabled AND CultureName = @CultureName",
|
||||
"ParametersJson": "[{\"Type\":\"Path\",\"Name\":\"CultureName\",\"DefaultValue\":\"ar\",\"Path\":\"/dil/:CultureName/\",\"IsRequired\":false},{\"Type\":\"Static\",\"Name\":\"IsEnabled\",\"DefaultValue\":\"true\",\"Path\":null,\"IsRequired\":false}]",
|
||||
"PermissionsJson": "[{\"ResourceType\":\"User\",\"ResourceId\":\"system@sozsoft.com\"}]"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in a new issue