Something went wrong. Try again.
Synapse is a study workspace. Organize courses read and annotate the material, train with generated exercises and watch your progress forked from denishovart.com/synapse
Something went wrong. Try again.
1234567891011121314151617import { SetMetadata, createParamDecorator, ExecutionContext } from '@nestjs/common';import type { PublicUser } from '../domain/models';import { IS_PUBLIC_KEY } from './auth.constants';
// Marks a handler (or a whole controller) as accessible without a session -// the global AuthGuard skips it. Used for the login/status/bootstrap routes.export const Public = () => SetMetadata(IS_PUBLIC_KEY, true);
// Injects the authenticated user the guard attached to the request. On a// @Public() route with no session this is undefined.export const CurrentUser = createParamDecorator( (_data: unknown, ctx: ExecutionContext): PublicUser | undefined => { const req = ctx.switchToHttp().getRequest<{ user?: PublicUser }>(); return req.user; },);