mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-13 20:57:24 +01:00
* wip: define items as mixed objects * add default owned gear * mark modified * more mark modified * more mark modified * more mark modified * more mark modified * fix common tests * fix common tests * update mongoose * add itemsUtils * use new util function in hall controller * add tests for items utils * update website/server to mark all items as modified * start updating common code * update login incentives * update unlock * remove changes to package-lock.json * remove changes to package.json
42 lines
932 B
JavaScript
42 lines
932 B
JavaScript
import mongoose from 'mongoose';
|
|
|
|
import { model as User } from '../../website/server/models/user';
|
|
import {
|
|
DailySchema,
|
|
HabitSchema,
|
|
RewardSchema,
|
|
TodoSchema,
|
|
} from '../../website/server/models/task';
|
|
export {translate} from './translate';
|
|
|
|
|
|
export function generateUser (options = {}) {
|
|
let user = new User(options).toObject();
|
|
|
|
return user;
|
|
}
|
|
|
|
export function generateDaily (options = {}) {
|
|
let Daily = mongoose.model('Daily', DailySchema);
|
|
|
|
return new Daily(options).toObject();
|
|
}
|
|
|
|
export function generateHabit (options = {}) {
|
|
let Habit = mongoose.model('Habit', HabitSchema);
|
|
|
|
return new Habit(options).toObject();
|
|
}
|
|
|
|
export function generateReward (options = {}) {
|
|
let Reward = mongoose.model('Reward', RewardSchema);
|
|
|
|
return new Reward(options).toObject();
|
|
}
|
|
|
|
export function generateTodo (options = {}) {
|
|
let Todo = mongoose.model('Todo', TodoSchema);
|
|
|
|
return new Todo(options).toObject();
|
|
}
|