remove MetaDataTable and MetaDataColumn to cleanup schema
This commit is contained in:
@@ -143,6 +143,16 @@ class Assignment(Base, BaseMixin):
|
||||
self.module_name = import_data['module_name']
|
||||
self.import_data = import_data['import_data']
|
||||
|
||||
def export_dict(self) -> Dict[AnyStr, Any]:
|
||||
item: Dict[AnyStr, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['module_name'] = self.module_name
|
||||
item['import_data'] = self.import_data
|
||||
return item
|
||||
|
||||
|
||||
class MailAccount(Base, BaseMixin):
|
||||
__tablename__ = "mail_account"
|
||||
|
||||
@@ -243,6 +243,20 @@ class Issue(Base, BaseMixin):
|
||||
self.volume_id = import_data['volume_id']
|
||||
self.story_arc_id = import_data['story_arc_id']
|
||||
|
||||
def export_dict(self) -> Dict[AnyStr, Any]:
|
||||
item: Dict[AnyStr, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['issue_number'] = self.issue_number
|
||||
item['in_stock'] = self.in_stock
|
||||
item['is_read'] = self.is_read
|
||||
item['comic_id'] = self.comic_id
|
||||
item['volume_id'] = self.volume_id
|
||||
item['story_arc_id'] = self.story_arc_id
|
||||
return item
|
||||
|
||||
|
||||
class Artist(Base, BaseMixin):
|
||||
__tablename__ = "artist"
|
||||
@@ -280,6 +294,16 @@ class Artist(Base, BaseMixin):
|
||||
if 'weblink' in import_data:
|
||||
self.weblink = import_data['weblink']
|
||||
|
||||
def export_dict(self) -> Dict[AnyStr, Any]:
|
||||
item: Dict[AnyStr, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
item['weblink'] = self.weblink
|
||||
return item
|
||||
|
||||
|
||||
class WorkType(Base, BaseMixin):
|
||||
__tablename__ = "worktype"
|
||||
|
||||
@@ -116,6 +116,15 @@ class MediaActor(Base, BaseMixin):
|
||||
item['name'] = self.name
|
||||
return item
|
||||
|
||||
def export_dict(self) -> Dict[AnyStr, Any]:
|
||||
item: Dict[AnyStr, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
return item
|
||||
|
||||
|
||||
class MediaActorFile(Base, BaseMixin):
|
||||
__tablename__ = 'media_actor_file'
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
from typing import Any, AnyStr, Dict
|
||||
from sqlalchemy import Column, String, ForeignKey, Integer, Boolean
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from db.models.base import Base, BaseMixin
|
||||
|
||||
|
||||
class MetaDataTable(Base, BaseMixin):
|
||||
__tablename__ = 'meta_data_table'
|
||||
table_name = Column(String, unique=True)
|
||||
table_columns = relationship("MetaDataColumn")
|
||||
|
||||
def __repr__(self):
|
||||
return f'MetaDataTable({self.id} {self.table_name})'
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.table_name}({self.id})'
|
||||
|
||||
def import_dict(self, import_data: Dict[AnyStr, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.table_name = import_data['table_name']
|
||||
|
||||
|
||||
class MetaDataColumn(Base, BaseMixin):
|
||||
__tablename__ = 'meta_data_column'
|
||||
column_name = Column(String, nullable=False)
|
||||
column_type = Column(String)
|
||||
column_order = Column(Integer)
|
||||
is_shown = Column(Boolean)
|
||||
column_label = Column(String)
|
||||
show_filter = Column(Boolean)
|
||||
filter_label = Column(String)
|
||||
ref_column = Column(String, nullable=True)
|
||||
table_id = Column(String, ForeignKey('meta_data_table.id'))
|
||||
table = relationship("MetaDataTable", back_populates="table_columns")
|
||||
|
||||
def __repr__(self):
|
||||
if self.column_name is None:
|
||||
return f'MetaDataColumn({self.id} {self.table.table_name}.__)'
|
||||
else:
|
||||
return f'MetaDataColumn({self.id} {self.table.table_name}.{self.column_name})'
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.column_name}({self.id})'
|
||||
|
||||
def import_dict(self, import_data: Dict[AnyStr, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.column_name = import_data['column_name']
|
||||
self.column_type = import_data['column_type']
|
||||
self.column_order = import_data['column_order']
|
||||
self.table_id = import_data['table_id']
|
||||
self.is_shown = import_data['is_shown']
|
||||
self.column_label = import_data['column_label']
|
||||
self.show_filter = import_data['show_filter']
|
||||
self.filter_label = import_data['filter_label']
|
||||
self.ref_column = import_data['ref_column']
|
||||
Reference in New Issue
Block a user