diff --git a/src/app.py b/src/app.py index 4217b93..95066f4 100644 --- a/src/app.py +++ b/src/app.py @@ -2,20 +2,19 @@ import sys from PySide6 import QtWidgets, QtCore -from ui.dashboard import LibraryDashboard +from ui.window import LibraryWindow if __name__ == "__main__": app = QtWidgets.QApplication([]) - window = LibraryDashboard() + window = LibraryWindow() window.show() sys.exit(app.exec()) # from sqlalchemy import create_engine # from sqlalchemy.orm import sessionmaker -# from models.book import Book, BookStatusEnum -# from models.author import Author +# from models.book_overview_view import BookOverviewView # # Replace with your MySQL database credentials # DATABASE_URI = 'mysql+mysqlconnector://username:password@localhost:3306/library' @@ -32,8 +31,8 @@ if __name__ == "__main__": # # Create a session instance # session = SessionLocal() -# books = session.query(Book).all() +# books = session.query(BookOverviewView).all() # for book in books: -# print(book.title, book.author.first_name) +# print(book.title, book.author_name, book.categories) # session.close() \ No newline at end of file diff --git a/src/models/__init__.py b/src/models/__init__.py index 34e40bd..c6d5a5d 100644 --- a/src/models/__init__.py +++ b/src/models/__init__.py @@ -7,4 +7,6 @@ from .member import Member from .librarian import Librarian from .loan import Loan -__all__ = ["Author", "Book", "BookCategory", "BookCategoryLink", "Member", "Librarian", "Loan"] +from .book_overview_view import BookOverviewView + +__all__ = ["Author", "Book", "BookCategory", "BookCategoryLink", "Member", "Librarian", "Loan", "BookOverviewView"] diff --git a/src/models/book_overview_view.py b/src/models/book_overview_view.py new file mode 100644 index 0000000..477e3ed --- /dev/null +++ b/src/models/book_overview_view.py @@ -0,0 +1,16 @@ +from sqlalchemy import Column, String, TIMESTAMP, Integer + +from .base import Base + +class BookOverviewView(Base): + __tablename__ = 'books_overview' + + id = Column(Integer, primary_key=True, autoincrement=True) + title = Column(String()) + author_name = Column(String()) + categories = Column(String()) + year_published = Column(String()) + isbn = Column(String()) + created_at = Column(TIMESTAMP()) + borrower_name = Column(String()) + librarian_name = Column(String()) \ No newline at end of file