mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-04-14 11:36:45 +00:00
commit deecf669d3e0b7d865a5e41ddf12611b0d25c1ac
Author: Kalista Payne <kalista@habitica.com>
Date: Wed Aug 13 17:37:41 2025 -0500
fix(background): *inside* forest witchs cottage
commit 977ebb5b7866d687727402ddaefa470932750491
Author: Kalista Payne <kalista@habitica.com>
Date: Wed Aug 13 17:08:05 2025 -0500
feat(content): October and November releases
commit fe46733a618501e688c590a9c05175f8504d3473
Author: Kalista Payne <kalista@habitica.com>
Date: Tue Aug 12 17:06:59 2025 -0500
fix(content): missing strings and release dates
commit fd4d69be71e38c8e985799369a370c50cb5230af
Author: Kalista Payne <kalista@habitica.com>
Date: Tue Aug 12 16:51:06 2025 -0500
chore(sprites): compile, update subproj
commit c055213790a32449d6bd6082168b34a1ff8e8554
Author: Kalista Payne <kalista@habitica.com>
Date: Tue Aug 12 16:49:14 2025 -0500
feat(content): September 2025 Gala and monthly
64 lines
1.5 KiB
JavaScript
64 lines
1.5 KiB
JavaScript
/* eslint-disable no-console */
|
|
import each from 'lodash/each';
|
|
import keys from 'lodash/keys';
|
|
import content from '../../website/common/script/content/index';
|
|
|
|
import { model as User } from '../../website/server/models/user';
|
|
|
|
const MIGRATION_NAME = 'full-gear';
|
|
|
|
const progressCount = 1000;
|
|
let count = 0;
|
|
|
|
/*
|
|
* Award every extant piece of equippable gear
|
|
*/
|
|
|
|
async function updateUser (user) {
|
|
count += 1;
|
|
|
|
const set = {};
|
|
|
|
set.migration = MIGRATION_NAME;
|
|
|
|
each(keys(content.gear.flat), gearItem => {
|
|
set[`items.gear.owned.${gearItem}`] = true;
|
|
});
|
|
|
|
if (count % progressCount === 0) console.warn(`${count} ${user._id}`);
|
|
|
|
return User.updateOne({ _id: user._id }, { $set: set }).exec();
|
|
}
|
|
|
|
export default async function processUsers () {
|
|
const query = {
|
|
migration: { $ne: MIGRATION_NAME },
|
|
'auth.local.username': 'ExampleHabitican',
|
|
};
|
|
|
|
const fields = {
|
|
_id: 1,
|
|
};
|
|
|
|
while (true) { // eslint-disable-line no-constant-condition
|
|
const users = await User // eslint-disable-line no-await-in-loop
|
|
.find(query)
|
|
.limit(250)
|
|
.sort({ _id: 1 })
|
|
.select(fields)
|
|
.lean()
|
|
.exec();
|
|
|
|
if (users.length === 0) {
|
|
console.warn('All appropriate users found and modified.');
|
|
console.warn(`\n${count} users processed\n`);
|
|
break;
|
|
} else {
|
|
query._id = {
|
|
$gt: users[users.length - 1],
|
|
};
|
|
}
|
|
|
|
await Promise.all(users.map(updateUser)); // eslint-disable-line no-await-in-loop
|
|
}
|
|
}
|