Skip to content

Commit

Permalink
Merge pull request #167 from GDSC-PKNU-Official/fix/#166
Browse files Browse the repository at this point in the history
Fix/#166: 채용 공지사항 데이터 반환 시 클라이언트가 필요로 하는 데이터를 반환하도록 수정
  • Loading branch information
pp449 authored Jan 7, 2024
2 parents 80116a7 + 2fa6e94 commit 0a1c97a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/apis/notice/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import notificationToSlack from 'src/hooks/notificateToSlack';
import { getDepartmentIdByMajor } from 'src/utils/majorUtils';

interface SeparateNoti {
고정: ResponseNotice[] | Notices[];
일반: ResponseNotice[] | Notices[];
고정: ResponseNotice[] | Notices[] | RecruitData[];
일반: ResponseNotice[] | Notices[] | RecruitData[];
}

export interface ResponseNotice {
Expand Down Expand Up @@ -98,14 +98,18 @@ export const getLanguage = async (): Promise<SeparateNoti> => {
return notices;
};

export const getRecruit = async (): Promise<RecruitData[]> => {
export const getRecruit = async (): Promise<SeparateNoti> => {
const query = 'SELECT * FROM recruit_notices;';
const recruitNotices = await selectQuery<RecruitData[]>(query);
recruitNotices.sort(
(notice1, notice2) =>
new Date(notice2.recruitment_period.split('~')[0]).getTime() -
new Date(notice1.recruitment_period.split('~')[0]).getTime(),
);
const notices: SeparateNoti = {
일반: recruitNotices,
고정: [],
};

return recruitNotices;
return notices;
};
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const handleDeployToServer = async () => {
// 이 함수는 현재 배포되어있는 서버를 위해 사용되는 로직이며 최초 서버에 배포되는 1회만 실행되도록 하기위한 함수에요
// 그렇기에 아래에 작성된 코드들은 배포서버에 배포되면 다음 배포전 수정해주세요!!
// 전공 관련 크롤링
await saveMajorNoticeToDB();
};

handleDeployToServer();
// handleDeployToServer();

0 comments on commit 0a1c97a

Please sign in to comment.