Skip to content

Data Model

Benjamin Ohene-Adu edited this page May 17, 2025 · 1 revision

Data Model Overview

This page documents the core data model for the TasteLocal app, which connects users to local food vendors. The model supports customer ordering, vendor management, reviews, payments, and rich cultural content.

Entity Descriptions

User

  • id: Unique identifier
  • name
  • email
  • phone
  • password_hash
  • role (customer, vendor, admin)
  • preferred_language
  • address (or addresses)
  • location (latitude, longitude)
  • order_history (list of Orders)

Vendor

  • id
  • name
  • description
  • location (latitude, longitude)
  • menu_items (list of MenuItems)
  • delivery_areas (geo-coordinates or polygons)
  • ratings (average, count)
  • reviews (list of Reviews)
  • photos

MenuItem

  • id
  • vendor_id
  • name
  • description
  • price
  • photo_url
  • category (e.g., Waakye, Fufu)
  • preparation_story
  • available (boolean)

Order

  • id
  • user_id
  • vendor_id
  • items (list of MenuItems + quantity)
  • total_price
  • status (pending, confirmed, delivered, cancelled)
  • delivery_address
  • delivery_time
  • payment_method
  • payment_status

Review

  • id
  • user_id
  • vendor_id
  • order_id
  • rating (1-5)
  • comment
  • timestamp

CulturalContent

  • id
  • dish_name
  • history
  • preparation_details
  • pairing_suggestions
  • media_url

Admin (if separate)

  • id
  • name
  • email
  • permissions

Mermaid Diagram

erDiagram
    USER {
      int id
      string name
      string email
      string phone
      string password_hash
      string role
      string preferred_language
      string address
      float location_lat
      float location_long
    }
    VENDOR {
      int id
      string name
      string description
      float location_lat
      float location_long
      string delivery_areas
      float ratings
      int ratings_count
    }
    MENUITEM {
      int id
      int vendor_id
      string name
      string description
      float price
      string photo_url
      string category
      string preparation_story
      boolean available
    }
    "ORDER" {
      int id
      int user_id
      int vendor_id
      float total_price
      string status
      string delivery_address
      datetime delivery_time
      string payment_method
      string payment_status
    }
    ORDERITEM {
      int id
      int order_id
      int menuitem_id
      int quantity
    }
    REVIEW {
      int id
      int user_id
      int vendor_id
      int order_id
      int rating
      string comment
      datetime timestamp
    }
    CULTURALCONTENT {
      int id
      string dish_name
      string history
      string preparation_details
      string pairing_suggestions
      string media_url
    }
    ADMIN {
      int id
      string name
      string email
      string permissions
    }

    USER ||--o{ "ORDER" : places
    USER ||--o{ REVIEW : writes
    VENDOR ||--o{ MENUITEM : offers
    VENDOR ||--o{ REVIEW : receives
    VENDOR ||--o{ "ORDER" : receives
    "ORDER" ||--o{ ORDERITEM : contains
    MENUITEM ||--o{ ORDERITEM : part_of
    "ORDER" ||--|{ REVIEW : has
    CULTURALCONTENT ||--o{ MENUITEM : relates_to
Loading

Notes

  • OrderItems is introduced as a join table to support multiple menu items per order.
  • CulturalContent can be linked to menu items by dish name or foreign key.
  • Admin is included for completeness but may be merged with User if only differentiated by role/permissions.

Feel free to expand this wiki with additional tables or relationships as your app grows!

Clone this wiki locally