Skip to content

Data Model

TL;DR

11 tablo. Kritik olanlar: places (tek mekân kaynağı), events (Place referanslı, gender damgalı, atomik kontenjan), joins (TTL'li, geçmiş tutmaz), questions/answers (private + RLS), moderation_queue/audit_log (denetim).

Tablolar

Tablo Amaç Not
members Üyelik, cinsiyet, rol email kamusal view'da yok
places Ortak mekân type: mosque/cafe/restaurant/other
mosque_details Camiye özgü alanlar 1:1, filtre alanları
place_reviews Yorum/fotoğraf moderasyonlu
events Planlı etkinlik place_id zorunlu, gender_type damgalı
attendances Etkinlik katılımı unique (event, member)
joins Vakit bazlı katılım TTL, unique (mosque, member, prayer, date)
questions / answers Ask visibility, status
circles / circle_members Küçük gruplar join_policy: invite/approval
notifications Bildirim Today kaynağı
moderation_queue / audit_log Moderasyon audit değiştirilemez

Şema (özet)

erDiagram
    MEMBERS ||--o{ EVENTS : creates
    MEMBERS ||--o{ ATTENDANCES : attends
    MEMBERS ||--o{ JOINS : going
    PLACES ||--o{ EVENTS : hosts
    PLACES ||--o{ JOINS : prayer
    PLACES ||--|| MOSQUE_DETAILS : details
    EVENTS ||--o{ ATTENDANCES : has

    MEMBERS {
        uuid id PK
        text email UK
        enum gender
        enum membership_status
        enum role
    }
    PLACES {
        uuid id PK
        enum type
        point coordinates
        enum status
    }
    EVENTS {
        uuid id PK
        uuid place_id FK
        enum gender_type
        int capacity
        int attendee_count
        enum status
    }
    JOINS {
        uuid id PK
        uuid mosque_id FK
        uuid member_id FK
        enum prayer
        timestamptz expires_at
    }

Kolon kuralları (özet)

Tablo Kritik kolon Kural
members.email personal Hiçbir kamusal yanıtta dönmez (NFR-007)
members.gender personal Zorunlu, değişimi destek + audit
places.coordinates public Sorgu coarse location ile
events.capacity public Atomik düşüm, negatife inemez
events.attendee_count public Denormalize sayaç, transaction içinde güncellenir
joins.expires_at internal Vakit penceresi sonunda satır silinir
questions.visibility personal private → RLS ile yalnızca sahip + yetkili
audit_log internal Append-only

Index'ler

places GIST(coordinates) · events (place_id, start_at), (gender_type, start_at) · joins (mosque_id, prayer, prayer_date), (expires_at) · questions (channel, status, category).

Migration politikası

Forward-only, paylaşılan ortamda uygulandıktan sonra düzenlenmez. Yıkıcı değişiklik (kolon silme, tip daraltma) ADR + yedek planı gerektirir.