NestJS - Guards
Identify the error in this custom decorator usage and how to fix it:
import { SetMetadata } from '@nestjs/common';
function Permissions(permissions: string[]) {
return (target: any, key: string) => {
Reflect.defineMetadata('permissions', permissions, target, key);
};
}
class UserController {
@Permissions(['read'])
getUser() {
return 'user';
}
}