Skip to content

Commit

Permalink
fix: 레거시 서비스 제거
Browse files Browse the repository at this point in the history
- WebPush, 우산대여제
  • Loading branch information
SkyLightQP committed Aug 18, 2021
1 parent 8e5d2f3 commit a809235
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 324 deletions.
38 changes: 0 additions & 38 deletions src/cron.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,12 @@
import { schedule } from 'node-cron';
import Rentals from './databases/models/rentals';
import { setExpire } from './services/rental-service';
import { logger } from './index';
import { getUsers } from './services/auth-service';
import { sendPushWithTopic } from './services/fcm-service';
import timetableParser from './managers/timetable-parser';
import { CalendarCache, DustCache, MealCache, WeatherCache } from './cache';

export default (): void => {
// 4시간 주기
schedule('0 */4 * * *', async () => {
logger.info('우산 연체 여부를 확인합니다.');

const now = Math.floor(new Date().getTime() / 1000);
const current = await Rentals.findAll({
where: {
isExpire: false
}
});

let count = 0;
const promise = current.map(async (info) => {
const time = Math.floor(info.expiryDate.getTime() / 1000);
if (now >= time) {
await setExpire(info.uuid);
count += 1;
}
});

await Promise.all(promise);
logger.info(`우산 ${count}개가 연체되었습니다.`);

await timetableParser.fetchTimetable();
logger.info('시간표를 새롭게 불러옵니다.');
});
Expand Down Expand Up @@ -74,18 +50,4 @@ export default (): void => {
logger.error(e);
}
});

// 평일 오전 8시
schedule('0 8 * * 1-5', async () => {
await sendPushWithTopic(
'all',
{
title: '건강상태 자가진단',
body: '오늘의 건강상태 자가진단을 참여해주세요.'
},
'https://hcs.eduro.go.kr/'
);

logger.info('건강상태 자가진단 푸시 알림을 보냈습니다.');
});
};
5 changes: 0 additions & 5 deletions src/databases/association.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Users from './models/users';
import Rentals from './models/rentals';
import Umbrellas from './models/umbrellas';
import Permissions from './models/permissions';
import FCM from './models/fcm';
import AnonymousReply from './models/anonymous-reply';
import Anonymous from './models/anonymous';

Expand All @@ -19,10 +18,6 @@ const databaseAssociation = (): void => {
Umbrellas.hasOne(Rentals, { foreignKey: 'umbrellaName' });
Rentals.belongsTo(Users, { foreignKey: 'umbrellaName' });

// Users, FCM 1:1
Users.hasOne(FCM, { foreignKey: 'uuid' });
FCM.belongsTo(Users, { foreignKey: 'uuid' });

// Anonymous, AnonymousReply 1:N
Anonymous.hasMany(AnonymousReply, { foreignKey: 'originId', as: 'reply' });
AnonymousReply.belongsTo(Anonymous, { foreignKey: 'originId' });
Expand Down
35 changes: 0 additions & 35 deletions src/databases/models/fcm.ts

This file was deleted.

130 changes: 0 additions & 130 deletions src/routers/fcm-router.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/routers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import WeatherRouter from './weather-router';
import NoticeRouter from './notice-router';
import CodeRouter from './activation-code-router';
import TimetableRouter from './timetable-router';
import FCMRouter from './fcm-router';
import AnonymousRouter from './anonymous-router';

const router = express.Router();
Expand All @@ -22,7 +21,6 @@ router.use('/weather', WeatherRouter);
router.use('/notice', NoticeRouter);
router.use('/code', CodeRouter);
router.use('/timetable', TimetableRouter);
router.use('/fcm', FCMRouter);
router.use('/anonymous', AnonymousRouter);

export default router;
114 changes: 0 additions & 114 deletions src/services/fcm-service.ts

This file was deleted.

0 comments on commit a809235

Please sign in to comment.