[#1879] separate task schema types into habitschema, dailyschema, etc to reduce server load and to ensure the proper default type (some people are getting habits in the wrong columns)

This commit is contained in:
Tyler Renelle
2013-11-21 09:53:50 -08:00
parent 3bc285f281
commit 18d6bed3b8
3 changed files with 68 additions and 27 deletions

View File

@@ -2,7 +2,7 @@ var mongoose = require("mongoose");
var Schema = mongoose.Schema;
var helpers = require('habitrpg-shared/script/helpers');
var _ = require('lodash');
var TaskSchema = require('./task').schema;
var TaskSchemas = require('./task');
var Group = require('./group').model;
var ChallengeSchema = new Schema({
@@ -10,10 +10,10 @@ var ChallengeSchema = new Schema({
name: String,
shortName: String,
description: String,
habits: [TaskSchema],
dailys: [TaskSchema],
todos: [TaskSchema],
rewards: [TaskSchema],
habits: [TaskSchemas.HabitSchema],
dailys: [TaskSchemas.DailySchema],
todos: [TaskSchemas.TodoSchema],
rewards: [TaskSchemas.RewardSchema],
leader: {type: String, ref: 'User'},
group: {type: String, ref: 'Group'},
timestamp: {type: Date, 'default': Date.now},