import { createParamDecorator, ExecutionContext } from '@nestjs/common';

export type { Payload as IUser } from '../../../services/authentication/jwt/interfaces/Payload';

export const User = createParamDecorator(
  (data: unknown, ctx: ExecutionContext) => {
    const request = ctx.switchToHttp().getRequest();

    return request.user;
  },
);
