-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
76 lines (67 loc) · 1.88 KB
/
schema.prisma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid()) @map("_id")
fullname String?
email String @unique
password String
otp Otp?
profile Profile?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sessions Session[]
}
model Session {
id String @id @default(uuid()) @map("_id")
expiresAt DateTime
userId String
user User @relation(references: [id], fields: [userId], onDelete: Cascade)
}
model Otp {
id String @id @default(uuid()) @map("_id")
otp String @unique
scheduledDeletionAt DateTime?
userId String @unique
user User @relation(references: [id], fields: [userId], onDelete: Cascade)
}
model Profile {
id String @id @default(uuid()) @map("_id")
bio String
phoneNumber String?
properties Property[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String @unique
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model Property {
id String @id @default(uuid()) @map("_id")
title String
description String
price Float
location String
propertyType PropertyType // HOUSE, APARTMENT, CONDO, STUDIO
features String[] // "Pool", "Garage"
availableFor AvailableFor // RENT, SALE
agentId String
agent Profile @relation(fields: [agentId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
enum PropertyType {
HOUSE
APARTMENT
CONDO
STUDIO
}
enum AvailableFor {
RENT
SALE
}