HUB - Admin und Einstellungen Seiten hinzugefügt, Prisma Client Integration und Migrationen aktualisiert
This commit is contained in:
26
apps/hub/app/(app)/settings/account/actions.ts
Normal file
26
apps/hub/app/(app)/settings/account/actions.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
'use server';
|
||||
import { Prisma, PrismaClient } from '@repo/db';
|
||||
import { getServerSession } from '../../../api/auth/[...nextauth]/auth';
|
||||
|
||||
export const unlinkDiscord = async (userId: string) => {
|
||||
const client = new PrismaClient();
|
||||
await client.discordAccount.deleteMany({
|
||||
where: {
|
||||
userId,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const updateUser = async (changes: Prisma.UserUpdateInput) => {
|
||||
const session = await getServerSession();
|
||||
if (!session) return null;
|
||||
|
||||
const client = new PrismaClient();
|
||||
|
||||
await client.user.update({
|
||||
where: {
|
||||
id: session.user.id,
|
||||
},
|
||||
data: changes,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user