@mbc-cqrs-serverless/core
Version:
CQRS and event base core
26 lines (25 loc) • 991 B
TypeScript
import { CanActivate } from '@nestjs/common';
/**
* Decorator that applies authentication and role-based access control.
* Combines RolesGuard with Swagger documentation.
*
* @param roles - Required roles for access
* @example
* ```typescript
* @Controller('orders')
* export class OrderController {
* @Post()
* @Auth('admin', 'manager')
* createOrder() {}
* }
* ```
*/
export declare function Auth(...roles: string[]): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
export declare function AuthGuard({ guard, roles, }: {
guard?: CanActivate | Function;
roles: string[];
}): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
/**
* Decorator that adds tenant code header requirement to Swagger docs.
*/
export declare function HeaderTenant(): MethodDecorator & ClassDecorator;