Параметр пропускает гвардейскую охрану
export const RoleGuard = (role: string) => {
class RoleGuardMixin implements CanActivate {
canActivate(context: ExecutionContext) {
// do something with context and role
return true;
}
}
const guard = mixin(RoleGuardMixin);
return guard;
}
// mixin as a function is imported from @nestjs/common and is a wrapper function that applies the @Injectable() decorator to the class
// Now to use the guard, you need to do something like
@UseGuards(RoleGuard('admin'))
Encouraging Eel