chore: import DH V2 D5.6.4 production baseline
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
|
||||
export const REQUIRED_PERMISSIONS_KEY = 'requiredPermissions';
|
||||
|
||||
export function RequirePermissions(...permissions: string[]) {
|
||||
const normalized = [
|
||||
...new Set(permissions.map((permission) => permission.trim()).filter(Boolean)),
|
||||
];
|
||||
|
||||
if (normalized.length === 0) {
|
||||
throw new Error('RequirePermissions needs at least one permission code');
|
||||
}
|
||||
|
||||
return SetMetadata(REQUIRED_PERMISSIONS_KEY, normalized);
|
||||
}
|
||||
Reference in New Issue
Block a user