1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

починка уведомлени в тг22

This commit is contained in:
MoonTestUse1
2025-01-04 05:20:56 +06:00
parent 4634262b91
commit cb9a10e36c
9 changed files with 285 additions and 48 deletions

View File

@@ -8,12 +8,11 @@ from ..schemas.request import Request, RequestCreate, RequestUpdate
from ..models.request import RequestStatus
from ..utils.auth import get_current_employee, get_current_admin
from ..utils.telegram import notify_new_request
import asyncio
router = APIRouter()
@router.post("/", response_model=Request)
def create_request(
async def create_request(
request: RequestCreate,
db: Session = Depends(get_db),
current_employee: dict = Depends(get_current_employee)
@@ -21,7 +20,7 @@ def create_request(
"""Create new request"""
db_request = requests.create_request(db, request, current_employee["id"])
# Отправляем уведомление в Telegram
asyncio.create_task(notify_new_request(db_request.id))
await notify_new_request(db_request.id)
return db_request
@router.get("/my", response_model=List[Request])