diff --git a/CONTRIBUTION.md b/CONTRIBUTION.md new file mode 100644 index 0000000..33d3894 --- /dev/null +++ b/CONTRIBUTION.md @@ -0,0 +1,66 @@ +# Contribution Guide + +Thank you for your interest in contributing to JamAndFlow-API! Please follow these steps to ensure a smooth workflow and maintain code quality. + +## 1. Fork & Clone +- Fork the repository on GitHub. +- Clone your fork locally: + ```bash + git clone + cd JamAndFlow-API + ``` + +## 2. Set Up Environment +- Follow the setup instructions in `local_setup.md` to create and activate a Python virtual environment. +- Install dependencies: + ```bash + pip install -r requirements.txt + ``` + +## 3. Pre-commit Hooks +- Install pre-commit: + ```bash + pip install pre-commit + pre-commit install + ``` +- Run pre-commit checks before pushing: + ```bash + pre-commit run --all-files + ``` + +## 4. Linting +- Ensure code style with flake8 or black: + ```bash + pip install flake8 black + flake8 . + black . + ``` + +## 5. Testing +- Run tests (add your test commands here, e.g. pytest): + ```bash + pip install pytest + pytest + ``` + +## 6. Workflow +1. Create a new branch for your feature or fix: + ```bash + git checkout -b feature/your-feature-name + ``` +2. Make your changes and commit with clear messages. +3. Ensure all tests pass and code is linted. +4. Push your branch and open a Pull Request. + +## 7. Docker & Database +- Use Docker for local development as described in `local_setup.md`. +- For database migrations, see the migration section in `local_setup.md`. +- For inspecting tables, see the Postgres section in `local_setup.md`. + +## 8. Code Review +- All contributions are reviewed before merging. +- Address any requested changes promptly. + +--- + +For more details, refer to `local_setup.md`. diff --git a/local_setup.md b/local_setup.md index 68f8bed..5b2e985 100644 --- a/local_setup.md +++ b/local_setup.md @@ -31,11 +31,17 @@ ## Settings up environment variables 6. Create a `.env` file in the root directory of the project and add the following environment variables: ```env - POSTGRES_USER= - POSTGRES_PASSWORD= + POSTGRES_USER= + POSTGRES_PASSWORD= POSTGRES_DB=JamAndFlow POSTGRES_HOST=db POSTGRES_PORT=5432 + FROM_EMAIL= + SMTP_PASSWORD= + SMTP_USERNAME= + SECRET_KEY= + ALGORITHM= + ACCESS_TOKEN_EXPIRE_MINUTES= ``` # TODO: Add docker setup instructions below @@ -55,10 +61,34 @@ docker compose down ``` -# How to crete a new migration -1. go to root directory -2. run the following command: +# How to create a new migration +1. Accessing the jam_and_flow_api Docker Container ```bash - alembic -c app/alembic.ini revision --autogenerate -m "testing" + docker exec -it jam_and_flow_api bash ``` +2. Run command: + ```bash + cd app + alembic revision --autogenerate -m "migration_name" + alembic upgrade head + ``` + +# How to inspect postgres table +1. Accessing the postgres_db Docker Container + ```bash + docker exec -it postgres_db bash + ``` +2. Run command: + ```bash + psql -U postgres -d JamAndFlow + ``` +3. To list tables: + ```sql + \dt + ``` +4. To view a specific table: + ```sql + SELECT * FROM table_name; + ``` + # TODO: Add testing instructions below