This commit is contained in:
polaris 2024-06-29 02:25:52 -04:00
parent f6c5710335
commit 60824969ec
59 changed files with 96 additions and 95 deletions

3
.eslintrc.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}

3
.example.env Normal file
View File

@ -0,0 +1,3 @@
DATABASE_URL="mysql://root:password@localhost:3306/lachesis"
DATABASE_AIME_URL = "mysql://root:password@localhost:3306/aime"
NEXT_PUBLIC_RESEND_API_KEY=""

57
.gitignore vendored
View File

@ -1,30 +1,37 @@
# Node.js # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
node_modules/
# Logs # dependencies
logs /node_modules
*.log /.pnp
.pnp.js
.yarn/install-state.gz
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log* npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Dependency directories # local env files
pids .env*.local
logs
*.pid
*.seed
*.pid.lock
# Optional npm cache directory # vercel
.npm .vercel
# Optional eslint cache # typescript
.eslintcache *.tsbuildinfo
next-env.d.ts
# Optional REPL history .env
.node_repl_history
# Environment variables
.env*
#nextjs
.next

View File

@ -14,7 +14,6 @@ export default async function AuthenticatedLayout({
redirect("/"); redirect("/");
} }
if (user.role === "ADMIN") {
return ( return (
<> <>
<main className="flex min-h-[calc(100vh-_theme(spacing.16))] flex-1 flex-col gap-4 bg-muted/40 p-4 md:gap-8 md:p-10"> <main className="flex min-h-[calc(100vh-_theme(spacing.16))] flex-1 flex-col gap-4 bg-muted/40 p-4 md:gap-8 md:p-10">
@ -29,8 +28,5 @@ export default async function AuthenticatedLayout({
</main> </main>
</> </>
); );
} else {
console.log("not an admin");
redirect("/home");
}
} }

View File

@ -1,6 +1,6 @@
"use server"; "use server";
import { daphnis } from "@/lib/prisma"; import { lachesis } from "@/lib/prisma";
import { randomUUID } from "crypto"; import { randomUUID } from "crypto";
import { Resend } from "resend"; import { Resend } from "resend";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
@ -39,7 +39,7 @@ export async function EmailPasswordResetLink(data: FormData) {
}; };
} }
const user = await daphnis.user.findUnique({ const user = await lachesis.user.findUnique({
where: { email }, where: { email },
}); });
@ -49,7 +49,7 @@ export async function EmailPasswordResetLink(data: FormData) {
}; };
} }
const token = await daphnis.passwordResetToken.create({ const token = await lachesis.passwordResetToken.create({
data: { data: {
id: randomUUID(), id: randomUUID(),
userId: user.id, userId: user.id,

View File

@ -1,7 +1,7 @@
"use server"; "use server";
import { getAuth } from "@/auth/queries/getauth"; import { getAuth } from "@/auth/queries/getauth";
import { daphnis } from "@/lib/prisma"; import { lachesis } from "@/lib/prisma";
import { randomUUID } from "crypto"; import { randomUUID } from "crypto";
import { randomBytes } from "crypto"; import { randomBytes } from "crypto";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
@ -20,7 +20,7 @@ export async function generateShareToken(id: number): Promise<{
} }
const gernatetoken = randomBytes(5).readUInt32BE(0).toString(); const gernatetoken = randomBytes(5).readUInt32BE(0).toString();
const token = await daphnis.linkSharingToken.create({ const token = await lachesis.linkSharingToken.create({
data: { data: {
playlogId: id, playlogId: id,
id: randomUUID(), id: randomUUID(),
@ -34,7 +34,7 @@ export async function generateShareToken(id: number): Promise<{
} }
export async function shareScore(token: string) { export async function shareScore(token: string) {
const PublicPage = await daphnis.linkSharingToken.findUnique({ const PublicPage = await lachesis.linkSharingToken.findUnique({
where: { where: {
token, token,
}, },
@ -52,7 +52,7 @@ export async function shareScore(token: string) {
const tokenAgeLimit = 1000 * 60 * 60 * 24; // 1 day in milliseconds const tokenAgeLimit = 1000 * 60 * 60 * 24; // 1 day in milliseconds
if (tokenAge > tokenAgeLimit) { if (tokenAge > tokenAgeLimit) {
await daphnis.linkSharingToken.update({ await lachesis.linkSharingToken.update({
where: { where: {
token, token,
}, },

View File

@ -4,7 +4,7 @@ import { cookies } from "next/headers";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { Argon2id } from "oslo/password"; import { Argon2id } from "oslo/password";
import { lucia } from "@/lib/lucia"; import { lucia } from "@/lib/lucia";
import { daphnis } from "@/lib/prisma"; import { lachesis } from "@/lib/prisma";
const signIn = async (formData: FormData) => { const signIn = async (formData: FormData) => {
const formDataRaw = { const formDataRaw = {
@ -13,7 +13,7 @@ const signIn = async (formData: FormData) => {
}; };
try { try {
const user = await daphnis.user.findUnique({ const user = await lachesis.user.findUnique({
where: { username: formDataRaw.username }, where: { username: formDataRaw.username },
}); });

View File

@ -5,7 +5,7 @@ import { cookies } from "next/headers";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { Argon2id } from "oslo/password"; import { Argon2id } from "oslo/password";
import { lucia } from "@/lib/lucia"; import { lucia } from "@/lib/lucia";
import { daphnis, artemis } from "@/lib/prisma"; import { lachesis, artemis } from "@/lib/prisma";
const signUp = async (formData: FormData) => { const signUp = async (formData: FormData) => {
const formDataRaw = { const formDataRaw = {
@ -22,7 +22,7 @@ const signUp = async (formData: FormData) => {
try { try {
// Check if access code is already used in lachesis database // Check if access code is already used in lachesis database
const existingUser = await daphnis.user.findFirst({ const existingUser = await lachesis.user.findFirst({
where: { where: {
accessCode: formDataRaw.accessCode, accessCode: formDataRaw.accessCode,
}, },
@ -33,7 +33,7 @@ const signUp = async (formData: FormData) => {
} }
// Check if username is already used in lachesis database // Check if username is already used in lachesis database
const existingUsername = await daphnis.user.findFirst({ const existingUsername = await lachesis.user.findFirst({
where: { where: {
username: formDataRaw.username, username: formDataRaw.username,
}, },
@ -43,7 +43,7 @@ const signUp = async (formData: FormData) => {
return { error: "Username is currently taken" }; return { error: "Username is currently taken" };
} }
const existingEmail = await daphnis.user.findFirst({ const existingEmail = await lachesis.user.findFirst({
where: { where: {
email: formDataRaw.email, email: formDataRaw.email,
}, },
@ -68,7 +68,7 @@ const signUp = async (formData: FormData) => {
const userId = generateId(15); const userId = generateId(15);
// Create user in the lachesis database // Create user in the lachesis database
await daphnis.user.create({ await lachesis.user.create({
data: { data: {
id: userId, id: userId,
username: formDataRaw.username, username: formDataRaw.username,
@ -93,7 +93,6 @@ const signUp = async (formData: FormData) => {
} catch (error: any) { } catch (error: any) {
return { error: "Account creation failed: " + error.message }; return { error: "Account creation failed: " + error.message };
} }
redirect("/home"); redirect("/home");
}; };

View File

@ -1,7 +1,7 @@
"use server"; "use server";
import { getAuth } from "@/auth/queries/getauth"; import { getAuth } from "@/auth/queries/getauth";
import { daphnis } from "@/lib/prisma"; import { lachesis } from "@/lib/prisma";
export async function getLachesisInUseCards() { export async function getLachesisInUseCards() {
const { user } = await getAuth(); const { user } = await getAuth();
@ -10,7 +10,7 @@ export async function getLachesisInUseCards() {
throw new Error("User is not authenticated or accessCode is missing"); throw new Error("User is not authenticated or accessCode is missing");
} }
const aimeUser = await daphnis.user.findFirst({ const aimeUser = await lachesis.user.findFirst({
where: { where: {
accessCode: user.accessCode, accessCode: user.accessCode,
}, },

View File

@ -2,7 +2,7 @@
import { getAuth } from "@/auth/queries/getauth"; import { getAuth } from "@/auth/queries/getauth";
import { artemis } from "@/lib/prisma"; import { artemis } from "@/lib/prisma";
import { daphnis } from "@/lib/prisma"; import { lachesis } from "@/lib/prisma";
export const LinkAimeCard = async (formData: FormData) => { export const LinkAimeCard = async (formData: FormData) => {
const { user } = await getAuth(); const { user } = await getAuth();
@ -13,7 +13,7 @@ export const LinkAimeCard = async (formData: FormData) => {
try { try {
// Check if access code is already used by another user in lachesis database // Check if access code is already used by another user in lachesis database
const existingUserWithAccessCode = await daphnis.user.findFirst({ const existingUserWithAccessCode = await lachesis.user.findFirst({
where: { where: {
accessCode: formDataRaw.accessCode, accessCode: formDataRaw.accessCode,
id: { id: {
@ -37,7 +37,7 @@ export const LinkAimeCard = async (formData: FormData) => {
throw new Error("Not in artemis's database, Nice try ^_^"); throw new Error("Not in artemis's database, Nice try ^_^");
} }
const userHoldsAccessCode = await daphnis.user.findFirst({ const userHoldsAccessCode = await lachesis.user.findFirst({
where: { where: {
accessCode: formDataRaw.accessCode, accessCode: formDataRaw.accessCode,
}, },
@ -48,7 +48,7 @@ export const LinkAimeCard = async (formData: FormData) => {
} }
// Update current user's access code // Update current user's access code
await daphnis.user.update({ await lachesis.user.update({
where: { where: {
id: user?.id, id: user?.id,
}, },

View File

@ -1,7 +1,7 @@
"use server"; "use server";
import { getAuth } from "@/auth/queries/getauth"; import { getAuth } from "@/auth/queries/getauth";
import { daphnis } from "@/lib/prisma"; import { lachesis } from "@/lib/prisma";
import { Argon2id } from "oslo/password"; import { Argon2id } from "oslo/password";
export const InApplicationPasswordReset = async ( export const InApplicationPasswordReset = async (
@ -22,7 +22,7 @@ export const InApplicationPasswordReset = async (
try { try {
// Fetch user from database // Fetch user from database
const existingUser = await daphnis.user.findUnique({ const existingUser = await lachesis.user.findUnique({
where: { where: {
id: user.id, id: user.id,
}, },
@ -46,7 +46,7 @@ export const InApplicationPasswordReset = async (
const hashedPassword = await new Argon2id().hash(newPassword); const hashedPassword = await new Argon2id().hash(newPassword);
// Update user's password // Update user's password
await daphnis.user.update({ await lachesis.user.update({
where: { where: {
id: user.id, id: user.id,
}, },

View File

@ -2,13 +2,10 @@
import { getAuth } from "@/auth/queries/getauth"; import { getAuth } from "@/auth/queries/getauth";
import { artemis } from "@/lib/prisma"; import { artemis } from "@/lib/prisma";
import { daphnis } from "@/lib/prisma"; import { lachesis } from "@/lib/prisma";
export async function getSongsWithTitles(userId: number) { export async function getSongsWithTitles(userId: number) {
try { try {
// Fetch songs from ChuniScorePlaylog
const songs = await artemis.chuni_score_playlog.findMany({ const songs = await artemis.chuni_score_playlog.findMany({
where: { where: {
user: userId, user: userId,
@ -95,7 +92,7 @@ export async function getSongsWithTitles(userId: number) {
export async function SharingPlaylogId(playlogid: number) { export async function SharingPlaylogId(playlogid: number) {
try { try {
const tokens = await daphnis.linkSharingToken.findMany({ const tokens = await lachesis.linkSharingToken.findMany({
where: { where: {
playlogId: playlogid, playlogId: playlogid,
}, },
@ -117,7 +114,7 @@ export async function SharingPlaylogId(playlogid: number) {
export const getUsername = async () => { export const getUsername = async () => {
const { user } = await getAuth(); // Assuming getAuth() returns an auth object with user info const { user } = await getAuth(); // Assuming getAuth() returns an auth object with user info
if (user) { if (user) {
return await daphnis.user.findFirst({ return await lachesis.user.findFirst({
where: { where: {
id: user.id, id: user.id,
username: user.username, username: user.username,
@ -134,7 +131,7 @@ export async function getAllAimeCards() {
throw new Error("User is not authenticated or accessCode is missing"); throw new Error("User is not authenticated or accessCode is missing");
} }
const aimeUser = await daphnis.user.findMany({ const aimeUser = await lachesis.user.findMany({
where: { where: {
accessCode: user.accessCode, accessCode: user.accessCode,
}, },

View File

@ -1,8 +1,8 @@
import { Lucia } from "lucia"; import { Lucia } from "lucia";
import { PrismaAdapter } from "@lucia-auth/adapter-prisma"; import { PrismaAdapter } from "@lucia-auth/adapter-prisma";
import { daphnis } from "./prisma"; import { lachesis } from "./prisma";
const adapter = new PrismaAdapter(daphnis.session, daphnis.user); const adapter = new PrismaAdapter(lachesis.session, lachesis.user);
export const lucia = new Lucia(adapter, { export const lucia = new Lucia(adapter, {
sessionCookie: { sessionCookie: {

View File

@ -1,8 +1,8 @@
import { PrismaClient as daphnisClient } from "@/prisma/schemas/daphnis/generated/daphnis"; import { PrismaClient as lachesisClient } from "@/prisma/schemas/lachesis/generated/lachesis";
import { PrismaClient as artemisClient } from "@/prisma/schemas/artemis/generated/artemis"; import { PrismaClient as artemisClient } from "@/prisma/schemas/artemis/generated/artemis";
const daphnisSingleton = () => { const lachesisSingleton = () => {
return new daphnisClient(); return new lachesisClient();
}; };
const aremisSingleton = () => { const aremisSingleton = () => {
@ -10,11 +10,11 @@ const aremisSingleton = () => {
}; };
declare global { declare global {
var daphnis: undefined | ReturnType<typeof daphnisSingleton>; var lachesis: undefined | ReturnType<typeof lachesisSingleton>;
var artemis: undefined | ReturnType<typeof aremisSingleton>; var artemis: undefined | ReturnType<typeof aremisSingleton>;
} }
export const daphnis = globalThis.daphnis ?? daphnisSingleton(); export const lachesis = globalThis.lachesis ?? lachesisSingleton();
export const artemis = globalThis.artemis ?? aremisSingleton(); export const artemis = globalThis.artemis ?? aremisSingleton();
if (process.env.NODE_ENV !== "production") globalThis.daphnis = daphnis; if (process.env.NODE_ENV !== "production") globalThis.lachesis = lachesis;

View File

@ -1,17 +1,15 @@
{ {
"name": "daphnis", "name": "lachesis",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"db:init": " prisma migrate dev --name init --schema prisma/schemas/daphnis/schema.prisma; npx prisma db pull --schema prisma/schemas/artemis/schema.prisma", "db:init": "npx prisma migrate dev --name init --schema prisma/schemas/lachesis/schema.prisma; npx prisma db pull --schema prisma/schemas/artemis/schema.prisma",
"artemis:generate": "prisma generate --schema=./prisma/schemas/artemis/schema.prisma", "artemis:generate": "prisma generate --schema=./prisma/schemas/artemis/schema.prisma",
"daphnis:generate": "prisma generate --schema=./prisma/schemas/daphnis/schema.prisma", "lachesis:migrate": "prisma migrate dev --schema=./prisma/schemas/lachesis/schema.prisma",
"lachesis:drop": "prisma migrate reset --schema=./prisma/schemas/lachesis/schema.prisma",
"daphnis:migrate": "prisma migrate dev --schema=./prisma/schemas/daphnis/schema.prisma",
"daphnis:drop": "prisma migrate reset --schema=./prisma/schemas/daphnis/schema.prisma",
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "dependencies": {

View File

@ -3647,7 +3647,7 @@ const config = {
"value": "prisma-client-js" "value": "prisma-client-js"
}, },
"output": { "output": {
"value": "/home/polaris/Documents/projects/daphnis/prisma/schemas/artemis/generated/artemis", "value": "/home/polaris/Documents/projects/lachesis/prisma/schemas/artemis/generated/artemis",
"fromEnvVar": null "fromEnvVar": null
}, },
"config": { "config": {
@ -3664,7 +3664,7 @@ const config = {
"isCustomOutput": true "isCustomOutput": true
}, },
"relativeEnvPaths": { "relativeEnvPaths": {
"rootEnvPath": null, "rootEnvPath": "../../../../../.env",
"schemaEnvPath": "../../../../../.env" "schemaEnvPath": "../../../../../.env"
}, },
"relativePath": "../..", "relativePath": "../..",

View File

@ -3648,7 +3648,7 @@ const config = {
"value": "prisma-client-js" "value": "prisma-client-js"
}, },
"output": { "output": {
"value": "/home/polaris/Documents/projects/daphnis/prisma/schemas/artemis/generated/artemis", "value": "/home/polaris/Documents/projects/lachesis/prisma/schemas/artemis/generated/artemis",
"fromEnvVar": null "fromEnvVar": null
}, },
"config": { "config": {
@ -3665,7 +3665,7 @@ const config = {
"isCustomOutput": true "isCustomOutput": true
}, },
"relativeEnvPaths": { "relativeEnvPaths": {
"rootEnvPath": null, "rootEnvPath": "../../../../../.env",
"schemaEnvPath": "../../../../../.env" "schemaEnvPath": "../../../../../.env"
}, },
"relativePath": "../..", "relativePath": "../..",

View File

@ -150,7 +150,7 @@ const config = {
"value": "prisma-client-js" "value": "prisma-client-js"
}, },
"output": { "output": {
"value": "/home/polaris/Documents/projects/daphnis/prisma/schemas/daphnis/generated/daphnis", "value": "/home/polaris/Documents/projects/lachesis/prisma/schemas/lachesis/generated/lachesis",
"fromEnvVar": null "fromEnvVar": null
}, },
"config": { "config": {
@ -177,7 +177,6 @@ const config = {
"db" "db"
], ],
"activeProvider": "mysql", "activeProvider": "mysql",
"postinstall": false,
"inlineDatasources": { "inlineDatasources": {
"db": { "db": {
"url": { "url": {
@ -186,8 +185,8 @@ const config = {
} }
} }
}, },
"inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"./generated/daphnis\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\nenum UserRole {\n ADMIN\n USER\n}\n\nmodel User {\n id String @id\n sessions Session[]\n username String @unique\n accessCode String @unique\n hashedPassword String\n email String @unique\n role UserRole @default(USER)\n PasswordResetToken PasswordResetToken[]\n LinkSharingToken LinkSharingToken[]\n}\n\nmodel PasswordResetToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n resetAt DateTime?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel LinkSharingToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n tokenExpiredAt DateTime?\n playlogId Int?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Session {\n id String @id\n expiresAt DateTime\n userId String\n user User @relation(references: [id], fields: [userId], onDelete: Cascade)\n}\n", "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"./generated/lachesis\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\nenum UserRole {\n ADMIN\n USER\n}\n\nmodel User {\n id String @id\n sessions Session[]\n username String @unique\n accessCode String @unique\n hashedPassword String\n email String @unique\n role UserRole @default(USER)\n PasswordResetToken PasswordResetToken[]\n LinkSharingToken LinkSharingToken[]\n}\n\nmodel PasswordResetToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n resetAt DateTime?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel LinkSharingToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n tokenExpiredAt DateTime?\n playlogId Int?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Session {\n id String @id\n expiresAt DateTime\n userId String\n user User @relation(references: [id], fields: [userId], onDelete: Cascade)\n}\n",
"inlineSchemaHash": "d87f50b9542355418c6259e30d43d396260e40a71d7c943615f89f3e1af2e4a0", "inlineSchemaHash": "4a941b08f33d6fbdef31c4059e37314345fc724bfa3f4c300d6cb38dc73636a9",
"copyEngine": true "copyEngine": true
} }
config.dirname = '/' config.dirname = '/'

View File

@ -151,7 +151,7 @@ const config = {
"value": "prisma-client-js" "value": "prisma-client-js"
}, },
"output": { "output": {
"value": "/home/polaris/Documents/projects/daphnis/prisma/schemas/daphnis/generated/daphnis", "value": "/home/polaris/Documents/projects/lachesis/prisma/schemas/lachesis/generated/lachesis",
"fromEnvVar": null "fromEnvVar": null
}, },
"config": { "config": {
@ -178,7 +178,6 @@ const config = {
"db" "db"
], ],
"activeProvider": "mysql", "activeProvider": "mysql",
"postinstall": false,
"inlineDatasources": { "inlineDatasources": {
"db": { "db": {
"url": { "url": {
@ -187,8 +186,8 @@ const config = {
} }
} }
}, },
"inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"./generated/daphnis\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\nenum UserRole {\n ADMIN\n USER\n}\n\nmodel User {\n id String @id\n sessions Session[]\n username String @unique\n accessCode String @unique\n hashedPassword String\n email String @unique\n role UserRole @default(USER)\n PasswordResetToken PasswordResetToken[]\n LinkSharingToken LinkSharingToken[]\n}\n\nmodel PasswordResetToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n resetAt DateTime?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel LinkSharingToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n tokenExpiredAt DateTime?\n playlogId Int?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Session {\n id String @id\n expiresAt DateTime\n userId String\n user User @relation(references: [id], fields: [userId], onDelete: Cascade)\n}\n", "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"./generated/lachesis\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\nenum UserRole {\n ADMIN\n USER\n}\n\nmodel User {\n id String @id\n sessions Session[]\n username String @unique\n accessCode String @unique\n hashedPassword String\n email String @unique\n role UserRole @default(USER)\n PasswordResetToken PasswordResetToken[]\n LinkSharingToken LinkSharingToken[]\n}\n\nmodel PasswordResetToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n resetAt DateTime?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel LinkSharingToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n tokenExpiredAt DateTime?\n playlogId Int?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Session {\n id String @id\n expiresAt DateTime\n userId String\n user User @relation(references: [id], fields: [userId], onDelete: Cascade)\n}\n",
"inlineSchemaHash": "d87f50b9542355418c6259e30d43d396260e40a71d7c943615f89f3e1af2e4a0", "inlineSchemaHash": "4a941b08f33d6fbdef31c4059e37314345fc724bfa3f4c300d6cb38dc73636a9",
"copyEngine": true "copyEngine": true
} }
@ -197,8 +196,8 @@ const fs = require('fs')
config.dirname = __dirname config.dirname = __dirname
if (!fs.existsSync(path.join(__dirname, 'schema.prisma'))) { if (!fs.existsSync(path.join(__dirname, 'schema.prisma'))) {
const alternativePaths = [ const alternativePaths = [
"prisma/schemas/daphnis/generated/daphnis", "prisma/schemas/lachesis/generated/lachesis",
"schemas/daphnis/generated/daphnis", "schemas/lachesis/generated/lachesis",
] ]
const alternativePath = alternativePaths.find((altPath) => { const alternativePath = alternativePaths.find((altPath) => {
@ -227,7 +226,7 @@ Object.assign(exports, Prisma)
// file annotations for bundling tools to include these files // file annotations for bundling tools to include these files
path.join(__dirname, "libquery_engine-debian-openssl-3.0.x.so.node"); path.join(__dirname, "libquery_engine-debian-openssl-3.0.x.so.node");
path.join(process.cwd(), "prisma/schemas/daphnis/generated/daphnis/libquery_engine-debian-openssl-3.0.x.so.node") path.join(process.cwd(), "prisma/schemas/lachesis/generated/lachesis/libquery_engine-debian-openssl-3.0.x.so.node")
// file annotations for bundling tools to include these files // file annotations for bundling tools to include these files
path.join(__dirname, "schema.prisma"); path.join(__dirname, "schema.prisma");
path.join(process.cwd(), "prisma/schemas/daphnis/generated/daphnis/schema.prisma") path.join(process.cwd(), "prisma/schemas/lachesis/generated/lachesis/schema.prisma")

View File

@ -1,5 +1,5 @@
{ {
"name": "prisma-client-aabc54979c11ed9fe0760e616a5aa0e1ec79c6db5c25a69f7c0abd1fa7e08ee5", "name": "prisma-client-70fb468b9272f6dedf5cd5bbd165ea4d0acb5a3a3690a9faf3c1349f968a09e4",
"main": "index.js", "main": "index.js",
"types": "index.d.ts", "types": "index.d.ts",
"browser": "index-browser.js", "browser": "index-browser.js",

View File

@ -6,7 +6,7 @@
generator client { generator client {
provider = "prisma-client-js" provider = "prisma-client-js"
output = "./generated/daphnis" output = "./generated/lachesis"
} }
datasource db { datasource db {

View File

@ -6,7 +6,7 @@
generator client { generator client {
provider = "prisma-client-js" provider = "prisma-client-js"
output = "./generated/daphnis" output = "./generated/lachesis"
} }
datasource db { datasource db {