import { applyDecorators, SetMetadata, UseGuards } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; import { ApiBearerAuth, ApiUnauthorizedResponse } from '@nestjs/swagger'; import { MoreLevelGuard } from 'kkk-lib/auth/more-level.guard'; // export const MoreLevel = (...args: string[]) => SetMetadata('more-level', args); export function AuthPowerDecorator(...roles: number[]) { return applyDecorators( SetMetadata('roles', roles), UseGuards(AuthGuard('jwt'), MoreLevelGuard), ApiBearerAuth(), ApiUnauthorizedResponse({ description: 'Unauthorized"' }), ); }