Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add slack monitoring constants #408

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion functions/api/routes/post/postPOST.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ const { postType, notificationType } = require("../../../constants/type");
const pushAlarmHandlers = require("../../../lib/pushAlarmHandlers");
const errorHandlers = require("../../../lib/errorHandlers");
const slackAPI = require("../../../middlewares/slackAPI");
const {
MONITORING_USERS_GROUP1_FROM,
MONITORING_USERS_GROUP1_TO,
MONITORING_USERS_GROUP2_FROM,
MONITORING_USERS_GROUP2_TO,
} = require("../../../constants/slackMonitoring");

module.exports = async (req, res) => {
const { type, majorId, answererId, title, content } = req.body;
Expand Down Expand Up @@ -158,7 +164,10 @@ module.exports = async (req, res) => {
}

// 더미 데이터에 1:1 질문 들어왔을 경우 슬랙에 메세지 전송
if ((answererId >= 1 && answererId <= 63) || (answererId >= 692 && answererId <= 798)) {
if (
(answererId >= MONITORING_USERS_GROUP1_FROM && answererId <= MONITORING_USERS_GROUP1_TO) ||
(answererId >= MONITORING_USERS_GROUP2_FROM && answererId <= MONITORING_USERS_GROUP2_TO)
) {
const [answerer, university] = await Promise.all([
userDB.getUserByUserId(client, answererId),
universityDB.getNameByMajorId(client, majorId),
Expand Down
11 changes: 11 additions & 0 deletions functions/constants/slackMonitoring.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const MONITORING_USERS_GROUP1_FROM = 1;
const MONITORING_USERS_GROUP1_TO = 63;
const MONITORING_USERS_GROUP2_FROM = 692;
const MONITORING_USERS_GROUP2_TO = 798;

module.exports = {
MONITORING_USERS_GROUP1_FROM,
MONITORING_USERS_GROUP1_TO,
MONITORING_USERS_GROUP2_FROM,
MONITORING_USERS_GROUP2_TO,
};