Skip to content

Commit

Permalink
feat: 馃幐 add api header
Browse files Browse the repository at this point in the history
  • Loading branch information
yeukfei02 committed Apr 21, 2022
1 parent 5848d36 commit fe1b4d0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/comment/comment.controller.ts
Expand Up @@ -12,14 +12,18 @@ import { CommentService } from './comment.service';
import { CreateCommentDto } from './dto/createComment.dto';
import { UpdateCommentDto } from './dto/updateComment.dto';

import { ApiBearerAuth, ApiResponse } from '@nestjs/swagger';
import { ApiBearerAuth, ApiHeader, ApiResponse } from '@nestjs/swagger';
import { CreateCommentResponse } from './response/createComment.response';
import { GetCommentsResponse } from './response/getComments.response';
import { GetCommentByIdResponse } from './response/getCommentById.response';
import { UpdateCommentByIdResponse } from './response/updateCommentById.response';
import { DeleteCommentByIdResponse } from './response/deleteCommentById.response';

@ApiBearerAuth()
@ApiHeader({
name: 'Authorization',
description: 'Jwt Token',
})
@Controller('comment')
export class CommentController {
constructor(private readonly commentService: CommentService) {}
Expand Down
6 changes: 5 additions & 1 deletion src/location/location.controller.ts
Expand Up @@ -2,11 +2,15 @@ import { Controller, Post, Get, Body, Query } from '@nestjs/common';
import { LocationService } from './location.service';
import { CreateLocationDto } from './dto/createLocation.dto';

import { ApiBearerAuth, ApiResponse } from '@nestjs/swagger';
import { ApiBearerAuth, ApiHeader, ApiResponse } from '@nestjs/swagger';
import { CreateLocationResponse } from './response/createLocation.response';
import { GetLocationsResponse } from './response/getLocations.response';

@ApiBearerAuth()
@ApiHeader({
name: 'Authorization',
description: 'Jwt Token',
})
@Controller('location')
export class LocationController {
constructor(private readonly locationService: LocationService) {}
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Expand Up @@ -15,7 +15,7 @@ async function bootstrap() {
const config = new DocumentBuilder()
.setTitle('dummy-api')
.setDescription('dummy-api documentation')
.setVersion('1.0')
.setVersion(process.env.npm_package_version || '1.0')
.addTag('dummy-api')
.addBearerAuth()
.build();
Expand Down
6 changes: 5 additions & 1 deletion src/post/post.controller.ts
Expand Up @@ -12,14 +12,18 @@ import { PostService } from './post.service';
import { CreatePostDto } from './dto/createPost.dto';
import { UpdatePostDto } from './dto/updatePost.dto';

import { ApiBearerAuth, ApiResponse } from '@nestjs/swagger';
import { ApiBearerAuth, ApiHeader, ApiResponse } from '@nestjs/swagger';
import { CreatePostResponse } from './response/createPost.response';
import { GetPostsResponse } from './response/getPosts.response';
import { GetPostByIdResponse } from './response/getPostById.response';
import { UpdatePostByIdResponse } from './response/updatePostById.response';
import { DeletePostByIdResponse } from './response/deletePostById.response';

@ApiBearerAuth()
@ApiHeader({
name: 'Authorization',
description: 'Jwt Token',
})
@Controller('post')
export class PostController {
constructor(private readonly postService: PostService) {}
Expand Down
6 changes: 5 additions & 1 deletion src/tag/tag.controller.ts
Expand Up @@ -2,11 +2,15 @@ import { Controller, Post, Get, Body, Query } from '@nestjs/common';
import { TagService } from './tag.service';
import { CreateTagDto } from './dto/createTag.dto';

import { ApiBearerAuth, ApiResponse } from '@nestjs/swagger';
import { ApiBearerAuth, ApiHeader, ApiResponse } from '@nestjs/swagger';
import { CreateTagResponse } from './response/createTag.response';
import { GetTagsResponse } from './response/getTags.response';

@ApiBearerAuth()
@ApiHeader({
name: 'Authorization',
description: 'Jwt Token',
})
@Controller('tag')
export class TagController {
constructor(private readonly tagService: TagService) {}
Expand Down
6 changes: 5 additions & 1 deletion src/user/user.controller.ts
Expand Up @@ -12,14 +12,18 @@ import { UserService } from './user.service';
import { CreateUserDto } from './dto/createUser.dto';
import { UpdateUserDto } from './dto/updateUser.dto';

import { ApiBearerAuth, ApiResponse } from '@nestjs/swagger';
import { ApiBearerAuth, ApiHeader, ApiResponse } from '@nestjs/swagger';
import { CreateUserResponse } from './response/createUser.response';
import { GetUsersResponse } from './response/getUsers.response';
import { GetUserByIdResponse } from './response/getUserById.response';
import { UpdateUserByIdResponse } from './response/updateUserById.response';
import { DeleteUserByIdResponse } from './response/deleteUserById.response';

@ApiBearerAuth()
@ApiHeader({
name: 'Authorization',
description: 'Jwt Token',
})
@Controller('users')
export class UserController {
constructor(private readonly userService: UserService) {}
Expand Down

0 comments on commit fe1b4d0

Please sign in to comment.