mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-02 04:00:36 +00:00
some api bug-fixes
This commit is contained in:
parent
7a83be70b1
commit
1b3056e63d
2 changed files with 5 additions and 4 deletions
|
|
@ -12,12 +12,12 @@ module.exports.batchTxn = batchTxn = (model, cb, options) ->
|
|||
paths = {}
|
||||
model._dontPersist = true
|
||||
ret = cb uObj, paths, batch
|
||||
_.each paths, (v,k) -> user.pass({cron:options?.cron}).set(k,helpers.dotGet(k, uObj));true
|
||||
_.each paths, (v,k) -> user.pass({cron:options?.cron}).set(k,batch.get(k));true
|
||||
model._dontPersist = false
|
||||
# some hackery in our own branched racer-db-mongo, see findAndModify of lefnire/racer-db-mongo#habitrpg index.js
|
||||
# pass true if we have levelled to supress xp notification
|
||||
unless _.isEmpty paths
|
||||
setOps = _.reduce paths, ((m,v,k)-> m[k] = helpers.dotGet(k,uObj);m), {}
|
||||
setOps = _.reduce paths, ((m,v,k)-> m[k] = batch.get(k);m), {}
|
||||
user.set "update__", setOps, options?.done
|
||||
else options?.done?()
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -383,5 +383,6 @@ api.batchUpdate = (req, res, next) ->
|
|||
# call all the operations, then return the user object to the requester
|
||||
async.series actions, (err) ->
|
||||
return res.json 500, {err} if err
|
||||
res.json 200, helpers.derbyUserToAPI(user)
|
||||
console.log "Reply sent"
|
||||
return res.json helpers.derbyUserToAPI(user)
|
||||
console.log "Reply sent"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue