Exemplo n.º 1
0
 def _create_from_draft(
         self,
         draft: types.ProductDiscountDraft,
         id: typing.Optional[str] = None) -> types.ProductDiscount:
     object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4())
     return types.ProductDiscount(
         id=str(object_id),
         version=1,
         name=draft.name,
         description=draft.description,
         value=draft.value,
         predicate=draft.predicate,
         sort_order=draft.sort_order,
         references=[],
         is_active=draft.is_active,
         valid_from=draft.valid_from,
         valid_until=draft.valid_until,
     )
 def post_load(self, data, **kwargs):
     return types.ProductDiscount(**data)