Sertifika & Rozet Kuralları
Akademi Eğitim Platformu Sertifika & Rozet Kurallarır Dökümanı
Sertifika ve Rozet Kural Sistemi
1. certificate_badge_rules
Sertifika & Rozet Kuralları (Ana Tablo)
| Alan | Tip | Açıklama |
|---|---|---|
| ruleId | int (PK) | Kural ID |
| academyId | bigint | Akademi ID |
| ruleType | enum | certificate, badge, both |
| name | varchar(500) | Kural adı |
| description | text | Açıklama |
| conditionType | enum | completion, score, time, custom |
| conditions | json | Kural koşulları |
| triggerType | enum | auto, manual, scheduled |
| schedule | json | Zamanlama |
| rewardType | enum | certificate, badge, both |
| certificateId | int | Sertifika template |
| badgeId | int | Rozet ID |
| status | enum | active, paused, draft, archived |
| priority | int | Öncelik |
| maxAwards | int | Maksimum ödül |
| isCumulative | boolean | Birden fazla hedef gerekli mi |
| requiredCount | int | Gerekli hedef sayısı |
| effectiveFrom | datetime | Başlangıç tarihi |
| effectiveTo | datetime | Bitiş tarihi |
| totalEligible | int | Uygun kullanıcı |
| totalAwarded | int | Verilen ödül |
| lastRunAt | datetime | Son çalışma zamanı |
| lastRunStatus | enum | Job durumu |
| createdAt | datetime | Oluşturulma |
| createdBy | int | Oluşturan |
| updatedAt | datetime | Güncelleme |
| updatedBy | int | Güncelleyen |
Indexler
- (academyId, status)
- (ruleType, status)
- (lastRunAt)
2. rule_targets
Kural - Hedef İlişki Tablosu (Çoka Çok)
| Alan | Tip | Açıklama |
|---|---|---|
| ruleTargetId | bigint (PK) | ID |
| ruleId | int | Kural ID |
| targetType | enum | course, module, learning_path, category, academy |
| targetId | bigint | Hedef ID |
| requirement | json | Hedefe özel koşullar |
| weight | int | Ağırlık |
| isRequired | boolean | Zorunlu |
| createdAt | datetime | Oluşturulma |
Indexler
- (ruleId)
- (targetType, targetId)
Unique
- (ruleId, targetType, targetId)
3. rule_execution_history
Kural Çalışma Geçmişi
| Alan | Tip | Açıklama |
|---|---|---|
| executionId | bigint (PK) | ID |
| ruleId | int | Kural |
| executedAt | datetime | Çalışma zamanı |
| status | enum | Job durumu |
| totalProcessed | int | İşlenen |
| totalAwarded | int | Verilen ödül |
| errors | int | Hata sayısı |
| executionTime | int | Saniye |
| log | json | İşlem logları |
Indexler
- (ruleId, executedAt)
- (status)
4. user_rule_progress
Kullanıcı - Kural - Hedef İlerleme
| Alan | Tip | Açıklama |
|---|---|---|
| userProgressId | bigint (PK) | ID |
| userId | int | Kullanıcı |
| ruleId | int | Kural |
| targetType | enum | hedef türü |
| targetId | bigint | hedef ID |
| progress | decimal | ilerleme (%) |
| score | decimal | puan |
| completedAt | datetime | tamamlanma |
| status | enum | hedef durumu |
| details | json | detaylar |
| updatedAt | datetime | güncelleme |
Indexler
- (userId, ruleId)
- (targetType, targetId)
- (status)
Unique
- (userId, ruleId, targetType, targetId)
5. user_rule_status
Kullanıcı Kural Durumu
| Alan | Tip | Açıklama |
|---|---|---|
| userRuleId | bigint (PK) | ID |
| userId | int | Kullanıcı |
| ruleId | int | Kural |
| status | enum | pending, eligible, awarded, expired |
| progress | json | genel ilerleme |
| completedTargets | int | tamamlanan |
| requiredTargets | int | gerekli |
| eligibleAt | datetime | uygunluk |
| awardedAt | datetime | ödül zamanı |
| awardedBy | enum | ödül veren |
| expiresAt | datetime | bitiş |
| createdAt | datetime | oluşturulma |
Indexler
- (userId, status)
- (ruleId, status)
- (eligibleAt)
Unique
- (userId, ruleId)
6. badges
Rozet Tanımları
| Alan | Tip | Açıklama |
|---|---|---|
| badgeId | int (PK) | ID |
| academyId | bigint | Akademi |
| name | varchar | Rozet adı |
| description | text | Açıklama |
| icon | varchar | FontAwesome veya SVG |
| color | varchar | CSS renk |
| category | varchar | achievement, skill, participation |
| level | int | 1=Bronz, 2=Gümüş, 3=Altın, 4=Platin |
| rarity | enum | common, rare, epic, legendary |
| maxAwards | int | maksimum |
| isActive | boolean | aktif |
| imageUrl | varchar | görsel |
| animation | varchar | animasyon |
| totalAwarded | int | verilen |
| uniqueHolders | int | benzersiz |
| createdAt | datetime | oluşturma |
| createdBy | int | oluşturan |
Indexler
- (academyId)
- (category)
7. user_badges
Kullanıcı Rozetleri
| Alan | Tip | Açıklama |
|---|---|---|
| userBadgeId | bigint (PK) | ID |
| userId | int | kullanıcı |
| badgeId | int | rozet |
| ruleId | int | kural |
| awardedAt | datetime | verilme zamanı |
| awardedBy | enum | sistem veya manuel |
| expiresAt | datetime | bitiş |
| isDisplayed | boolean | profilde göster |
Indexler
- (userId)
- (badgeId)
Unique
- (userId, badgeId)
Enum Tanımları
enum_certificate_badge_rule_type
- certificate
- badge
- both
enum_rule_target_type
- academy
- course
- module
- learning_path
- category
enum_rule_condition_type
- completion
- score
- time
- quiz
- assignment
- attendance
- custom
enum_rule_trigger_type
- auto
- manual
- scheduled
enum_rule_reward_type
- certificate
- badge
- both
enum_rule_status
- active
- paused
- draft
- archived
enum_job_status
- pending
- running
- completed
- failed
- partial
enum_user_rule_status
- pending
- in_progress
- eligible
- awarded
- expired
enum_user_target_status
- not_started
- in_progress
- completed
- failed
enum_awarded_by
- system
- admin
- instructor
- auto
enum_badge_rarity
- common
- rare
- epic
- legendary