Skip to content

Instantly share code, notes, and snippets.

@minhntm
Created September 10, 2021 03:46
Show Gist options
  • Save minhntm/8ffe1c6c704593a3dd0a24e0b1604952 to your computer and use it in GitHub Desktop.
Save minhntm/8ffe1c6c704593a3dd0a24e0b1604952 to your computer and use it in GitHub Desktop.
import { CustomDecorator, SetMetadata } from "@nestjs/common";
// action, object
export type RequiredPermission = [PermissionAction, PermissionObjectType]
export const PERMISSION_CHECKER_KEY = "permission_checker_params_key";
export const CheckPermissions = (...params: RequiredPermission[]): CustomDecorator<string> =>
SetMetadata(PERMISSION_CHECKER_KEY, params);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment