diff --git a/apps/backend/src/routes/public.ts b/apps/backend/src/routes/public.ts index 6820072..01f1378 100644 --- a/apps/backend/src/routes/public.ts +++ b/apps/backend/src/routes/public.ts @@ -77,14 +77,18 @@ interface CardLinkWithPlatform { export async function publicRoutes(app: FastifyInstance) { // ─── Public Profile ─── + /** + * GET /api/u/:username + * Returns the public profile information for a user. + */ app.get('/:username', { config: { rateLimit: { max: 100, - timeWindow: '1 minute' - } - } as FastifyContextConfig - }, async (request: FastifyRequest<{ Params: { username: string }; Querystring: { source?: string } }>, reply: FastifyReply) => { + timeWindow: '1 minute', + }, + }, + }, async (request: FastifyRequest<{ Params: { username: string } }>, reply: FastifyReply) => { const { username } = request.params; const user = await app.prisma.user.findUnique({ @@ -234,19 +238,19 @@ export async function publicRoutes(app: FastifyInstance) { }); // ─── Public Card View ─── + /** + * GET /api/u/:username/card/:cardId + * Returns full owner profile + specific card data. + * Used when viewing a card through username + cardId (e.g. QR code scans). + */ app.get('/:username/card/:cardId', { config: { rateLimit: { max: 100, - timeWindow: '1 minute' - } - } as FastifyContextConfig - }, async (request: FastifyRequest<{ Params: { username: string; cardId: string }; Querystring: { source?: string } }>, reply: FastifyReply) => { - /** - * GET /api/public/:username/card/:cardId - * Returns full owner profile + specific card data. - * Used when viewing a card through username + cardId (e.g. QR code scans). - */ + timeWindow: '1 minute', + }, + }, + }, async (request: FastifyRequest<{ Params: { username: string; cardId: string } }>, reply: FastifyReply) => { const { username, cardId } = request.params; const user = await app.prisma.user.findUnique({