summaryrefslogtreecommitdiff
path: root/src/services/events/event.service.js
blob: 45aebd3f3640f68718c424672c38aefbeb4fff97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const { Scheduler } = require('mongo-cronjob');
const service = require('feathers-mongoose');
const handleAttendClassJob = require('../../handlers');
const Model = require('./models.js').Event;

const handleTestJob = () => new Promise(res => setTimeout(res, 10000));


module.exports = app => {
  app.use('/events', service({ Model }));

  const scheduler = new Scheduler(Model);
  scheduler.registerHandler('class', handleAttendClassJob);
  scheduler.registerHandler('test', handleTestJob);
};