Skip to content

Commit

Permalink
feat: change user query
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoAseff authored Jan 16, 2025
1 parent 5520232 commit d22872b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/server/actions/user.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use server";
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();
import { db } from "../db";

/**
* Deletes a user account and all related data.
Expand All @@ -16,7 +15,7 @@ const prisma = new PrismaClient();
*/
export async function deleteUserAccount(userId: string): Promise<void> {
try {
await prisma.$transaction(async (tx) => {
await db.$transaction(async (tx) => {
// First get the settings ID for this user
const userSettings = await tx.settings.findUnique({
where: { userId },
Expand Down Expand Up @@ -75,7 +74,7 @@ export async function changeUsername(
newUsername: string,
): Promise<void> {
try {
await prisma.user.update({
await db.user.update({
where: { id: userId },
data: { name: newUsername },
});
Expand Down

0 comments on commit d22872b

Please sign in to comment.