-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #377 from ParsePlatform/nlutsenko.router.roles
Refactor and deduplicate RolesRouter, fix missing query on /roles.
- Loading branch information
Showing
3 changed files
with
45 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
import ClassesRouter from './ClassesRouter'; | ||
import PromiseRouter from '../PromiseRouter'; | ||
import rest from '../rest'; | ||
|
||
export class RolesRouter extends ClassesRouter { | ||
handleFind(req) { | ||
req.params.className = '_Role'; | ||
return super.handleFind(req); | ||
} | ||
|
||
handleGet(req) { | ||
req.params.className = '_Role'; | ||
return super.handleGet(req); | ||
} | ||
|
||
handleCreate(req) { | ||
req.params.className = '_Role'; | ||
return super.handleCreate(req); | ||
} | ||
|
||
handleUpdate(req) { | ||
req.params.className = '_Role'; | ||
return super.handleUpdate(req); | ||
} | ||
|
||
handleDelete(req) { | ||
req.params.className = '_Role'; | ||
return super.handleDelete(req); | ||
} | ||
|
||
getExpressRouter() { | ||
let router = new PromiseRouter(); | ||
router.route('GET','/roles', req => { return this.handleFind(req); }); | ||
router.route('GET','/roles/:objectId', req => { return this.handleGet(req); }); | ||
router.route('POST','/roles', req => { return this.handleCreate(req); }); | ||
router.route('PUT','/roles/:objectId', req => { return this.handleUpdate(req); }); | ||
router.route('DELETE','/roles/:objectId', req => { return this.handleDelete(req); }); | ||
return router; | ||
} | ||
} | ||
|
||
export default RolesRouter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.