daphnis/components/avatarcustomization/actions.ts
2024-07-23 16:15:27 -04:00

33 lines
877 B
TypeScript

"use server";
import { getAuth } from "@/auth/queries/getauth";
import { artemis, daphnis } from "@/lib/prisma";
import type * as Prisma from "@prisma/client";
// type ChuniScorePlaylog = Prisma.PrismaClient;
// type ChuniStaticMusic = Prisma.PrismaClient;
export async function getAllAvatarParts(category: number) {
const { user } = await getAuth();
if (!user || !user.accessCode) {
throw new Error("User is not authenticated or accessCode is missing");
}
const avatarParts = await artemis.chuni_static_avatar.findMany({
where: {
category: category
},
select: {
id: true,
name: true,
avatarAccessoryId: true,
category: true,
version: true,
iconPath: true,
texturePath: true,
}
});
return avatarParts;
}