31 lines
718 B
TypeScript
31 lines
718 B
TypeScript
"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,
|
|
});
|
|
};
|
|
|
|
export const changePassword = async (changes: Prisma.UserUpdateInput) => {
|
|
// TODO: Add password change logic
|
|
};
|