149 lines
6.3 KiB
Markdown
149 lines
6.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.
|
||
|
||
---
|
||
|
||
|
||
## 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: `App.{Modul}`, `App.{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 `LanguagesData.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
|
||
|
||
- **MenusData.json:**
|
||
- Never modify the `Routes` section directly. Only `MenuGroups` and `Menus` sections can be changed for menu additions or updates. All menu additions must use the platform's configuration mechanisms or be added to `MenuGroups` and `Menus` as required by platform design.
|
||
|
||
- **LanguagesData.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.
|
||
|
||
---
|
||
|
||
## File-by-File Change Summary
|
||
|
||
|
||
### 1. MenusData.json
|
||
- **{Modul} menu** added as a top-level menu with `ShortName: {Modul}`.
|
||
- **{Liste}** added as a child menu under {Modul}.
|
||
|
||
### 2. PermissionsData.json
|
||
- **{Modul} permissions** grouped under `App.{Modul}`.
|
||
- **{Liste} permissions** nested under {Modul} group.
|
||
|
||
### 3. ListFormSeeder_Administration.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. SqlTables.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 PermissionsData.json).
|
||
|
||
### 7. LanguagesData.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}):
|
||
- MenusData.json'a kök menü olarak ekle
|
||
- PermissionsData.json'da ayrı bir PermissionGroup oluştur
|
||
- ListFormSeeder_{Modul}.cs dosyası oluştur ve list-form seed'ini buraya taşı
|
||
- SqlTables.sql'de tabloyu {Modul}_T_{Entity} olarak adlandır
|
||
- LanguagesData.json'a 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
|
||
- SqlTables.sql'de tabloyu {Modul}_T_{Entity} olarak oluştur
|
||
- PermissionsData.json'da ilgili izinleri {Modul} grubuna ekle
|
||
- LanguagesData.json'a 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 LanguagesData.json'a şu şekilde ekle:
|
||
- App.{Modul}
|
||
- App.{Modul}.{Liste}
|
||
- App.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, PermissionsData.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})
|
||
- [ ] LanguagesData.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.
|