-
Notifications
You must be signed in to change notification settings - Fork 10
chore(flight): refactor routes #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,5 @@ | ||
| import documentRoutes from './documents'; | ||
| import roleRoutes from './roles'; | ||
| import searchRoutes from './search'; | ||
| import userRoutes from './users'; | ||
| import routes from './routes'; | ||
|
|
||
| export default (router) => { | ||
| documentRoutes(router); | ||
| roleRoutes(router); | ||
| searchRoutes(router); | ||
| userRoutes(router); | ||
| routes(router); | ||
| }; | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import documentController from '../controllers/documents'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module '../controllers/documents' import/no-unresolved |
||
| import rolesController from '../controllers/roles'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module '../controllers/roles' import/no-unresolved |
||
| import searchController from '../controllers/search'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module '../controllers/search' import/no-unresolved |
||
| import usersController from '../controllers/users'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module '../controllers/users' import/no-unresolved |
||
| import { | ||
| authenticate, | ||
| findDocumentById, | ||
| findRoleById, | ||
| findUserById, | ||
| isAdministrator, | ||
| validateDocument, | ||
| validateLimitAndOffset, | ||
| validateLogin, | ||
| validateParam, | ||
| validateQuery, | ||
| validateRole, | ||
| validateUser | ||
| } from '../middleware/middleware'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unable to resolve path to module '../middleware/middleware' import/no-unresolved |
||
|
|
||
| const routes = (router) => { | ||
| // Document routes | ||
| router.route('/documents') | ||
| .get(authenticate, validateLimitAndOffset, documentController.getAll) | ||
| .post(authenticate, validateDocument, documentController.create); | ||
|
|
||
| router.route('/documents/:id') | ||
| .get(authenticate, validateParam, findDocumentById, documentController.getOne) | ||
| .put(authenticate, validateParam, findDocumentById, documentController.update) | ||
| .delete(authenticate, validateParam, findDocumentById, documentController.delete); | ||
|
|
||
| // Role routes | ||
| router.route('/roles') | ||
| .get(authenticate, isAdministrator, rolesController.getAll) | ||
| .post(authenticate, isAdministrator, validateRole, rolesController.create); | ||
|
|
||
| router.route('/roles/:id') | ||
| .get(authenticate, isAdministrator, validateParam, findRoleById, rolesController.getOne) | ||
| .put(authenticate, isAdministrator, validateParam, findRoleById, rolesController.update) | ||
| .delete(authenticate, isAdministrator, validateParam, findRoleById, rolesController.delete); | ||
|
|
||
| // Search route | ||
| router.route('/search/users') | ||
| .get(validateQuery, searchController.searchUser); | ||
|
|
||
| router.route('/search/documents') | ||
| .get(validateQuery, searchController.searchDocument); | ||
|
|
||
| // User routes | ||
| router.route('/users/login') | ||
| .post(validateLogin, usersController.login); | ||
|
|
||
| router.route('/users/logout') | ||
| .post(usersController.logout); | ||
|
|
||
| router.route('/users') | ||
| .get(authenticate, isAdministrator, validateLimitAndOffset, usersController.getAll) | ||
| .post(validateUser, usersController.signup); | ||
|
|
||
| router.route('/users/:id') | ||
| .get(authenticate, validateParam, findUserById, usersController.getOne) | ||
| .put(authenticate, validateParam, findUserById, usersController.update) | ||
| .delete(authenticate, validateParam, findUserById, usersController.delete); | ||
|
|
||
| router.route('/users/:id/documents') | ||
| .get(authenticate, validateParam, findUserById, usersController.getUserDocuments); | ||
| }; | ||
|
|
||
| export default routes; | ||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module './routes' import/no-unresolved
Missing file extension for "./routes" import/extensions