46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
"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 CurrentTrophy = await artemis.chuni_profile_data.findMany({
|
|
where: {
|
|
user: user.UserId,
|
|
},
|
|
select: {
|
|
trophyId: true,
|
|
},
|
|
});
|
|
return CurrentTrophy;
|
|
}
|
|
|
|
export async function getTrophies() {
|
|
const { user } = await getAuth();
|
|
|
|
if (!user || !user.accessCode) {
|
|
throw new Error("User is not authenticated or accessCode is missing");
|
|
}
|
|
|
|
const AllStaticTrophies =
|
|
await artemis.cozynet_chuni_static_trophies.findMany({
|
|
select: {
|
|
category: true,
|
|
netOpenName: true,
|
|
id: true,
|
|
str: true,
|
|
imagePath: true,
|
|
rareType: true,
|
|
sortName: true,
|
|
},
|
|
});
|
|
return AllStaticTrophies;
|
|
}
|