-
Notifications
You must be signed in to change notification settings - Fork 0
Database Schema
Rohit Patil edited this page Sep 26, 2024
·
7 revisions
Table Users {
id uuid [primary key]
firstName varchar2 [not null]
lastName varchar2
email varchar2 [not null, unique]
emailVerified bool [default: false]
mobile varchar2 [not null, unique]
mobileVerified bool [default: false]
googleId varchar2 [unique]
role UserRole
lastLogout timestamp
createdAt timestamp
updatedAt timestamp
}
Table HashedPassword {
id uuid
userId uuid [ref: - Users.id]
hashedPassword varchar2
}
Enum UserRole {
MERCHANT_OPERATOR
MERCHANT_ADMIN
CUSTOMERs
SUPER_ADMIN
}
Table Merchant {
id uuid [primary key]
restaurantName varchar2
address uuid [not null, ref: - Address.id]
owner uuid [not null, ref: > Users.id]
type MerchantType [not null, default: "DINE_IN"]
isOnline bool [default: false]
createdAt timestamp
updatedAt timestamp
}
Table Timing {
id uuid [primary key]
merchantId uuid [not null, ref: > Merchant.id]
dayOfWeek DayOfWeek [not null]
openTime time
closeTime time
isClosed bool [default: false]
createdAt timestamp
updatedAt timestamp
indexes {
(merchantId, dayOfWeek) [unique]
}
}
Enum DayOfWeek {
MONDAY
TUESDAY
WEDNESDAY
THURSDAY
FRIDAY
SATURDAY
SUNDAY
}
Table Address {
id uuid [primary key]
addressLine1 varchar2 [not null]
addressLine2 varchar2
city varchar2
district varchar2
state varchar2
pincode varchar2(6)
createdAt timestamp
updatedAt timestamp
}
Table MenuCategory{
id uuid [primary key]
name varchar2 [not null]
merchantId uuid [not null, ref : > Merchant.id]
createdAt timestamp
updatedAt timestamp
}
Table MenuItem {
id uuid [primary key]
merchantId uuid [not null, ref: > Merchant.id]
name varchar2 [not null]
description varchar2
category uuid [not null, ref: > MenuCategory.id]
tag ItemTag [not null]
price float [not null]
imageUrl varchar2
createdAt timestamp
updatedAt timestamp
}
Enum MerchantType{
DINE_IN
TAKE_AWAY
}
Enum ItemTag {
VEG
NONVEG
JAIN
}
Table Table {
id uuid [primary key]
merchantId uuid [not null, ref: > Merchant.id]
tableNumber int [not null]
createdAt timestamp
updatedAt timestamp
indexes {
(merchantId, tableNumber) [unique]
}
}
Table QrCode {
id uuid [primary key]
tableId uuid [ref: - Table.id]
merchantId uuid [not null, ref: > Merchant.id]
createdAt timestamp
updatedAt timestamp
}
Table Order {
id uuid [primary key]
token integer
merchantId uuid [not null, ref: > Merchant.id]
tableId uuid [ref: > Table.id]
status OrderStatus [default: 'ACCEPTED']
totalAmout float
createdAt timestamp
updatedAt timestamp
}
Table OrderItem {
id uuid [primary key]
itemId uuid [not null, ref: > MenuItem.id]
orderId uuid [not null, ref: > Order.id]
instruction varchar2
quantity int
amount float
status OrderItemStatus [default: 'PREPARING']
createdAt timestamp
}
Enum OrderStatus{
ACCEPTED
PREPARING
COMPLETED
}
Enum OrderItemStatus {
PREPARING
SERVED
}