From 8c9677ffc5aef95964b42c03690eb5ea1b912b13 Mon Sep 17 00:00:00 2001 From: Biswa Kalyan Bhuyan Date: Sat, 26 Apr 2025 15:31:33 +0530 Subject: testing location tracker --- app/prisma/schema.prisma | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 app/prisma/schema.prisma (limited to 'app/prisma/schema.prisma') 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) +} -- cgit v1.2.3-59-g8ed1b