Skip to content

Commit

Permalink
added class-specific decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghel committed Mar 13, 2024
1 parent 9b9ce80 commit 12c7a69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { DecoratorUtils } from "@multiversx/sdk-nestjs-common/lib/utils/decorator.utils";

export class DisableFieldsInterceptorOnControllerOptions { }

export const DisableFieldsInterceptorOnController = DecoratorUtils.registerClassDecorator(DisableFieldsInterceptorOnControllerOptions, {});
1 change: 1 addition & 0 deletions packages/http/src/interceptors/entities/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './disable.fields.interceptor';
export * from './disable.fields.interceptor.on.controller';
4 changes: 2 additions & 2 deletions packages/http/src/interceptors/fields.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DecoratorUtils } from "@multiversx/sdk-nestjs-common";
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from "@nestjs/common";
import { Observable } from "rxjs";
import { map } from 'rxjs/operators';
import { DisableFieldsInterceptorOptions } from "./entities";
import { DisableFieldsInterceptorOnControllerOptions, DisableFieldsInterceptorOptions } from "./entities";

@Injectable()
export class FieldsInterceptor implements NestInterceptor {
Expand All @@ -18,7 +18,7 @@ export class FieldsInterceptor implements NestInterceptor {
return next.handle();
}

const disableFieldsInterceptorClassMetadata = DecoratorUtils.getClassDecorator(DisableFieldsInterceptorOptions, context.getClass());
const disableFieldsInterceptorClassMetadata = DecoratorUtils.getClassDecorator(DisableFieldsInterceptorOnControllerOptions, context.getClass());
if (disableFieldsInterceptorClassMetadata) {
return next.handle();
}
Expand Down

0 comments on commit 12c7a69

Please sign in to comment.