Skip to content

Commit 6acb611

Browse files
Andela DeveloperAndela Developer
Andela Developer
authored and
Andela Developer
committed
- add env.sample file
[Finishes #149632847]
1 parent bd2a8fd commit 6acb611

File tree

3 files changed

+135
-5
lines changed

3 files changed

+135
-5
lines changed

.env.sample

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
JWT_SECRET=''
2+
TEST_ADMIN_PASSWORD=''
3+
TEST_FELLOW_PASSWORD=''
4+
TEST_FACILITATOR_PASSWORD=''
5+
PASSWORD=''
6+
TEST_DB=''

README.md

+122-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,125 @@
1-
# document-manager
21
[![Build Status](https://travis-ci.org/iakhator/document-manager.svg?branch=staging)](https://travis-ci.org/iakhator/document-manager)
32
[![Coverage Status](https://coveralls.io/repos/github/iakhator/document-manager/badge.svg?branch=staging)](https://coveralls.io/github/iakhator/document-manager?branch=staging)
43
[![Code Climate](https://codeclimate.com/github/iakhator/document-manager/badges/gpa.svg)](https://codeclimate.com/github/iakhator/document-manager)
4+
5+
# document-manager
6+
Document manager provides REST API endpoints for a document management system. It allows create, retrieve, update and delete actions to be carried out.
7+
It also ensures that users are authorized.
8+
9+
# API Documentation
10+
The API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API status and errors.
11+
12+
## Features
13+
14+
**Users**:
15+
A created user will have a role, either an admin or a fellow.
16+
- A Fellow User can:
17+
- Create an account
18+
- Search users
19+
- Create a document
20+
- Edit a document
21+
- Retrieve a document
22+
- Delete a document
23+
- Limit access to a document by specifying an access group `i.e. public, private or role`.
24+
- View public documents created by other users.
25+
- View documents created by his access group with access level set as `role`.
26+
- Search documents.
27+
- View `public` and `role` access level documents of other regular users.
28+
29+
- An Admin User can:
30+
- View all users
31+
- View all created documents
32+
- Delete any user
33+
- Update any user's role
34+
- Create a new role
35+
- View all created roles
36+
- Search for any user
37+
- Search for any document
38+
39+
**Documents**:
40+
Documents can be created and must have:
41+
- Published date
42+
- Title
43+
- Content
44+
- Access (`private, public or role`)
45+
46+
**Roles**:
47+
Roles can also be created, the default roles are `admin` and `fellow`.
48+
Only an admin user can create and manage role(s)
49+
50+
**Authentication**:
51+
Users are authenticated and validated using JSON web token (JWT).
52+
By generating a token on login, API endpoints and documents are protected from unauthorized access.
53+
Requests to protected routes are validated using the generated token.
54+
55+
## Endpoints
56+
57+
**Users**
58+
59+
Request type | Endpoint | Action
60+
------------ | -------- | ------
61+
POST | [/users](#create-user) | Create a new user
62+
GET | [/users](#get-all-users) | Get all users
63+
GET | [/users/:id](#get-user) | Get details of a specific user
64+
GET | [/users/login](#login) | To log a user in
65+
GET | [/users/?limit={integer}&offset={integer}](#pagination) | Pagination for users
66+
GET | [/search/users/?query=new](#search-user) | To search for a user
67+
GET | [/users/:id/documents](#user-documents) | Retrieve all documents created by a user
68+
PUT | [/users/:id](#edit-user) | Edit user details
69+
DELETE | [/users/:id](#delete-user) | Delete a user from database
70+
71+
**Roles**
72+
73+
Request type | Endpoint | Action
74+
------------ | -------- | ------
75+
POST | [/roles](#create-role) | Create a new role
76+
GET | [/roles](#get-all-roles) | Get all created roles
77+
GET | [/role/:id](#get-role) | Get a specific role
78+
PUT | [/role/:id](#edit-role) | Edit a specific role
79+
DELETE | [/role/:id](#delete-role) | Delete a specific role
80+
81+
**Documents**
82+
83+
Request type | Endpoint | Action
84+
------------ | -------- | ------
85+
POST | [/documents](#create-document) | Create a new document
86+
GET | [/documents](#get-all-documents) | Retrieve all documents
87+
GET | [/documents/:id](#get-document) | Retrieve a specific document
88+
GET | [/documents/?limit={integer}&offset={integer}](#pagination) | Pagination for documents
89+
GET | [/search/documents/?query=new](#search-document) | Search documents using key terms
90+
PUT | [/documents/:id](#edit-document) | Update a specific document
91+
DELETE | [/documents/:id](#delete-document) | Remove a specific document from storage
92+
93+
## Development
94+
Document Management System API is built with the following technologies;
95+
- EcmaScript6 (ES6)
96+
- [NodeJs](https://nodejs.org)
97+
- [Express](http://expressjs.com/)
98+
- [Postgresql](https://www.postgresql.org/)
99+
- [Sequelize ORM](http://docs.sequelizejs.com/en/v3/)
100+
101+
## Installation
102+
- Install [NodeJs](https://nodejs.org/en/) and [Postgres](https://www.postgresql.org/) on your machine
103+
- Clone the repository `$ git clone https://github.com/iakhator/document-manager.git`
104+
- Change into the directory `$ cd /document-manager`
105+
- Install all required dependencies with `$ npm install`
106+
- Create a `.env` file in your root directory as described in `.env.sample` file
107+
- Start the app with `npm start`
108+
- Run Test `npm test`
109+
110+
## Contributing
111+
- Fork this repository to your GitHub account
112+
- Clone the forked repository
113+
- Create your feature branch
114+
- Commit your changes
115+
- Push to the remote branch
116+
- Open a Pull Request
117+
118+
## Limitations
119+
The limitations of the API are:
120+
- Users cannot delete themselves using the API
121+
- Documents are not unique (A user can create a document with the same title)
122+
- User cannot login on two different platform
123+
124+
## LICENSE
125+
This project is authored by [Itua Akhator](https://github.com/iakhator) it is licensed under the MIT license.

codeclimate.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
engines:
22
eslint:
33
enabled: true
4-
channel: "eslint-3"
5-
checks:
6-
import/no-unresolved:
7-
enabled: false
4+
config:
5+
config: .eslintrc
86
duplication:
97
enabled: false
108
config:
119
languages:
1210
- javascript
11+
fixme:
12+
enabled: true
1313
ratings:
1414
paths:
15+
- "**.es6"
1516
- "**.js"
17+
- "**.jsx"
1618
exclude_paths:
19+
- node_modules/**/*
1720
- server/test/

0 commit comments

Comments
 (0)