48 lines
721 B
JavaScript
48 lines
721 B
JavaScript
// index.js
|
|
const express = require('express');
|
|
const app = express();
|
|
const cron = require('node-cron')
|
|
|
|
|
|
app.get('/send-target-reports', (req, res) => {
|
|
console.log('Sending target reports to sales executives');
|
|
res.send('Target reports sent successfully');
|
|
});
|
|
|
|
app.listen(3000, () => {
|
|
console.log('Server is running on port 3000');
|
|
});
|
|
|
|
cron.schedule('* * * * *', () => {
|
|
fetchCalendar()
|
|
|
|
})
|
|
|
|
|
|
/**
|
|
* calendars
|
|
* - from
|
|
* - to
|
|
* - fetch
|
|
* - last_fetch
|
|
*/
|
|
|
|
const fetchCalendar = () => {
|
|
console.log('fetchCalendar');
|
|
|
|
/**
|
|
* upsert records
|
|
* soft delete
|
|
* analyze calendar
|
|
*/
|
|
}
|
|
|
|
const analyzeCalendar = () => {
|
|
/**
|
|
* tag
|
|
* start
|
|
* end
|
|
*/
|
|
}
|
|
|