mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Refactored getAll into regular GET. I.e. /db/achievement
This commit is contained in:
parent
df60402d00
commit
0f1c59f2d5
2 changed files with 2 additions and 3 deletions
|
@ -11,11 +11,11 @@ class AchievementHandler extends Handler
|
|||
hasAccess: (req) ->
|
||||
req.method is 'GET' or req.user?.isAdmin()
|
||||
|
||||
getAll: (req, res) ->
|
||||
get: (req, res) ->
|
||||
query = @modelClass.find({})
|
||||
query.exec (err, documents) =>
|
||||
return @sendDatabaseError(res, err) if err
|
||||
documents = (@formatEntity(req, doc) for doc in documents)
|
||||
@sendSuccess(res, documents)
|
||||
|
||||
module.exports = new AchievementHandler()
|
||||
module.exports = new AchievementHandler()
|
||||
|
|
|
@ -37,7 +37,6 @@ module.exports.setup = (app) ->
|
|||
return handler.search(req, res) if req.route.method is 'get' and parts[1] is 'search'
|
||||
return handler.getNamesByIDs(req, res) if req.route.method in ['get', 'post'] and parts[1] is 'names'
|
||||
return handler.getByRelationship(req, res, parts[1..]...) if parts.length > 2
|
||||
return handler.getAll(req, res) if req.route.method is 'get' and parts[1] is 'all'
|
||||
return handler.getById(req, res, parts[1]) if req.route.method is 'get' and parts[1]?
|
||||
return handler.patch(req, res, parts[1]) if req.route.method is 'patch' and parts[1]?
|
||||
handler[req.route.method](req, res)
|
||||
|
|
Loading…
Reference in a new issue