def get(self, practice_center_id): filters = [ MySQLFilter.filter_equal(f'P.{PracticeCenters.id_col}', practice_center_id) ] return self.build_query(self.select_all_operation, filters)
def update_last_login_date(self, username, last_login_date): filters = [ MySQLFilter.filter_equal_string(Users.username_col, username) ] operation = (f'UPDATE {Users.table_name} ' f"SET {Users.last_login_date_col} = '{last_login_date}' ") return self.build_query(operation, filters)
def get_by_name(self, name): operation = ( f'SELECT {EquipmentTypes.id_col}, {EquipmentTypes.name_col} ' f'FROM {EquipmentTypes.table_name}') filters = [ MySQLFilter.filter_equal_string(EquipmentTypes.name_col, name) ] return self.build_query(operation, filters)
def get_all_for_type(self, type_id, type_id_col, climate_name_col, table_name): operation = (f'SELECT {climate_name_col} AS {self.fake_name_col}' f' FROM {table_name}') filters = [MySQLFilter.filter_equal(type_id_col, type_id)] orders = [climate_name_col] return self.build_query(operation, filters, orders)
def get_all_for_equipment_type(self, type_id): operation = (f'SELECT S.{Sports.id_col}, S.{Sports.name_col} ' f'FROM {Sports.table_name} S ' f'JOIN {SportEquipmentTypes.table_name} E ON ' f'E.{SportEquipmentTypes.sport_id_col} = S.{Sports.id_col}') filters = [MySQLFilter.filter_equal(SportEquipmentTypes.type_id_col, type_id)] orders = [f'S.{Sports.name_col}'] return self.build_query(operation, filters, orders)
def get_by_name(self, name): filters = [MySQLFilter.filter_equal_string(Sports.name_col, name)] return self.build_query(select_all_simple_operation, filters)
def get(self, sport_id): filters = [MySQLFilter.filter_equal(f'S.{Sports.id_col}', sport_id)] return self.build_query(self.select_all_operation, filters)
def get_by_name(self, name): filters = [ MySQLFilter.filter_equal_string(f'{Manufacturers.name_col}', name) ] return self.build_query(select_all_operation, filters)
def get(self, equipment_id): filters = [ MySQLFilter.filter_equal(f'E.{Equipments.id_col}', equipment_id) ] return self.build_query(self.select_all_operation, filters)
def get(self, username): filters = [ MySQLFilter.filter_equal_string(Users.username_col, username) ] return self.build_query(select_all_operation, filters)
def get(self, shop_id): filters = [MySQLFilter.filter_equal(Shops.id_col, shop_id)] return self.build_query(select_all_operation, filters)