-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [FEAT] 커뮤니티 게시글 신고하기 validator 구현 * [DOCS] 커뮤니티 게시글 신고하기 response message 추가 * [FEAT] 커뮤니티 게시글 신고하기 query 작성 * [FEAT] 커뮤니티 게시글 신고하기 controller 구현 * [CHORE] validator id 최솟값 1로 변경
- Loading branch information
Showing
5 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
const util = require('../../../lib/util'); | ||
const statusCode = require('../../../constants/statusCode'); | ||
const responseMessage = require('../../../constants/responseMessage'); | ||
const db = require('../../../db/db'); | ||
const { communityDB } = require('../../../db'); | ||
const asyncWrapper = require('../../../lib/asyncWrapper'); | ||
|
||
/** | ||
* @route POST /community/reports | ||
* @desc 커뮤니티 게시글 신고 | ||
* @access Private | ||
*/ | ||
|
||
module.exports = async (req, res) => { | ||
module.exports = asyncWrapper(async (req, res) => { | ||
const { userId } = req.user; | ||
const { communityPostId } = req.body; | ||
}; | ||
|
||
const dbConnection = await db.connect(req); | ||
req.dbConnection = dbConnection; | ||
|
||
const communityPostReport = await communityDB.reportCommunityPost(dbConnection, userId, communityPostId); | ||
if (!communityPostReport) { | ||
return res.status(statusCode.BAD_REQUEST).send(util.fail(statusCode.BAD_REQUEST, responseMessage.NO_COMMUNITY_POST)) | ||
} | ||
|
||
res.status(statusCode.CREATED).send(util.success(statusCode.CREATED, responseMessage.REPORT_COMMUNITY_POST_SUCCESS)) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters