From 4f7ba046dc7dd78e01ba677a77fd2227a430b2fa Mon Sep 17 00:00:00 2001 From: sujikim Date: Fri, 22 Dec 2023 08:51:58 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=B9=9C=EB=B0=94=20=EB=A6=AC=EB=89=B4?= =?UTF-8?q?=EC=96=BC=EB=A1=9C=20=EC=9D=B8=ED=95=9C=2012=EC=9B=94=20?= =?UTF-8?q?=EB=A1=9C=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=9E=84=EC=8B=9C?= =?UTF-8?q?=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/decemberRotation.js | 8 ++++++++ src/services/shift.js | 13 ++----------- 2 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 src/constants/decemberRotation.js diff --git a/src/constants/decemberRotation.js b/src/constants/decemberRotation.js new file mode 100644 index 0000000..72c5360 --- /dev/null +++ b/src/constants/decemberRotation.js @@ -0,0 +1,8 @@ +export const decemberRotation = { + '2023-12-22': ['gychoi', 'minjeeki'], + '2023-12-23': ['yena'], + '2023-12-26': ['danpark', 'kko'], + '2023-12-27': ['jihwjeon', 'jimin'], + '2023-12-28': ['hyeonjun', 'sejokim'], + '2023-12-29': ['euiclee', 'hyeonjan'], +}; diff --git a/src/services/shift.js b/src/services/shift.js index c2a276d..58e9cc2 100644 --- a/src/services/shift.js +++ b/src/services/shift.js @@ -1,3 +1,4 @@ +import { decemberRotation } from '../constants/decemberRotation.js'; import { SHIFT, SHIFT_WEEKEND } from '../constants/events.js'; import { TOGETHER_RANGE } from '../constants/sheet.js'; import { confirmMessage } from '../messages/confirmMessage.js'; @@ -17,22 +18,12 @@ export const sendShiftConfirmation = async () => { today.slice(5, 10) ); - const todayLibrarians = await getTodayLibrariansFromTogether(today); + const todayLibrarians = decemberRotation[today]; const todayLibrariansId = await getLibrariansIdFromSheet(todayLibrarians); await Promise.all(todayLibrariansId.map((id) => sendBlocks(id, message))); }; -const getTodayLibrariansFromTogether = async (today) => { - const ratations = await httpClientForTogether - .get('/', { params: { month: new Date().getMonth() + 1 } }) - .then((response) => response.data); - - return ratations - .filter((ratation) => ratation.date.includes(today)) - .map((ratation) => ratation.intraId); -}; - const getLibrariansIdFromSheet = async (targets) => { const librarians = await httpClientForSheet .get(`/${TOGETHER_RANGE}`)