Skip to content

Commit

Permalink
modify/#66: modify swagger docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hobiJeong committed Dec 10, 2023
1 parent 03b1b82 commit 891a19f
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/apis/notice-posts/controllers/notice-posts.swagger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HttpStatus, applyDecorators } from '@nestjs/common';
import { ApiBearerAuth, ApiOperation, ApiProperty } from '@nestjs/swagger';
import { ApiBearerAuth, ApiOperation, ApiResponse } from '@nestjs/swagger';
import { OperationObject } from '@nestjs/swagger/dist/interfaces/open-api-spec.interface';
import { COMMON_ERROR_CODE } from '@src/constants/error/common/common-error-code.constant';
import { HttpException } from '@src/http-exceptions/exceptions/http.exception';
Expand Down Expand Up @@ -109,7 +109,7 @@ export const ApiNoticePost: ApiOperator<keyof NoticePostsController> = {
Partial<OperationObject>,
): PropertyDecorator => {
return applyDecorators(
ApiProperty({
ApiOperation({
operationId: 'NoticePostPutUpdate',
...apiOperationOptions,
}),
Expand Down Expand Up @@ -147,7 +147,7 @@ export const ApiNoticePost: ApiOperator<keyof NoticePostsController> = {
Partial<OperationObject>,
): PropertyDecorator => {
return applyDecorators(
ApiProperty({
ApiOperation({
operationId: 'NoticePostPatchUpdate',
...apiOperationOptions,
}),
Expand Down Expand Up @@ -185,7 +185,7 @@ export const ApiNoticePost: ApiOperator<keyof NoticePostsController> = {
Partial<OperationObject>,
): PropertyDecorator => {
return applyDecorators(
ApiProperty({
ApiOperation({
operationId: 'NoticePostRemove',
...apiOperationOptions,
}),
Expand Down Expand Up @@ -220,15 +220,11 @@ export const ApiNoticePost: ApiOperator<keyof NoticePostsController> = {
Partial<OperationObject>,
): PropertyDecorator => {
return applyDecorators(
ApiProperty({
ApiOperation({
operationId: 'NoticePostIncreaseHit',
...apiOperationOptions,
}),
DetailResponseDto.swaggerBuilder(
HttpStatus.OK,
'noticePost',
NoticePostDto,
),
ApiResponse({ status: HttpStatus.NO_CONTENT }),
HttpException.swaggerBuilder(
HttpStatus.BAD_REQUEST,
[COMMON_ERROR_CODE.INVALID_REQUEST_PARAMETER],
Expand All @@ -238,6 +234,12 @@ export const ApiNoticePost: ApiOperator<keyof NoticePostsController> = {
type: ValidationError,
},
),
HttpException.swaggerBuilder(HttpStatus.NOT_FOUND, [
COMMON_ERROR_CODE.RESOURCE_NOT_FOUND,
]),
HttpException.swaggerBuilder(HttpStatus.INTERNAL_SERVER_ERROR, [
COMMON_ERROR_CODE.SERVER_ERROR,
]),
);
},
};

0 comments on commit 891a19f

Please sign in to comment.