fids/gateway/src/api/routes/notifications.py

19 lines
534 B
Python

from asyncreq import request
from fastapi import APIRouter, HTTPException
from src.api.config import API_NOTIFICATIONS
from src.api.schemas.notification import Update as Message
router = APIRouter()
@router.post("")
async def receive_message(message: Message):
print(message.model_dump())
(response, status, _) = await request(
f"{API_NOTIFICATIONS}", "POST", json=message.model_dump()
)
if status < 200 or status > 204:
raise HTTPException(status_code=status, detail=response)
return response