Best Flask open-source libraries and packages

The_crm_service

REST API
Updated 1 year ago

The CRM Service

📜 Description:

The objective is to create a REST API to manage customer data for a small shop. It will work as the backend side for a CRM interface that is being developed by a different team.

The API should be only accessible by a registered user by providing an authentication mechanism.

A User (no Admin) can:
▸ Create a new customer (with name, surname and photo).
▸ List all customers.
▸ Get full customer information.
▸ Update an existing customer.
▸ Delete an existing customer (soft delete).

An Admin User can do the previous actions and manage users:
▸ Create users.
▸ List users.
▸ Update users.
▸ Delete users.
▸ Change admin status.

Every time a customer is modified by a user, the relationship between them is stored in an association table called 'modifications'.


▶️ Run the project (Local):

This project works with these minimum versions:
Python version 3.9
Flask 2.0
Flask-SQLAlchemy 2.5
Flask-JWT-extended 4.3.0

Clone this repository:

git clone https://github.com/9Shuck/the_crm_service.git

Go inside the directory if you are not in:

cd the_crm_service

Install python3.9 🐍

Make sure pip package is installed

Install environment:

pipenv install

Go inside the environment:

pipenv shell

Run the app:

Python3 app.py

Login with this credentials to access the API:

email: admin@crm.com
password: 123456aB

▶️ Run the project (Deployment):

This project is deployed the Heroku:
https://the-crm-service.herokuapp.com/


📡 Endpoints Access:

The API can be accessed with Postman/Insomnia.
If the project is running locally: {URL} = http://127.0.0.1:5000
If the project is running in the deployment: {URL} = https://the-crm-service.herokuapp.com

Access for every user:

POST: {URL} /login

Access just for admin user:

POST: {URL} /user
GET: {URL} /user
PATCH: {URL} /user/id
DELETE: {URL} /user/id

Access just for admin user or no admin user who created the customer:

POST: {URL} /customer
GET: {URL} /customer
GET: {URL} /customer/id
PATCH: {URL} /customer/id
DELETE: {URL} /customer/id

🎞 Example with Insomnia:

1-Login with the credentials and copy the Bearer Token:


2-Paste the Bearer Token:

3-Create a User (All users created aren't admins):

4-Get a List of all Users (Non active users are listed):

5-Modify a User (Can modify each field separetely even change Admin status):

6-Delete a User (Soft Delete):

Customer endpoints works the same way except that can be managed with non-admin users.


🧪 Run Tests:

Go inside the directory if you are not in:

cd the_crm_service

Make sure app.py is running

Run the tests:

python3 tests/test_login.py

If all test are correct, this example message should be shown:

----------------------------------------------------------------------
Ran 6 tests in 0.064s

OK

🧩 UML Diagram:


🛠 Languages and Tools:

python python flask git git