mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 06:34:15 +00:00
feat: astro test
This commit is contained in:
parent
df6e31ba89
commit
84144c383c
262 changed files with 18993 additions and 2655 deletions
211
backend/prisma/schema.prisma
Normal file
211
backend/prisma/schema.prisma
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
email String @unique
|
||||
emailVerified DateTime?
|
||||
image String?
|
||||
description String? @db.VarChar(512)
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
imageUpdatedAt DateTime?
|
||||
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
miis Mii[]
|
||||
likes Like[]
|
||||
|
||||
reportsAuthored Report[] @relation("ReportAuthor")
|
||||
reports Report[] @relation("ReportTargetCreator")
|
||||
punishments Punishment[]
|
||||
|
||||
@@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(512)
|
||||
platform MiiPlatform @default(THREE_DS)
|
||||
quarantined Boolean @default(false)
|
||||
in_queue Boolean @default(false)
|
||||
|
||||
instructions Json?
|
||||
youtubeId String?
|
||||
gender MiiGender?
|
||||
makeup MiiMakeup?
|
||||
|
||||
firstName String?
|
||||
lastName String?
|
||||
islandName String?
|
||||
allowedCopying Boolean?
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
likedBy Like[]
|
||||
|
||||
punishmentId Int?
|
||||
punishments MiiPunishment[]
|
||||
|
||||
@@index([tags], type: Gin)
|
||||
@@index([createdAt])
|
||||
@@index([quarantined, createdAt(sort: Desc)])
|
||||
@@index([platform, createdAt(sort: Desc)])
|
||||
@@index([userId, createdAt(sort: Desc)])
|
||||
@@index([gender])
|
||||
@@index([makeup])
|
||||
@@index([quarantined, id])
|
||||
@@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])
|
||||
@@index([miiId])
|
||||
@@map("likes")
|
||||
}
|
||||
|
||||
model Report {
|
||||
id Int @id @default(autoincrement())
|
||||
reportType ReportType
|
||||
status ReportStatus @default(OPEN)
|
||||
targetId Int
|
||||
|
||||
reason ReportReason
|
||||
reasonNotes String?
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
// note: this refers to the person who made the report
|
||||
authorId Int?
|
||||
author User? @relation("ReportAuthor", fields: [authorId], references: [id])
|
||||
creatorId Int?
|
||||
creator User? @relation("ReportTargetCreator", fields: [creatorId], references: [id])
|
||||
|
||||
@@map("reports")
|
||||
}
|
||||
|
||||
model MiiPunishment {
|
||||
punishmentId Int
|
||||
miiId Int
|
||||
reason String
|
||||
|
||||
punishment Punishment @relation(fields: [punishmentId], references: [id], onDelete: Cascade)
|
||||
mii Mii @relation(fields: [miiId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([punishmentId, miiId])
|
||||
@@map("mii_punishments")
|
||||
}
|
||||
|
||||
model Punishment {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
type PunishmentType
|
||||
returned Boolean @default(false)
|
||||
|
||||
notes String
|
||||
reasons String[]
|
||||
violatingMiis MiiPunishment[]
|
||||
|
||||
expiresAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
|
||||
@@map("punishments")
|
||||
}
|
||||
|
||||
enum MiiPlatform {
|
||||
SWITCH
|
||||
THREE_DS // can't start with a number
|
||||
}
|
||||
|
||||
enum MiiGender {
|
||||
MALE
|
||||
FEMALE
|
||||
NONBINARY
|
||||
}
|
||||
|
||||
enum MiiMakeup {
|
||||
FULL
|
||||
PARTIAL
|
||||
NONE
|
||||
}
|
||||
|
||||
enum ReportType {
|
||||
MII
|
||||
USER
|
||||
}
|
||||
|
||||
enum ReportReason {
|
||||
INAPPROPRIATE
|
||||
SPAM
|
||||
BAD_QUALITY
|
||||
OTHER
|
||||
}
|
||||
|
||||
enum ReportStatus {
|
||||
OPEN
|
||||
RESOLVED
|
||||
DISMISSED
|
||||
}
|
||||
|
||||
enum PunishmentType {
|
||||
WARNING
|
||||
TEMP_EXILE
|
||||
PERM_EXILE
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue