import { CanActivate , ExecutionContext , HttpException , HttpStatus , Injectable , } from '@nestjs/common' ; @ Injectable ( ) export class SellerGuard implements CanActivate { constructor ( ) { } canActivate ( context ) { const request = context . switchToHttp ( ) . getRequest ( ) ; const user = request . user ; if ( user . seller ) { return true ; } throw new HttpException ( 'Unauthorized access' , HttpStatus . UNAUTHORIZED ) ; } }