0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-13 04:22:40 +00:00

Removing invalid brews is working

This commit is contained in:
Scott Tolksdorf
2017-01-10 17:20:33 -05:00
parent 0878439750
commit 728277f861
8 changed files with 159 additions and 28 deletions

View File

@@ -93,21 +93,6 @@ const BrewData = {
return BrewData.get({ editId });
},
//Removes all empty brews that are older than 3 days and that are shorter than a tweet
removeInvalid : (force = false) => {
const invalidBrewQuery = Brew.find({
'$where' : "this.text.length < 140",
createdAt: {
$lt: Moment().subtract(3, 'days').toDate()
}
});
if(force) return invalidBrewQuery.remove().exec();
return invalidBrewQuery.exec()
.then((objs) => {
return objs.length;
});
},
search : (query, req={}) => {
//defaults with page and count
//returns a non-text version of brews