Skip to content

Commit

Permalink
[FEAT] community 게시글 작성 swagger 명세 (#335)
Browse files Browse the repository at this point in the history
* [FEAT] community 게시글 작성 swagger 명세

* [FIX] communityPost 파일명 수정
  • Loading branch information
jokj624 authored Mar 20, 2024
1 parent b552c51 commit 6e1ea7b
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
9 changes: 9 additions & 0 deletions functions/api/routes/community/communityPostPOST.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @route POST /community/posts
* @desc 커뮤니티 게시글 작성
* @access Private
*/

module.exports = async (req, res) => {
const { communityPostId } = req.body;
};
30 changes: 30 additions & 0 deletions functions/api/routes/community/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,36 @@ router.get(
*/
);

router.post(
'/posts',
checkUser,
require('./communityPostPOST'),
/**
* #swagger.summary = "커뮤니티 글 작성"
* #swagger.requestBody = {
required: true,
content: {
"application/json": {
schema:{
$ref: "#/components/schemas/requestCreateCommunityPostSchema"
}
}
}
}
* #swagger.responses[201] = {
description: "커뮤니티 게시글 작성 성공",
content: {
"application/json": {
schema:{
$ref: "#/components/schemas/responseCreateCommunityPostSchema"
}
}
}
}
* #swagger.responses[400]
*/
);

router.post(
'/report',
checkUser,
Expand Down
20 changes: 19 additions & 1 deletion functions/constants/swagger/schemas/communitySchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,24 @@ const responseCommunityPostsSchema = {
},
};

const responseCreateCommunityPostSchema = {
$status: 201,
$success: true,
$message: '커뮤니티 게시글 작성 성공',
};

const requestCreateCommunityPostSchema = {
$communityCategoryIds: [1, 2, 3],
$title: '게시글 제목',
$body: '게시글 본문',
$contentUrl: '공유하는 콘텐츠 링크',
$contentTitle: '공유하는 콘텐츠 제목(og:title)',
contentDescription: '공유하는 콘텐츠 description(og:description)',
thumbnailUrl: '공유하는 콘텐츠 thumbnail(og:image)',
};

const responseCommunityReportSchema = {
$status: 200,
$status: 201,
$success: true,
$message: '커뮤니티 게시글 신고 성공',
};
Expand All @@ -89,6 +105,8 @@ module.exports = {
responseCommunityCategorySchema,
responseCommunityPostsDetailSchema,
responseCommunityPostsSchema,
responseCreateCommunityPostSchema,
requestCreateCommunityPostSchema,
responseCommunityReportSchema,
requestCommunityReportSchema,
};

0 comments on commit 6e1ea7b

Please sign in to comment.