def list_skill(qs: str = ''): with SkillRepository() as repo: result, count = repo.get_skill_list(qs) if result: mapping = create_mapping(result[0], SkillDTO) return serialize(odata( count, [create_dto(skill, SkillDTO, mapping) for skill in result])), HTTPStatus.OK else: raise SkillFoundError(ErrorMessages.NoSkillsFound, ErrorCodes.NoSkillsFound, http_status_code=HTTPStatus.NOT_FOUND)
def list_zone(qs: str = ''): with ZoneRepository() as repo: result, count = repo.get_zone_list(qs) if result: mapping = create_mapping(result[0], ZoneDTO) return serialize( odata(count, [create_dto(zone, ZoneDTO, mapping) for zone in result])), HTTPStatus.OK else: raise ZoneFoundError(ErrorMessages.NoZonesFound, ErrorCodes.NoZonesFound, http_status_code=HTTPStatus.NOT_FOUND)
def list_categories(qs: str = ''): with CategoryRepository() as repo: result, count = repo.get_category_list(qs) if result: mapping = create_mapping(result[0], CategoryDTO) return serialize(odata( count, [create_dto(category, CategoryDTO, mapping) for category in result])), HTTPStatus.OK else: raise CategoryListError(ErrorMessages.NoCategoryFound, ErrorCodes.NoService, http_status_code=HTTPStatus.NOT_FOUND)
def list_services(qs: str = ''): with ServiceRepository() as repo: result, count = repo.get_service_list(qs) if result: mapping = create_mapping(result[0], ServiceDTO) return serialize( odata(count, [ create_dto(service, ServiceDTO, mapping) for service in result ])), HTTPStatus.OK else: raise ServiceListError(ErrorMessages.NoServicesFound, ErrorCodes.NoService, http_status_code=HTTPStatus.NOT_FOUND)