Changed leftovers to daphnis

This commit is contained in:
polaris 2024-06-29 01:46:07 -04:00
parent 14456e5397
commit 9950e50bfd
7 changed files with 24 additions and 18 deletions

4
.gitignore vendored
View File

@ -24,3 +24,7 @@ logs
# Environment variables
.env*
#nextjs
.next

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@ import { artemis } from "@/lib/prisma";
import { daphnis } from "@/lib/prisma";
export async function getSongsWithTitles(userId: number) {
try {
// Fetch songs from ChuniScorePlaylog
const songs = await artemis.chuni_score_playlog.findMany({
where: {
user: userId,

View File

@ -7,7 +7,7 @@
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",