Exemplo n.º 1
0
 async def from_doc(doc: Document) -> "Product":
     return Product(
         id=doc.doc_id,
         title=doc.get("title"),
         price=doc.get("price"),
         inventory_count=doc.get("inventory_count"),
     )
Exemplo n.º 2
0
 async def from_doc(doc: Document) -> "User":
     user = User(id=doc.doc_id, username=doc.get("username"))
     user.password_hash = doc.get("password_hash")
     return user
Exemplo n.º 3
0
 async def from_doc(doc: Document) -> "CartItem":
     return CartItem(
         product=await Product.from_doc(doc.get("product")), amount=doc.get("amount")
     )