mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
* upgrade gulp-babel * upgrade babel-eslint * upgrade eslint-friendly-formatter * start upgrading chai * start to upgrade eslint * restore skipped tests * start to upgrqde monk * fix linting and remove unused file * fix mocha notifications, and common tests * fix unit tests * start to fix initrgration tests * more integration tests fixes * upgrade monk to latest version * lint /scripts * migrations: start moving to /archive unused migrations and run eslint with --fix * lint migrations * fix more integration tests * fix test
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
let UserNotification = require('../../website/server/models/userNotification').model;
|
|
|
|
let _id = '';
|
|
|
|
let items = ['back_mystery_201801', 'headAccessory_mystery_201801'];
|
|
|
|
let update = {
|
|
$addToSet: {
|
|
'purchased.plan.mysteryItems': {
|
|
$each: items,
|
|
},
|
|
},
|
|
$push: {
|
|
notifications: (new UserNotification({
|
|
type: 'NEW_MYSTERY_ITEMS',
|
|
data: {
|
|
items,
|
|
},
|
|
})).toJSON(),
|
|
},
|
|
};
|
|
|
|
/* var update = {
|
|
$set:{
|
|
'purchased.plan':{
|
|
customerId: "",
|
|
dateCreated: new Date(),
|
|
dateTerminated: null,
|
|
dateUpdated:new Date(),
|
|
gemsBought: 0,
|
|
mysteryItems: [],
|
|
paymentMethod: "Paypal",
|
|
planId : "basic_earned"
|
|
}
|
|
}
|
|
};*/
|
|
|
|
if (_id) {
|
|
// singular (missing items)
|
|
db.users.update({_id}, update);
|
|
} else {
|
|
// multiple (once @ start of event)
|
|
db.users.update({
|
|
'purchased.plan.customerId': { $ne: null },
|
|
$or: [
|
|
{ 'purchased.plan.dateTerminated': { $gte: new Date() } },
|
|
{ 'purchased.plan.dateTerminated': { $exists: false } },
|
|
{ 'purchased.plan.dateTerminated': { $eq: null } },
|
|
],
|
|
}, update, { multi: true });
|
|
}
|