import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
import { Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
import { UseInterceptorFor } from '@gadmin2/nest-common';
import { <%= classify(name) %>Controller } from '../../generated/<%= name %>/<%= name %>.controller';

<% if (method) { %>@UseInterceptorFor(<%= classify(name) %>Controller, '<%= method %>')<% } else { %>@UseInterceptorFor(<%= classify(name) %>Controller)<% } %>
export class <%= classify(name) %><% if (method) { %><%= classify(method) %><% } %>Interceptor implements NestInterceptor {
  intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
    console.log('Before...');
    return next.handle().pipe(tap((val) => console.log(`After...`, val)));
  }
}
