remove obsolete kontor.py #61

Merged
tpeetz merged 166 commits from develop/0.1.0 into main 2025-04-30 15:31:19 +00:00
3 changed files with 112 additions and 2 deletions
Showing only changes of commit 4cea554116 - Show all commits
+10 -1
View File
@@ -3,10 +3,11 @@ from datetime import datetime
from pathlib import Path from pathlib import Path
from .base import Base from .base import Base
from .bookshelf import Article, Book, Author, BookshelfPublisher, ArticleAuthor, BookAuthor
from .comic import Comic, Artist, Publisher, Issue, StoryArc, TradePaperback, Volume, ComicWork, WorkType from .comic import Comic, Artist, Publisher, Issue, StoryArc, TradePaperback, Volume, ComicWork, WorkType
from .metadata import MetaDataTable, MetaDataColumn from .metadata import MetaDataTable, MetaDataColumn
from .tysc import Card, CardSet, Sport, Team, FieldPosition, Rooster, Player, Vendor from .tysc import Card, CardSet, Sport, Team, FieldPosition, Rooster, Player, Vendor
from .media import MediaFile from .media import MediaFile, MediaArticle, MediaVideo
class KontorDB: class KontorDB:
@@ -35,7 +36,15 @@ class KontorDB:
self.registry['volume'] = Volume self.registry['volume'] = Volume
self.registry['comic_work'] = ComicWork self.registry['comic_work'] = ComicWork
self.registry['worktype'] = WorkType self.registry['worktype'] = WorkType
self.registry['article'] = Article
self.registry['book'] = Book
self.registry['author'] = Author
self.registry['bookshelf_publisher'] = BookshelfPublisher
self.registry['article_author'] = ArticleAuthor
self.registry['book_author'] = BookAuthor
self.registry['media_file'] = MediaFile self.registry['media_file'] = MediaFile
self.registry['media_article'] = MediaArticle
self.registry['media_video'] = MediaVideo
def get_table_names(self) -> list: def get_table_names(self) -> list:
tables = self.session.query(MetaDataTable).all() tables = self.session.query(MetaDataTable).all()
+75
View File
@@ -0,0 +1,75 @@
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String
from sqlalchemy.dialects.mysql import BIT
from sqlalchemy.orm import relationship
from .base import Base
class Article(Base):
__tablename__ = 'article'
id = Column(String, primary_key=True)
created_date = Column(DateTime)
last_modified_date = Column(DateTime)
version = Column(Integer)
title = Column(String(length=255), unique=True)
article_authors = relationship("ArticleAuthor")
class Author(Base):
__tablename__ = 'author'
id = Column(String, primary_key=True)
created_date = Column(DateTime)
last_modified_date = Column(DateTime)
version = Column(Integer)
first_name = Column(String(255))
last_name = Column(String(255))
article_authors = relationship("ArticleAuthor")
book_authors = relationship("BookAuthor")
class BookshelfPublisher(Base):
__tablename__ = 'bookshelf_publisher'
id = Column(String, primary_key=True)
created_date = Column(DateTime)
last_modified_date = Column(DateTime)
version = Column(Integer)
name = Column(String(length=255), unique=True)
books = relationship("Book")
class Book(Base):
__tablename__ = 'book'
id = Column(String, primary_key=True)
created_date = Column(DateTime)
last_modified_date = Column(DateTime)
version = Column(Integer)
isbn = Column(String(255), unique=True)
title = Column(String(255))
year = Column(Integer, nullable=False)
publisher_id = Column(String, ForeignKey('bookshelf_publisher.id'), nullable=False)
publisher = relationship('BookshelfPublisher', back_populates="books")
book_authors = relationship("BookAuthor")
class ArticleAuthor(Base):
__tablename__ = 'article_author'
id = Column(String, primary_key=True)
created_date = Column(DateTime)
last_modified_date = Column(DateTime)
version = Column(Integer)
article_id = Column(String, ForeignKey('article.id'), nullable=False)
article = relationship('Article', back_populates="article_authors")
author_id = Column(String, ForeignKey('author.id'), nullable=False)
author = relationship('Author', back_populates="article_authors")
class BookAuthor(Base):
__tablename__ = 'book_author'
id = Column(String, primary_key=True)
created_date = Column(DateTime)
last_modified_date = Column(DateTime)
version = Column(Integer)
author_id = Column(String, ForeignKey('author.id'), nullable=False)
author = relationship('Author', back_populates="book_authors")
book_id = Column(String, ForeignKey('book.id'), nullable=False)
book = relationship('Book', back_populates="book_authors")
+27 -1
View File
@@ -15,7 +15,7 @@ class MediaFile(Base):
path = Column(String(255)) path = Column(String(255))
review = Column(BIT(1)) review = Column(BIT(1))
title = Column(String(255)) title = Column(String(255))
url = Column(String(255)) url = Column(String(255), unique=True)
should_download = Column(BIT(1)) should_download = Column(BIT(1))
def __repr__(self): def __repr__(self):
@@ -23,3 +23,29 @@ class MediaFile(Base):
def __str__(self): def __str__(self):
return f'{self.title}({self.id})' return f'{self.title}({self.id})'
class MediaArticle(Base):
__tablename__ = 'media_article'
id = Column(String, primary_key=True)
created_date = Column(DateTime)
last_modified_date = Column(DateTime)
version = Column(Integer)
review = Column(BIT(1))
title = Column(String(255))
url = Column(String(255), unique=True)
class MediaVideo(Base):
__tablename__ = 'media_video'
id = Column(String, primary_key=True)
created_date = Column(DateTime)
last_modified_date = Column(DateTime)
version = Column(Integer)
cloud_link = Column(String(255))
file_name = Column(String(255))
path = Column(String(255))
review = Column(BIT(1))
title = Column(String(255))
url = Column(String(255), unique=True)
should_download = Column(BIT(1))