Country, City, District düzenlemesi
This commit is contained in:
parent
06c59824bd
commit
4b9ef52e84
23 changed files with 1218252 additions and 89728 deletions
|
|
@ -8,6 +8,7 @@ public class CountryDto : AuditedEntityDto<Guid>
|
|||
{
|
||||
public string Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
public string CurrencyCode { get; set; }
|
||||
public int PhoneCode { get; set; }
|
||||
public string TaxLabel { get; set; }
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ namespace Kurs.Platform.Contacts;
|
|||
|
||||
public class DistrictDto : AuditedEntityDto<Guid>
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string CountryCode { get; set; }
|
||||
public string CityCode { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Township { get; set; }
|
||||
public string Street { get; set; }
|
||||
public string ZipCode { get; set; }
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
8990
api/src/Kurs.Platform.DbMigrator/Seeds/Cities.json
Normal file
8990
api/src/Kurs.Platform.DbMigrator/Seeds/Cities.json
Normal file
File diff suppressed because it is too large
Load diff
2003
api/src/Kurs.Platform.DbMigrator/Seeds/Countries.json
Normal file
2003
api/src/Kurs.Platform.DbMigrator/Seeds/Countries.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,9 @@
|
|||
[
|
||||
{ "Name": "Afrika" },
|
||||
{ "Name": "Antarktika" },
|
||||
{ "Name": "Asya" },
|
||||
{ "Name": "Avrupa" },
|
||||
{ "Name": "Kuzey Amerika" },
|
||||
{ "Name": "Okyanusya" },
|
||||
{ "Name": "Güney Amerika" }
|
||||
]
|
||||
598122
api/src/Kurs.Platform.DbMigrator/Seeds/Districts.json
Normal file
598122
api/src/Kurs.Platform.DbMigrator/Seeds/Districts.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -10452,7 +10452,7 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
{
|
||||
Popup = new GridEditingPopupDto
|
||||
{
|
||||
Title = "State Form",
|
||||
Title = "City Form",
|
||||
Width = 500,
|
||||
Height = 300
|
||||
},
|
||||
|
|
@ -10474,10 +10474,7 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
new EditingFormItemDto { Order = 1, DataField = "CountryCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions="{ \"showClearButton\" : true }" },
|
||||
new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 3, DataField = "Code", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 4, DataField = "District", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 5, DataField = "Township", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 6, DataField = "Street", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 7, DataField = "ZipCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }
|
||||
new EditingFormItemDto { Order = 4, DataField = "PlateCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }
|
||||
]
|
||||
}
|
||||
}),
|
||||
|
|
@ -10528,64 +10525,12 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
ListFormCode = listFormCity.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Name",
|
||||
FieldName = "CountryCode",
|
||||
Width = 200,
|
||||
ListOrderNo = 2,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ValidationRuleJson = JsonSerializer.Serialize(new[]
|
||||
{
|
||||
new ValidationRuleDto { Type = "required" }
|
||||
}),
|
||||
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
||||
{
|
||||
C = AppCodes.Definitions.City + ".Create",
|
||||
R = AppCodes.Definitions.City,
|
||||
U = AppCodes.Definitions.City + ".Update",
|
||||
E = true,
|
||||
I = true,
|
||||
Deny = false
|
||||
})
|
||||
},
|
||||
new()
|
||||
{
|
||||
ListFormCode = listFormCity.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Code",
|
||||
Width = 120,
|
||||
ListOrderNo = 3,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ValidationRuleJson = JsonSerializer.Serialize(new[]
|
||||
{
|
||||
new ValidationRuleDto { Type = "required" }
|
||||
}),
|
||||
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
||||
{
|
||||
C = AppCodes.Definitions.City + ".Create",
|
||||
R = AppCodes.Definitions.City,
|
||||
U = AppCodes.Definitions.City + ".Update",
|
||||
E = true,
|
||||
I = true,
|
||||
Deny = false
|
||||
})
|
||||
},
|
||||
new()
|
||||
{
|
||||
ListFormCode = listFormCity.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "CountryCode",
|
||||
Width = 120,
|
||||
ListOrderNo = 4,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = false,
|
||||
LookupJson = JsonSerializer.Serialize(new LookupDto
|
||||
{
|
||||
|
|
@ -10613,7 +10558,59 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
ListFormCode = listFormCity.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "District",
|
||||
FieldName = "Name",
|
||||
Width = 200,
|
||||
ListOrderNo = 3,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ValidationRuleJson = JsonSerializer.Serialize(new[]
|
||||
{
|
||||
new ValidationRuleDto { Type = "required" }
|
||||
}),
|
||||
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
||||
{
|
||||
C = AppCodes.Definitions.City + ".Create",
|
||||
R = AppCodes.Definitions.City,
|
||||
U = AppCodes.Definitions.City + ".Update",
|
||||
E = true,
|
||||
I = true,
|
||||
Deny = false
|
||||
})
|
||||
},
|
||||
new()
|
||||
{
|
||||
ListFormCode = listFormCity.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Code",
|
||||
Width = 120,
|
||||
ListOrderNo = 4,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ValidationRuleJson = JsonSerializer.Serialize(new[]
|
||||
{
|
||||
new ValidationRuleDto { Type = "required" }
|
||||
}),
|
||||
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
||||
{
|
||||
C = AppCodes.Definitions.City + ".Create",
|
||||
R = AppCodes.Definitions.City,
|
||||
U = AppCodes.Definitions.City + ".Update",
|
||||
E = true,
|
||||
I = true,
|
||||
Deny = false
|
||||
})
|
||||
},
|
||||
new()
|
||||
{
|
||||
ListFormCode = listFormCity.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "PlateCode",
|
||||
Width = 100,
|
||||
ListOrderNo = 5,
|
||||
Visible = true,
|
||||
|
|
@ -10634,84 +10631,6 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
Deny = false
|
||||
})
|
||||
},
|
||||
new()
|
||||
{
|
||||
ListFormCode = listFormCity.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Street",
|
||||
Width = 100,
|
||||
ListOrderNo = 6,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = false,
|
||||
ValidationRuleJson = JsonSerializer.Serialize(new[]
|
||||
{
|
||||
new ValidationRuleDto { Type = "required" }
|
||||
}),
|
||||
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
||||
{
|
||||
C = AppCodes.Definitions.City + ".Create",
|
||||
R = AppCodes.Definitions.City,
|
||||
U = AppCodes.Definitions.City + ".Update",
|
||||
E = true,
|
||||
I = true,
|
||||
Deny = false
|
||||
})
|
||||
},
|
||||
new()
|
||||
{
|
||||
ListFormCode = listFormCity.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Township",
|
||||
Width = 100,
|
||||
ListOrderNo = 7,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = false,
|
||||
ValidationRuleJson = JsonSerializer.Serialize(new[]
|
||||
{
|
||||
new ValidationRuleDto { Type = "required" }
|
||||
}),
|
||||
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
||||
{
|
||||
C = AppCodes.Definitions.City + ".Create",
|
||||
R = AppCodes.Definitions.City,
|
||||
U = AppCodes.Definitions.City + ".Update",
|
||||
E = true,
|
||||
I = true,
|
||||
Deny = false
|
||||
})
|
||||
},
|
||||
new()
|
||||
{
|
||||
ListFormCode = listFormCity.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "ZipCode",
|
||||
Width = 100,
|
||||
ListOrderNo = 8,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = false,
|
||||
ValidationRuleJson = JsonSerializer.Serialize(new[]
|
||||
{
|
||||
new ValidationRuleDto { Type = "required" }
|
||||
}),
|
||||
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
||||
{
|
||||
C = AppCodes.Definitions.City + ".Create",
|
||||
R = AppCodes.Definitions.City,
|
||||
U = AppCodes.Definitions.City + ".Update",
|
||||
E = true,
|
||||
I = true,
|
||||
Deny = false
|
||||
})
|
||||
}
|
||||
]);
|
||||
#endregion
|
||||
}
|
||||
|
|
@ -10796,8 +10715,8 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
Popup = new GridEditingPopupDto
|
||||
{
|
||||
Title = "District Form",
|
||||
Width = 500,
|
||||
Height = 300
|
||||
Width = 600,
|
||||
Height = 500
|
||||
},
|
||||
AllowDeleting = true,
|
||||
AllowAdding = true,
|
||||
|
|
@ -10814,11 +10733,12 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
ItemType = "group",
|
||||
Items =
|
||||
[
|
||||
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 2, DataField = "CityCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
|
||||
new EditingFormItemDto { Order = 3, DataField = "Township", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 4, DataField = "Street", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 5, DataField = "ZipCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }
|
||||
new EditingFormItemDto { Order = 1, DataField = "CountryCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions="{ \"showClearButton\" : true }" },
|
||||
new EditingFormItemDto { Order = 2, DataField = "CityCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions="{ \"showClearButton\" : true }" },
|
||||
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 4, DataField = "Township", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 5, DataField = "Street", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 6, DataField = "ZipCode", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }
|
||||
]
|
||||
}
|
||||
}),
|
||||
|
|
@ -10869,13 +10789,20 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
ListFormCode = listFormDistrict.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Name",
|
||||
Width = 200,
|
||||
FieldName = "CountryCode",
|
||||
Width = 120,
|
||||
ListOrderNo = 2,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
LookupJson = JsonSerializer.Serialize(new LookupDto
|
||||
{
|
||||
DataSourceType = UiLookupDataSourceTypeEnum.Query,
|
||||
DisplayExpr = "Name",
|
||||
ValueExpr = "Key",
|
||||
LookupQuery = $"SELECT \"{DbTablePrefix}Country\".\"Code\" AS \"Key\", \"{DbTablePrefix}Country\".\"Name\" as \"Name\" FROM \"{DbTablePrefix}Country\" ORDER BY \"{DbTablePrefix}Country\".\"Name\""
|
||||
}),
|
||||
ValidationRuleJson = JsonSerializer.Serialize(new[]
|
||||
{
|
||||
new ValidationRuleDto { Type = "required" }
|
||||
|
|
@ -10928,12 +10855,38 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
ListFormCode = listFormDistrict.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Township",
|
||||
Width = 120,
|
||||
FieldName = "Name",
|
||||
Width = 200,
|
||||
ListOrderNo = 4,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
ValidationRuleJson = JsonSerializer.Serialize(new[]
|
||||
{
|
||||
new ValidationRuleDto { Type = "required" }
|
||||
}),
|
||||
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
||||
{
|
||||
C = AppCodes.Definitions.District + ".Create",
|
||||
R = AppCodes.Definitions.District,
|
||||
U = AppCodes.Definitions.District + ".Update",
|
||||
E = true,
|
||||
I = true,
|
||||
Deny = false
|
||||
})
|
||||
},
|
||||
new()
|
||||
{
|
||||
ListFormCode = listFormDistrict.ListFormCode,
|
||||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Township",
|
||||
Width = 200,
|
||||
ListOrderNo = 5,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = false,
|
||||
ValidationRuleJson = JsonSerializer.Serialize(new[]
|
||||
{
|
||||
|
|
@ -10955,8 +10908,8 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
CultureName = LanguageCodes.En,
|
||||
SourceDbType = DbType.String,
|
||||
FieldName = "Street",
|
||||
Width = 100,
|
||||
ListOrderNo = 5,
|
||||
Width = 400,
|
||||
ListOrderNo = 6,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
|
|
@ -10982,7 +10935,7 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
|
|||
SourceDbType = DbType.String,
|
||||
FieldName = "ZipCode",
|
||||
Width = 100,
|
||||
ListOrderNo = 6,
|
||||
ListOrderNo = 7,
|
||||
Visible = true,
|
||||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ using Volo.Abp.DependencyInjection;
|
|||
using Volo.Abp.Domain.Repositories;
|
||||
using Volo.Abp.MultiTenancy;
|
||||
using Volo.Abp.PermissionManagement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EFCore.BulkExtensions;
|
||||
using System.Collections.Generic;
|
||||
using Kurs.Platform.Contacts;
|
||||
using static Kurs.Settings.SettingsConsts;
|
||||
|
||||
namespace Kurs.Platform.Data.Seeds;
|
||||
|
|
@ -165,6 +169,14 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
.Build();
|
||||
var items = configuration.Get<SeederDto>();
|
||||
|
||||
await SeedCountyGroupsAsync();
|
||||
|
||||
await SeedCountriesAsync();
|
||||
|
||||
await SeedCitiesAsync();
|
||||
|
||||
await SeedDistrictsAsync();
|
||||
|
||||
foreach (var item in items.Charts)
|
||||
{
|
||||
if (!charts.Any(a => a.ChartCode == item.ChartCode))
|
||||
|
|
@ -463,70 +475,6 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
}
|
||||
}
|
||||
|
||||
foreach (var item in items.CountryGroups)
|
||||
{
|
||||
var exists = await _countryGroupRepository.AnyAsync(x => x.Name == item.Name);
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
await _countryGroupRepository.InsertAsync(new CountryGroup
|
||||
{
|
||||
Name = item.Name,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in items.Countries)
|
||||
{
|
||||
var exists = await _countryRepository.AnyAsync(x => x.Code == item.Code);
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
await _countryRepository.InsertAsync(new Country
|
||||
{
|
||||
Code = item.Code,
|
||||
Name = item.Name,
|
||||
CurrencyCode = item.CurrencyCode,
|
||||
PhoneCode = item.PhoneCode,
|
||||
TaxLabel = item.TaxLabel,
|
||||
GroupName = item.GroupName
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in items.Cities)
|
||||
{
|
||||
var exists = await _cityRepository.AnyAsync(x => x.Name == item.Name && x.CountryCode == item.CountryCode);
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
await _cityRepository.InsertAsync(new City
|
||||
{
|
||||
Code = item.Code,
|
||||
Name = item.Name,
|
||||
PlateCode = item.PlateCode,
|
||||
CountryCode = item.CountryCode
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in items.Districts)
|
||||
{
|
||||
var exists = await _districtRepository.AnyAsync(x => x.Name == item.Name && x.CityCode == item.CityCode);
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
await _districtRepository.InsertAsync(new District
|
||||
{
|
||||
Name = item.Name,
|
||||
CityCode = item.CityCode,
|
||||
Township = item.Township,
|
||||
Street = item.Street,
|
||||
ZipCode = item.ZipCode
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in items.SkillTypes)
|
||||
{
|
||||
var exists = await _skillTypeRepository.AnyAsync(x => x.Name == item.Name);
|
||||
|
|
@ -787,5 +735,239 @@ public class PlatformDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SeedCountyGroupsAsync()
|
||||
{
|
||||
var dbCtx = await _countryRepository.GetDbContextAsync();
|
||||
|
||||
// DB’de mevcut kodları set olarak al
|
||||
var existingCodes = (await dbCtx.Set<CountryGroup>()
|
||||
.Select(c => c.Name)
|
||||
.ToListAsync())
|
||||
.ToHashSet();
|
||||
|
||||
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
|
||||
|
||||
using var fs = File.OpenRead(Path.Combine("Seeds", "CountryGroups.json"));
|
||||
|
||||
var buffer = new List<CountryGroup>(capacity: 1000);
|
||||
var seenCodes = new HashSet<string>(); // JSON içindeki duplicate’leri yakalamak için
|
||||
|
||||
await foreach (var item in JsonSerializer.DeserializeAsyncEnumerable<CountryGroupDto>(fs, options))
|
||||
{
|
||||
if (item == null) continue;
|
||||
if (string.IsNullOrWhiteSpace(item.Name)) continue; // boş kodları atla
|
||||
|
||||
// hem DB’de hem JSON içinde duplicate engelle
|
||||
if (!seenCodes.Add(item.Name) || existingCodes.Contains(item.Name))
|
||||
continue;
|
||||
|
||||
buffer.Add(new CountryGroup(
|
||||
Guid.NewGuid(),
|
||||
item.Name
|
||||
));
|
||||
|
||||
if (buffer.Count >= 1000)
|
||||
{
|
||||
await BulkCountryGroupInsertAsync(buffer);
|
||||
buffer.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer.Count > 0)
|
||||
{
|
||||
await BulkCountryGroupInsertAsync(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task BulkCountryGroupInsertAsync(List<CountryGroup> entities)
|
||||
{
|
||||
var dbCtx = await _countryGroupRepository.GetDbContextAsync();
|
||||
await dbCtx.BulkInsertAsync(entities, new BulkConfig
|
||||
{
|
||||
BatchSize = 1000
|
||||
});
|
||||
}
|
||||
|
||||
public async Task SeedCountriesAsync()
|
||||
{
|
||||
var dbCtx = await _countryRepository.GetDbContextAsync();
|
||||
|
||||
// DB’de mevcut kodları set olarak al
|
||||
var existingCodes = (await dbCtx.Set<Country>()
|
||||
.Select(c => c.Code)
|
||||
.ToListAsync())
|
||||
.ToHashSet();
|
||||
|
||||
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
|
||||
|
||||
using var fs = File.OpenRead(Path.Combine("Seeds", "Countries.json"));
|
||||
|
||||
var buffer = new List<Country>(capacity: 1000);
|
||||
var seenCodes = new HashSet<string>(); // JSON içindeki duplicate’leri yakalamak için
|
||||
|
||||
await foreach (var item in JsonSerializer.DeserializeAsyncEnumerable<CountryDto>(fs, options))
|
||||
{
|
||||
if (item == null) continue;
|
||||
if (string.IsNullOrWhiteSpace(item.Code)) continue; // boş kodları atla
|
||||
|
||||
// hem DB’de hem JSON içinde duplicate engelle
|
||||
if (!seenCodes.Add(item.Code) || existingCodes.Contains(item.Code))
|
||||
continue;
|
||||
|
||||
buffer.Add(new Country(
|
||||
Guid.NewGuid(),
|
||||
item.Code,
|
||||
item.Name,
|
||||
item.GroupName,
|
||||
item.CurrencyCode,
|
||||
item.PhoneCode,
|
||||
item.TaxLabel
|
||||
));
|
||||
|
||||
if (buffer.Count >= 1000)
|
||||
{
|
||||
await BulkCountryInsertAsync(buffer);
|
||||
buffer.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer.Count > 0)
|
||||
{
|
||||
await BulkCountryInsertAsync(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task BulkCountryInsertAsync(List<Country> entities)
|
||||
{
|
||||
var dbCtx = await _countryRepository.GetDbContextAsync();
|
||||
await dbCtx.BulkInsertAsync(entities, new BulkConfig
|
||||
{
|
||||
BatchSize = 1000
|
||||
});
|
||||
}
|
||||
|
||||
public async Task SeedCitiesAsync()
|
||||
{
|
||||
var dbCtx = await _cityRepository.GetDbContextAsync();
|
||||
|
||||
// 1. Mevcut kayıtları çek (tek sorguda)
|
||||
var existingCities = await dbCtx.Set<City>()
|
||||
.Select(d => new { d.Code })
|
||||
.ToListAsync();
|
||||
|
||||
var existingSet = existingCities
|
||||
.Select(d => d.Code)
|
||||
.ToHashSet();
|
||||
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
// 2. JSON’u stream et
|
||||
using FileStream fs = File.OpenRead(Path.Combine("Seeds", "Cities.json"));
|
||||
|
||||
var buffer = new List<City>(capacity: 5000);
|
||||
await foreach (var item in JsonSerializer.DeserializeAsyncEnumerable<CityDto>(fs, options))
|
||||
{
|
||||
if (item == null) continue;
|
||||
|
||||
var key = $"{item.Code}";
|
||||
if (existingSet.Contains(key)) continue; // duplicate kontrolü
|
||||
|
||||
buffer.Add(new City(
|
||||
Guid.NewGuid(),
|
||||
item.CountryCode,
|
||||
item.Name,
|
||||
$"{item.CountryCode}.{item.Code}",
|
||||
item.PlateCode
|
||||
));
|
||||
|
||||
if (buffer.Count >= 1000) // 3. Batch
|
||||
{
|
||||
await BulkCityInsertAsync(buffer);
|
||||
buffer.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer.Count > 0)
|
||||
{
|
||||
await BulkCityInsertAsync(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task BulkCityInsertAsync(List<City> entities)
|
||||
{
|
||||
var dbCtx = await _cityRepository.GetDbContextAsync();
|
||||
await dbCtx.BulkInsertAsync(entities, new BulkConfig
|
||||
{
|
||||
PreserveInsertOrder = true,
|
||||
SetOutputIdentity = true,
|
||||
BatchSize = 1000
|
||||
});
|
||||
}
|
||||
|
||||
public async Task SeedDistrictsAsync()
|
||||
{
|
||||
var dbCtx = await _districtRepository.GetDbContextAsync();
|
||||
|
||||
// 1. Mevcut kayıtları çek (tek sorguda)
|
||||
var existingDistricts = await dbCtx.Set<District>()
|
||||
.Select(d => new { d.CountryCode, d.CityCode, d.Name, d.Township, d.Street, d.ZipCode })
|
||||
.ToListAsync();
|
||||
|
||||
var existingSet = existingDistricts
|
||||
.Select(d => $"{d.CountryCode}:{d.CityCode}:{d.Name}:{d.Township}:{d.Street}:{d.ZipCode}")
|
||||
.ToHashSet();
|
||||
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
// 2. JSON’u stream et
|
||||
using FileStream fs = File.OpenRead(Path.Combine("Seeds", "Districts.json"));
|
||||
|
||||
var buffer = new List<District>(capacity: 5000);
|
||||
await foreach (var item in JsonSerializer.DeserializeAsyncEnumerable<DistrictDto>(fs, options))
|
||||
{
|
||||
if (item == null) continue;
|
||||
|
||||
var key = $"{item.CountryCode}:{item.CityCode}:{item.Name}:{item.Township}:{item.Street}:{item.ZipCode}";
|
||||
if (existingSet.Contains(key)) continue; // duplicate kontrolü
|
||||
|
||||
buffer.Add(new District(
|
||||
Guid.NewGuid(),
|
||||
item.CountryCode,
|
||||
$"{item.CountryCode}.{item.CityCode}",
|
||||
item.Name,
|
||||
item.Township,
|
||||
item.Street,
|
||||
item.ZipCode
|
||||
));
|
||||
|
||||
if (buffer.Count >= 5000) // 3. Batch
|
||||
{
|
||||
await BulkDistrictInsertAsync(buffer);
|
||||
buffer.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer.Count > 0)
|
||||
{
|
||||
await BulkDistrictInsertAsync(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task BulkDistrictInsertAsync(List<District> entities)
|
||||
{
|
||||
var dbCtx = await _districtRepository.GetDbContextAsync();
|
||||
await dbCtx.BulkInsertAsync(entities, new BulkConfig
|
||||
{
|
||||
PreserveInsertOrder = true,
|
||||
SetOutputIdentity = true,
|
||||
BatchSize = 5000
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -25,10 +25,6 @@ public class SeederDto
|
|||
public List<UomCategorySeedDto> UomCategories { get; set; }
|
||||
public List<UomSeedDto> Uoms { get; set; }
|
||||
public List<CurrencySeedDto> Currencies { get; set; }
|
||||
public List<CountryGroupSeedDto> CountryGroups { get; set; }
|
||||
public List<CountrySeedDto> Countries { get; set; }
|
||||
public List<CitySeedDto> Cities { get; set; }
|
||||
public List<DistrictSeedDto> Districts { get; set; }
|
||||
public List<SkillTypeSeedDto> SkillTypes { get; set; }
|
||||
public List<SkillSeedDto> Skills { get; set; }
|
||||
public List<SkillLevelSeedDto> SkillLevels { get; set; }
|
||||
|
|
@ -157,38 +153,6 @@ public class CurrencySeedDto
|
|||
public bool IsActive { get; set; }
|
||||
}
|
||||
|
||||
public class CountryGroupSeedDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public class CountrySeedDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Code { get; set; }
|
||||
public string CurrencyCode { get; set; }
|
||||
public int PhoneCode { get; set; }
|
||||
public string TaxLabel { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
}
|
||||
|
||||
public class CitySeedDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Code { get; set; }
|
||||
public string PlateCode { get; set; }
|
||||
public string CountryCode { get; set; }
|
||||
}
|
||||
|
||||
public class DistrictSeedDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string CityCode { get; set; }
|
||||
public string Township { get; set; }
|
||||
public string Street { get; set; }
|
||||
public string ZipCode { get; set; }
|
||||
}
|
||||
|
||||
public class SkillTypeSeedDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
|
@ -307,8 +271,8 @@ public class PaymentMethodSeedDto
|
|||
|
||||
public class InstallmentOptionSeedDto
|
||||
{
|
||||
public int Id { get; set; } // e.g. 1, 2, 3, 6, 12
|
||||
public string Name { get; set; } // e.g. "Tek Çekim", "2 Taksit"
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public decimal Commission { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
|||
598122
api/src/Kurs.Platform.DbMigrator/Seeds/Utils/data.json
Normal file
598122
api/src/Kurs.Platform.DbMigrator/Seeds/Utils/data.json
Normal file
File diff suppressed because it is too large
Load diff
BIN
api/src/Kurs.Platform.DbMigrator/Seeds/Utils/data.xlsx
Normal file
BIN
api/src/Kurs.Platform.DbMigrator/Seeds/Utils/data.xlsx
Normal file
Binary file not shown.
80
api/src/Kurs.Platform.DbMigrator/Seeds/Utils/xlsx2json.py
Normal file
80
api/src/Kurs.Platform.DbMigrator/Seeds/Utils/xlsx2json.py
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
|
||||
# Excel'deki kolon adları bu adaylara göre eşleştirilecektir.
|
||||
CANDIDATES = {
|
||||
"CountryCode": ["CountryCode", "Ad", "Adi", "İsim", "Isim"],
|
||||
"CityCode": ["CityCode", "City", "SehirKodu", "ŞehirKodu", "Il", "İl", "IlKodu", "İlKodu", "Plaka"],
|
||||
"Name": ["Name", "Ad", "Adi", "İsim", "Isim"],
|
||||
"Township": ["Township", "Ilce", "İlçe", "District", "Semt"],
|
||||
"Street": ["Street", "Sokak", "Cadde", "Adres", "Mahalle"],
|
||||
"ZipCode": ["ZipCode", "PostaKodu", "PK", "Zip", "PostCode", "PostalCode"]
|
||||
}
|
||||
|
||||
REQUIRED_KEYS = ["CountryCode", "CityCode", "Name", "Township", "Street", "ZipCode"]
|
||||
|
||||
def build_column_map(columns):
|
||||
lower_map = {c.casefold(): c for c in columns if c is not None}
|
||||
col_map = {}
|
||||
missing = []
|
||||
|
||||
for target_key in REQUIRED_KEYS:
|
||||
found = None
|
||||
for cand in CANDIDATES.get(target_key, [target_key]):
|
||||
if cand.casefold() in lower_map:
|
||||
found = lower_map[cand.casefold()]
|
||||
break
|
||||
if found is None:
|
||||
missing.append(target_key)
|
||||
else:
|
||||
col_map[target_key] = found
|
||||
|
||||
if missing:
|
||||
raise ValueError(
|
||||
"Aşağıdaki alanlar için uygun Excel sütunu bulunamadı: "
|
||||
+ ", ".join(missing)
|
||||
+ f"\nBulunan sütunlar: {', '.join(columns)}"
|
||||
)
|
||||
|
||||
return col_map
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description="XLSX dosyasını belirtilen şemada JSON'a dönüştürür.")
|
||||
ap.add_argument("-i", "--input", required=True, help="Girdi XLSX dosyası")
|
||||
ap.add_argument("-o", "--output", default="output.json", help="Çıktı JSON dosyası (varsayılan: output.json)")
|
||||
ap.add_argument("-s", "--sheet", default=0, help="Sayfa adı veya index (varsayılan: 0)")
|
||||
args = ap.parse_args()
|
||||
|
||||
in_path = Path(args.input)
|
||||
out_path = Path(args.output)
|
||||
|
||||
if not in_path.exists():
|
||||
raise FileNotFoundError(f"Girdi dosyası bulunamadı: {in_path}")
|
||||
|
||||
# Excel dosyasını oku (pandas engine otomatik seçer)
|
||||
df = pd.read_excel(in_path, sheet_name=args.sheet, dtype=str)
|
||||
|
||||
# Kolonları eşleştir
|
||||
col_map = build_column_map(df.columns)
|
||||
|
||||
# Sadece gereken kolonları al ve yeniden isimlendir
|
||||
result_df = df[list(col_map.values())].rename(columns={v: k for k, v in col_map.items()})
|
||||
|
||||
# NaN'leri boş string'e çevir
|
||||
result_df = result_df.fillna("")
|
||||
|
||||
# JSON'a dönüştür
|
||||
data = result_df.to_dict(orient="records")
|
||||
|
||||
with open(out_path, "w", encoding="utf-8") as jf:
|
||||
json.dump(data, jf, ensure_ascii=False, indent=4)
|
||||
|
||||
print(f"Tamam: {in_path} -> {out_path} ({len(data)} kayıt)")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -1,17 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
|
||||
namespace Kurs.Platform.Entities;
|
||||
|
||||
public class City : FullAuditedEntity<Guid>
|
||||
{
|
||||
public string Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string PlateCode { get; set; }
|
||||
public string CountryCode { get; set; }
|
||||
public Country Country { get; set; }
|
||||
public ICollection<District> District { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Code { get; set; }
|
||||
public string PlateCode { get; set; }
|
||||
|
||||
public Country Country { get; set; }
|
||||
public ICollection<District> Districts { get; set; }
|
||||
|
||||
protected City() { }
|
||||
|
||||
public City(Guid id, string countryCode, string name, string code, string plateCode)
|
||||
: base(id)
|
||||
{
|
||||
CountryCode = countryCode;
|
||||
Name = name;
|
||||
Code = code;
|
||||
PlateCode = plateCode;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,43 @@ public class Country : FullAuditedEntity<Guid>
|
|||
public bool StateRequired { get; set; }
|
||||
|
||||
public ICollection<City> Cities { get; set; }
|
||||
|
||||
protected Country() { }
|
||||
|
||||
public Country(
|
||||
Guid id,
|
||||
string code,
|
||||
string name,
|
||||
string groupName,
|
||||
string currentyCode,
|
||||
int phoneCode,
|
||||
string taxLabel,
|
||||
bool zipRequired = false,
|
||||
bool stateRequired = false)
|
||||
: base(id)
|
||||
{
|
||||
Code = code;
|
||||
Name = name;
|
||||
GroupName = groupName;
|
||||
CurrencyCode = currentyCode;
|
||||
PhoneCode = phoneCode;
|
||||
TaxLabel = taxLabel;
|
||||
ZipRequired = zipRequired;
|
||||
StateRequired = stateRequired;
|
||||
}
|
||||
}
|
||||
|
||||
public class CountryGroup : FullAuditedEntity<Guid>
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
protected CountryGroup() { }
|
||||
|
||||
public CountryGroup(
|
||||
Guid id,
|
||||
string name)
|
||||
: base(id)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
|
|
@ -5,10 +5,24 @@ namespace Kurs.Platform.Entities;
|
|||
|
||||
public class District : FullAuditedEntity<Guid>
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string CountryCode { get; set; }
|
||||
public string CityCode { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Township { get; set; }
|
||||
public string Street { get; set; }
|
||||
public string ZipCode { get; set; }
|
||||
public City City { get; set; }
|
||||
|
||||
protected District() { }
|
||||
|
||||
public District(Guid id, string countryCode, string cityCode, string name, string township, string street, string zipCode)
|
||||
: base(id)
|
||||
{
|
||||
CountryCode = countryCode;
|
||||
CityCode = cityCode;
|
||||
Name = name;
|
||||
Township = township;
|
||||
Street = street;
|
||||
ZipCode = zipCode;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class PlatformDbContext :
|
|||
public DbSet<CountryGroup> CountryGroups { get; set; }
|
||||
public DbSet<Country> Countries { get; set; }
|
||||
public DbSet<City> Cities { get; set; }
|
||||
public DbSet<District> Districts { get; set; }
|
||||
public DbSet<SkillType> SkillTypes { get; set; }
|
||||
public DbSet<Skill> Skills { get; set; }
|
||||
public DbSet<SkillLevel> SkillLevels { get; set; }
|
||||
|
|
@ -381,7 +382,13 @@ public class PlatformDbContext :
|
|||
b.Property(x => x.Code).IsRequired().HasMaxLength(16);
|
||||
b.Property(x => x.PlateCode).HasMaxLength(20);
|
||||
|
||||
b.HasIndex(x => new { x.CountryCode, x.Name }).IsUnique();
|
||||
b.HasIndex(x => new { x.CountryCode, x.Code }).IsUnique();
|
||||
|
||||
b.HasMany(x => x.Districts)
|
||||
.WithOne(x => x.City)
|
||||
.HasForeignKey(x => new { x.CountryCode, x.CityCode })
|
||||
.HasPrincipalKey(x => new { x.CountryCode, x.Code })
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
builder.Entity<District>(b =>
|
||||
|
|
@ -395,7 +402,7 @@ public class PlatformDbContext :
|
|||
b.Property(x => x.Street).HasMaxLength(256);
|
||||
b.Property(x => x.ZipCode).HasMaxLength(16);
|
||||
|
||||
b.HasIndex(x => new { x.CityCode, x.Name }).IsUnique();
|
||||
b.HasIndex(x => new { x.CountryCode, x.CityCode, x.Name, x.Township, x.Street, x.ZipCode }).IsUnique();
|
||||
});
|
||||
|
||||
builder.Entity<SkillType>(b =>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EFCore.BulkExtensions" Version="9.0.1" />
|
||||
<ProjectReference Include="..\..\modules\Kurs.Languages\Kurs.Languages.EntityFrameworkCore\Kurs.Languages.EntityFrameworkCore.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Kurs.Notifications\Kurs.Notifications.EntityFrameworkCore\Kurs.Notifications.EntityFrameworkCore.csproj" />
|
||||
<ProjectReference Include="..\..\modules\Kurs.Settings\Kurs.Settings.EntityFrameworkCore\Kurs.Settings.EntityFrameworkCore.csproj" />
|
||||
|
|
|
|||
6565
api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250819080748_Districs.Designer.cs
generated
Normal file
6565
api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250819080748_Districs.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,221 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Kurs.Platform.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Districs : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PCity_CountryCode_Code",
|
||||
table: "PCity");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Phone",
|
||||
table: "PDemo",
|
||||
type: "nvarchar(20)",
|
||||
maxLength: 20,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Message",
|
||||
table: "PDemo",
|
||||
type: "nvarchar(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Email",
|
||||
table: "PDemo",
|
||||
type: "nvarchar(256)",
|
||||
maxLength: 256,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Address",
|
||||
table: "PDemo",
|
||||
type: "nvarchar(512)",
|
||||
maxLength: 512,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(max)");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CountryCode",
|
||||
table: "PCity",
|
||||
type: "nvarchar(8)",
|
||||
maxLength: 8,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(8)",
|
||||
oldMaxLength: 8,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Code",
|
||||
table: "PCity",
|
||||
type: "nvarchar(16)",
|
||||
maxLength: 16,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(16)",
|
||||
oldMaxLength: 16,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "PlateCode",
|
||||
table: "PCity",
|
||||
type: "nvarchar(20)",
|
||||
maxLength: 20,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddUniqueConstraint(
|
||||
name: "AK_PCity_CountryCode_Code",
|
||||
table: "PCity",
|
||||
columns: new[] { "CountryCode", "Code" });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PDistrict",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
CountryCode = table.Column<string>(type: "nvarchar(8)", nullable: true),
|
||||
CityCode = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
|
||||
Township = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
|
||||
Street = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
||||
ZipCode = table.Column<string>(type: "nvarchar(16)", maxLength: 16, nullable: true),
|
||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
||||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PDistrict", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PDistrict_PCity_CountryCode_CityCode",
|
||||
columns: x => new { x.CountryCode, x.CityCode },
|
||||
principalTable: "PCity",
|
||||
principalColumns: new[] { "CountryCode", "Code" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PCity_CountryCode_Code",
|
||||
table: "PCity",
|
||||
columns: new[] { "CountryCode", "Code" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PDistrict_CityCode_Name_Township_Street_ZipCode",
|
||||
table: "PDistrict",
|
||||
columns: new[] { "CityCode", "Name", "Township", "Street", "ZipCode" },
|
||||
unique: true,
|
||||
filter: "[Township] IS NOT NULL AND [Street] IS NOT NULL AND [ZipCode] IS NOT NULL");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PDistrict_CountryCode_CityCode",
|
||||
table: "PDistrict",
|
||||
columns: new[] { "CountryCode", "CityCode" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "PDistrict");
|
||||
|
||||
migrationBuilder.DropUniqueConstraint(
|
||||
name: "AK_PCity_CountryCode_Code",
|
||||
table: "PCity");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PCity_CountryCode_Code",
|
||||
table: "PCity");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PlateCode",
|
||||
table: "PCity");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Phone",
|
||||
table: "PDemo",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(20)",
|
||||
oldMaxLength: 20);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Message",
|
||||
table: "PDemo",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(2000)",
|
||||
oldMaxLength: 2000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Email",
|
||||
table: "PDemo",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(256)",
|
||||
oldMaxLength: 256);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Address",
|
||||
table: "PDemo",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(512)",
|
||||
oldMaxLength: 512);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CountryCode",
|
||||
table: "PCity",
|
||||
type: "nvarchar(8)",
|
||||
maxLength: 8,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(8)",
|
||||
oldMaxLength: 8);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Code",
|
||||
table: "PCity",
|
||||
type: "nvarchar(16)",
|
||||
maxLength: 16,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "nvarchar(16)",
|
||||
oldMaxLength: 16);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PCity_CountryCode_Code",
|
||||
table: "PCity",
|
||||
columns: new[] { "CountryCode", "Code" },
|
||||
unique: true,
|
||||
filter: "[CountryCode] IS NOT NULL AND [Code] IS NOT NULL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ namespace Kurs.Platform.Migrations
|
|||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("ProductVersion", "9.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
|
@ -945,7 +945,7 @@ namespace Kurs.Platform.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Banks", (string)null);
|
||||
b.ToTable("Banks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kurs.Platform.Entities.BankAccount", b =>
|
||||
|
|
@ -1011,7 +1011,7 @@ namespace Kurs.Platform.Migrations
|
|||
|
||||
b.HasIndex("CurrencyId");
|
||||
|
||||
b.ToTable("BankAccounts", (string)null);
|
||||
b.ToTable("BankAccounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kurs.Platform.Entities.BlogCategory", b =>
|
||||
|
|
@ -1454,10 +1454,12 @@ namespace Kurs.Platform.Migrations
|
|||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("nvarchar(16)");
|
||||
|
||||
b.Property<string>("CountryCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("nvarchar(8)");
|
||||
|
||||
|
|
@ -1496,11 +1498,14 @@ namespace Kurs.Platform.Migrations
|
|||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("PlateCode")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CountryCode", "Code")
|
||||
.IsUnique()
|
||||
.HasFilter("[CountryCode] IS NOT NULL AND [Code] IS NOT NULL");
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("PCity", (string)null);
|
||||
});
|
||||
|
|
@ -2043,7 +2048,8 @@ namespace Kurs.Platform.Migrations
|
|||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("nvarchar(512)");
|
||||
|
||||
b.Property<DateTime>("CreationTime")
|
||||
.HasColumnType("datetime2")
|
||||
|
|
@ -2063,7 +2069,8 @@ namespace Kurs.Platform.Migrations
|
|||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.IsRequired()
|
||||
|
|
@ -2086,7 +2093,8 @@ namespace Kurs.Platform.Migrations
|
|||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("nvarchar(2000)");
|
||||
|
||||
b.Property<int>("NumberOfBranches")
|
||||
.HasColumnType("int");
|
||||
|
|
@ -2101,13 +2109,85 @@ namespace Kurs.Platform.Migrations
|
|||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PDemo", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kurs.Platform.Entities.District", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("CityCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("nvarchar(16)");
|
||||
|
||||
b.Property<string>("CountryCode")
|
||||
.HasColumnType("nvarchar(8)");
|
||||
|
||||
b.Property<DateTime>("CreationTime")
|
||||
.HasColumnType("datetime2")
|
||||
.HasColumnName("CreationTime");
|
||||
|
||||
b.Property<Guid?>("CreatorId")
|
||||
.HasColumnType("uniqueidentifier")
|
||||
.HasColumnName("CreatorId");
|
||||
|
||||
b.Property<Guid?>("DeleterId")
|
||||
.HasColumnType("uniqueidentifier")
|
||||
.HasColumnName("DeleterId");
|
||||
|
||||
b.Property<DateTime?>("DeletionTime")
|
||||
.HasColumnType("datetime2")
|
||||
.HasColumnName("DeletionTime");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bit")
|
||||
.HasDefaultValue(false)
|
||||
.HasColumnName("IsDeleted");
|
||||
|
||||
b.Property<DateTime?>("LastModificationTime")
|
||||
.HasColumnType("datetime2")
|
||||
.HasColumnName("LastModificationTime");
|
||||
|
||||
b.Property<Guid?>("LastModifierId")
|
||||
.HasColumnType("uniqueidentifier")
|
||||
.HasColumnName("LastModifierId");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("Street")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("Township")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("ZipCode")
|
||||
.HasMaxLength(16)
|
||||
.HasColumnType("nvarchar(16)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CountryCode", "CityCode");
|
||||
|
||||
b.HasIndex("CityCode", "Name", "Township", "Street", "ZipCode")
|
||||
.IsUnique()
|
||||
.HasFilter("[Township] IS NOT NULL AND [Street] IS NOT NULL AND [ZipCode] IS NOT NULL");
|
||||
|
||||
b.ToTable("PDistrict", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kurs.Platform.Entities.GlobalSearch", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
|
|
@ -6074,7 +6154,8 @@ namespace Kurs.Platform.Migrations
|
|||
.WithMany("Cities")
|
||||
.HasForeignKey("CountryCode")
|
||||
.HasPrincipalKey("Code")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Country");
|
||||
});
|
||||
|
|
@ -6099,6 +6180,17 @@ namespace Kurs.Platform.Migrations
|
|||
b.Navigation("Entity");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kurs.Platform.Entities.District", b =>
|
||||
{
|
||||
b.HasOne("Kurs.Platform.Entities.City", "City")
|
||||
.WithMany("Districts")
|
||||
.HasForeignKey("CountryCode", "CityCode")
|
||||
.HasPrincipalKey("CountryCode", "Code")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("City");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kurs.Platform.Entities.ListFormCustomization", b =>
|
||||
{
|
||||
b.HasOne("Kurs.Platform.Entities.ListForm", null)
|
||||
|
|
@ -6368,6 +6460,11 @@ namespace Kurs.Platform.Migrations
|
|||
b.Navigation("Posts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kurs.Platform.Entities.City", b =>
|
||||
{
|
||||
b.Navigation("Districts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kurs.Platform.Entities.Country", b =>
|
||||
{
|
||||
b.Navigation("Cities");
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
|
|||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||
}, {
|
||||
"url": "index.html",
|
||||
"revision": "0.20gg38gpeso"
|
||||
"revision": "0.8rvvf2rf6hg"
|
||||
}], {});
|
||||
workbox.cleanupOutdatedCaches();
|
||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||
|
|
|
|||
Loading…
Reference in a new issue