From 403d975934072ff62ed0d147d433578b75a104e8 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sun, 27 Dec 2020 21:58:58 +0200 Subject: [PATCH] Collection: fix dep handling. --- etebase_fastapi/collection.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etebase_fastapi/collection.py b/etebase_fastapi/collection.py index 0af6056..5e987d8 100644 --- a/etebase_fastapi/collection.py +++ b/etebase_fastapi/collection.py @@ -137,8 +137,8 @@ class CollectionItemBulkGetIn(BaseModel): class ItemDepIn(BaseModel): - etag: str uid: str + etag: str def validate_db(self): item = models.CollectionItem.objects.get(uid=self.uid) @@ -153,12 +153,12 @@ class ItemDepIn(BaseModel): class ItemBatchIn(BaseModel): items: t.List[CollectionItemIn] - deps: t.Optional[ItemDepIn] + deps: t.Optional[t.List[ItemDepIn]] def validate_db(self): if self.deps is not None: - for key, _value in self.deps: - getattr(self.deps, key).validate_db() + for dep in self.deps: + dep.validate_db() @sync_to_async