Добавлен эндпоинт на скачивание файла с результатами вакцинации
Some checks failed
Build And Push / publish (push) Failing after 54s
Some checks failed
Build And Push / publish (push) Failing after 54s
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "HospitalAssistantBackend"
|
name = "HospitalAssistantBackend"
|
||||||
version = "1.3.0"
|
version = "1.4.0"
|
||||||
description = "Backend for Hospital Assistant"
|
description = "Backend for Hospital Assistant"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13,<3.14"
|
requires-python = ">=3.13,<3.14"
|
||||||
|
|||||||
@ -101,6 +101,28 @@ async def get_vaccs_report(
|
|||||||
return await c.vitacore_api.getVaccsReport(user.vita_id)
|
return await c.vitacore_api.getVaccsReport(user.vita_id)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get('/getVaccsReport/download')
|
||||||
|
async def get_vaccs_report_download(
|
||||||
|
user: Annotated[User, Depends(login)], resultId: str | None = None
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Get report of vaccinations for user by id.
|
||||||
|
"""
|
||||||
|
if resultId is not None:
|
||||||
|
model = await c.vitacore_api.getDiagResultFile(resultId)
|
||||||
|
else:
|
||||||
|
model = await c.vitacore_api.getVaccsReport(user.vita_id)
|
||||||
|
|
||||||
|
file_bytes = base64.b64decode(model.content)
|
||||||
|
filename = f'vaccs_report_{resultId or user.vita_id}.doc'
|
||||||
|
|
||||||
|
return Response(
|
||||||
|
content=file_bytes,
|
||||||
|
media_type='application/msword',
|
||||||
|
headers={'Content-Disposition': f'attachment; filename="{filename}"'},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get('/getMedExamDict')
|
@router.get('/getMedExamDict')
|
||||||
async def get_med_exam_dict(user: Annotated[User, Depends(login)]):
|
async def get_med_exam_dict(user: Annotated[User, Depends(login)]):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user