-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #62 | update api and api-tests
- Loading branch information
Ezumezu Chukwuma
committed
Jan 6, 2017
1 parent
c0746c3
commit 8a2653c
Showing
20 changed files
with
605 additions
and
44 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
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 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,53 @@ | ||
import User from '../models/user-model.js'; | ||
|
||
/** | ||
* AuthController | ||
* | ||
* Handles requests made to /api/v1/auth | ||
*/ | ||
class AuthController { | ||
|
||
/** | ||
* signup | ||
* | ||
* Registers a new user | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} User | ||
*/ | ||
signup(req, res, next) { | ||
res.send({ content: 'signup' }); | ||
} | ||
|
||
/** | ||
* signin | ||
* | ||
* Logs in a registered user | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} User | ||
*/ | ||
signin(req, res, next) { | ||
res.send({ content: 'signin' }); | ||
} | ||
|
||
/** | ||
* signout | ||
* | ||
* Logs out a logged in user | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {String} Success or Failure | ||
*/ | ||
signout(req, res, next) { | ||
res.send({ content: 'signout' }); | ||
} | ||
} | ||
|
||
export default new AuthController(); |
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,89 @@ | ||
import DocumentCategory from '../models/category-model.js'; | ||
|
||
/** | ||
* DocumentCategoryControl | ||
* | ||
* handles requests made to /api/v1/categories | ||
*/ | ||
class DocumentCategoryControl { | ||
|
||
/** | ||
* getCategories | ||
* | ||
* Gets all category names | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object[]} Categories | ||
*/ | ||
getCategories(req, res, next) { | ||
res.send({ content: 'get all doc categories' }); | ||
} | ||
|
||
/** | ||
* getCategory | ||
* | ||
* Gets a category name | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Category | ||
*/ | ||
getCategory(req, res, next) { | ||
res.send({ content: 'get the name of the category' }); | ||
} | ||
|
||
/** | ||
* getCategoryDocuments | ||
* | ||
* Gets a category name | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Category | ||
*/ | ||
getCategoryDocuments(req, res, next) { | ||
res.send({ content: 'get docs from a specified category' }); | ||
} | ||
|
||
/** | ||
* addCategory | ||
* | ||
* Adds a new category names | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Categories | ||
*/ | ||
addCategory(req, res, next) { | ||
res.send({ content: 'add a new category' }); | ||
} | ||
|
||
/** | ||
* editCategory | ||
* | ||
* Edits a category data | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Category | ||
*/ | ||
editCategory(req, res, next) { | ||
res.send({ content: 'edit a category' }); | ||
} | ||
|
||
/** | ||
* deleteCategory | ||
* | ||
* Delete a category data | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Category | ||
*/ | ||
deleteCategory(req, res, next) { | ||
res.send({ content: 'delete a category' }); | ||
} | ||
} | ||
|
||
export default new DocumentCategoryControl(); |
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,71 @@ | ||
import DocumentTemplate from '../models/templates-model.js'; | ||
|
||
/** | ||
* DocumentTemplateControl | ||
* | ||
* Handles requests made to /api/v1/templates | ||
*/ | ||
class DocumentTemplateControl { | ||
|
||
/** | ||
* getTemplates | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object[]} Templates | ||
*/ | ||
getTemplates(req, res, next) { | ||
res.send({ content: 'get all templates' }); | ||
} | ||
|
||
/** | ||
* getTemplate | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Template | ||
*/ | ||
getTemplate(req, res, next) { | ||
res.send({ content: 'get a particulatr template' }); | ||
} | ||
|
||
/** | ||
* addTemplates | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Template | ||
*/ | ||
addTemplates(req, res, next) { | ||
res.send({ content: 'add a template' }); | ||
} | ||
|
||
/** | ||
* editTemplates | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Template | ||
*/ | ||
editTemplates(req, res, next) { | ||
res.send({ content: 'edit a template' }); | ||
} | ||
|
||
/** | ||
* deleteTemplates | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Template | ||
*/ | ||
deleteTemplates(req, res, next) { | ||
res.send({ content: 'delete a template' }); | ||
} | ||
} | ||
|
||
export default new DocumentTemplateControl(); |
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,136 @@ | ||
import User from '../models/user-model.js'; | ||
|
||
/** | ||
* UserController class. | ||
* Handles requests made to the /api/v1/users endpoint | ||
*/ | ||
class UserController { | ||
|
||
/** | ||
* getAllUsers | ||
* | ||
* Gets all registered users. | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object[]} Users | ||
*/ | ||
getAllUsers(req, res, next) { | ||
res.send({ content: 'get all users' }); | ||
} | ||
|
||
/** | ||
* getOneUser | ||
* | ||
* Gets a specified user. | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} User | ||
*/ | ||
getOneUser(req, res, next) { | ||
res.send({ content: 'get single user' }); | ||
} | ||
|
||
/** | ||
* editUser | ||
* | ||
* Edits a users data. | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Users | ||
*/ | ||
editUser(req, res, next) { | ||
res.send({ content: 'edit single user' }); | ||
} | ||
|
||
/** | ||
* deleteUser | ||
* | ||
* Deletes a users data. | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Users | ||
*/ | ||
deleteUser(req, res, next) { | ||
res.send({ content: 'deletes a user' }); | ||
} | ||
|
||
/** | ||
* getUserDocuments | ||
* | ||
* Get all documents belonging to a user. | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object[]} Document | ||
*/ | ||
getUserDocuments(req, res, next) { | ||
res.send({ content: 'get a user\'s documents' }); | ||
} | ||
|
||
/** | ||
* getUserDocument | ||
* | ||
* Get a specified document belonging to a user. | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Document | ||
*/ | ||
getUserDocument(req, res, next) { | ||
res.send({ content: 'get a specified document from a specified user' }); | ||
} | ||
|
||
/** | ||
* createDocument | ||
* | ||
* Save a customized document. | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Document | ||
*/ | ||
createDocument(req, res, next) { | ||
res.send({ content: 'add a document' }); | ||
} | ||
|
||
/** | ||
* editUserDocument | ||
* | ||
* Edits a users document. | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Document | ||
*/ | ||
editUserDocument(req, res, next) { | ||
res.send({ content: 'edit a specified document' }); | ||
} | ||
|
||
/** | ||
* deleteUserDocument | ||
* | ||
* Deletes a users document. | ||
* | ||
* @param {Object} req | ||
* @param {Object} res | ||
* @param {Object} next | ||
* @returns {Object} Users | ||
*/ | ||
deleteUserDocument(req, res, next) { | ||
res.send({ content: 'delete a specified document' }); | ||
} | ||
} | ||
|
||
export default new UserController(); |
Oops, something went wrong.