24 lines
580 B
TypeScript

import { usePrisma } from "../utils/prisma";
export async function getProfile(userId: string) {
const db = usePrisma();
return db.profile.findUnique({ where: { id: userId } });
}
export async function updateProfile(
userId: string,
data: Partial<{
username: string | null;
nickname: string | null;
avatar: string | null;
}>,
) {
const db = usePrisma();
return db.profile.update({ where: { id: userId }, data });
}
export async function deleteProfile(userId: string) {
const db = usePrisma();
return db.profile.delete({ where: { id: userId } });
}