From 07a861ada50663d9e64822c1b814bcb53afafe8f Mon Sep 17 00:00:00 2001 From: Mayank Pathak Date: Sat, 12 Jun 2021 23:30:17 +0530 Subject: [PATCH 1/8] Registers github router to app --- src/factory.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/factory.py b/src/factory.py index 3c19d15..4bcd00b 100644 --- a/src/factory.py +++ b/src/factory.py @@ -1,5 +1,6 @@ from fastapi import FastAPI from src.routers.health import health_router +from src.routers.github import github_router from starlette.middleware.cors import CORSMiddleware from config.settings import ServerConfig @@ -23,5 +24,6 @@ def create_app() -> FastAPI: allow_origins=[str(origin) for origin in ServerConfig.CORS_ORIGINS], ) app.include_router(health_router, prefix="/health") + app.include_router(github_router, prefix="/webhook/github") return app From 24cb67d40629d8ec69fa57b595db81d2d20371f6 Mon Sep 17 00:00:00 2001 From: Mayank Pathak Date: Sat, 12 Jun 2021 23:35:44 +0530 Subject: [PATCH 2/8] Adds endpoint for github webhook --- src/routers/github/__init__.py | 1 + src/routers/github/routes.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/routers/github/__init__.py create mode 100644 src/routers/github/routes.py diff --git a/src/routers/github/__init__.py b/src/routers/github/__init__.py new file mode 100644 index 0000000..f2eca46 --- /dev/null +++ b/src/routers/github/__init__.py @@ -0,0 +1 @@ +from src.routers.github.routes import router as github_router diff --git a/src/routers/github/routes.py b/src/routers/github/routes.py new file mode 100644 index 0000000..ac40cc9 --- /dev/null +++ b/src/routers/github/routes.py @@ -0,0 +1,12 @@ +from typing import Dict + +from fastapi import APIRouter + + +router = APIRouter() + + +@router.post("/") +async def webhook() -> Dict[str, str]: + """WebHook for GitHub endpoint""" + return {"status": "ok"} From d2993f8e865c63a4acc507366277af98f5a388b8 Mon Sep 17 00:00:00 2001 From: Mayank Pathak Date: Sat, 12 Jun 2021 23:37:16 +0530 Subject: [PATCH 3/8] Fixes FLK-D403 --- src/routers/github/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routers/github/routes.py b/src/routers/github/routes.py index ac40cc9..c8a0935 100644 --- a/src/routers/github/routes.py +++ b/src/routers/github/routes.py @@ -8,5 +8,5 @@ @router.post("/") async def webhook() -> Dict[str, str]: - """WebHook for GitHub endpoint""" + """Webhook for GitHub endpoint""" return {"status": "ok"} From ceba362671fe860532b98312dbd38adcc9acfc1e Mon Sep 17 00:00:00 2001 From: Mayank Pathak Date: Sat, 12 Jun 2021 23:37:50 +0530 Subject: [PATCH 4/8] Formatting commit --- src/factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/factory.py b/src/factory.py index 4bcd00b..7d825d3 100644 --- a/src/factory.py +++ b/src/factory.py @@ -1,6 +1,6 @@ from fastapi import FastAPI -from src.routers.health import health_router from src.routers.github import github_router +from src.routers.health import health_router from starlette.middleware.cors import CORSMiddleware from config.settings import ServerConfig From 62ef439e15231eb817f1177b3a6214907410145b Mon Sep 17 00:00:00 2001 From: Mayank Pathak Date: Sat, 12 Jun 2021 23:30:17 +0530 Subject: [PATCH 5/8] Registers github router to app --- src/factory.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/factory.py b/src/factory.py index 3c19d15..4bcd00b 100644 --- a/src/factory.py +++ b/src/factory.py @@ -1,5 +1,6 @@ from fastapi import FastAPI from src.routers.health import health_router +from src.routers.github import github_router from starlette.middleware.cors import CORSMiddleware from config.settings import ServerConfig @@ -23,5 +24,6 @@ def create_app() -> FastAPI: allow_origins=[str(origin) for origin in ServerConfig.CORS_ORIGINS], ) app.include_router(health_router, prefix="/health") + app.include_router(github_router, prefix="/webhook/github") return app From 9e1aa5956a2d9645e12749df62e623277cea2551 Mon Sep 17 00:00:00 2001 From: Mayank Pathak Date: Sat, 12 Jun 2021 23:35:44 +0530 Subject: [PATCH 6/8] Adds endpoint for github webhook --- src/routers/github/__init__.py | 1 + src/routers/github/routes.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/routers/github/__init__.py create mode 100644 src/routers/github/routes.py diff --git a/src/routers/github/__init__.py b/src/routers/github/__init__.py new file mode 100644 index 0000000..f2eca46 --- /dev/null +++ b/src/routers/github/__init__.py @@ -0,0 +1 @@ +from src.routers.github.routes import router as github_router diff --git a/src/routers/github/routes.py b/src/routers/github/routes.py new file mode 100644 index 0000000..ac40cc9 --- /dev/null +++ b/src/routers/github/routes.py @@ -0,0 +1,12 @@ +from typing import Dict + +from fastapi import APIRouter + + +router = APIRouter() + + +@router.post("/") +async def webhook() -> Dict[str, str]: + """WebHook for GitHub endpoint""" + return {"status": "ok"} From 4853b3a0a0964016c355f91de5db62c37c618e4e Mon Sep 17 00:00:00 2001 From: Mayank Pathak Date: Sat, 12 Jun 2021 23:37:16 +0530 Subject: [PATCH 7/8] Fixes FLK-D403 --- src/routers/github/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routers/github/routes.py b/src/routers/github/routes.py index ac40cc9..c8a0935 100644 --- a/src/routers/github/routes.py +++ b/src/routers/github/routes.py @@ -8,5 +8,5 @@ @router.post("/") async def webhook() -> Dict[str, str]: - """WebHook for GitHub endpoint""" + """Webhook for GitHub endpoint""" return {"status": "ok"} From 82d4087d6d7f79766dce6a3dc04676f6a048a68e Mon Sep 17 00:00:00 2001 From: Mayank Pathak Date: Sat, 12 Jun 2021 23:37:50 +0530 Subject: [PATCH 8/8] Formatting commit --- src/factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/factory.py b/src/factory.py index 4bcd00b..7d825d3 100644 --- a/src/factory.py +++ b/src/factory.py @@ -1,6 +1,6 @@ from fastapi import FastAPI -from src.routers.health import health_router from src.routers.github import github_router +from src.routers.health import health_router from starlette.middleware.cors import CORSMiddleware from config.settings import ServerConfig