Exemplo n.º 1
0
    def _create_from_draft(
        self, draft: types.ReviewDraft, id: Optional[str] = None
    ) -> types.Review:
        object_id = uuid.UUID(id) if id is not None else uuid.uuid4()

        return types.Review(
            id=str(object_id),
            version=1,
            key=draft.key,
            created_at=datetime.datetime.now(datetime.timezone.utc),
            uniqueness_value=draft.uniqueness_value,
            locale=draft.locale,
            author_name=draft.author_name,
            title=draft.title,
            text=draft.text,
            target=draft.target,
            included_in_statistics=False,
            rating=draft.rating,
            state=None,
            customer=draft.customer,
            custom=utils.create_from_draft(draft.custom),
        )
Exemplo n.º 2
0
 def post_load(self, data):
     return types.Review(**data)
Exemplo n.º 3
0
 def post_load(self, data, **kwargs):
     return types.Review(**data)