Skip to content

Commit

Permalink
Merge 4796e25 into 42f6248
Browse files Browse the repository at this point in the history
  • Loading branch information
segunolalive committed Nov 14, 2017
2 parents 42f6248 + 4796e25 commit f9d2d9a
Show file tree
Hide file tree
Showing 129 changed files with 22,447 additions and 7 deletions.
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": ["env", "react"],
"plugins": ["transform-object-rest-spread"],
"env": {
"production": {
"plugins": [
"transform-react-remove-prop-types",
"transform-react-constant-elements",
"transform-react-inline-elements"
]
}
}
}
14 changes: 14 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
engines:
duplication:
enabled: false
config:
languages:
javascript:
mass_threshold: 20
ratings:
paths:
- "**.js"
exclude_paths:
- "test/"
- "node_modules/"
- "templates/"
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo_token: COVERALLS_REPO_TOKEN
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
username=your database username
database=your development database name
database_test=enter your database name here, test environment
host=enter local host address
dialect=enter database type
password=enter your password here
GOOGLE_CLIENT_ID=your google client id
GOOGLE_CLIENT_SECRET=your google client secret
EMAIL_ADDRESS=email address
EMAIL_PASSWORD=email password
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/server/test
/dist
51 changes: 51 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"root": true,
"extends": ["airbnb-base", "plugin:react/recommended"],
"env": {
"browser": true,
"node": true,
"es6": true,
"mocha": true
},
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": { "jsx": true }
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js",".jsx"]
}
}
},
"rules": {
"one-var": 0,
"one-var-declaration-per-line": 0,
"new-cap": 0,
"consistent-return": 0,
"no-param-reassign": 0,
"comma-dangle": 0,
"max-len": [1, 80, 2],
"import/prefer-default-export": 0,
"curly": ["error", "multi-line"],
"import/no-unresolved": [2, { "commonjs": true }],
"import/extensions": "off",
"no-shadow": ["error", { "allow": ["req", "res", "err"] }],
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"valid-jsdoc": ["error", {
"requireReturn": true,
"requireReturnType": true,
"requireParamDescription": false,
"requireReturnDescription": true
}],
"class-methods-use-this": 0,
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true
}
}]
}
}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage
/.nyc_output

# production
/build
/dist

# misc
.DS_Store
/config/db.js
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
/job
*.txt

npm-debug.log*
yarn-debug.log*
yarn-error.log*
5 changes: 5 additions & 0 deletions .hound.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
eslint:
enabled: true
config_file: .eslintrc
ignore_file: .eslintignore

8 changes: 8 additions & 0 deletions .sequelizerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const path = require('path');

module.exports = {
"config": path.resolve('./server/config', 'config.js'),
"models-path": path.resolve('./server/models'),
"seeders-path": path.resolve('./server/seeders'),
"migrations-path": path.resolve('./server/migrations')
};
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: node_js
node_js:
- "6"
env:
global:
- export NODE_ENV=test
script:
- npm test
after_success:
- npm run coverage
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 Segun Ola <segunola@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node dist/server/bin/www.js
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
[![Build Status](https://travis-ci.org/segunolalive/helloBooks.svg?branch=development)](https://travis-ci.org/segunolalive/helloBooks)
[![Coverage Status](https://coveralls.io/repos/github/segunolalive/helloBooks/badge.svg?branch=development)](https://coveralls.io/github/segunolalive/helloBooks?branch=development)
[![Code Climate](https://codeclimate.com/github/segunolalive/helloBooks/badges/gpa.svg)](https://codeclimate.com/github/segunolalive/helloBooks?branch=development)

# helloBooks

### A Library app
Hello books is an application that provides users with access to books from wherever they are.
Being a virtual library, users can borrow and read their favorite books using any device.
HelloBooks exposes RESTful API endpoints such that anyone customize the method of consuming
the resources.

#### Built With
* [NodeJS](https://nodejs.org/en/) - is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.
* [PostgreSQL](https://www.postgresql.org/) - A powerful, open source object-relational database system.
* [Sequelize](http://docs.sequelizejs.com/) - is a promise-based ORM for Node.js v4 and up. It supports the dialects PostgreSQL, MySQL, SQLite and MSSQL and features solid transaction support, relations, read replication and more.
* [ExpressJS](http://expressjs.com/) - Fast, unopinionated, minimalist web framework for Node.js.
* [Reactjs](https://reactjs.org/)A declarative component-based JavaScript library for building user interfaces


#### Getting Started
```
# Clone your fork of this repository
# Ensure NodeJS, PostgreSQL and Sequelize cli are globally installed
# Switch to project directory
cd helloBooks
# Install dependencies
npm install
# Set up environment variables
Follow the template in example.environment
# Run database migrations
npm run migrate:dev
# Start the app
- In development mode, run the following from two separate terminal windows/tabs
npm run start:client
npm run start:dev
navigate to http://localhost:8080 in your browser
- For production build, run:
npm run building
then
npm run start
```

#### Features
- Authentication is via [**JSON Web Tokens**](https://jwt.io/)
- Login/Sign up to gain access to routes
- A library of books from different categories
- Ability to borrow books repeatedly
- Track your reading/borrowing history
- Admin access to add and modify book details

#### API Documentation
- https://www.segunolalive-hellobooks.com/api/docs


#### Testing
Run `npm test`

#### Contributing
Hello books is open source and contributions are highly welcomed.

If you would like to contribute, follow the instructions below.

- Fork this project.
- Checkout a new branch
- Make your changes and commit.
- Keep commit messages atomic.
- Raise a pull request against development.

**NB:** All Pull requests must be made against development branch. PRs against master would be rejected.

See project wiki for coding style guide, commit message, pull request and branch naming conventions.

---

#### Acknowledgments

* Andela Fellowship (https://andela.com/)

---
#### License
MIT License
27 changes: 27 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "helloBooks",
"scripts": {},
"env": {
"DATABASE_URL": {
"required": true
},
"NODE_ENV": {
"required": true
},
"NODE_MODULES_CACHE": {
"required": true
},
"SECRET": {
"required": true
}
},
"formation": {},
"addons": [
"papertrail"
],
"buildpacks": [
{
"url": "heroku/nodejs"
}
]
}
39 changes: 39 additions & 0 deletions client/actions/actionTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import keyMirror from './keyMirror';
/**
* array of action types
* @type {Array}
*/
const actionList = [
'AUTH_LOADING',
'SIGN_UP',
'LOGIN',
'LOGOUT',
'SET_LOGIN_STATUS',
'UPDATE_PROFILE',
'SET_BOOK_ID',
'GET_BOOK',
'GET_BOOKS',
'GET_BORROWED_BOOKS',
'GET_TRANSACTION_HISTORY',
'GET_ALL_BORROWED',
'GET_BOOK_CATEGORIES',
'BORROW_BOOK',
'RETURN_BOOK',
'CREATE_BOOK',
'READ_BOOK',
'EDIT_BOOK_INFO',
'DELETE_BOOK',
'UPLOAD_BOOK_FILE',
'UPLOAD_BOOK_COVER',
'SAVE_STATE',
'GET_SAVED_STATE',
'GET_ADMIN_NOTIFICATIONS',
];

/**
* action types object
* @type {Object}
*/
const actionTypes = keyMirror(actionList);

export default actionTypes;
Loading

0 comments on commit f9d2d9a

Please sign in to comment.