Database Schema - SCCapstone/EZBag GitHub Wiki
Below is our database schema. We are using Mongo to construct our database. It is a document based database schema.
Cart Collection
_id: Varchar | productIDs: Varchar | barcodeTypes: Varchar | quantities: Number | businessID: Number | subtotal: Number | session: Number | tax: number | cartStartTime: Number | cartCheckoutTime: Number
The Cart collection will store all carts which were checked out at a particular business. Carts contain a list of the products purchased and their associated quantities, the businessID of the store where the products were purchased, the subtotal and tax associated with the purchase, as well as the time a cart was initialized and checked out.
{
"_id":"5f698fa8da276d5e59e80ef3",
"productIDs":["5f66fd980cf2ad3955343c9d","5f66fd9dskfd38d8f8ajdjf3"],
"quantities":[1,1],
"businessID":"1",
"subtotal":10.99,
"session":"123234667779493202736282",
"tax":0.6594,
"time":"1600753576145"
}
Product Collection
_id: Varchar | barcode: Varchar | barcodeType: Varchar | name: Varchar | price: Number | description: Varchar | businessID: Number | time: Number
The product collection holds the price and barcode information for a product and links it to a particular business.
{
"_id":"5f66fd980cf2ad3955343c9d",
"barcode":"9781401953119",
"barcodeType":"ean13",
"name":"Becoming Supernatural, How Common People Are Doing The Uncommon",
"price":8.99,
"description":"By Dr. Joe Dispenza",
"businessID":"1",
"time":"1600585112772"
}
Info Collection
_id: Varchar | email: Varchar | phone: Number | time: Number
The info collection will hold a customer’s contact information.
{
"_id":"5f5db9892585ed27519a387b",
"email":"[email protected]",
"phone":"8603337654",
"Time":"1599977865352"
}
Event Collection
_id: Varchar | type: Varchar | barcode: Varchar | session: Number | time: Number
The event collection will link a scanned item to a customer and place it in their cart.
{
"_id":"5f698dccda276d5e590a174d",
"type":"customerScannedItem",
"barcode":"670433093101",
"session":"123234667779493202736283",
"time":"1600753100108"
}
User Collection
_id: Varchar | email: Varchar | passwordHash: Varchar | businessID: Number | role: String The user collection will store a user’s matching email and password hash (or some equivalent verification method), along with the ID for their business and the user’s role at that business (employee, owner, etc.).
{
"_id":"5f698dccda276d5e590a174d",
"email":"[email protected]",
"passwordHash":"$5$MnfsQ4iN$ZMTppKN16y/tIsUYs/obHlhdP.Os80yXhTurpBMUbA5",
"BusinessID":"12345678",
"role":"employee"
}
Sales Collection
_id: Varchar | businessID: Number | day: Number | transactions: Number | uniqueCustomers: Number | revenue: Number
The sales collection will store sales information to be displayed on the sales dashboard for each business. Some example metrics to be tracked are included, but this example is far from complete.
{
"_id":"5f698dccda276d5e590a174d",
"businessID": 1,
"Day": 1602869303977,
"transactions":"12345678",
"uniqueCustomers":"23",
“Revenue”: 580.34
}