tomodachi-share/prisma/schema.prisma
trafficlunar 20f1c51f0c feat: groundwork for 'living the dream' mii submissions
Based on the screenshots from yesterday's Nintendo Direct, it is
presumed that the Mii editor in "Living the Dream" is similar to
Miitopia's one.

This commit lays the groundwork for Miis created in the sequel game.
However, due to the way TomodachiShare generates portraits of the Miis,
I can't do that unless there is a way to parse the QR code data and
render the Mii.

Note: I don't know if Nintendo will use access codes (as was the case
with Miitopia) therefore, as a precaution, another branch will be
created in anticipation for that.
2025-09-13 15:03:12 +01:00

190 lines
3.8 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[]
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(256)
platform MiiPlatform @default(THREE_DS)
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[]
punishmentId Int?
punishments MiiPunishment[]
@@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?
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
}
enum ReportType {
MII
USER
}
enum ReportReason {
INAPPROPRIATE
SPAM
COPYRIGHT
OTHER
}
enum ReportStatus {
OPEN
RESOLVED
DISMISSED
}
enum PunishmentType {
WARNING
TEMP_EXILE
PERM_EXILE
}