mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-22 07:51:09 -05:00
Initialize frontend project with Next.js, Tailwind CSS, and essential configurations
This commit is contained in:
137
frontend/prisma/schema.prisma
Normal file
137
frontend/prisma/schema.prisma
Normal file
@@ -0,0 +1,137 @@
|
||||
// This is your Prisma schema file
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
previewFeatures = ["postgresqlExtensions"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
extensions = [postgis]
|
||||
}
|
||||
|
||||
// Core user model
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
email String @unique
|
||||
username String @unique
|
||||
password String?
|
||||
dateJoined DateTime @default(now())
|
||||
isActive Boolean @default(true)
|
||||
isStaff Boolean @default(false)
|
||||
isSuperuser Boolean @default(false)
|
||||
lastLogin DateTime?
|
||||
createdParks Park[] @relation("ParkCreator")
|
||||
reviews Review[]
|
||||
photos Photo[]
|
||||
}
|
||||
|
||||
// Park model
|
||||
model Park {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
slug String @unique
|
||||
description String? @db.Text
|
||||
status ParkStatus @default(OPERATING)
|
||||
location Json? // Store PostGIS point as JSON for now
|
||||
|
||||
// Details
|
||||
opening_date DateTime? @db.Date
|
||||
closing_date DateTime? @db.Date
|
||||
operating_season String?
|
||||
size_acres Decimal? @db.Decimal(10, 2)
|
||||
website String?
|
||||
|
||||
// Statistics
|
||||
average_rating Decimal? @db.Decimal(3, 2)
|
||||
ride_count Int?
|
||||
coaster_count Int?
|
||||
|
||||
// Relationships
|
||||
creator User? @relation("ParkCreator", fields: [creatorId], references: [id])
|
||||
creatorId Int?
|
||||
owner Company? @relation(fields: [ownerId], references: [id])
|
||||
ownerId Int?
|
||||
areas ParkArea[]
|
||||
reviews Review[]
|
||||
photos Photo[]
|
||||
|
||||
// Metadata
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
|
||||
@@index([slug])
|
||||
}
|
||||
|
||||
// Park Area model
|
||||
model ParkArea {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
slug String
|
||||
description String? @db.Text
|
||||
opening_date DateTime? @db.Date
|
||||
closing_date DateTime? @db.Date
|
||||
park Park @relation(fields: [parkId], references: [id], onDelete: Cascade)
|
||||
parkId Int
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
|
||||
@@unique([parkId, slug])
|
||||
@@index([slug])
|
||||
}
|
||||
|
||||
// Company model (for park owners)
|
||||
model Company {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
website String?
|
||||
parks Park[]
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
}
|
||||
|
||||
// Review model
|
||||
model Review {
|
||||
id Int @id @default(autoincrement())
|
||||
content String @db.Text
|
||||
rating Int
|
||||
park Park @relation(fields: [parkId], references: [id])
|
||||
parkId Int
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
photos Photo[]
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
|
||||
@@index([parkId])
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
// Photo model
|
||||
model Photo {
|
||||
id Int @id @default(autoincrement())
|
||||
url String
|
||||
caption String?
|
||||
park Park? @relation(fields: [parkId], references: [id])
|
||||
parkId Int?
|
||||
review Review? @relation(fields: [reviewId], references: [id])
|
||||
reviewId Int?
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
|
||||
@@index([parkId])
|
||||
@@index([reviewId])
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
enum ParkStatus {
|
||||
OPERATING
|
||||
CLOSED_TEMP
|
||||
CLOSED_PERM
|
||||
UNDER_CONSTRUCTION
|
||||
DEMOLISHED
|
||||
RELOCATED
|
||||
}
|
||||
Reference in New Issue
Block a user