aboutsummaryrefslogtreecommitdiffstats
path: root/backend/src/routes/user.ts
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-11-05 15:54:48 -0800
committerPinapelz <yukais@pinapelz.com>2025-11-05 16:00:29 -0800
commitbd525aaba017deb95415c28ea6725ddc1dae7890 (patch)
treec1239911c35120caad858df4f51461029e47dd7d /backend/src/routes/user.ts
parent8052754a4bcc3d07208d11aad764d2bb3492166d (diff)
fix recent games played sorting to prio date
Diffstat (limited to 'backend/src/routes/user.ts')
-rw-r--r--backend/src/routes/user.ts20
1 files changed, 12 insertions, 8 deletions
diff --git a/backend/src/routes/user.ts b/backend/src/routes/user.ts
index 96a452e..3019da7 100644
--- a/backend/src/routes/user.ts
+++ b/backend/src/routes/user.ts
@@ -24,14 +24,18 @@ export const handleMeRoute = async (req: express.Request, res: express.Response)
select: { id: true, username: true, isAdmin: true, bio: true }
});
const recentPlayedGames: RecentPlayedGame[] = await prisma.$queryRaw`
- SELECT DISTINCT ON (s."gameInternalName")
- g."formattedName",
- s."gameInternalName",
- s."timestamp"
- FROM "Score" s
- INNER JOIN "Game" g ON g."internalName" = s."gameInternalName"
- WHERE s."userId" = ${parseInt(userId as string)}
- ORDER BY s."gameInternalName", s."timestamp" DESC
+ SELECT *
+ FROM (
+ SELECT DISTINCT ON (s."gameInternalName")
+ g."formattedName",
+ s."timestamp",
+ s."gameInternalName"
+ FROM "Score" s
+ INNER JOIN "Game" g ON g."internalName" = s."gameInternalName"
+ WHERE s."userId" = ${parseInt(userId as string)}
+ ORDER BY s."gameInternalName", s."timestamp" DESC
+ ) sub
+ ORDER BY sub."timestamp" DESC
LIMIT 5;
`;
const scoreCountByGame: SafeGameCount[] = await prisma.$queryRaw`
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage