Ejemplo n.º 1
0
    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)))
Ejemplo n.º 2
0
    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)))
Ejemplo n.º 5
0
 def get_all_being_borrowed(self):
     return DatabaseManager.get_list(BookCirculation.select().where(
         BookCirculation.return_time.is_null(True)))
Ejemplo n.º 6
0
 def get_complete_history(self):
     return DatabaseManager.get_list(BookCirculation.select())
Ejemplo n.º 7
0
 def get_all_user(self):
     return DatabaseManager.get_list(
         User.select().where(User.is_active == True))
Ejemplo n.º 8
0
 def search(self, keyword):
     return DatabaseManager.get_list(
         User.select().where((User.name.contains(keyword))
                             & (User.is_active == True)))