-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdailySearchReportJob.js
More file actions
executable file
·27 lines (22 loc) · 1 KB
/
dailySearchReportJob.js
File metadata and controls
executable file
·27 lines (22 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'use strict'
let moment = require("moment");
let db = require('./database'); //Connexão com DynamoDB
console.log(db);
const SearchSummary = require('./entities/searchsummaries/SearchSummaries');
// return searchsummaries 2 days before
let findSearchesTwoDaysBefore = function () {
return new Promise((resolve) => {
let minDateTwoDays = moment().subtract(2, 'day').startOf('day').toDate().toISOString();
let maxDateTwoDays = moment().subtract(2, 'day').endOf('day').toDate().toISOString();
SearchSummary.scan('created_at').between(minDateTwoDays, maxDateTwoDays).exec()
.then(function (searchsummary) {
console.log(searchsummary);
resolve(searchsummary);
})
.catch(function (err) {
console.error('err', err);
});
})
};
findSearchesTwoDaysBefore();
//dailySearches();