Skip to content

Commit

Permalink
fix: 친바 리뉴얼로 인한 12월 로테이션 임시대응
Browse files Browse the repository at this point in the history
  • Loading branch information
not-using committed Dec 21, 2023
1 parent 53341c3 commit 4f7ba04
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
8 changes: 8 additions & 0 deletions src/constants/decemberRotation.js
Original file line number Diff line number Diff line change
@@ -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'],
};
13 changes: 2 additions & 11 deletions src/services/shift.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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}`)
Expand Down

0 comments on commit 4f7ba04

Please sign in to comment.