Skip to content

francis-mwas/politico-app-api-v1

Repository files navigation

POLITICO-APP

Maintainability Build Status Coverage Status Codacy Badge Python 3.6 license

#Politico app challenge Politico is an application that enables citizens give their mandate to politicians running for different government offices, while building trust in the process through transparency.

How politico app works

  • An admin creates a political party
  • An admin creates political offices
  • Politicians show their interest to run for a particular government office
  • Normal users creates an account
  • Normal users with an account can login
  • Normal users who are qualified to vote, can search for government offices and vote their prffered candidate to represent them.
  • Normal users can be able to view their votes and the candidate they have voted for
  • Polician user can file a petition against a concluded political office election

Prerequisite

Installation and setup

Clone this repository

https://github.com/francis-mwas/politico-app-api-v1

Heroku link

https://politico-app-api-v1.herokuapp.com/

API documentation link

https://politicoapiv2.docs.apiary.io/

Create and activate virtual environment

in the root directory,open your terminal and create virtual environment by entering the commands below

virtualenv env --python=python3.6

source env/bin/activate

Install all the required dependancies

pip install -r requirements.txt

Running Politico application

$ export FLASK_APP=run.py

$ export MODE=development

$ python manage.py

$ flask run

Politico App Available Endpoints

Method Endpoint Description Roles
POST /api/v2/admin/parties create party Admin
GET /api/v2/admin/parties Fetch all parties Admin
DELETE /api/v2/admin/parties/<{id}> delete a specific party Admin
PATCH /api/v2/admin/parties/<{id}> edit a specific party Admin
GET /api/v2/admin/parties/<{id}> get a specific party Admin
POST /api/v2/admin/offices create office Admin
GET /api/v2/admin/offices/<{id}> get a specific office Admin
GET /api/v2/admin/offices fetch all offices Admin
PATCH /api/v2/admin/offices/<{id}> update a specific office Admin
POST /api/V2/auth/signup create an account Admin /Users
POST /api/v2/auth/signin signin Admin /Users
POST /api/v2/users/votes Vote for a candidate Admin /Users
GET /api/v2/users/candidates View candidates Admin /Users
GET /api/v2/users/offices/1 View office results Admin /Users
GET /api/v2/admin/users View all users Admin
GET /api/v2/admin/office/1/register Register candidates Admin
GET /api/v2/users/office/1/3/result View office results for specific office and specific candidate Admin /Users
DELETE /api/v2/admin/offices/<{id}> delete a specific office Admin

Testing

Pytest

- Testing with coverage

- pytest --cov=app

Author

Francis Mwangi

About

politico

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published