-
Notifications
You must be signed in to change notification settings - Fork 3
/
deleteTweets.js
30 lines (23 loc) · 962 Bytes
/
deleteTweets.js
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
28
29
30
require("dotenv").config();
const Tweet = require("./models/Tweet.schema");
const Contact = require("./models/Contact.schema");
const fraud = require("./models/Fraud.schema");
//const analytics = require("./analytics");
// const Mixpanel = require('mixpanel');
// var analytics = Mixpanel.init(process.env.ANALYTICS_KEY);
const deleteTweets = async () => {};
const deleteFraud = async () => {
let fraudNums = await fraud.find({});
//make an array of all fraud numbers
let arr = [];
for (let num of fraudNums) {
arr.push(String(num.phone_no));
}
let tSum = await Tweet.deleteMany({ phone: { $in: arr } });
let cSum = await Contact.deleteMany({ contact_no: { $in: arr } });
console.log("Routine fraud delete summary : ");
console.log("Tweet summary : ", tSum);
console.log("contacts summary : ", cSum);
//analytics.track("Routine fraud delete triggered",delSummary.deletedCount);
};
module.exports = { deleteTweets, deleteFraud };