157 lines
8.3 KiB
Markdown
157 lines
8.3 KiB
Markdown
|
||
# Sozsoft Platform Module Implementation Rules & Instructions
|
||
|
||
## Purpose
|
||
This document summarizes the rules, standards, and step-by-step instructions for implementing any module (e.g., CRM, MRP, HR) with a sample list (e.g., Opportunity, Order) in the Sozsoft Platform. Replace all placeholders (e.g., {Modul}, {Liste}, {Entity}) with your actual module, list, or entity names. Use as a reference for future development and as a prompt guide for similar tasks.
|
||
|
||
---
|
||
|
||
|
||
> **Bu doküman depo içi seeder'larla (DbMigrator/Migrations) modül eklemeyi anlatır.**
|
||
> Çalışma zamanında Wizard / Custom Components / CRUD Endpoint Manager ile üretim yapacaksan
|
||
> `lowcode.instructions.md` esastır; oradaki seed dosyaları `configs/seeds` altına düşer.
|
||
|
||
## General Principles
|
||
- **Configuration First:** Always prefer platform configuration (menus, permissions, forms, localization) over custom code.
|
||
- **Modularization:** Each module (e.g., {Modul}) must have its own seeder, permission group, and localization entries.
|
||
- **Naming Conventions:**
|
||
- Table names: `{Modul}_T_{Entity}` (e.g., `Mrp_T_Order`)
|
||
- Menu/permission keys: `{Modul}`, `{Modul}.{Liste}`
|
||
- **Tenant Isolation:** All data, forms, and permissions must be tenant-aware.
|
||
- **Localization:** Every menu, list, and field must have a corresponding entry in `configs/seeds/data/Sas.Languages.LanguageText/{CultureName}.json`.
|
||
- **No Redundant Code:** Avoid duplicating permission grants or seeding logic across modules.
|
||
- **SeedConsts Rule:** For every new module/entity, add a constant to `SeedConsts` (e.g., `public static class {Modul}` and `public const string {Liste}`) if it does not already exist. Never duplicate existing constants.
|
||
- **DeleteCommand Rule:** In all `ListFormSeeder_{Modul}.cs` files, the `DeleteCommand` property **must** use the `DefaultDeleteCommand` function, e.g., `DeleteCommand = DefaultDeleteCommand("{TabloAdı}")`. Never use a raw SQL string directly for `DeleteCommand`.
|
||
|
||
---
|
||
|
||
## Special File Handling Rules
|
||
|
||
- **configs/seeds/data/Sas.Menus.*.json:**
|
||
- Never add, remove or re-path a route in `Sas.Menus.Routes.json`. The only field set you may edit on an existing row is its `Seo*` columns (lowcode §0.9). Only `Sas.Menus.Module.json` and `Sas.Menus.Menu.json` can be changed for menu additions or updates. All menu additions must use the platform's configuration mechanisms or be added to those two files as required by platform design.
|
||
|
||
- **configs/seeds/data/Sas.Languages.LanguageText/{CultureName}.json:**
|
||
- When adding a new key, always check if the key already exists. Only add the key if it does not exist to prevent duplicates.
|
||
- The data lives in the folder `configs/seeds/data/Sas.Languages.LanguageText/`: one file per language (`ar, de-DE, en, es, fi, fr, hi, hr, hu, it, pt-BR, ru, sk, sl, tr, zh-Hans`, i.e. every `CultureName` of `Sas.Languages.Language.json`). The file name is the language's `CultureName` (`{CultureName}.json`: `tr.json`, `de-DE.json`) and its `Rows` hold all rows of that language.
|
||
- Wizard, MCP and every component/screen/menu addition follow the same rule: the generated EN + TR rows are written by the deploy/seeder, the producer then writes the translated rows for all other languages (`lowcode.instructions.md` §4.4.3, CLAUDE.md standing default 27). Deleting a key removes its row from every file.
|
||
- Every new key is added to **all** language files (one row per file). `en` and `tr` carry the authored text; the other 14 files get its translation. When a language is added to `Sas.Languages.Language.json`, create its file and translate every key.
|
||
- Each row's `Id` = UUID v5 (URL namespace) of `Sas_H_LanguageText:{ResourceName}:{Key}:{CultureName}`; never a random GUID.
|
||
|
||
---
|
||
|
||
## File-by-File Change Summary
|
||
|
||
|
||
### 1. configs/seeds/data/Sas.Menus.Menu.json
|
||
- **{Modul} menu** added as a top-level menu with `ModuleId: {Modul}`; the module row goes into `Sas.Menus.Module.json`.
|
||
- **{Liste}** added as a child menu under {Modul}.
|
||
|
||
### 2. configs/seeds/data/Abp.Identity.Permissions.json
|
||
- **{Modul} permissions** grouped under `{Modul}`.
|
||
- **{Liste} permissions** nested under {Modul} group.
|
||
|
||
### 3. ListFormSeeder_Adm.cs
|
||
- **Removed** {Liste} seeding logic (moved to {Modul} seeder).
|
||
|
||
### 4. ListFormSeeder_{Modul}.cs
|
||
- **Created** new seeder file for {Modul}.
|
||
- **Seeds** {Liste} list-form, referencing `{Modul}_T_{Entity}`.
|
||
|
||
### 5. SqlObjects.sql
|
||
- **Renamed** {Liste} table to `{Modul}_T_{Entity}`.
|
||
- **Updated** all related constraints and references.
|
||
|
||
### 6. PlatformIdentityDataSeeder.cs
|
||
- **Removed** redundant {Modul} permission grant logic (now handled by the permission seed data).
|
||
|
||
### 7. Sas.Languages.LanguageText/{CultureName}.json
|
||
- **Added** localization entries for:
|
||
- {Modul} menu and {Liste} list
|
||
- {Liste} list fields (e.g., `FullName`, `Phone`)
|
||
|
||
---
|
||
|
||
## Step-by-Step Instructions (Prompt Examples)
|
||
|
||
|
||
### 1. Add a New Module (e.g., {Modul})
|
||
```
|
||
Yeni bir modül ekle (ör: {Modul}):
|
||
- configs/seeds/data/Sas.Menus.Menu.json'a kök menü, Sas.Menus.Module.json'a modül kaydı olarak ekle
|
||
- configs/seeds/data/Abp.Identity.PermissionGroups.json'da ayrı bir grup oluştur
|
||
- ListFormSeeder_{Modul}.cs dosyası oluştur ve list-form seed'ini buraya taşı
|
||
- SqlObjects.sql'de tabloyu {Modul}_T_{Entity} olarak adlandır
|
||
- configs/seeds/data/Sas.Languages.LanguageText/{CultureName}.json dosyasına menü, liste ve alan çevirilerini ekle
|
||
```
|
||
|
||
### 2. Add a New List Under a Module
|
||
```
|
||
Yeni bir liste ekle (ör: {Liste}):
|
||
- {Modul} ana menüsünün altına ekle
|
||
- ListFormSeeder_{Modul}.cs dosyasına seed kodunu ekle
|
||
- SqlObjects.sql'de tabloyu {Modul}_T_{Entity} olarak oluştur
|
||
- configs/seeds/data/Abp.Identity.Permissions.json'da ilgili izinleri {Modul} grubuna ekle
|
||
- configs/seeds/data/Sas.Languages.LanguageText/{CultureName}.json dosyasına liste ve alan çevirilerini ekle
|
||
```
|
||
|
||
### 3. Enforce Tenant Isolation and Full Audit
|
||
```
|
||
Tablo ve list-form için tenant izolasyonu ve full-audit alanlarını ekle:
|
||
- Tabloya TenantId, CreationTime, CreatorId, LastModificationTime, LastModifierId, IsDeleted, DeleterId, DeletionTime alanlarını ekle
|
||
- List-form seed'inde tenant-aware ayarları kontrol et
|
||
```
|
||
|
||
|
||
### 4. Add/Update Localization
|
||
```
|
||
Yeni menü, liste veya alan eklediğinde configs/seeds/data/Sas.Languages.LanguageText/{CultureName}.json klasöründeki tüm dil dosyalarına (EN + TR yazılan metin, diğer diller çeviri) şu şekilde ekle:
|
||
- {Modul}
|
||
- {Modul}.{Liste}
|
||
- Sas.Listform.ListformField.{Alan}
|
||
```
|
||
|
||
### 5. SeedConsts and DeleteCommand Rules
|
||
```
|
||
- SeedConsts.cs dosyasına, yeni modül veya entity için (ör: public static class {Modul} ve altında public const string {Liste}) sabit ekle. Eğer zaten varsa tekrar ekleme.
|
||
- ListFormSeeder_{Modul}.cs dosyalarında DeleteCommand satırı **her zaman** DefaultDeleteCommand fonksiyonu ile olmalı:
|
||
DeleteCommand = DefaultDeleteCommand("{TabloAdı}")
|
||
- DeleteCommand'da doğrudan SQL stringi **kullanma**.
|
||
```
|
||
|
||
### 5. Remove Redundant or Incorrect Code
|
||
```
|
||
- Farklı modüllerde aynı izin veya seed kodu varsa, sadece ilgili modülde bırak
|
||
- PlatformIdentityDataSeeder.cs'de Permission grant kodunu kaldır, Abp.Identity.Permissions.json'dan yönet
|
||
```
|
||
|
||
---
|
||
|
||
|
||
## Validation Checklist
|
||
- [ ] Menü ve izinler doğru hiyerarşide mi?
|
||
- [ ] List-form seed'leri doğru modül dosyasında mı?
|
||
- [ ] Tablo isimleri ve referansları standartlara uygun mu? (örn: {Modul}_T_{Entity})
|
||
- [ ] Sas.Languages.LanguageText/{CultureName}.json'da tüm yeni menü, liste ve alanlar var mı?
|
||
- [ ] Redundant kod veya izin grant'ı var mı?
|
||
- [ ] Seed ve migration sonrası UI'da çeviriler doğru görünüyor mu?
|
||
- [ ] SeedConsts.cs dosyasında ilgili sabitler var mı, tekrar eklenmemiş mi?
|
||
- [ ] ListFormSeeder dosyalarında DeleteCommand satırı DefaultDeleteCommand fonksiyonu ile mi atanmış?
|
||
|
||
---
|
||
|
||
## Rollback Strategy
|
||
- Değişiklikleri modül bazında geri al (örn: sadece {Modul} ile ilgili dosyaları revert et)
|
||
- JSON dosyalarında eski anahtarları ve çevirileri sil
|
||
- Seeder ve migration dosyalarını eski haline getir
|
||
|
||
---
|
||
|
||
## Quick Prompts for Future Use
|
||
- "Yeni bir modül ekle ve tüm standartlara göre yapılandır."
|
||
- "Yeni bir liste ekle, tenant izolasyonu ve çevirileriyle birlikte."
|
||
- "Mevcut bir modülde eksik olan çeviri veya izinleri tamamla."
|
||
- "Tüm {Modul} ile ilgili seed ve izinleri modüler yapıya uygun şekilde güncelle."
|
||
|
||
---
|
||
|
||
> **Not:** Tüm işlemlerden sonra seed'leri çalıştırıp UI'da menü ve çevirileri kontrol etmeyi unutma.
|