Skip to content

Commit

Permalink
docs: add question enhancement API swagger
Browse files Browse the repository at this point in the history
Co-authored-by: shl0501 <[email protected]>
Co-authored-by: 유영재 <[email protected]>
  • Loading branch information
3 people committed Feb 4, 2025
1 parent af6e207 commit 9952d26
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions apps/server/src/ai/ai.controller.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { Body, Controller, Post, UseGuards } from '@nestjs/common';
import { ApiBody } from '@nestjs/swagger';

import { AiService } from './ai.service';
import { ImproveQuestionDto } from './dto/improve-question.dto';
import { ImproveQuestionSwagger } from './swagger/improve-question.swagger';

import { SessionTokenValidationGuard } from '@common/guards/session-token-validation.guard';
@Controller('ai')
export class AiController {
constructor(private readonly aiService: AiService) {}

@Post('question-improve')
@ImproveQuestionSwagger()
@ApiBody({ type: ImproveQuestionDto })
@UseGuards(SessionTokenValidationGuard)
public async improveQuestion(@Body() improveQuestionDto: ImproveQuestionDto) {
const { body: userContent } = improveQuestionDto;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/ai/dto/improve-question.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BaseDto } from '@common/base.dto';

export class ImproveQuestionDto extends BaseDto {
@ApiProperty({
example: '이것은 질문의 내용입니다.',
example: '리마큐가 뭐임?',
description: '질문 본문 내용',
required: true,
})
Expand Down
Empty file.
18 changes: 18 additions & 0 deletions apps/server/src/ai/swagger/improve-question.swagger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { applyDecorators } from '@nestjs/common';
import { ApiOperation, ApiResponse } from '@nestjs/swagger';

export const ImproveQuestionSwagger = () =>
applyDecorators(
ApiOperation({ summary: '질문 개선' }),
ApiResponse({
status: 201,
description: '질문 개선 성공',
schema: {
example: {
result: {
question: '리마큐(Remacu)란 무엇인가요?',
},
},
},
}),
);

0 comments on commit 9952d26

Please sign in to comment.