aboutsummaryrefslogtreecommitdiffstats
path: root/backend/src/routes/user.ts
diff options
context:
space:
mode:
Diffstat (limited to 'backend/src/routes/user.ts')
-rw-r--r--backend/src/routes/user.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/backend/src/routes/user.ts b/backend/src/routes/user.ts
index fc03e68..497d6da 100644
--- a/backend/src/routes/user.ts
+++ b/backend/src/routes/user.ts
@@ -4,12 +4,13 @@ import { prisma } from '../config/db';
export const handleMeRoute = async (req: express.Request, res: express.Response) => {
try {
- if (!req.session.userId) {
- return res.status(403).json({ error: 'Not Authenticated' });
+ const { userId } = req.query;
+ if (!userId) {
+ return res.status(400).json({ error: 'userId query parameter is required' });
}
const user = await prisma.user.findUniqueOrThrow({
- where: { id: req.session.userId },
- select: { id: true, username: true, isAdmin: true }
+ where: { id: parseInt(userId as string) },
+ select: { id: true, username: true, isAdmin: true, bio: true }
});
const isAdmin = user.id === 1 || user.isAdmin;
res.json({user, isAdmin});
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage