Everything starts with user

We will allow user to signup using their mobile no.

image.png

model User {
  id                String      @id @default(uuid())
  name              String
  phoneNumber       String
  email             String?     @unique
  addresses         Address[]
  createdAt         DateTime    @default(now())
  updatedAt         DateTime    @updatedAt
}

When someone order food they will have address for sure

image.png

image.png

model Address {
  id                String       @id @default(uuid())

  houseNumber       String       
  floor             String?      
  area              String       
  landmark          String?      
  pincode           String?      

  // we will get through Gio location api
  latitude          Float?       
  longitude         Float?       

  // 🏷️ Type
  type              AddressType  // home, work, hotel, other

  // 👤 Relationship
  userId            String
  user              User         @relation(fields: [userId], references: [id], onDelete: Cascade)

  // 🕓 Metadata
  createdAt         DateTime     @default(now())
  updatedAt         DateTime     @updatedAt

  @@index([userId])
  @@index([latitude, longitude])
}

enum AddressType {
  home
  work
  hotel
  other
}

When we talk about platform like The most important model is product

image.png

High Level Schema For BlinkIt