def _create_from_draft( self, draft: types.StoreDraft, id: typing.Optional[str] = None ) -> types.Store: object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4()) return types.Store( id=str(object_id), version=1, key=draft.key, name=draft.name, created_at=datetime.datetime.now(datetime.timezone.utc), )
def _create_from_draft(self, draft: types.StoreDraft, id: Optional[str] = None) -> types.Store: object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4()) distribution_channels: List[types.ChannelReference] = [] if draft.distribution_channels: distribution_channels = convert_identifiers_to_references( self._storage._stores["channel"], draft.distribution_channels) return types.Store( id=str(object_id), version=1, key=draft.key, name=draft.name, created_at=datetime.datetime.now(datetime.timezone.utc), languages=draft.languages, distribution_channels=distribution_channels, )
def post_load(self, data, **kwargs): return types.Store(**data)
def post_load(self, data): return types.Store(**data)