Add models for EmailTemplate, ActivityLog, and NotificationLog

Introduced new database models to handle email templates, activity logs, and notification logs, including relevant enums and utilities. Updated ER diagram to reflect new relationships and attributes, enhancing event tracking and notification management capabilities.
This commit is contained in:
2025-02-27 19:54:26 +01:00
parent 7247190f5f
commit 9d71fc7fcd
5 changed files with 342 additions and 4 deletions

View File

@@ -2,6 +2,8 @@ erDiagram
User ||--o{ Event : "creates"
User ||--o{ EventManager : "is assigned as"
User ||--o{ Guest : "can be linked to"
User ||--o{ ActivityLog : "generates"
User ||--o{ EmailTemplate : "creates"
User {
uuid id PK
string email UK
@@ -37,6 +39,9 @@ erDiagram
Event ||--o{ GiftItem : "contains"
Event ||--o{ EventMedia : "has"
Event ||--o{ GiftCategory : "has"
Event ||--o{ EmailTemplate : "has"
Event ||--o{ NotificationLog : "generates"
Event ||--o{ ActivityLog : "tracks"
Event }o--|| EventTheme : "uses"
Event {
uuid id PK
@@ -70,6 +75,8 @@ erDiagram
Guest ||--o{ RSVP : "submits"
Guest ||--o{ GiftPurchase : "makes"
Guest ||--o{ NotificationLog : "receives"
Guest ||--o{ ActivityLog : "generates"
Guest {
uuid id PK
uuid event_id FK
@@ -195,5 +202,60 @@ erDiagram
datetime updated_at
}
EmailTemplate {
uuid id PK
string name
string description
enum template_type "INVITATION/REMINDER/CONFIRMATION/UPDATE/THANK_YOU/CUSTOM"
string subject
text html_content
text text_content
json variables
uuid event_id FK "nullable"
uuid created_by FK
boolean is_active
boolean is_system
datetime created_at
datetime updated_at
}
NotificationLog {
uuid id PK
enum notification_type "EMAIL/SMS/PUSH/IN_APP"
enum status "QUEUED/SENT/DELIVERED/FAILED/OPENED/CLICKED"
string subject
string content_preview
uuid template_id FK
uuid event_id FK
uuid guest_id FK "nullable"
string recipient
datetime sent_at
datetime delivered_at
datetime opened_at
string error_message
integer retry_count
string external_id
json metadata
datetime created_at
datetime updated_at
}
ActivityLog {
uuid id PK
enum activity_type
text description
uuid event_id FK "nullable"
uuid user_id FK "nullable"
uuid guest_id FK "nullable"
uuid target_id "generic ID"
string target_type "type of target"
string ip_address
string user_agent
json data
datetime created_at
datetime updated_at
}
EmailTemplate }o--|| NotificationLog : "used for"
User ||--o{ EventManager : "has roles"
Event ||--o{ RSVP : "receives"