mirror of
https://github.com/Balshgit/gpt_chat_bot.git
synced 2025-12-15 16:10:39 +03:00
microservices are able to run (#5)
This commit is contained in:
0
bot_microservice/api/__init__.py
Normal file
0
bot_microservice/api/__init__.py
Normal file
0
bot_microservice/api/bot/__init__.py
Normal file
0
bot_microservice/api/bot/__init__.py
Normal file
19
bot_microservice/api/bot/controllers.py
Normal file
19
bot_microservice/api/bot/controllers.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from fastapi import APIRouter, Request
|
||||
from fastapi.responses import ORJSONResponse
|
||||
from settings.config import get_settings
|
||||
from starlette import status
|
||||
|
||||
router = APIRouter()
|
||||
settings = get_settings()
|
||||
|
||||
|
||||
@router.post(
|
||||
f"/{settings.TELEGRAM_API_TOKEN}",
|
||||
name="system:process_bot_updates",
|
||||
status_code=status.HTTP_202_ACCEPTED,
|
||||
summary="process bot updates",
|
||||
include_in_schema=False,
|
||||
)
|
||||
async def process_bot_updates(request: Request) -> ORJSONResponse:
|
||||
await request.app.state.queue.put_updates_on_queue(request)
|
||||
return ORJSONResponse(content=None, status_code=status.HTTP_202_ACCEPTED)
|
||||
0
bot_microservice/api/system/__init__.py
Normal file
0
bot_microservice/api/system/__init__.py
Normal file
15
bot_microservice/api/system/controllers.py
Normal file
15
bot_microservice/api/system/controllers.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from fastapi import APIRouter
|
||||
from fastapi.responses import ORJSONResponse
|
||||
from starlette import status
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get(
|
||||
"/healthcheck",
|
||||
name="system:healthcheck",
|
||||
status_code=status.HTTP_200_OK,
|
||||
summary="Healthcheck service",
|
||||
)
|
||||
async def healthcheck() -> ORJSONResponse:
|
||||
return ORJSONResponse(content=None, status_code=status.HTTP_200_OK)
|
||||
Reference in New Issue
Block a user