-
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.
Merge pull request #409 from sparcs-kaist/dev
Main branch update from Dev branch
- Loading branch information
Showing
10 changed files
with
100 additions
and
39 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const { eventStatusModel } = require("../modules/stores/mongo"); | ||
const logger = require("../../modules/logger"); | ||
|
||
/** | ||
* ์ฌ์ฉ์๊ฐ ์ฐจ๋จ ๋์๋์ง ์ฌ๋ถ๋ฅผ ํ๋จํฉ๋๋ค. | ||
* ์ฐจ๋จ๋ ์ฌ์ฉ์๋ ์ด๋ฒคํธ์ ํํ์ฌ ์๋น์ค ์ด์ฉ์ ์ ์ฌ๋ฅผ ๋ฐ์ต๋๋ค. | ||
* @param {*} req eventStatus๊ฐ ์ฑ๊ณต์ ์ผ ๊ฒฝ์ฐ req.eventStatus = eventStatus๋ก ๋ค์ด๊ฐ๋๋ค. | ||
* @param {*} res | ||
* @param {*} next | ||
* @returns | ||
*/ | ||
const checkBanned = async (req, res, next) => { | ||
try { | ||
const eventStatus = await eventStatusModel | ||
.findOne({ userId: req.userOid }) | ||
.lean(); | ||
if (!eventStatus) { | ||
return res | ||
.status(400) | ||
.json({ error: "checkBanned: nonexistent eventStatus" }); | ||
} | ||
if (eventStatus.isBanned) { | ||
return res.status(400).json({ error: "checkBanned: banned user" }); | ||
} | ||
req.eventStatus = eventStatus; | ||
next(); | ||
} catch (err) { | ||
logger.error(err); | ||
res.error(500).json({ | ||
error: "checkBanned: internal server error", | ||
}); | ||
} | ||
}; | ||
|
||
module.exports = checkBanned; |
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
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
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