I keep forgetting to do things. The edit mii api route has been using the public folder as an uploads directory... whoops...
139 lines
2.7 KiB
Text
139 lines
2.7 KiB
Text
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
username String? @unique
|
|
name String
|
|
email String @unique
|
|
emailVerified DateTime?
|
|
image String?
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
usernameUpdatedAt DateTime?
|
|
imageUpdatedAt DateTime?
|
|
|
|
accounts Account[]
|
|
sessions Session[]
|
|
miis Mii[]
|
|
likes Like[]
|
|
Report Report[]
|
|
|
|
@@map("users")
|
|
}
|
|
|
|
model Account {
|
|
userId Int
|
|
type String
|
|
provider String
|
|
providerAccountId String
|
|
refresh_token String?
|
|
access_token String?
|
|
expires_at Int?
|
|
token_type String?
|
|
scope String?
|
|
id_token String?
|
|
session_state String?
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@id([provider, providerAccountId])
|
|
@@map("accounts")
|
|
}
|
|
|
|
model Session {
|
|
sessionToken String @unique
|
|
userId Int
|
|
expires DateTime
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("sessions")
|
|
}
|
|
|
|
model Mii {
|
|
id Int @id @default(autoincrement())
|
|
userId Int
|
|
name String @db.VarChar(64)
|
|
imageCount Int @default(0)
|
|
tags String[]
|
|
description String? @db.VarChar(256)
|
|
|
|
firstName String
|
|
lastName String
|
|
gender MiiGender?
|
|
islandName String
|
|
allowedCopying Boolean
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
likedBy Like[]
|
|
|
|
@@map("miis")
|
|
}
|
|
|
|
model Like {
|
|
userId Int
|
|
miiId Int
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
mii Mii @relation(fields: [miiId], references: [id], onDelete: Cascade)
|
|
|
|
@@id([userId, miiId])
|
|
@@map("likes")
|
|
}
|
|
|
|
model Report {
|
|
id Int @id @default(autoincrement())
|
|
reportType ReportType
|
|
status ReportStatus @default(OPEN)
|
|
targetId Int
|
|
|
|
reason ReportReason
|
|
reasonNotes String?
|
|
|
|
// note: this refers to the person who made the report
|
|
authorId Int?
|
|
createdAt DateTime @default(now())
|
|
|
|
user User? @relation(fields: [authorId], references: [id])
|
|
|
|
@@map("reports")
|
|
}
|
|
|
|
enum MiiGender {
|
|
MALE
|
|
FEMALE
|
|
}
|
|
|
|
enum ReportType {
|
|
MII
|
|
USER
|
|
}
|
|
|
|
enum ReportReason {
|
|
INAPPROPRIATE
|
|
SPAM
|
|
COPYRIGHT
|
|
OTHER
|
|
}
|
|
|
|
enum ReportStatus {
|
|
OPEN
|
|
RESOLVED
|
|
DISMISSED
|
|
}
|