示例#1
0
 def get_all_schools(self) -> (List, Any):
     """
     get all school
     :return: school list of dict
     """
     try:
         self.logger.info("Get school list")
         return self.__return_school_list(SchoolModel.get_all_schools())
     except SQLAlchemyError as error:
         self.logger.error("Error: {}".format(error))
         raise SQLCustomError(description="GET School SQL ERROR")
示例#2
0
 def get_all_schools(self, page: int = 1) -> (List, Any):
     """
     get all school
     :params:page : int
     :return: school list of dict
     """
     try:
         self.logger.info("Get school list")
         schools = SchoolModel.get_all_schools(page)
         return self.__return_school_list(schools.items), schools.total
     except SQLAlchemyError as error:
         self.logger.error("Error: {}".format(error))
         raise SQLCustomError(description="GET School SQL ERROR")
示例#3
0
 def get_all_schools(self,
                     page: int = 1,
                     per_page: int = 20) -> Dict[str, Union[list, Any]]:
     """
     get all school
     :params:page : int
     :params:per_page : int
     :return: school list of dict
     """
     try:
         self.logger.info("Get school list")
         schools = SchoolModel.get_all_schools(page, per_page)
         return {
             "schools": self.__return_school_list(schools.items),
             "total_count": schools.total,
             "current_page": schools.page,
             "next_page": schools.next_num,
             "prev_page": schools.prev_num,
             "pages": schools.pages
         }
     except SQLAlchemyError as error:
         self.logger.error("Error: {}".format(error))
         raise SQLCustomError(description="GET School SQL ERROR")