Refactor event schema to enhance clarity and functionality

Updated attributes, relationships, and data types to improve schema accuracy and flexibility. Added new enums, foreign keys, and reordered fields for better organization. Renamed and adjusted components to reflect evolving business logic.
This commit is contained in:
2025-02-27 19:12:47 +01:00
parent 46fabc38a4
commit 7247190f5f

View File

@@ -9,11 +9,11 @@ erDiagram
string first_name string first_name
string last_name string last_name
string phone_number string phone_number
datetime created_at
datetime updated_at
boolean is_active boolean is_active
boolean is_superuser boolean is_superuser
json preferences json preferences
datetime created_at
datetime updated_at
} }
EventManager }o--|| Event : "manages" EventManager }o--|| Event : "manages"
@@ -21,14 +21,14 @@ erDiagram
uuid id PK uuid id PK
uuid user_id FK uuid user_id FK
uuid event_id FK uuid event_id FK
string role uuid assigned_by FK
enum role "OWNER/ADMIN/MODERATOR/VIEWER"
boolean can_edit boolean can_edit
boolean can_invite boolean can_invite
boolean can_manage_gifts boolean can_manage_gifts
boolean can_send_updates boolean can_send_updates
boolean can_view_analytics boolean can_view_analytics
datetime assigned_at datetime assigned_at
uuid assigned_by FK
datetime created_at datetime created_at
datetime updated_at datetime updated_at
} }
@@ -36,7 +36,7 @@ erDiagram
Event ||--o{ Guest : "invites" Event ||--o{ Guest : "invites"
Event ||--o{ GiftItem : "contains" Event ||--o{ GiftItem : "contains"
Event ||--o{ EventMedia : "has" Event ||--o{ EventMedia : "has"
Event ||--o{ EventUpdate : "has" Event ||--o{ GiftCategory : "has"
Event }o--|| EventTheme : "uses" Event }o--|| EventTheme : "uses"
Event { Event {
uuid id PK uuid id PK
@@ -57,8 +57,6 @@ erDiagram
uuid theme_id FK uuid theme_id FK
json custom_theme_settings json custom_theme_settings
json additional_info json additional_info
datetime created_at
datetime updated_at
boolean is_active boolean is_active
boolean rsvp_enabled boolean rsvp_enabled
boolean gift_registry_enabled boolean gift_registry_enabled
@@ -66,26 +64,32 @@ erDiagram
integer max_guests_per_invitation integer max_guests_per_invitation
string contact_email string contact_email
string contact_phone string contact_phone
datetime created_at
datetime updated_at
} }
Guest ||--o{ RSVP : "submits" Guest ||--o{ RSVP : "submits"
Guest ||--o{ GiftPurchase : "makes"
Guest { Guest {
uuid id PK uuid id PK
uuid event_id FK uuid event_id FK
uuid invited_by FK
uuid user_id FK "nullable" uuid user_id FK "nullable"
string name string full_name
string email string email
string phone string phone
string invitation_code UK string invitation_code UK
datetime invited_at enum status "INVITED/PENDING/CONFIRMED/DECLINED/WAITLISTED/CANCELLED"
boolean email_sent integer max_additional_guests
datetime email_sent_at integer actual_additional_guests
integer reminder_count datetime invitation_sent_at
datetime last_reminder_sent datetime last_reminded_at
string relationship datetime response_date
string dietary_restrictions
string notes string notes
json address
json custom_fields json custom_fields
boolean is_blocked
boolean can_bring_guests
datetime created_at datetime created_at
datetime updated_at datetime updated_at
} }
@@ -94,83 +98,73 @@ erDiagram
uuid id PK uuid id PK
uuid guest_id FK uuid guest_id FK
uuid event_id FK uuid event_id FK
boolean attending enum status "ATTENDING/NOT_ATTENDING/MAYBE"
integer number_of_adults integer number_of_guests
integer number_of_children string response_message
string dietary_restrictions string dietary_requirements
string message json additional_info
string additional_guests_names datetime response_date
datetime responded_at datetime last_updated
string ip_address
string user_agent
json custom_responses
datetime created_at datetime created_at
datetime updated_at datetime updated_at
} }
GiftItem ||--o{ GiftReservation : "has" GiftCategory ||--o{ GiftItem : "groups"
GiftCategory {
uuid id PK
uuid event_id FK
uuid created_by FK
string name
string description
string icon
string color
integer display_order
boolean is_visible
json custom_fields
datetime created_at
datetime updated_at
}
GiftItem ||--o{ GiftPurchase : "tracks"
GiftItem { GiftItem {
uuid id PK uuid id PK
uuid event_id FK uuid event_id FK
uuid added_by FK
uuid category_id FK
string name string name
string description string description
string image_url float price
decimal price
string currency string currency
string purchase_url
integer priority
boolean is_group_gift
decimal amount_contributed
integer quantity_requested integer quantity_requested
integer quantity_remaining integer quantity_received
boolean is_custom_amount enum status "AVAILABLE/RESERVED/PURCHASED/RECEIVED/REMOVED"
decimal min_custom_amount enum priority "LOW/MEDIUM/HIGH/MUST_HAVE"
boolean is_visible string purchase_url
json category_tags string store_name
json additional_details string brand
datetime created_at string model
datetime updated_at string image_url
}
GiftReservation {
uuid id PK
uuid gift_item_id FK
uuid guest_id FK "nullable"
string reserver_name
string reserver_email
string reserver_phone
integer quantity
decimal amount
boolean is_anonymous
datetime reserved_at
string reservation_code
string message
boolean is_purchased
datetime purchased_at
datetime created_at
datetime updated_at
}
EventMedia {
uuid id PK
uuid event_id FK
string media_type
string title
string description
string file_path
string url
string thumbnail_url
integer display_order integer display_order
boolean is_featured boolean is_visible
boolean is_public string notes
string alt_text json custom_fields
string credit datetime last_status_change
datetime upload_date
json metadata
datetime created_at datetime created_at
datetime updated_at datetime updated_at
} }
GiftPurchase {
uuid id PK
uuid gift_id FK
uuid guest_id FK
integer quantity
datetime purchased_at
float purchase_price
string purchase_currency
string notes
}
EventTheme ||--o{ Event : "applied to"
EventTheme { EventTheme {
uuid id PK uuid id PK
string name string name
@@ -178,81 +172,28 @@ erDiagram
string preview_image_url string preview_image_url
json color_palette json color_palette
json fonts json fonts
json animations
json layout_options
json component_styles
boolean is_active
datetime created_at datetime created_at
datetime updated_at datetime updated_at
} }
EventUpdate { EventMedia {
uuid id PK uuid id PK
uuid event_id FK uuid event_id FK
uuid uploaded_by FK
string file_path
string original_filename
enum media_type "IMAGE/VIDEO/DOCUMENT"
string content_type
integer file_size
enum purpose "BANNER/GALLERY/ATTACHMENT"
boolean is_public
integer display_order
string title string title
string content string description
boolean is_important json metadata
boolean is_pinned
boolean send_notification
boolean notification_sent
datetime notification_sent_at
datetime publish_date
datetime created_at datetime created_at
datetime updated_at datetime updated_at
} }
EmailTemplate {
uuid id PK
string name
string subject
string html_content
string text_content
string description
string template_type
json variables
boolean is_active
datetime created_at
datetime updated_at
}
Setting {
string key PK
string value
string description
string category
datetime created_at
datetime updated_at
}
NotificationLog {
uuid id PK
string notification_type
uuid event_id FK
uuid guest_id FK "nullable"
string recipient
string subject
string content_preview
boolean is_sent
string error_message
datetime sent_at
datetime created_at
}
EventActivity {
uuid id PK
uuid event_id FK
uuid user_id FK "nullable"
uuid guest_id FK "nullable"
string activity_type
string description
json context_data
string ip_address
datetime created_at
}
EventTheme ||--o{ Event : "applied to"
Guest ||--o{ GiftReservation : "makes"
Event ||--o{ RSVP : "receives"
Event ||--o{ EventActivity : "logs"
Event ||--o{ NotificationLog : "generates"
User ||--o{ EventManager : "has roles" User ||--o{ EventManager : "has roles"
Event ||--o{ RSVP : "receives"