Skip to content

cosmas28/business-connect-v2

Repository files navigation

Build Status Coverage Status WeConnect provides a platform that brings businesses and individuals together. This platform creates awareness for businesses and gives the users the ability to write reviews about the businesses they have interacted with.

API installation

To set up WeConnect API, make sure that you have python 3.6 or more, postman and pip installed.

  • Clone the Repo into your local directory.
$ git clone https://github.com/cosmas28/business-connect-v2.git
  • create a virtual environment.
$ virtualenv <your_virtualenv>
  • Activate your virtual environment

Navigate to the API directory.

$ cd business-connect-v2

To install the packages run pip install -r requirements.txt

Database setup instructions

  • Install PostgreSQL.
  • Create a new database.
  • Change Database configuration at SQLALCHEMY_DATABASE_URI environment variable to include your database name, password and user name i.e SQLALCHEMY_DATABASE_URI = 'postgresql://<username>:<password>@localhost/database_name'

How to make migrations

  • Run migrations initialization using this command $ python manage.py db init
  • Run actual migrations using $ python manage.py db migrate
  • Finally apply migrations using $ python manage.py db upgrade
  • Then each time the database models change repeat the migrate and upgrade commands.

Usage

$ python manage.py runserver

How to view API documentation

Run the endpoints on Postman

Test

Run the test using bash

$ pytest

Run the API endpoints using the following URLs

HTTP Method URL Functionality
POST /api/v2/auth/register Creates a new user account
POST /api/v2/auth/login logs in a user
POST /api/v2/auth/logout logs in a user
POST /api/v2/auth/reset-password Password Reset
POST /api/v2/businesses Registers a business
GET /api/v2/businesses Retrieves all businesses
GET /api/v2/businesses/int:business_id get a business
DELETE /api/v2/businesses/int:business_id Remove a business
PUT /api/v2/businesses/int:business_id Update a business profile
POST /api/v2/businesses/int:business_id/reviews Add a review for a business
GET /api/v2/businesses/int:business_id/reviews Get all reviews for a business
GET /api/v2/businesses/location?q=&start=&limit= Filter businesses based on location
GET /api/v2/businesses/location?q=&start=&limit= Filter businesses based on category
GET /api/v2/businesses/search?q=<business_name>&start=&limit= Search for a business

Acknowledgements

  • Andela Kenya Recruitment team for inspiration

About

WeConnect version 2 is implemented using PostgreSQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published