diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-11-04 10:44:22 -0800 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-11-04 10:44:22 -0800 |
| commit | 945bf269d7b0c8f8b5245475398694378b74b25f (patch) | |
| tree | 2a6a235f021145b839078513d47fe64cae6511cd /backend/src/routes | |
| parent | 732f3873354863a4dec591d4d6a425edb7b47c61 (diff) | |
add bio for profile page
Diffstat (limited to 'backend/src/routes')
| -rw-r--r-- | backend/src/routes/user.ts | 9 |
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}); |
