added diff name and setup skeleton for top recent plays

This commit is contained in:
Polaris
2024-08-14 11:52:19 -04:00
parent a2f5febb60
commit ad12f07cde
7 changed files with 93 additions and 8 deletions

View File

@ -0,0 +1,35 @@
"use server";
import { getAuth } from "@/auth/queries/getauth";
import { supportedVersionNumber } from "@/lib/helpers";
import { artemis } from "@/lib/prisma";
export async function getUserRecentPlays() {
const { user } = await getAuth();
if (!user || !user.accessCode) {
throw new Error("User is not authenticated or accessCode is missing");
}
const userRatingBaseHotList = await artemis.chuni_profile_rating.findMany({
where: {
user: user.UserId,
// userRatingBaseList recent 30 // userRatingBaseHotList recent 15
type: "userRatingBaseList",
version: supportedVersionNumber, // TODO: eventually change this so the user can set their own version
},
select: {
score:true,
difficultId: true,
musicId: true,
type:true,
version: true,
romVersionCode: true,
id: true,
index:true,
user: true,
},
});
return userRatingBaseHotList;
}