Skip to content

Cmdliner/Eather_Api

Repository files navigation

Backend API for the Eather platform

Technologies used

  • Python
  • FastAPI
  • Passlib
  • MySql (Maria DB)
  • Docker

BUGS

TODO

  • Appointment works (created in rogue dev mode) refactor and handle errors properly
  • Results are a one-to-one relationship to Appointments
  • Implement error handling properly

How to use

Create a virtual environment using venv

python -m venv venv

Activate the virtual environment

For UNIX and Unix-Like systems run:

source venv/bin/activate

For windows run:

venv\Scripts\activate

Install the dependencies with pip

pip install -r requirements.txt

Create a .env file at the project root using template by running:

chmod u+x scripts/create_env.sh  && ./scripts/create_env.sh

Database Operations

  • Ensure that database in the env file is already created. If not create it now.
  • Run database migrations

Database Migrations

#!/bin/python3
from models.base import Base
from config.db import engine


def init_db():
    Base.metadata.create_all(bind=engine)


if __name__ == "__main__":
    print("Creating tables...")
    init_db()
    print("DONE :)")

Uncomment all and run the create_tables script as shown above in the root of the project directory.

python create_tables.py

Confirm project structure

At the end of this (with the exception of the .env file and env/ directories) your project should look like this: project-structure

Run the Development Server

fastapi dev app.py

PROJECT STRUCURE

├── api
│   ├── appointment.py
│   ├── auth.py
│   ├── __init__.py
│   ├── result.py
│   └── test.py
├── app.py
├── config
│   ├── db.py
│   ├── __init__.py
│   └── settings.py
├── create_tables.py
├── Dockerfile
├── middlewares
│   └── auth.py
├── models
│   ├── appointment.py
│   ├── association.py
│   ├── base.py
│   ├── __init__.py
│   ├── result.py
│   ├── test.py
│   └── user.py
├── README.md
├── requirements.txt
├── schemas
│   ├── appointment.py
│   ├── __init__.py
│   ├── test.py
│   └── user.py
├── scripts
│   └── create_env.sh
└── utils
    ├── auth_helpers.py
    ├── __init__.py
    └── user_roles.py

8 directories, 29 files

About

The Backend Api for Eather

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published