Esempio n. 1
0
 def convert_service_db_model_to_entity_model(service):
     return Service(
         org_uuid=service.org_uuid,
         uuid=service.uuid,
         service_id=service.service_id,
         display_name=service.display_name,
         short_description=service.short_description,
         description=service.description,
         project_url=service.project_url,
         proto=service.proto,
         metadata_ipfs_hash=service.metadata_ipfs_hash,
         assets=service.assets,
         rating=service.rating,
         ranking=service.ranking,
         contributors=service.contributors,
         tags=service.tags,
         mpe_address=service.mpe_address,
         service_state=ServiceState(service.service_state.org_uuid,
                                    service.service_state.service_uuid,
                                    service.service_state.state,
                                    service.service_state.transaction_hash),
         groups=[
             ServiceGroup(
                 org_uuid=group.org_uuid,
                 service_uuid=group.service_uuid,
                 group_id=group.group_id,
                 group_name=group.group_name,
                 endpoints=group.endpoints,
                 pricing=group.pricing,
                 free_calls=group.free_calls,
                 daemon_address=group.daemon_address,
                 free_call_signer_address=group.free_call_signer_address)
             for group in service.groups
         ])
 def create_service_state_entity_model(org_uuid, service_uuid, state, transaction_hash=None):
     return ServiceState(
         org_uuid=org_uuid,
         service_uuid=service_uuid,
         state=state,
         transaction_hash=transaction_hash
     )
Esempio n. 3
0
 def convert_service_state_from_db(service_state):
     return ServiceState(service_state.org_uuid, service_state.service_uuid,
                         service_state.state,
                         service_state.transaction_hash)