mv did as a module and migrates files to dpp

This commit is contained in:
Cayo Puigdefabregas 2023-06-16 18:05:52 +02:00
parent 1f78c184b5
commit 311ca3ca51
9 changed files with 14 additions and 23 deletions

View File

@ -1,7 +1,7 @@
"""sanitization """sanitization
Revision ID: 4f33137586dd Revision ID: 4f33137586dd
Revises: 8334535d56fa Revises: 93daff872771
Create Date: 2023-02-13 18:01:00.092527 Create Date: 2023-02-13 18:01:00.092527
""" """
@ -14,7 +14,7 @@ from ereuse_devicehub import teal
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = '4f33137586dd' revision = '4f33137586dd'
down_revision = '8334535d56fa' down_revision = '93daff872771'
branch_labels = None branch_labels = None
depends_on = None depends_on = None

View File

@ -1,7 +1,7 @@
"""add vendor family in device """add vendor family in device
Revision ID: 564952310b17 Revision ID: 564952310b17
Revises: 4b7f77f121bf Revises: af038a8a388c
Create Date: 2022-11-14 13:12:22.916848 Create Date: 2022-11-14 13:12:22.916848
""" """
@ -11,7 +11,7 @@ from alembic import context, op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = '564952310b17' revision = '564952310b17'
down_revision = '4b7f77f121bf' down_revision = 'af038a8a388c'
branch_labels = None branch_labels = None
depends_on = None depends_on = None

View File

@ -9,10 +9,10 @@ from flask.json import jsonify
from flask.views import View from flask.views import View
from ereuse_devicehub import __version__ from ereuse_devicehub import __version__
from ereuse_devicehub.modules.dpp.models import Dpp
from ereuse_devicehub.resources.device.models import Device from ereuse_devicehub.resources.device.models import Device
from ereuse_devicehub.resources.did.models import Dpp
did = Blueprint('did', __name__, url_prefix='/did') did = Blueprint('did', __name__, url_prefix='/did', template_folder='templates')
class DidView(View): class DidView(View):

View File

@ -1,7 +1,7 @@
"""add api_keys_dlt to user """add api_keys_dlt to user
Revision ID: 4b7f77f121bf Revision ID: 4b7f77f121bf
Revises: af038a8a388c Revises:
Create Date: 2022-12-01 10:35:36.795035 Create Date: 2022-12-01 10:35:36.795035
""" """
@ -11,7 +11,7 @@ from alembic import context, op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = '4b7f77f121bf' revision = '4b7f77f121bf'
down_revision = 'af038a8a388c' down_revision = None
branch_labels = None branch_labels = None
depends_on = None depends_on = None

View File

@ -1,7 +1,7 @@
"""add digital passport dpp """add digital passport dpp
Revision ID: 8334535d56fa Revision ID: 8334535d56fa
Revises: 93daff872771 Revises: 4b7f77f121bf
Create Date: 2023-01-19 12:01:54.102326 Create Date: 2023-01-19 12:01:54.102326
""" """
@ -12,7 +12,7 @@ from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = '8334535d56fa' revision = '8334535d56fa'
down_revision = '93daff872771' down_revision = '4b7f77f121bf'
branch_labels = None branch_labels = None
depends_on = None depends_on = None

View File

@ -6,7 +6,7 @@ from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import backref, relationship from sqlalchemy.orm import backref, relationship
from sqlalchemy.util import OrderedSet from sqlalchemy.util import OrderedSet
from ereuse_devicehub.resources.action.models import ActionStatus, Snapshot from ereuse_devicehub.resources.action.models import Snapshot
from ereuse_devicehub.resources.device.models import Device from ereuse_devicehub.resources.device.models import Device
from ereuse_devicehub.resources.models import STR_SM_SIZE, Thing from ereuse_devicehub.resources.models import STR_SM_SIZE, Thing
from ereuse_devicehub.resources.user.models import User from ereuse_devicehub.resources.user.models import User
@ -60,15 +60,6 @@ class Proof(Thing):
primaryjoin=Snapshot.id == snapshot_id, primaryjoin=Snapshot.id == snapshot_id,
) )
action_status_id = Column(
UUID(as_uuid=True), ForeignKey(ActionStatus.id), nullable=True
)
action_status = relationship(
ActionStatus,
backref=backref('proofs', lazy=True),
primaryjoin=ActionStatus.id == action_status_id,
)
class Dpp(Thing): class Dpp(Thing):
""" """

View File

@ -510,7 +510,7 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice):
api = API(api_dlt, token_dlt, "ethereum") api = API(api_dlt, token_dlt, "ethereum")
from ereuse_devicehub.resources.did.models import PROOF_ENUM, Proof from ereuse_devicehub.modules.dpp.models import PROOF_ENUM, Proof
deviceCHID = self.device.chid deviceCHID = self.device.chid
docSig = hashlib.sha3_256(self.snapshot.json_wb.encode('utf-8')).hexdigest() docSig = hashlib.sha3_256(self.snapshot.json_wb.encode('utf-8')).hexdigest()
@ -881,7 +881,7 @@ class Snapshot(JoinedWithOneDeviceMixin, ActionWithOneDevice):
if 'dpp' not in app.blueprints.keys() or not self.device.hid: if 'dpp' not in app.blueprints.keys() or not self.device.hid:
return return
from ereuse_devicehub.resources.did.models import Dpp from ereuse_devicehub.modules.dpp.models import Dpp
dpp = "{chid}:{phid}".format(chid=self.device.chid, phid=self.phid_dpp) dpp = "{chid}:{phid}".format(chid=self.device.chid, phid=self.phid_dpp)
if Dpp.query.filter_by(key=dpp).all(): if Dpp.query.filter_by(key=dpp).all():

View File

@ -948,7 +948,7 @@ class Device(Thing):
api = API(api_dlt, token_dlt, "ethereum") api = API(api_dlt, token_dlt, "ethereum")
result = api.register_device(self.chid) result = api.register_device(self.chid)
from ereuse_devicehub.resources.did.models import PROOF_ENUM, Proof from ereuse_devicehub.modules.dpp.models import PROOF_ENUM, Proof
from ereuse_devicehub.resources.enums import StatusCode from ereuse_devicehub.resources.enums import StatusCode
if result['Status'] == StatusCode.Success.value: if result['Status'] == StatusCode.Success.value: