import { createParamDecorator, type ExecutionContext } from '@nestjs/common';
import { type JwtPayload } from '../../infrastructure/services/token.service';

export const CurrentUser = createParamDecorator(
  (_data: unknown, ctx: ExecutionContext): JwtPayload => {
    const request = ctx.switchToHttp().getRequest();
    return request.user;
  },
);
