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