Skip to content

Commit 8ca5478

Browse files
committed
feat: add controller decorator
1 parent 92b2bc1 commit 8ca5478

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {
2+
applyDecorators,
3+
ClassSerializerInterceptor,
4+
Controller,
5+
SerializeOptions,
6+
UseInterceptors,
7+
} from '@nestjs/common';
8+
import { ApiTags } from '@nestjs/swagger';
9+
10+
export const ControllerDecorator = (name: string, tag?: string) => {
11+
return applyDecorators(
12+
Controller(name),
13+
UseInterceptors(ClassSerializerInterceptor),
14+
SerializeOptions({ excludeExtraneousValues: true }),
15+
ApiTags(tag || name),
16+
);
17+
};

0 commit comments

Comments
 (0)