diff --git a/src/db/data/handler.ts b/src/db/data/handler.ts index 9b76d047..94107e64 100644 --- a/src/db/data/handler.ts +++ b/src/db/data/handler.ts @@ -82,7 +82,7 @@ export const saveNoticeToDB = async (): Promise => { : college.departmentSubName; if (noticeLists.pinnedNotice !== undefined) { - const pinnedNotiQuery = `SELECT link FROM ${major}고정 ORDER BY uploadDate DESC LIMIT 1;`; + const pinnedNotiQuery = `SELECT link FROM ${major}고정 ORDER BY STR_TO_DATE(uploadDate, '%Y-%m-%d') DESC LIMIT 1;`; let pinnedNotiLink = ''; db.query(pinnedNotiQuery, async (err, res) => { if (err) { @@ -101,7 +101,7 @@ export const saveNoticeToDB = async (): Promise => { }); } - const normalNotiQuery = `SELECT link FROM ${major}일반 ORDER BY uploadDate DESC LIMIT 1;`; + const normalNotiQuery = `SELECT link FROM ${major}일반 ORDER BY STR_TO_DATE(uploadDate, '%Y-%m-%d') DESC LIMIT 1;`; let normalNotiLink = ''; db.query(normalNotiQuery, async (err, res) => { if (err) { @@ -134,7 +134,7 @@ const saveSchoolNotice = async ( notices: string[], mode: string, ): Promise[]> => { - const query = `SELECT link FROM 학교${mode} ORDER BY uploadDate DESC LIMIT 1;`; + const query = `SELECT link FROM 학교${mode} ORDER BY STR_TO_DATE(uploadDate, '%Y-%m-%d') DESC LIMIT 1;`; try { const res = await new Promise((resolve, reject) => { db.query(query, (err, res) => {