[main] Added model for a view
This commit is contained in:
parent
fb7aebd0d7
commit
277abe79d7
11
src/app.py
11
src/app.py
@ -2,20 +2,19 @@ import sys
|
|||||||
from PySide6 import QtWidgets, QtCore
|
from PySide6 import QtWidgets, QtCore
|
||||||
|
|
||||||
|
|
||||||
from ui.dashboard import LibraryDashboard
|
from ui.window import LibraryWindow
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = QtWidgets.QApplication([])
|
app = QtWidgets.QApplication([])
|
||||||
window = LibraryDashboard()
|
window = LibraryWindow()
|
||||||
window.show()
|
window.show()
|
||||||
sys.exit(app.exec())
|
sys.exit(app.exec())
|
||||||
|
|
||||||
# from sqlalchemy import create_engine
|
# from sqlalchemy import create_engine
|
||||||
# from sqlalchemy.orm import sessionmaker
|
# from sqlalchemy.orm import sessionmaker
|
||||||
|
|
||||||
# from models.book import Book, BookStatusEnum
|
# from models.book_overview_view import BookOverviewView
|
||||||
# from models.author import Author
|
|
||||||
|
|
||||||
# # Replace with your MySQL database credentials
|
# # Replace with your MySQL database credentials
|
||||||
# DATABASE_URI = 'mysql+mysqlconnector://username:password@localhost:3306/library'
|
# DATABASE_URI = 'mysql+mysqlconnector://username:password@localhost:3306/library'
|
||||||
@ -32,8 +31,8 @@ if __name__ == "__main__":
|
|||||||
# # Create a session instance
|
# # Create a session instance
|
||||||
# session = SessionLocal()
|
# session = SessionLocal()
|
||||||
|
|
||||||
# books = session.query(Book).all()
|
# books = session.query(BookOverviewView).all()
|
||||||
# for book in books:
|
# for book in books:
|
||||||
# print(book.title, book.author.first_name)
|
# print(book.title, book.author_name, book.categories)
|
||||||
|
|
||||||
# session.close()
|
# session.close()
|
@ -7,4 +7,6 @@ from .member import Member
|
|||||||
from .librarian import Librarian
|
from .librarian import Librarian
|
||||||
from .loan import Loan
|
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"]
|
||||||
|
16
src/models/book_overview_view.py
Normal file
16
src/models/book_overview_view.py
Normal file
@ -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())
|
Loading…
x
Reference in New Issue
Block a user