added trophies
This commit is contained in:
44
components/(customization)/trophycustomization/actions.ts
Normal file
44
components/(customization)/trophycustomization/actions.ts
Normal file
@ -0,0 +1,44 @@
|
||||
"use server";
|
||||
|
||||
import { getAuth } from "@/auth/queries/getauth";
|
||||
import { artemis, daphnis } from "@/lib/prisma";
|
||||
import type * as Prisma from "@prisma/client";
|
||||
|
||||
export async function getCurrentTrophies() {
|
||||
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: {
|
||||
trophyId: true,
|
||||
},
|
||||
});
|
||||
return avatarParts;
|
||||
}
|
||||
|
||||
export async function getTrophies() {
|
||||
const { user } = await getAuth();
|
||||
|
||||
if (!user || !user.accessCode) {
|
||||
throw new Error("User is not authenticated or accessCode is missing");
|
||||
}
|
||||
|
||||
const staticTrophies = await artemis.cozynet_chuni_static_trophies.findMany({
|
||||
select: {
|
||||
category: true,
|
||||
netOpenName: true,
|
||||
id: true,
|
||||
str: true,
|
||||
imagePath: true,
|
||||
rareType: true,
|
||||
sortName: true,
|
||||
},
|
||||
});
|
||||
return staticTrophies;
|
||||
}
|
Reference in New Issue
Block a user