From d5979d6007266ceea52bda6a349c0e29eb4f738f Mon Sep 17 00:00:00 2001 From: Lee sang Yeop Date: Sun, 24 Sep 2023 10:40:53 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=EC=BA=90=EB=9F=AC=EC=85=80=EC=97=90=20?= =?UTF-8?q?=EB=93=A4=EC=96=B4=EA=B0=80=EB=8A=94=20=EC=9B=A8=EC=9D=BC?= =?UTF-8?q?=EB=B9=84=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EB=8A=94=20=EB=AA=A8?= =?UTF-8?q?=EC=A7=91=EA=B8=B0=EA=B0=84=EC=9D=B4=20=EB=82=A8=EC=95=84?= =?UTF-8?q?=EC=9E=88=EB=8A=94=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B5=9C?= =?UTF-8?q?=EB=8C=80=207=EA=B0=9C=EB=A1=9C=20=EC=A0=9C=ED=95=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/notice/service.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/apis/notice/service.ts b/src/apis/notice/service.ts index ec521390..cb6718f6 100644 --- a/src/apis/notice/service.ts +++ b/src/apis/notice/service.ts @@ -50,7 +50,16 @@ export const getWhalebe = async (): Promise => { return new Promise((resolve) => { db.query(query, (err, res) => { if (err) notificationToSlack('웨일비 조회 실패'); - resolve(res as WhalebeData[]); + const whalebeData = res as WhalebeData[]; + const today = new Date(); + const todayString = `${today.getFullYear()}-${String( + today.getMonth() + 1, + ).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`; + + const filteredData = whalebeData + .filter((data) => data.date >= todayString) + .slice(0, 7); + resolve(filteredData); }); }); };