Skip to content

Instantly share code, notes, and snippets.

@p32929
Created December 7, 2022 14:07
Show Gist options
  • Save p32929/9e2936fc65de89d7cc286e580e1ca59d to your computer and use it in GitHub Desktop.
Save p32929/9e2936fc65de89d7cc286e580e1ca59d to your computer and use it in GitHub Desktop.
GetUser.Decorator.ts
// import { User } from '@interfaces/user.interface';
import { User } from '@interfaces/user.interface';
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
export const GetUser = createParamDecorator(
(data, ctx: ExecutionContext): User => {
const req = ctx.switchToHttp().getRequest();
return req.user;
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment