This a project review app, where we have reviewers and projects and we have sales manager to oversee them and supervisor to manage the reviewers and view projects and a project manager where they can assign reviewers to projects also add projects or remove them.
Follow instructions to install the latest version of python for your platform in the python docs
We recommend working within a virtual environment whenever using Python for projects. This keeps your dependencies for each project separate and organaized. Instructions for setting up a virual enviornment for your platform can be found in the python docs
Once you have your virtual environment setup and running, install dependencies by naviging to the /
directory and running:
pip install -r requirements.txt
This will install all of the required packages we selected within the requirements.txt
file.
-
Flask is a lightweight backend microservices framework. Flask is required to handle requests and responses.
-
SQLAlchemy is the Python SQL toolkit and ORM we'll use handle the lightweight sqlite database. You'll primarily work in app.py and can reference models.py.
-
Flask-CORS is the extension we'll use to handle cross origin requests from a potential frontend server.
With Postgres running, initialize the the database
createdb capstone
createdb capstone_test
iuyhkuytnmjjg,.kjhfjhg7yhnmhg## Running the server
From within the /
directory first ensure you are working using your created virtual environment.
Please also set the database URL (sample script assumes postgres runs on port 5432)
To run the server locally, execute:
source setup.sh && flask run
the production project is available at https://fsdn-capstore.herokuapp.com
you can find the postman collection within the source files.
the tokens are already provided in the setup.sh file.
Can view projects and reviewers
A Supervisor extends the permissions of the Sales Manager by adding and deleting reviewers from the database. He/She can also modify reviewers and projects
The Project Manager extends the permissions of the Supervisor by adding or deleting projects from the database, also project manager can assign reviewers to projects and vise versa.
you can find the documentation in details here
unprocessable e.g. trying to update a record that does not exist
{
"error": 422,
"message": "unprocessable",
"success": false
}
when we can't create new resource in db
{
"error": 406,
"message": "Could not create new resource",
"success": false
}
Defined Error handlers:
- 400 - Bad reqest
- 401 - token expired / invalid claims / invalid header
- 403 - unauthorized
- 404 - Resource not found
- 422 - Unprocessable entity
- 500 - Internal Server error
- 406 - Could not create a resource
Sample Response for 404
{
"error": 404,
"message": "Resource was not found",
"success": false
}
to the run the test execute:
dropdb capstone_test
createdb capstone_test
source setup.sh && python3 testcapstone.py