diff options
author | 2025-04-26 15:31:33 +0530 | |
---|---|---|
committer | 2025-04-26 15:31:33 +0530 | |
commit | 8c9677ffc5aef95964b42c03690eb5ea1b912b13 (patch) | |
tree | 8d1941b0e591e601288387c464db098e66e9b365 /app/prisma | |
download | realtimeloc-8c9677ffc5aef95964b42c03690eb5ea1b912b13.tar.gz realtimeloc-8c9677ffc5aef95964b42c03690eb5ea1b912b13.tar.bz2 realtimeloc-8c9677ffc5aef95964b42c03690eb5ea1b912b13.zip |
testing location tracker
Diffstat (limited to 'app/prisma')
-rw-r--r-- | app/prisma/schema.prisma | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/app/prisma/schema.prisma b/app/prisma/schema.prisma new file mode 100644 index 0000000..9dde5b5 --- /dev/null +++ b/app/prisma/schema.prisma @@ -0,0 +1,53 @@ +// This is your Prisma schema file, +// learn more about it in the docs: https://pris.ly/d/prisma-schema + +// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? +// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init + +generator client { + provider = "prisma-client-js" + output = "../src/generated/prisma" +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} + +model User { + id String @id @default(uuid()) + email String @unique + name String? + password String + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + locations Location[] + locationShares LocationShare[] @relation("Sender") + locationReceived LocationShare[] @relation("Receiver") +} + +model Location { + id String @id @default(uuid()) + userId String + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + latitude Float + longitude Float + accuracy Float? + timestamp DateTime @default(now()) + shares LocationShare[] +} + +model LocationShare { + id String @id @default(uuid()) + senderId String + sender User @relation("Sender", fields: [senderId], references: [id], onDelete: Cascade) + receiverId String? + receiver User? @relation("Receiver", fields: [receiverId], references: [id], onDelete: SetNull) + locationId String + location Location @relation(fields: [locationId], references: [id], onDelete: Cascade) + token String @unique + expiryAt DateTime? + createdAt DateTime @default(now()) + emailSent Boolean @default(false) + accessCount Int @default(0) +} |