def get(self): state = request.args.get('state', None) prof = request.args.get('profession', None) county = request.args.get('county', None) city = request.args.get('city', None) zipcode = request.args.get('zipcode', None) license = request.args.get('license', None) phone = request.args.get('phone', None) email = request.args.get('email', None) employees = request.args.get('employees', None) company_name = request.args.get('company_name', None) srch_type_comp = request.args.get('srch_type_comp', None) lic_owner = request.args.get('lic_owner', None) srch_type_licO = request.args.get('srch_type_licO', None) record = RecordSchema.getCounts_main_filter( state, prof, county, city, zipcode, license, phone, email, employees, company_name, srch_type_comp, lic_owner, srch_type_licO) if record: return {'count': record} return {'message': 'record not found'}, 404
def get(self): licenseType = request.args.get('license_type', None) state = request.args.get('state', None) state = None if state == 'all' else state prof = request.args.get('profession', None) profBucket = request.args.get('profession_bucket', None) profSubBucket = request.args.get('profession_sub_bucket', None) profSubBucket2 = request.args.get('profession_sub_bucket2', None) county = request.args.get('county', None) city = request.args.get('city', None) zipcode = request.args.get('zipcode', None) license = request.args.get('license', None) phone = request.args.get('phone', None) email = request.args.get('email', None) employees = request.args.get('employees', None) company_name = request.args.get('company_name', None) srch_type_comp = request.args.get('srch_type_comp', None) lic_owner = request.args.get('lic_owner', None) srch_type_licO = request.args.get('srch_type_licO', None) # print("SEARCH PRM", state) allowedProfessions = None allowedProfessionsBuckets = None record = None # check if License type requested is allowed for current user if licenseType is not None and licenseType != "all": # print("0---------------------------------") if UserPrm.isTypeInPrm(get_jwt_identity(), 'Lic_types', licenseType): # print("1---------------------------------") if prof is not None: if UserPrm.isProfessionInPrm(get_jwt_identity(), 'Professions', prof): # print("2---------------------------------") allowedProfessions = UserPrm.getAllowedProfessions( get_jwt_identity(), 'Professions') record = RecordSchema.getCounts_main_filter( licenseType, state, prof, allowedProfessions, profBucket, allowedProfessionsBuckets, profSubBucket, profSubBucket2, county, city, zipcode, license, phone, email, employees, company_name, srch_type_comp, lic_owner, srch_type_licO) elif profBucket is not None: if UserPrm.isProfessionInPrm(get_jwt_identity(), 'ProfessionBuckets', profBucket): allowedProfessionsBuckets = UserPrm.getAllowedProfessions( get_jwt_identity(), 'ProfessionBuckets') record = RecordSchema.getCounts_main_filter( licenseType, state, prof, allowedProfessions, profBucket, allowedProfessionsBuckets, profSubBucket, profSubBucket2, county, city, zipcode, license, phone, email, employees, company_name, srch_type_comp, lic_owner, srch_type_licO) else: if UserPrm.isProfessionInPrm(get_jwt_identity(), 'ProfessionBuckets', profBucket): allowedProfessionsBuckets = UserPrm.getAllowedProfessions( get_jwt_identity(), 'ProfessionBuckets') allowedProfessions = UserPrm.getAllowedProfessions( get_jwt_identity(), 'Professions') record = RecordSchema.getCounts_main_filter( licenseType, state, prof, allowedProfessions, profBucket, allowedProfessionsBuckets, profSubBucket, profSubBucket2, county, city, zipcode, license, phone, email, employees, company_name, srch_type_comp, lic_owner, srch_type_licO) if record: return {'count': record} return {'message': 'record not found'}, 404