Skip to content

Commit

Permalink
chore: (changes to jsdocs): Improved readability of Jsdoc
Browse files Browse the repository at this point in the history
- Implemented spacing between Jsdoc statements
- Implemented reducer for categories to help refactor the bookReducer
  • Loading branch information
Benny Ogidan authored and Benny Ogidan committed Dec 16, 2017
1 parent 8074141 commit cc1131e
Show file tree
Hide file tree
Showing 57 changed files with 740 additions and 228 deletions.
26 changes: 9 additions & 17 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"root": true,
"parser": "babel-eslint",
"extends": "airbnb",
"plugins": [
"react"
],
"plugins": [ "react" ],
"env": {
"jquery": true,
"node": true,
Expand All @@ -23,22 +22,15 @@
"comma-dangle": 0,
"curly": [ "error", "multi-line" ],
"prefer-destructuring": [ "error", { "object": false, "array": false } ],
"import/no-unresolved": [ 2, { "commonjs": true } ],
"import/no-unresolved": "off",
"no-shadow": [ "error", { "allow": [ "req", "res", "err" ] } ],
"max-len":[
1,
80,
2
"max-len": [ 1, 80, 2 ],
"react/no-unknown-property": [
2,
{
"ignore": [ "class", "for" ]
}
],
"react/no-unknown-property": [
2,
{
"ignore": [
"class",
"for"
]
}
],
"valid-jsdoc": [
"error",
{
Expand Down
6 changes: 0 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

#### Description of Task to be completed?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->



#### Screenshots (if appropriate):

Expand Down
53 changes: 52 additions & 1 deletion client/src/app/actions/actiontype.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,108 @@
export const CLEAR_BOOK_FIELD = 'CLEAR_BOOK_FIELD';
export const USER_LOGGED_IN = 'USER_LOGGED_IN';

export const USER_LOG_IN_FAILURE = 'USER_LOG_IN_FAILURE';

export const USER_LOGGED_OUT = 'USER_LOGGED_OUT';

export const SIGN_UP_USER_FAILURE = 'SIGN_UP_USER_FAILURE';

export const SIGNUP_USER_SUCCESS = 'SIGNUP_USER_SUCCESS';

export const FETCH_SELECTED_BOOK_SUCCESS = 'FETCH_SELECTED_BOOK_SUCCESS';

export const FETCH_SELECTED_BOOK_FAILURE = 'FETCH_SELECTED_BOOK_FAILURE';

export const CREATE_BOOK_SUCCESS = 'CREATE_BOOK_SUCCESS';

export const CREATE_BOOK_FAILURE = 'CREATE_BOOK_FAILURE';

export const FETCH_ALL_RECENT_BOOKS = 'FETCH_ALL_RECENT_BOOKS ';

export const FETCH_ALL_BOOKS = 'FETCH_ALL_BOOKS ';

export const FETCH_BOOKS_BY_USER_ID = 'FETCH_BOOKS_BY_USER_ID';

export const FETCH_BOOKS_REJECTED = 'FETCH_BOOKS_REJECTED';

export const FETCH_ALL_OVERDUE_BOOKS = 'FETCH_ALL_OVERDUE_BOOKS';

export const FETCH_ALL_OVERDUE_REJECTED = 'FETCH_ALL_OVERDUE_REJECTED';

export const UPLOAD_TO_CLOUD_IMAGE_SUCCESS = 'UPLOAD_TO_CLOUD_IMAGE_SUCCESS';

export const UPLOAD_TO_CLOUD_IMAGE_FAILURE = 'UPLOAD_TO_CLOUD_IMAGE_FAILURE';

export const SEARCH_BOOKS_SUCCESS = 'SEARCH_BOOKS_SUCCESS';

export const SEARCH_BOOKS_FAILURE = 'SEARCH_BOOKS_FAILURE';

export const FETCH_CATEGORIES_SUCCESS = 'FETCH_CATEGORIES_SUCCESS';

export const FETCH_CATEGORIES_FAILURE = 'FETCH_CATEGORIES_FAILURE';

export const FETCH_BOOKS_FOR_CATEGORIES_SUCCESS =
'FETCH_BOOKS_FOR_CATEGORIES_SUCCESS';

export const FETCH_BOOKS_FOR_CATEGORIES_FAILURE =
'FETCH_BOOKS_FOR_CATEGORIES_FAILURE';

export const CLOUDINARY_UPLOAD_PRESET = 'yn0wpv0n';

export const CLOUDINARY_UPLOAD_URL =
'https://api.cloudinary.com/v1_1/digpnxufx/upload';

export const UPDATE_BOOK_SUCCESS = 'UPDATE_BOOK_SUCCESS';

export const UPDATE_BOOK_FAILURE = 'UPDATE_BOOK_FAILURE';

export const BORROW_BOOKS_SUCCESS = 'BORROW_BOOKS_SUCCESS';

export const BORROW_BOOKS_FAIL = 'BORROW_BOOKS_FAIL';

export const RETURN_BOOKS_SUCCESS = 'RETURN_BOOKS_SUCCESS';

export const RETURN_BOOKS_FAIL = 'RETURN_BOOKS_FAIL';

export const LOAN_HISTORY_SUCCESS = 'LOAN_HISTORY_SUCCESS';

export const LOAN_HISTORY_FAILURE = 'LOAN_HISTORY_FAILURE';

export const DELETE_BOOK_SUCCESS = 'DELETE_BOOK_SUCCESS';

export const DELETE_BOOK_FAILURE = 'DELETE_BOOK_FAILURE';

export const ADD_CATEGORY_SUCCESS = 'ADD_CATEGORY_SUCCESS';

export const ADD_CATEGORY_FAILURE = 'ADD_CATEGORY_FAILURE';

export const EDIT_CATEGORY_SUCCESS = 'EDIT_CATEGORY_SUCCESS';

export const EDIT_CATEGORY_FAILURE = 'EDIT_CATEGORY_FAILURE';

export const DELETE_CATEGORY_SUCCESS = 'DELETE_CATEGORY_SUCCESS';

export const DELETE_CATEGORY_FAILURE = 'DELETE_CATEGORY_FAILURE';

export const GET_USER_LIST_SUCCESS = 'GET_USER_LIST_SUCCESS';

export const GET_USER_LIST_FAILURE = 'GET_USER_LIST_FAILURE';

export const GET_USER_LEVEL_LIST_SUCCESS = 'GET_USER_LEVEL_LIST_SUCCESS';

export const GET_USER_LEVEL_LIST_FAILURE = 'GET_USER_LEVEL_LIST_FAILURE';

export const CHANGE_USER_LEVEL_SUCCESS = 'CHANGE_USER_LEVEL_SUCCESS';

export const CHANGE_USER_LEVEL_FAILURE = 'CHANGE_USER_LEVEL_FAILURE';

export const GET_USER_SUCCESS = 'GET_USER_SUCCESS';

export const GET_USER_FAILURE = 'GET_USER_FAILURE';

export const PASSWORD_CHANGED_SUCCESS = 'PASSWORD_CHANGED_SUCCESS';

export const PASSWORD_CHANGED_FAILURE = 'PASSWORD_CHANGED_FAILURE';

export const GET_NOTIFICATIONS_SUCCESS = 'GET_NOTIFICATIONS_SUCCESS';

export const GET_NOTIFICATIONS_FAILURE = 'GET_NOTIFICATIONS_FAILURE';
3 changes: 3 additions & 0 deletions client/src/app/actions/admin/books.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ export const DeleteBookFailure = error =>

/**
* async helper function: add Book to the database
*
* @function addBook
*
* @param {object} bookDetails
*
* @returns {function} asynchronous action
*/
export const addBook = bookDetails => dispatch => api
Expand Down
4 changes: 4 additions & 0 deletions client/src/app/actions/admin/changeUserLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ export const changeUserLevelFailure = error =>

/**
* async helper function: User Level
*
* @function changeUserLevelAction
*
* @param {number} newLevelId
*
* @param {string} userId
*
* @returns {function} asynchronous action
*/
export const changeUserLevelAction = (newLevelId, userId) => dispatch => api
Expand Down
3 changes: 3 additions & 0 deletions client/src/app/actions/admin/deleteCategory.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ export const deleteCategoryFailure = error =>

/**
* async helper function: delete Category
*
* @function deleteCategory
*
* @param {number} categoryId
*
* @returns {function} asynchronous action
*/
export const deleteCategoryAction = categoryId => dispatch => api
Expand Down
4 changes: 4 additions & 0 deletions client/src/app/actions/admin/editCategory.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ export const editCategoryFailure = error =>

/**
* async helper function: add Book to the database
*
* @function editNewCategory
*
* @param {string} categoryName
*
* @param {number} categoryId
*
* @returns {function} asynchronous action
*/
export const editCategoryAction = (categoryName, categoryId) => dispatch =>
Expand Down
3 changes: 3 additions & 0 deletions client/src/app/actions/admin/getSelectedUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ export const getUserFailure = error => ({ type: GET_USER_FAILURE, error });

/**
* async helper function: get User Lists
*
* @function getUserLists
*
* @param {integer} userId
*
* @returns {function} asynchronous action
*/
export const getSelectedUser = userId => dispatch => api
Expand Down
4 changes: 3 additions & 1 deletion client/src/app/actions/admin/getUserLevelList.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export const getUserLevelListFailure = error =>

/**
* async helper function: get User Lists
* @function getUserLevelListaction
*
* @function getUserLevelListactioN
*
* @returns {function} asynchronous action
*/
export const getUserLevelListAction = () => dispatch => api
Expand Down
15 changes: 13 additions & 2 deletions client/src/app/actions/admin/getUserList.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,27 @@ import {
import api from '../api';

export const getUserListSuccess = userList => (
{ type: GET_USER_LIST_SUCCESS, userList }
{
type: GET_USER_LIST_SUCCESS,
userList
}
);
export const getUserListFailure = error => ({ type: GET_USER_LIST_FAILURE, error });
export const getUserListFailure = error =>
({
type: GET_USER_LIST_FAILURE,
error
});


/**
* async helper function: get User Lists
*
* @function getUserLists
*
* @param {integer} offset
*
* @param {integer} limit
*
* @returns {function} asynchronous action
*/
export const getUserListAction = (offset, limit) => dispatch => api
Expand Down
14 changes: 6 additions & 8 deletions client/src/app/actions/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import axios from 'axios';
export default {
user: {
login: credentials => axios.post('api/v1/auth/users/signin', credentials),

signup: data => axios.post('api/v1/auth/users/signup', data),

changePassword: (password, oldPassword) =>
axios.put(
'api/v1/users/changepassword',
Expand All @@ -16,18 +18,15 @@ export default {
.then(res => res.data),

fetchRecentBooks: (offset, limit) => axios
.get(`api/v1/auth/books/recentbooks?offset
=${offset}&limit=${limit}`)
.get(`api/v1/auth/books/recentbooks?offset=${offset}&limit=${limit}`)
.then(res => res.data),

fetchOverdueBooks: (offset, limit) => axios
.get(`api/v1/users/getoverduebooks?offset
=${offset}&limit=${limit}`)
.get(`api/v1/users/getoverduebooks?offset=${offset}&limit=${limit}`)
.then(res => res.data),

fetchBooksByUserId: (offset, limit) => axios
.get(`api/v1/users/borrowedbooks?offset=
${offset}&limit=${limit}&returned=false`)
.get(`api/v1/users/borrowedbooks?offset=${offset}&limit=${limit}&returned=false`)
.then(res => res.data),

borrowBook: book => axios.post('api/v1/users/loanbook', book)
Expand All @@ -49,8 +48,7 @@ export default {
.then(res => res.data),

fetchAllBooksByCategories: (categoryId, offset, limit) => axios
.get(`api/v1/books/category
/${categoryId}?offset=${offset}&limit=${limit}`)
.get(`api/v1/books/category/${categoryId}?offset=${offset}&limit=${limit}`)
.then(res => res.data),

fetchSelectedBookById: bookId => axios
Expand Down
20 changes: 20 additions & 0 deletions client/src/app/actions/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ import setAuthorizationToken from '../utils/setAuthorizationToken';

/**
* create action: userLoggedIn: user
*
* @function userLoggedIn
*
* @param {object} data
*
* @returns {object} action: type and response
*/
export const userLoggedIn = data =>
Expand All @@ -30,8 +33,11 @@ export const userLogInFailure = error =>

/**
* create action: userLoggedIn: user
*
* @function userLoggedOut
*
* @param {object} user
*
* @returns {object} action: type and response
*/
export const userLoggedOut = user =>
Expand All @@ -42,8 +48,11 @@ export const userLoggedOut = user =>

/**
* create action: sign : user
*
* @function userAuthFailure
*
* @param {object} user
*
* @returns {object} action: type and response
*/
export const signUpUserFailure = user =>
Expand All @@ -54,8 +63,11 @@ export const signUpUserFailure = user =>

/**
* create action: signUpUserSuccess : user
*
* @function signUpUserSuccess
*
* @param {object} user
*
* @returns {object} action: type and response
*/
export const signUpUserSuccess = user =>
Expand All @@ -66,8 +78,11 @@ export const signUpUserSuccess = user =>

/**
* async helper function: sign up user
*
* @function signup
*
* @param {object} data
*
* @returns {function} asynchronous action
*/
export const signup = data => dispatch => api
Expand All @@ -85,8 +100,11 @@ export const signup = data => dispatch => api

/**
* async helper function: log in user
*
* @function login
*
* @param {object} credentials
*
* @returns {function} asynchronous action
*/
export const login = credentials => dispatch => api
Expand All @@ -107,7 +125,9 @@ export const login = credentials => dispatch => api

/**
* async helper function: log out user
*
* @function logout
*
* @returns {function} asynchronous action
*/
export const logout = () => (dispatch) => {
Expand Down
Loading

0 comments on commit cc1131e

Please sign in to comment.