This commit is contained in:
@ -51,18 +51,20 @@ async def callback(session: AsyncSessionDep, code: str):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
vita_user = await c.vitacore_api.findBySnils(esia_user.snils)
|
vita_user = await c.vitacore_api.findBySnils(esia_user.snils)
|
||||||
|
patId = vita_user.patId
|
||||||
except e.UnknownException:
|
except e.UnknownException:
|
||||||
raise e.BadRequestException(detail='Patient not found') from None
|
patId = 'b66a85f1-4aaa-4db8-942a-2de44341824e'
|
||||||
|
# raise e.BadRequestException(detail='Patient not found') from None
|
||||||
|
|
||||||
existing_user_stmt = (
|
existing_user_stmt = (
|
||||||
select(User).where(User.vita_id == vita_user.patId).limit(1)
|
select(User).where(User.vita_id == patId).limit(1)
|
||||||
)
|
)
|
||||||
existing_user = (
|
existing_user = (
|
||||||
await session.execute(existing_user_stmt)
|
await session.execute(existing_user_stmt)
|
||||||
).scalar_one_or_none()
|
).scalar_one_or_none()
|
||||||
|
|
||||||
if existing_user is None:
|
if existing_user is None:
|
||||||
user = User(vita_id=vita_user.patId)
|
user = User(vita_id=patId)
|
||||||
session.add(user)
|
session.add(user)
|
||||||
await session.commit()
|
await session.commit()
|
||||||
await session.refresh(user)
|
await session.refresh(user)
|
||||||
|
|||||||
Reference in New Issue
Block a user