Skip to content

Instantly share code, notes, and snippets.

View josvaal's full-sized avatar
💻
Coding

José Valentino josvaal

💻
Coding
View GitHub Profile
@josvaal
josvaal / role.guard.ts
Created March 31, 2025 22:01
role.guard.ts
import {
CanActivate,
ExecutionContext,
Injectable,
UnauthorizedException,
} from '@nestjs/common';
import { JwtService, TokenExpiredError } from '@nestjs/jwt';
import { Request } from 'express';
import { jwtConstants } from '../constants';
import { User } from '@prisma/client';