mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-04 01:29:21 +00:00
Create method to reset habitica db
This commit is contained in:
parent
ece2985eb0
commit
63b17f0173
1 changed files with 25 additions and 0 deletions
|
|
@ -50,6 +50,31 @@ export function generateGroup(leader, update={}) {
|
|||
});
|
||||
};
|
||||
|
||||
export function resetHabiticaDB() {
|
||||
return new Promise((resolve, reject) => {
|
||||
mongo.connect('mongodb://localhost/habitrpg_test', (err, db) => {
|
||||
if (err) return reject(err);
|
||||
|
||||
db.dropDatabase((err) => {
|
||||
if (err) return reject(err);
|
||||
// A fresh install of Habitica has a tavern group
|
||||
let groups = db.collection('groups');
|
||||
groups.insertOne({
|
||||
_id: 'habitrpg',
|
||||
chat: [],
|
||||
leader: '9',
|
||||
name: 'HabitRPG',
|
||||
type: 'guild',
|
||||
privacy: 'public',
|
||||
}, (err) => {
|
||||
if (err) return reject(err);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function _requestMaker(user, method) {
|
||||
return (route, send, query) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue