kopia lustrzana https://github.com/bugout-dev/moonstream
Removed entity client dependency
rodzic
a3b0841d10
commit
bbe1530eef
|
@ -774,12 +774,7 @@ def fix_duplicates_keys_in_entity_subscription():
|
|||
|
||||
secondary_fields = secondary_fields["secondary_fields"]
|
||||
|
||||
# get entity id
|
||||
|
||||
entity_id = entity.entity_id
|
||||
|
||||
# get entity type
|
||||
|
||||
entity_type = None
|
||||
|
||||
# extract required fields
|
||||
|
@ -800,7 +795,7 @@ def fix_duplicates_keys_in_entity_subscription():
|
|||
new_required_fields.append(
|
||||
{"type": "copy_of_malformed_entity_20230213"}
|
||||
)
|
||||
new_required_fields.append({"entity_id": str(entity_id)})
|
||||
new_required_fields.append({"entity_id": str(entity.id)})
|
||||
|
||||
new_entity = bc.create_entity(
|
||||
token=MOONSTREAM_ADMIN_ACCESS_TOKEN,
|
||||
|
@ -812,12 +807,12 @@ def fix_duplicates_keys_in_entity_subscription():
|
|||
secondary_fields=entity.secondary_fields,
|
||||
)
|
||||
logger.info(
|
||||
f"Entity {new_entity.entity_id} created successfully for journal (collection) {journal_id}"
|
||||
f"Entity {new_entity.id} created successfully for journal (collection) {journal_id}"
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f"Failed to create entity {entity_id} for journal (collection) {journal_id}: {str(e)}, user_id: {user_id}"
|
||||
f"Failed to create entity {entity.id} for journal (collection) {journal_id}: {str(e)}, user_id: {user_id}"
|
||||
)
|
||||
continue
|
||||
|
||||
|
@ -827,7 +822,7 @@ def fix_duplicates_keys_in_entity_subscription():
|
|||
bc.update_entity(
|
||||
token=MOONSTREAM_ADMIN_ACCESS_TOKEN,
|
||||
journal_id=journal_id,
|
||||
entity_id=entity_id,
|
||||
entity_id=entity.id,
|
||||
blockchain=entity.blockchain,
|
||||
address=entity.address,
|
||||
title=entity.title,
|
||||
|
@ -835,10 +830,10 @@ def fix_duplicates_keys_in_entity_subscription():
|
|||
secondary_fields=secondary_fields,
|
||||
)
|
||||
logger.info(
|
||||
f"Entity {entity_id} updated successfully for journal (collection) {journal_id}"
|
||||
f"Entity {entity.id} updated successfully for journal (collection) {journal_id}"
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f"Failed to update entity {entity_id} for journal (collection) {journal_id}: {str(e)}, user_id: {user_id}"
|
||||
f"Failed to update entity {entity.id} for journal (collection) {journal_id}: {str(e)}, user_id: {user_id}"
|
||||
)
|
||||
|
|
|
@ -24,7 +24,6 @@ from ..settings import (
|
|||
MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX,
|
||||
)
|
||||
from ..settings import bugout_client as bc
|
||||
from ..settings import entity_client as ec
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
import os
|
||||
from typing import Optional, Dict
|
||||
from uuid import UUID
|
||||
from typing import Dict, Optional
|
||||
|
||||
from bugout.app import Bugout
|
||||
from entity.client import Entity # type: ignore
|
||||
from moonstreamdb.blockchain import AvailableBlockchainType
|
||||
|
||||
|
||||
# Bugout
|
||||
BUGOUT_BROOD_URL = os.environ.get("BUGOUT_BROOD_URL", "https://auth.bugout.dev")
|
||||
BUGOUT_SPIRE_URL = os.environ.get("BUGOUT_SPIRE_URL", "https://spire.bugout.dev")
|
||||
|
@ -14,15 +11,6 @@ BUGOUT_SPIRE_URL = os.environ.get("BUGOUT_SPIRE_URL", "https://spire.bugout.dev"
|
|||
|
||||
bugout_client = Bugout(brood_api_url=BUGOUT_BROOD_URL, spire_api_url=BUGOUT_SPIRE_URL)
|
||||
|
||||
# Entity
|
||||
|
||||
MOONSTREAM_ENTITY_URL = os.environ.get("MOONSTREAM_ENTITY_URL", "")
|
||||
if MOONSTREAM_ENTITY_URL == "":
|
||||
raise ValueError("MOONSTREAM_ENTITY_URL environment variable must be set")
|
||||
|
||||
entity_client = Entity(MOONSTREAM_ENTITY_URL)
|
||||
|
||||
|
||||
BUGOUT_REQUEST_TIMEOUT_SECONDS = 5
|
||||
|
||||
HUMBUG_REPORTER_BACKEND_TOKEN = os.environ.get("HUMBUG_REPORTER_BACKEND_TOKEN")
|
||||
|
|
|
@ -36,7 +36,6 @@ jsonschema==4.17.0
|
|||
lru-dict==1.1.8
|
||||
Mako==1.2.3
|
||||
MarkupSafe==2.1.1
|
||||
moonstream-entity==0.0.5
|
||||
moonstreamdb==0.3.4
|
||||
multiaddr==0.0.9
|
||||
multidict==6.0.2
|
||||
|
|
|
@ -14,7 +14,6 @@ setup(
|
|||
"appdirs",
|
||||
"boto3",
|
||||
"bugout>=0.2.12",
|
||||
"moonstream-entity>=0.0.5",
|
||||
"fastapi",
|
||||
"moonstreamdb>=0.3.4",
|
||||
"humbug",
|
||||
|
|
Ładowanie…
Reference in New Issue