generated from CMU-17-356/dronut-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Object Data Model
Joanna Yao edited this page Mar 20, 2023
·
28 revisions
Objects: User
, Order
, Merchant
, Product
Relationships:
-
User
directly refers toOrder
, indirectly refers toProduct
viaproduct_name
-
Order
indirectly refers toProduct
viaproduct_name
, and toUser
viausername
-
Merchant
directly refers toProduct
User:
{
"username" : String, // UNIQUE (PK), URL-SAFE
"password" : String, // Salted, Hashed Password.
"full_name" : String,
"history" : [Order], // list of all past orders
}
Order:
{
"username" : String,
"items" : [{
"title": String,
"quantity": Integer,
}],
"transaction_id": String
"totals" : Number,
"address" : String // Delivery address
"status": String // unpaid -> paid -> sent -> delivered
}
Merchant:
{
"name" : String, // UNIQUE (PK), URL-SAFE
"location" : ?String, // optional, default to Lawrenceville
"menu" : [{
"product": Product,
"inventory": Integer,
}]
}
Product:
{
"title" : String, // UNIQUE (PK), URL-SAFE
"display_name": String,
"price" : Number,
"image" : String, // path to image
}
The following schema is only used for API data format; there is no corresponding table or data in DB
Drone:
{
"id" : String,
"drone_name" : String,
"status" : String // default to available, can also be in_route
}