Skip to content

Commit

Permalink
Merge branch 'fix/auth-request-token-v1' of https://github.com/johnso…
Browse files Browse the repository at this point in the history
…n-oragui/hng_boilerplate_python_fastapi_web into fix/auth-request-token-v1
  • Loading branch information
johnson-oragui committed Aug 15, 2024
2 parents d9354d8 + 72aee10 commit e9126f9
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 239 deletions.
19 changes: 7 additions & 12 deletions .github/workflows/cd.dev.yml.bac → .github/workflows/cd.dev.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Dev Branch Deployment

on:
workflow_run:
workflows: ["CI"]
types:
- completed
push:
branches: [dev]
paths-ignore:
- "README.md"
- ".github/workflows/**"
workflow_dispatch:

jobs:
on-success:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -22,14 +22,9 @@ jobs:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd python/dev_source_code/
cd boilerplate-python/dev/
git pull origin dev
source .venv/bin/activate
pip install -r requirements.txt
alembic upgrade head
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The triggering workflow failed'
40 changes: 0 additions & 40 deletions .github/workflows/cd.dev.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Prod Branch Deployment

on:
workflow_run:
workflows: ["CI"]
types:
- completed
push:
branches: [main]
paths-ignore:
- "README.md"
- ".github/workflows/**"
workflow_dispatch:

jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -22,14 +22,9 @@ jobs:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd python/prod_source_code/
cd boilerplate-python/prod/
git pull origin main
source .venv/bin/activate
pip install -r requirements.txt
alembic upgrade head
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The triggering workflow failed'
39 changes: 0 additions & 39 deletions .github/workflows/cd.prod.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Staging Branch Deployment

on:
workflow_run:
workflows: ["CI"]
types:
- completed
push:
branches: [staging]
paths-ignore:
- "README.md"
- ".github/workflows/**"
workflow_dispatch:

jobs:
on-success:
Expand All @@ -22,14 +23,8 @@ jobs:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd python/staging_source_code/
cd boilerplate-python/staging/
git pull origin staging
source .venv/bin/activate
pip install -r requirements.txt
alembic upgrade head

on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The triggering workflow failed'
39 changes: 0 additions & 39 deletions .github/workflows/cd.staging.yml

This file was deleted.

9 changes: 2 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
name: CI

on:
push:
branches: [main, staging, dev, devops-main]
paths-ignore:
- "README.md"
- ".github/workflows/**"
pull_request:
branches: [main, staging, dev, devops-main]
types: [opened, synchronize, reopened]
paths-ignore:
- "README.md"
- ".github/workflows/**"
Expand All @@ -28,7 +23,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
Expand Down
File renamed without changes.
53 changes: 0 additions & 53 deletions .github/workflows/test.yml.bac

This file was deleted.

3 changes: 1 addition & 2 deletions api/v1/routes/organisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from fastapi.encoders import jsonable_encoder
from fastapi.responses import StreamingResponse
from sqlalchemy.orm import Session

from api.utils.success_response import success_response
from api.v1.models.user import User
from api.v1.schemas.organisation import (
Expand Down Expand Up @@ -126,4 +125,4 @@ async def delete_organisation(
return success_response(
status_code=status.HTTP_200_OK,
message="Organisation with ID {org_id} deleted successfully",
)
)
23 changes: 1 addition & 22 deletions api/v1/routes/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,31 +265,10 @@ def get_organisation_products(
db, user=current_user, org_id=org_id, limit=limit, page=page
)

total_products = len(products)

total_pages = int(total_products / limit) + (total_products % limit > 0)

product_data = [
{
"name": product.name,
"description": product.description,
"price": str(product.price),
}
for product in products
]

data = {
"current_page": page,
"total_pages": total_pages,
"limit": limit,
"total_items": total_products,
"products": product_data,
}

return success_response(
status_code=200,
message="Successfully fetched organisations products",
data=data,
data=[jsonable_encoder(product) for product in products],
)


Expand Down
2 changes: 1 addition & 1 deletion api/v1/services/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from api.v1.models.invitation import Invitation
from api.v1.models.organisation import Organisation
from api.v1.models.user import User
from api.v1.services.user import user_service
from sqlalchemy.exc import IntegrityError
from api.v1.models.permissions.role import Role
from api.v1.schemas.permissions.roles import RoleCreate
Expand Down Expand Up @@ -214,7 +215,6 @@ def fetch(self):

def fetch_all(self):
pass

def update(self):
pass

Expand Down
5 changes: 3 additions & 2 deletions api/v1/services/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ def fetch_all(db: Session, **query_params: Optional[Any]):
)

return query.all()





product_service = ProductService()

0 comments on commit e9126f9

Please sign in to comment.