apiv2 more of previous (task xform)
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@
|
||||
"expect.js": "~0.2.0",
|
||||
"derby-i18n": "git://github.com/switz/derby-i18n#master",
|
||||
"relative-date": "~1.1.1",
|
||||
"lodash": "~1.2.1",
|
||||
"lodash": "~1.3.1",
|
||||
"async": "~0.2.9",
|
||||
"optimist": "~0.5.2"
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ router.post '/', api.auth, (req, res, next) ->
|
||||
uObj = misc.hydrate user.get()
|
||||
#transform user structure FROM user.tasks{} + user.habitIds[] TO user.habits[] + user.todos[] etc.
|
||||
_.each ['habit','daily','todo','reward'], (type) ->
|
||||
uObj["#{type}s"] = _.transform uObj["#{type}Ids"], (result, tid) -> uObj.tasks[tid]
|
||||
uObj["#{type}s"] = _.transform uObj["#{type}Ids"], (result, tid) -> result.push(uObj.tasks[tid])
|
||||
delete uObj["#{type}Ids"]
|
||||
delete uObj.tasks
|
||||
res.json 200, uObj
|
||||
|
||||
Reference in New Issue
Block a user