Collection: fix dep handling.

This commit is contained in:
Tom Hacohen 2020-12-27 21:58:58 +02:00
parent fa0cd01a59
commit 403d975934

View File

@ -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