small fixes for db logic

This commit is contained in:
Wyatt Johnson
2018-04-19 09:21:12 -06:00
parent 0e2a37ac91
commit b60e62f976
+4 -4
View File
@@ -237,7 +237,9 @@ class Users {
static async setUsername(id, username, assignedBy) {
try {
const oldestEditTime = moment().subtract(14, 'days');
const oldestEditTime = moment()
.subtract(14, 'days')
.toDate();
// A username can be set if:
//
@@ -252,9 +254,7 @@ class Users {
{
'status.username.status': { $in: ['APPROVED', 'SET'] },
'status.username.history.created_at': {
$not: {
$gte: oldestEditTime,
},
$lte: oldestEditTime,
},
},
],