refactor much of the hodge-podge code into their own files

This commit is contained in:
Tyler Renelle
2013-02-08 17:44:06 -05:00
parent 4dd7bad81a
commit 230d672fc7
8 changed files with 284 additions and 266 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ strategies =
options =
domain: process.env.BASE_URL || 'http://localhost:3000'
allowPurl: true
schema: require('../app/schema').newUserObject()
schema: require('../app/character').newUserObject()
customAccessControl: habitrpgStore.customAccessControl
mongo_store = new MongoStore {url: process.env.NODE_DB_URI}, ->
+2 -2
View File
@@ -1,5 +1,5 @@
_ = require 'underscore'
schema = require "../app/schema"
character = require "../app/character"
module.exports.middleware = (req, res, next) ->
model = req.getModel()
@@ -33,7 +33,7 @@ module.exports.app = (appExports, model) ->
Buy Reroll Button
###
appExports.buyReroll = (e, el, next) ->
batch = new schema.BatchUpdate(model)
batch = new character.BatchUpdate(model)
obj = model.get('_user')
batch.set 'balance', obj.balance-1
_.each obj.tasks, (task) -> batch.set("tasks.#{task.id}.value", 0) unless task.type == 'reward'