From 3b93cd389580444de19b0c9d54cb519ae7e9bc0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?=
<76204082+iamsedatozturk@users.noreply.github.com>
Date: Fri, 4 Sep 2026 14:32:20 +0300
Subject: [PATCH] seed/data Seeder Products
---
.github/instructions/lowcode.instructions.md | 2 +
.../Migrations/ListFormSeeder_Saas.cs | 4 +
.../Data/ListFormSeedDataApplier.cs | 14 +-
.../Seeds/TenantData.json | 142 ---------------
.../Seeds/TenantDataSeeder.cs | 36 ----
.../seeds/host/data/App.Orders.Products.json | 161 ++++++++++++++++++
6 files changed, 176 insertions(+), 183 deletions(-)
create mode 100644 configs/seeds/host/data/App.Orders.Products.json
diff --git a/.github/instructions/lowcode.instructions.md b/.github/instructions/lowcode.instructions.md
index 4e4ba8be..1cd9bb09 100644
--- a/.github/instructions/lowcode.instructions.md
+++ b/.github/instructions/lowcode.instructions.md
@@ -3437,6 +3437,8 @@ Kurallar:
- **Identity anahtarlı tablolarda satır anahtarsız yazılır.** `Id` alanı dosyada yoksa anahtar
veritabanına bırakılır; satırın var olup olmadığı dosyadaki **tüm alan değerlerinin**
(tenant kapsamı dahil) eşleşmesine bakılarak belirlenir.
+- **Dosyadaki değer varsayılanı ezer.** `InsertFieldsDefaultValueJson` yalnızca dosyada bulunmayan
+ alanları doldurur (audit kolonları, kapsam, anahtar); ekrandan kayıtta ise varsayılan girilen değeri ezer.
- **Uygulama yalnızca ekler:** anahtarı veritabanında bulunmayan satırlar `INSERT` edilir; var olan
kayıt güncellenmez (her migrate'te ekrandaki güncel değerler dosyadaki eskisiyle ezilmesin diye)
ve dosyada olmayan satır silinmez.
diff --git a/api/src/Sozsoft.Platform.DbMigrator/Migrations/ListFormSeeder_Saas.cs b/api/src/Sozsoft.Platform.DbMigrator/Migrations/ListFormSeeder_Saas.cs
index cdb05d04..2b341d5b 100644
--- a/api/src/Sozsoft.Platform.DbMigrator/Migrations/ListFormSeeder_Saas.cs
+++ b/api/src/Sozsoft.Platform.DbMigrator/Migrations/ListFormSeeder_Saas.cs
@@ -7140,6 +7140,10 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
Description = $"{listFormName}.Description",
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Product)),
+ SeedFilePath = SeedPathResolver.GetDataFilePath(listFormName),
+ SeedSyncInsert = false,
+ SeedSyncUpdate = false,
+ SeedSyncDelete = false,
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.Guid,
DefaultFilter = DefaultFilterJson,
diff --git a/api/src/Sozsoft.Platform.Domain/Data/ListFormSeedDataApplier.cs b/api/src/Sozsoft.Platform.Domain/Data/ListFormSeedDataApplier.cs
index 18ba6d06..d38ac8dd 100644
--- a/api/src/Sozsoft.Platform.Domain/Data/ListFormSeedDataApplier.cs
+++ b/api/src/Sozsoft.Platform.Domain/Data/ListFormSeedDataApplier.cs
@@ -181,8 +181,8 @@ public class ListFormSeedDataApplier(
if (hasKey)
{
- // Insert varsayilanlari anahtari @NEWID ile uretir; dosyadaki anahtar korunmazsa ayni
- // dosya her uygulandiginda yeni kayit olusurdu.
+ // Anahtar alan ekranin alan listesinde olmasa bile dosyadaki deger yazilir; aksi halde
+ // @NEWID devreye girer ve ayni dosya her uygulandiginda yeni kayit olusur.
insertParameters[keyFieldName] = keyValue;
}
else
@@ -214,8 +214,9 @@ public class ListFormSeedDataApplier(
}
///
- /// Ekran tanimindaki varsayilan alanlari (audit, anahtar, tenant) parametrelere ekler —
- /// ListFormManager.GetParametersAsync ile ayni sozlesme.
+ /// Ekran tanimindaki varsayilan alanlari (audit, anahtar, tenant) parametrelere ekler.
+ /// Ekran uzerinden kayitta varsayilan girilen degeri ezer; seed'de tersi gecerlidir: dosyadaki
+ /// deger kaynaktir, yalnizca dosyada olmayan alanlar varsayilandan doldurulur.
///
private async Task MergeDefaultsAsync(
ListForm listForm,
@@ -232,7 +233,10 @@ public class ListFormSeedDataApplier(
var defaults = await defaultValueManager.GenerateDefaultValuesAsync(listForm, fields, op, keys);
foreach (var item in defaults)
{
- parameters[item.Key] = item.Value.CustomValue;
+ if (!parameters.ContainsKey(item.Key))
+ {
+ parameters[item.Key] = item.Value.CustomValue;
+ }
}
}
diff --git a/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantData.json b/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantData.json
index 96532159..9a5c2bc6 100644
--- a/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantData.json
+++ b/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantData.json
@@ -362,148 +362,6 @@
]
}
],
- "Products": [
- {
- "name": "App.PublicProducts.BranchHosting",
- "description": "App.ProductsBranchHosting.BranchHostingDesc",
- "category": "App.ProductsCategories.Uyelik",
- "order": 1,
- "monthlyPrice": 850,
- "yearlyPrice": 3400,
- "isQuantityBased": true,
- "imageUrl": "https://images.pexels.com/photos/1181673/pexels-photo-1181673.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.BackupService",
- "description": "App.ProductsBackupService.BackupServiceDesc",
- "category": "App.ProductsCategories.Uyelik",
- "order": 2,
- "monthlyPrice": 2100,
- "yearlyPrice": 2100,
- "isQuantityBased": false,
- "imageUrl": "https://images.pexels.com/photos/442150/pexels-photo-442150.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.RemoteSupportContract",
- "description": "App.ProductsRemoteSupportContract.RemoteSupportContractDesc",
- "category": "App.ProductsCategories.Uyelik",
- "order": 3,
- "monthlyPrice": 5000,
- "yearlyPrice": 5000,
- "isQuantityBased": false,
- "imageUrl": "https://images.pexels.com/photos/3184465/pexels-photo-3184465.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.UserLicense",
- "description": "App.ProductsUserLicense.UserLicenseDesc",
- "category": "App.ProductsCategories.Lisans",
- "order": 4,
- "monthlyPrice": 900,
- "yearlyPrice": 3500,
- "isQuantityBased": true,
- "imageUrl": "https://images.pexels.com/photos/3184360/pexels-photo-3184360.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.TeacherLicense",
- "description": "App.ProductsTeacherLicense.TeacherLicenseDesc",
- "category": "App.ProductsCategories.Lisans",
- "order": 5,
- "monthlyPrice": 500,
- "yearlyPrice": 1700,
- "isQuantityBased": true,
- "imageUrl": "https://images.pexels.com/photos/5212345/pexels-photo-5212345.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.MobileReporting",
- "description": "App.ProductsMobileReporting.MobileReportingDesc",
- "category": "App.ProductsCategories.Lisans",
- "order": 6,
- "monthlyPrice": 400,
- "yearlyPrice": 1400,
- "isQuantityBased": false,
- "imageUrl": "https://images.pexels.com/photos/1092644/pexels-photo-1092644.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.RemoteBranchTraining",
- "description": "App.ProductsRemoteBranchTraining.RemoteBranchTrainingDesc",
- "category": "App.ProductsCategories.EkHizmetler",
- "order": 7,
- "monthlyPrice": 3700,
- "yearlyPrice": 3700,
- "isQuantityBased": true,
- "imageUrl": "https://images.pexels.com/photos/3184339/pexels-photo-3184339.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.ExtraHourlyService",
- "description": "App.ProductsExtraHourlyService.ExtraHourlyServiceDesc",
- "order": 8,
- "category": "App.ProductsCategories.EkHizmetler",
- "monthlyPrice": 2000,
- "yearlyPrice": 2000,
- "isQuantityBased": true,
- "imageUrl": "https://images.pexels.com/photos/3184291/pexels-photo-3184291.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.Sms5k",
- "description": "App.ProductsSms.SmsDesc",
- "category": "App.ProductsCategories.EkHizmetler",
- "order": 9,
- "monthlyPrice": 750,
- "yearlyPrice": 750,
- "isQuantityBased": true,
- "imageUrl": "https://images.pexels.com/photos/404280/pexels-photo-404280.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.Sms10k",
- "description": "App.ProductsSms.SmsDesc",
- "category": "App.ProductsCategories.EkHizmetler",
- "order": 10,
- "monthlyPrice": 1350,
- "yearlyPrice": 1350,
- "isQuantityBased": true,
- "imageUrl": "https://images.pexels.com/photos/404280/pexels-photo-404280.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.Sms25k",
- "description": "App.ProductsSms.SmsDesc",
- "category": "App.ProductsCategories.EkHizmetler",
- "order": 11,
- "monthlyPrice": 2900,
- "yearlyPrice": 2900,
- "isQuantityBased": true,
- "imageUrl": "https://images.pexels.com/photos/404280/pexels-photo-404280.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.Sms50k",
- "description": "App.ProductsSms.SmsDesc",
- "category": "App.ProductsCategories.EkHizmetler",
- "order": 12,
- "monthlyPrice": 5100,
- "yearlyPrice": 5100,
- "isQuantityBased": true,
- "imageUrl": "https://images.pexels.com/photos/404280/pexels-photo-404280.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.Sms100k",
- "description": "App.ProductsSms.SmsDesc",
- "category": "App.ProductsCategories.EkHizmetler",
- "order": 13,
- "monthlyPrice": 8800,
- "yearlyPrice": 8800,
- "isQuantityBased": true,
- "imageUrl": "https://images.pexels.com/photos/404280/pexels-photo-404280.jpeg?auto=compress&cs=tinysrgb&w=300"
- },
- {
- "name": "App.PublicProducts.SmsBlocking",
- "description": "App.ProductsSmsBlocking.SmsBlockingDesc",
- "category": "App.ProductsCategories.EkHizmetler",
- "order": 14,
- "monthlyPrice": 880,
- "yearlyPrice": 880,
- "isQuantityBased": true,
- "imageUrl": "https://images.pexels.com/photos/1591061/pexels-photo-1591061.jpeg?auto=compress&cs=tinysrgb&w=300"
- }
- ],
"PaymentMethods": [
{
"name": "Kredi Kartı",
diff --git a/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantDataSeeder.cs b/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantDataSeeder.cs
index ba20463c..2d9f6bdf 100644
--- a/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantDataSeeder.cs
+++ b/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantDataSeeder.cs
@@ -39,7 +39,6 @@ public class TenantSeederDto
public List Services { get; set; }
public List PaymentMethods { get; set; }
public List InstallmentOptions { get; set; }
- public List Products { get; set; }
public List Contacts { get; set; }
//Report Templates
@@ -391,18 +390,6 @@ public class ContactSeedDto
public MapDto Map { get; set; }
}
-public class ProductSeedDto
-{
- public string Name { get; set; }
- public string Description { get; set; }
- public string Category { get; set; }
- public int Order { get; set; }
- public decimal? MonthlyPrice { get; set; }
- public decimal? YearlyPrice { get; set; }
- public bool IsQuantityBased { get; set; }
- public string ImageUrl { get; set; }
-}
-
public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
{
private readonly ILookupNormalizer _lookupNormalizer;
@@ -423,7 +410,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
private readonly IRepository _forumCategoryRepository;
private readonly IRepository _workHourRepository;
private readonly IIdentityUserRepository _repositoryUser;
- private readonly IRepository _productRepository;
private readonly IRepository _departmentRepository;
private readonly IRepository _jobPositionRepository;
private readonly IRepository _announcementRepository;
@@ -456,7 +442,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
IRepository homeRepository,
IRepository aboutRepository,
IRepository servicesRepository,
- IRepository productRepository,
IRepository paymentMethodRepository,
IRepository installmentOptionRepository,
IRepository contactRepository,
@@ -488,7 +473,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
_skillTypeRepository = skillTypeRepository;
_skillRepository = skillRepository;
_skillLevelRepository = skillLevelRepository;
- _productRepository = productRepository;
_paymentMethodRepository = paymentMethodRepository;
_installmentOptionRepository = installmentOptionRepository;
_reportCategoriesRepository = reportCategoriesRepository;
@@ -645,26 +629,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
}
}
- foreach (var item in items.Products)
- {
- var exists = await _productRepository.AnyAsync(x => x.Name == item.Name);
-
- if (!exists)
- {
- await _productRepository.InsertAsync(new Product
- {
- Name = item.Name,
- Description = item.Description,
- Category = item.Category,
- Order = item.Order,
- MonthlyPrice = item.MonthlyPrice,
- YearlyPrice = item.YearlyPrice,
- IsQuantityBased = item.IsQuantityBased,
- ImageUrl = item.ImageUrl
- });
- }
- }
-
foreach (var item in items.InstallmentOptions)
{
var exists = await _installmentOptionRepository.AnyAsync(x => x.Installment == item.Installment);
diff --git a/configs/seeds/host/data/App.Orders.Products.json b/configs/seeds/host/data/App.Orders.Products.json
new file mode 100644
index 00000000..83e44825
--- /dev/null
+++ b/configs/seeds/host/data/App.Orders.Products.json
@@ -0,0 +1,161 @@
+{
+ "ListFormCode": "App.Orders.Products",
+ "KeyFieldName": "Id",
+ "GeneratedAt": "2026-09-04T00:00:00Z",
+ "Rows": [
+ {
+ "Id": "287ad415-dd06-52f3-9a76-10795658a4f6",
+ "Name": "App.PublicProducts.BranchHosting",
+ "Description": "App.ProductsBranchHosting.BranchHostingDesc",
+ "Category": "App.ProductsCategories.Uyelik",
+ "Order": 1,
+ "MonthlyPrice": 850,
+ "YearlyPrice": 3400,
+ "IsQuantityBased": true,
+ "ImageUrl": "https://images.pexels.com/photos/1181673/pexels-photo-1181673.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "3ced7419-b72a-5bd5-b587-b76cc9778460",
+ "Name": "App.PublicProducts.BackupService",
+ "Description": "App.ProductsBackupService.BackupServiceDesc",
+ "Category": "App.ProductsCategories.Uyelik",
+ "Order": 2,
+ "MonthlyPrice": 2100,
+ "YearlyPrice": 2100,
+ "IsQuantityBased": false,
+ "ImageUrl": "https://images.pexels.com/photos/442150/pexels-photo-442150.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "22d113c5-94ad-5002-8e1f-79a622ca1ac6",
+ "Name": "App.PublicProducts.RemoteSupportContract",
+ "Description": "App.ProductsRemoteSupportContract.RemoteSupportContractDesc",
+ "Category": "App.ProductsCategories.Uyelik",
+ "Order": 3,
+ "MonthlyPrice": 5000,
+ "YearlyPrice": 5000,
+ "IsQuantityBased": false,
+ "ImageUrl": "https://images.pexels.com/photos/3184465/pexels-photo-3184465.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "39999ed6-7115-5816-bd32-5a786d68e356",
+ "Name": "App.PublicProducts.UserLicense",
+ "Description": "App.ProductsUserLicense.UserLicenseDesc",
+ "Category": "App.ProductsCategories.Lisans",
+ "Order": 4,
+ "MonthlyPrice": 900,
+ "YearlyPrice": 3500,
+ "IsQuantityBased": true,
+ "ImageUrl": "https://images.pexels.com/photos/3184360/pexels-photo-3184360.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "c2cf95b8-f63b-5ad4-9e5e-edbb8901da82",
+ "Name": "App.PublicProducts.TeacherLicense",
+ "Description": "App.ProductsTeacherLicense.TeacherLicenseDesc",
+ "Category": "App.ProductsCategories.Lisans",
+ "Order": 5,
+ "MonthlyPrice": 500,
+ "YearlyPrice": 1700,
+ "IsQuantityBased": true,
+ "ImageUrl": "https://images.pexels.com/photos/5212345/pexels-photo-5212345.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "8c231f32-2709-54f7-8607-35e63e9b4a4e",
+ "Name": "App.PublicProducts.MobileReporting",
+ "Description": "App.ProductsMobileReporting.MobileReportingDesc",
+ "Category": "App.ProductsCategories.Lisans",
+ "Order": 6,
+ "MonthlyPrice": 400,
+ "YearlyPrice": 1400,
+ "IsQuantityBased": false,
+ "ImageUrl": "https://images.pexels.com/photos/1092644/pexels-photo-1092644.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "0c927e71-0c51-5a2d-899c-c22302b563a0",
+ "Name": "App.PublicProducts.RemoteBranchTraining",
+ "Description": "App.ProductsRemoteBranchTraining.RemoteBranchTrainingDesc",
+ "Category": "App.ProductsCategories.EkHizmetler",
+ "Order": 7,
+ "MonthlyPrice": 3700,
+ "YearlyPrice": 3700,
+ "IsQuantityBased": true,
+ "ImageUrl": "https://images.pexels.com/photos/3184339/pexels-photo-3184339.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "37d1aefa-cbfe-5251-9525-ca17becb596f",
+ "Name": "App.PublicProducts.ExtraHourlyService",
+ "Description": "App.ProductsExtraHourlyService.ExtraHourlyServiceDesc",
+ "Category": "App.ProductsCategories.EkHizmetler",
+ "Order": 8,
+ "MonthlyPrice": 2000,
+ "YearlyPrice": 2000,
+ "IsQuantityBased": true,
+ "ImageUrl": "https://images.pexels.com/photos/3184291/pexels-photo-3184291.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "591e9307-c825-521e-bf06-d6f647708ca4",
+ "Name": "App.PublicProducts.Sms5k",
+ "Description": "App.ProductsSms.SmsDesc",
+ "Category": "App.ProductsCategories.EkHizmetler",
+ "Order": 9,
+ "MonthlyPrice": 750,
+ "YearlyPrice": 750,
+ "IsQuantityBased": true,
+ "ImageUrl": "https://images.pexels.com/photos/404280/pexels-photo-404280.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "8ff856d2-30d5-5f5e-b38e-f6cebee76421",
+ "Name": "App.PublicProducts.Sms10k",
+ "Description": "App.ProductsSms.SmsDesc",
+ "Category": "App.ProductsCategories.EkHizmetler",
+ "Order": 10,
+ "MonthlyPrice": 1350,
+ "YearlyPrice": 1350,
+ "IsQuantityBased": true,
+ "ImageUrl": "https://images.pexels.com/photos/404280/pexels-photo-404280.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "bfa0964b-e8cb-5739-8b4a-d44773553f0a",
+ "Name": "App.PublicProducts.Sms25k",
+ "Description": "App.ProductsSms.SmsDesc",
+ "Category": "App.ProductsCategories.EkHizmetler",
+ "Order": 11,
+ "MonthlyPrice": 2900,
+ "YearlyPrice": 2900,
+ "IsQuantityBased": true,
+ "ImageUrl": "https://images.pexels.com/photos/404280/pexels-photo-404280.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "2b675f5f-320f-5424-8393-3dc0363ad27e",
+ "Name": "App.PublicProducts.Sms50k",
+ "Description": "App.ProductsSms.SmsDesc",
+ "Category": "App.ProductsCategories.EkHizmetler",
+ "Order": 12,
+ "MonthlyPrice": 5100,
+ "YearlyPrice": 5100,
+ "IsQuantityBased": true,
+ "ImageUrl": "https://images.pexels.com/photos/404280/pexels-photo-404280.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "730c2dbf-c700-506d-b216-a169cbd85a15",
+ "Name": "App.PublicProducts.Sms100k",
+ "Description": "App.ProductsSms.SmsDesc",
+ "Category": "App.ProductsCategories.EkHizmetler",
+ "Order": 13,
+ "MonthlyPrice": 8800,
+ "YearlyPrice": 8800,
+ "IsQuantityBased": true,
+ "ImageUrl": "https://images.pexels.com/photos/404280/pexels-photo-404280.jpeg?auto=compress&cs=tinysrgb&w=300"
+ },
+ {
+ "Id": "53ae0678-3c01-5887-89e9-12a45bcc188f",
+ "Name": "App.PublicProducts.SmsBlocking",
+ "Description": "App.ProductsSmsBlocking.SmsBlockingDesc",
+ "Category": "App.ProductsCategories.EkHizmetler",
+ "Order": 14,
+ "MonthlyPrice": 880,
+ "YearlyPrice": 880,
+ "IsQuantityBased": true,
+ "ImageUrl": "https://images.pexels.com/photos/1591061/pexels-photo-1591061.jpeg?auto=compress&cs=tinysrgb&w=300"
+ }
+ ]
+}