Proje: Okul Database · Hub: Okul Database — Domains
Users & Customers Domain
Platform iki tür aktör barındırır: D2C users (veliler/adaylar) ve B2B customers (okul firmaları).
D2C: Users (~15 tablo)
users
Ana kullanıcı tablosu. D2C kanalın temel kaydı.
| Kolon | Tip | Açıklama |
|---|---|---|
id | bigint PK | |
name | varchar (FT index) | |
email | varchar unique | |
customer_id | FK nullable | B2B firmaya bağlıysa |
user_type_id | FK | → users_types |
deleted_at | timestamp | Soft delete |
Full-text index: 2026-02-10 migration ile eklendi.
user_details
Kullanıcı profil genişletmesi.
| Kolon | Açıklama |
|---|---|
user_id | FK → users |
phone | (indexed) |
budget_min, budget_max | Bütçe aralığı |
lead_lost_count | Kaybedilen lead sayısı |
lead_won_count | Kazanılan lead sayısı |
lead_closed_count | Kapatılan |
lead_open_count | Açık lead |
kvkk_accepted_at | KVKK onay zamanı |
Diğer User Tabloları
| Tablo | Açıklama |
|---|---|
user_logs | Aktivite audit trail |
user_favorites | Polimorfik favori okullar |
user_contacts | Ek iletişim bilgileri |
user_session_hash | Session yönetimi (2026-04-09 eklendi) |
user_notification_ids | Push token yönetimi |
users_types | Rol sınıflandırması (referans) |
verification_codes | Email doğrulama |
otp_codes | OTP (ip_address, user_agent ile) |
B2B: Customers (~14 tablo)
customers
Organizasyon/firma hesabı. Okulların sahibi veya yöneticisi.
| Kolon | Açıklama |
|---|---|
id, name | Temel kimlik |
tc_no | Türkiye kimlik no |
erp_code | Muhasebe entegrasyon kodu |
is_inflation_auto_updated | Enflasyon fiyat güncelleme bayrağı |
| ~27 kolon toplam |
customer_users
B2B portal kullanıcıları. customers ↔ users M2M bağlantısı.
| Kolon | Açıklama |
|---|---|
customer_id | FK → customers |
user_id | FK → users |
role_id | Config tablosundan (customer_user_role) |
title_id | Config tablosundan (customer_user_title) |
customer_user_schools
Fine-grained erişim kontrolü. Hangi customer_user hangi okula erişebilir.
| Kolon | Açıklama |
|---|---|
customer_user_id | FK |
school_id | FK |
campus_id | FK nullable |
Sözleşme & Anlaşma
| Tablo | Açıklama |
|---|---|
customer_agreements | Ana sözleşme kaydı (JSON product data içerir) |
customer_agreements_renew_logs | Yenileme takibi |
customer_agreements_renew_discounts | Yenileme indirimleri (assigned_user, followed_status) |
customer_user_agreement_signs | İmza takibi (IP + timestamp) |
agreement_texts | Sözleşme şablonları (started_at/finished_at ile geçerlilik) |
Scoring & Activity
| Tablo | Açıklama |
|---|---|
customer_scores | 5 boyut: demand, communication, responsiveness, payment, total (tinyInt 0-255) |
customer_user_daily_activity_logs | Günlük aktivite per customer_user |
customer_credit_cards | Kart token (PCI) |
D2C vs B2B Ayrımı
D2C Flow:
users → leads → school_offers → schools
(veliler ve adaylar, form doldurur)
B2B Flow:
customers → customer_users → customer_user_schools → schools
customers → customer_agreements → payments
(okul yöneticileri, ürün satın alır)
Kesişim:
users.customer_id → customers (B2B portal user, aynı zamanda users tablosunda)
customer_users JOIN users ON customer_users.user_id = users.id
Related
- table-users —
userstablo detayı - table-customers —
customerstablo detayı - table-customer-agreements — Sözleşme detayı
- domain-leads-sales — Lead lifecycle
- domain-payments — Ödeme akışı