added trophies
This commit is contained in:
56
components/(customization)/avatarcustomization/actions.ts
Normal file
56
components/(customization)/avatarcustomization/actions.ts
Normal file
@ -0,0 +1,56 @@
|
||||
"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 getCurrentAvatarParts() {
|
||||
const { user } = await getAuth();
|
||||
|
||||
if (!user || !user.accessCode) {
|
||||
throw new Error("User is not authenticated or accessCode is missing");
|
||||
}
|
||||
|
||||
const avatarParts = await artemis.chuni_profile_data.findMany({
|
||||
where: {
|
||||
user: user.UserId,
|
||||
},
|
||||
select: {
|
||||
avatarSkin: true,
|
||||
avatarBack: true,
|
||||
avatarFace: true,
|
||||
avatarFront: true,
|
||||
avatarHead: true,
|
||||
avatarItem: true,
|
||||
avatarWear: true,
|
||||
},
|
||||
});
|
||||
return avatarParts;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user