nearly done with attached checker ... todo client.get and right nc -l 5555 call
Some checks failed
checks-impure / test (pull_request) Failing after 25s
checks / test (pull_request) Failing after 1m42s

This commit is contained in:
Georg-Stahn
2023-12-03 22:13:00 +01:00
parent 1142ee1b80
commit 98747bc39b
4 changed files with 44 additions and 27 deletions

View File

@@ -1,4 +1,3 @@
import time
from typing import List, Optional
from sqlalchemy.orm import Session
@@ -134,6 +133,11 @@ def get_entities(
) -> List[sql_models.Entity]:
return db.query(sql_models.Entity).offset(skip).limit(limit).all()
def get_entity_by_did(db: Session, did: str) -> Optional[sql_models.Entity]:
return db.query(sql_models.Entity).filter(sql_models.Entity.did == did).first()
# get attached
def get_attached_entities(
db: Session, skip: int = 0, limit: int = 100
@@ -141,10 +145,6 @@ def get_attached_entities(
return db.query(sql_models.Entity).offset(skip).limit(limit).filter(sql_models.Entity.attached == True)
def get_entity_by_did(db: Session, did: str) -> Optional[sql_models.Entity]:
return db.query(sql_models.Entity).filter(sql_models.Entity.did == did).first()
# set attached
# None if did not found
# Returns same entity if setting didnt changed something