def search_history(self, keyword: str): user_query = self.__search_user(keyword) book_query = self.__search_book(keyword) return DatabaseManager.get_list(BookCirculation.select().where( (BookCirculation.user << user_query) | (BookCirculation.book << book_query)))
def search_borrowing(self, keyword: str): user_query = self.__search_user(keyword) book_query = self.__search_book(keyword) return DatabaseManager.get_list(BookCirculation.select().where( ((BookCirculation.user << user_query) | (BookCirculation.book << book_query)) & BookCirculation.return_time.is_null(True)))
def get_all_books(self): return DatabaseManager.get_list( Book.select().where(Book.is_available == True))
def search(self, keyword): return DatabaseManager.get_list( Book.select().where((Book.title.contains(keyword)) & (Book.is_available == True)))
def get_all_being_borrowed(self): return DatabaseManager.get_list(BookCirculation.select().where( BookCirculation.return_time.is_null(True)))
def get_complete_history(self): return DatabaseManager.get_list(BookCirculation.select())
def get_all_user(self): return DatabaseManager.get_list( User.select().where(User.is_active == True))
def search(self, keyword): return DatabaseManager.get_list( User.select().where((User.name.contains(keyword)) & (User.is_active == True)))