attached
Some checks failed
checks-impure / test (pull_request) Successful in 28s
checks / test (pull_request) Failing after 3m19s

This commit is contained in:
Georg-Stahn
2023-12-03 20:40:53 +01:00
parent 9a31fbe010
commit 1142ee1b80
3 changed files with 39 additions and 9 deletions

View File

@@ -175,6 +175,28 @@ async def attach(
db: Session = Depends(sql_db.get_db),
) -> dict[str, str]:
background_tasks.add_task(
sql_crud.check_health, db, entity_did, message="Not attched any more"
attach_entity(entity_did, db), db, entity_did
)
return {"message": "Attaching in the background"}
# TODO
def attach_entity(entity_did: str, db: Session) -> None:
sql_crud.attach_entity_by_did(db, entity_did, True)
while db_entity.attached:
#query status endpoint
#except not reached set false
time.sleep(5)
@router.get("/api/v1/detach", response_model=Optional[Entity], tags=[Tags.entities])
async def detach(
background_tasks: BackgroundTasks,
entity_did: str = "did:sov:test:1234",
skip: int = 0,
limit: int = 100,
db: Session = Depends(sql_db.get_db),
) -> dict[str, str]:
background_tasks.add_task(
sql_crud.set_attached_by_entity_did, db, entity_did, False
)
return {"message": "Detaching in the background"}