Skip to content

zakh-d/python-fs-internship-backend

Repository files navigation

Web Service based on FastAPI

How to run

Clone this repo

git clone https://github.com/zakh-d/python-fs-internship-backend.git

Set env variables

Create .env file based on .env.example file

Run using docker compose

This requires you to have Docker installed on your PC.

docker compose up -d

Apply migrations

Apply migrations to the db inside docker container. Check here how to do this.

Database migrations

Applying existing alembic migrations

To apply existing alembic migration to postgres inside docker container run following command

docker compose exec api alembic upgrade head

this would apply all existing migrations to the db.

Creating new alembic migrations

To create new alembic migration run following command

 docker compose exec api alembic revision --autogenerate -m 'migration description'

this would automatically check models, that were inheritted from Base class in app.db.models module, whether there were any changes, if so I would generate migrations files inside app/db/migrations folder. You MUST check created file

Testing

Just run prepared script

./test.sh

ERD

erDiagram
    USER ||--o{ COMPANY_ACTION: relates
    USER ||--o{ COMPANY: owns
    USER {
        uuid id
        varchar email
        varchar username
        varchar first_name
        varchar last_name
    }

    COMPANY ||--o{ COMPANY_ACTION: relates
    COMPANY {
        uuid id
        uuid owner_id
        varchar name
        varchar description
    }
    COMPANY_ACTION {
        uuid id
        uuid company_id
        uuid user_id
        enum type
    }
Loading

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages