feat: add mii gender property to database

will have to create a migration script
This commit is contained in:
trafficlunar 2025-05-05 17:46:32 +01:00
parent 0233d803fc
commit 412b0e775b
3 changed files with 13 additions and 0 deletions

View file

@ -0,0 +1,5 @@
-- CreateEnum
CREATE TYPE "MiiGender" AS ENUM ('MALE', 'FEMALE');
-- AlterTable
ALTER TABLE "miis" ADD COLUMN "gender" "MiiGender";

View file

@ -72,6 +72,7 @@ model Mii {
firstName String firstName String
lastName String lastName String
gender MiiGender?
islandName String islandName String
allowedCopying Boolean allowedCopying Boolean
@ -111,6 +112,11 @@ model Report {
@@map("reports") @@map("reports")
} }
enum MiiGender {
MALE
FEMALE
}
enum ReportType { enum ReportType {
MII MII
USER USER

View file

@ -7,6 +7,7 @@ import sharp from "sharp";
import qrcode from "qrcode-generator"; import qrcode from "qrcode-generator";
import { profanity } from "@2toad/profanity"; import { profanity } from "@2toad/profanity";
import { MiiGender } from "@prisma/client";
import { auth } from "@/lib/auth"; import { auth } from "@/lib/auth";
import { prisma } from "@/lib/prisma"; import { prisma } from "@/lib/prisma";
@ -99,6 +100,7 @@ export async function POST(request: NextRequest) {
firstName: conversion.tomodachiLifeMii.firstName, firstName: conversion.tomodachiLifeMii.firstName,
lastName: conversion.tomodachiLifeMii.lastName, lastName: conversion.tomodachiLifeMii.lastName,
gender: conversion.mii.gender == 0 ? MiiGender.MALE : MiiGender.FEMALE,
islandName: conversion.tomodachiLifeMii.islandName, islandName: conversion.tomodachiLifeMii.islandName,
allowedCopying: conversion.mii.allowCopying, allowedCopying: conversion.mii.allowCopying,
}, },