add app interceptor
This commit is contained in:
parent
778248b16f
commit
91dcac731d
@ -1,6 +1,8 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
import { APP_PIPE } from '@nestjs/core';
|
||||
import { APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core';
|
||||
|
||||
import { AppInterceptor } from '@/modules/core/providers/app.interceptor';
|
||||
|
||||
import { database } from './config';
|
||||
|
||||
@ -17,6 +19,10 @@ import { DatabaseModule } from './modules/database/database.module';
|
||||
provide: APP_PIPE,
|
||||
useValue: new AppPipe(DEFAULT_VALIDATION_CONFIG),
|
||||
},
|
||||
{
|
||||
provide: APP_INTERCEPTOR,
|
||||
useClass: AppInterceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
export class AppModule {}
|
||||
|
@ -9,15 +9,11 @@ import {
|
||||
Post,
|
||||
Query,
|
||||
SerializeOptions,
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common';
|
||||
|
||||
import { AppInterceptor } from '@/modules/core/providers/app.interceptor';
|
||||
|
||||
import { CreateCategoryDto, QueryCategoryDto, UpdateCategoryDto } from '../dtos/category.dto';
|
||||
import { CategoryService } from '../services';
|
||||
|
||||
@UseInterceptors(AppInterceptor)
|
||||
@Controller('category')
|
||||
export class CategoryController {
|
||||
constructor(protected service: CategoryService) {}
|
||||
|
@ -8,16 +8,12 @@ import {
|
||||
Post,
|
||||
Query,
|
||||
SerializeOptions,
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common';
|
||||
|
||||
import { AppInterceptor } from '@/modules/core/providers/app.interceptor';
|
||||
|
||||
import { CreateCommentDto, QueryCommentDto, QueryCommentTreeDto } from '../dtos/comment.dto';
|
||||
import { CommentService } from '../services';
|
||||
|
||||
@Controller('comment')
|
||||
@UseInterceptors(AppInterceptor)
|
||||
export class CommentController {
|
||||
constructor(protected service: CommentService) {}
|
||||
|
||||
|
@ -9,14 +9,11 @@ import {
|
||||
Post,
|
||||
Query,
|
||||
SerializeOptions,
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common';
|
||||
|
||||
import { CreatePostDto, QueryPostDto, UpdatePostDto } from '@/modules/content/dtos/post.dto';
|
||||
import { PostService } from '@/modules/content/services/post.service';
|
||||
import { AppInterceptor } from '@/modules/core/providers/app.interceptor';
|
||||
|
||||
@UseInterceptors(AppInterceptor)
|
||||
@Controller('posts')
|
||||
export class PostController {
|
||||
constructor(private postService: PostService) {}
|
||||
|
@ -9,16 +9,12 @@ import {
|
||||
Post,
|
||||
Query,
|
||||
SerializeOptions,
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common';
|
||||
|
||||
import { AppInterceptor } from '@/modules/core/providers/app.interceptor';
|
||||
|
||||
import { CreateTagDto, QueryTagDto, UpdateTagDto } from '../dtos/tag.dto';
|
||||
import { TagService } from '../services';
|
||||
|
||||
@Controller('tag')
|
||||
@UseInterceptors(AppInterceptor)
|
||||
export class TagController {
|
||||
constructor(protected service: TagService) {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user