24 lines
628 B

import Operation from '../services/operation.js'
import cron from 'node-cron'
const operation = new Operation()
export default function (fastify, opts, done) {
cron.schedule(`00 00 07 * * *`, async () => {
await operation.sanaEnter(fastify.req, fastify.reply)
});
cron.schedule(`00 00 16 * * *`, async () => {
await operation.sanaExit(fastify.req, fastify.reply)
});
cron.schedule(`*/5 * * * * *`, async () => {
await operation.test(fastify.req, fastify.reply)
});
fastify.get('/enter', operation.sanaEnter);
fastify.get('/exit', operation.sanaExit);
done();
};