예제 #1
0
 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),
     )
예제 #2
0
    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,
        )
예제 #3
0
 def post_load(self, data, **kwargs):
     return types.Store(**data)
예제 #4
0
 def post_load(self, data):
     return types.Store(**data)