Skip to content

Commit

Permalink
client_store update should be like every other update
Browse files Browse the repository at this point in the history
  • Loading branch information
niklastheman committed Jan 9, 2025
1 parent 361d967 commit b8f89b7
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions fedn/network/storage/statestore/stores/client_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,11 @@ def _get_client_by_client_id(self, client_id: str) -> Dict:
raise EntityNotFound(f"Entity with client_id {client_id} not found")
return document

def update(self, by_key: str, value: str, item: Client) -> bool:
def update(self, id: str, item: Client) -> Tuple[bool, Any]:
try:
result = self.database[self.collection].update_one({by_key: value}, {"$set": item})
if result.modified_count == 1:
document = self.database[self.collection].find_one({by_key: value})
return True, from_document(document)
else:
return False, "Entity not found"
existing_client = self.get(id)

return super().update(existing_client["id"], item)
except Exception as e:
return False, str(e)

Expand Down

0 comments on commit b8f89b7

Please sign in to comment.