def apply_job(): request_value = request.get_json() job_id = request_value['job_id'] company_id = request_value['company_id'] job = Job.query.filter_by(id=job_id).one_or_none() if job is None: abort(404) company = Company.query.filter_by(id=company_id).one_or_none() if company is None: abort(404) candidate = Candidate( job_id, company_id, request_value['name'], request_value['email'], request_value['phone'] ) candidate.insert() return jsonify({ 'message': 'Your application was successfully sent.', 'status_code': 200, 'success': True })
def add_candidate_profile(payload): try: body = request.get_json() new_name = body.get('name') new_surname = body.get('surname') new_date_of_birth = body.get('date_of_birth') new_city = body.get('city') new_region = body.get('region') new_email = body.get('email') new_phone = body.get('phone') new_facebook_link = body.get('facebook_link') new_linkedin_link = body.get('linkedin_link') new_address = body.get('address') new_work_experience = body.get('work_experience') new_education = body.get('education') new_seeking_job = body.get('seeking_job') new_desired_salary = body.get('desired_salary') new_desired_industry = body.get('desired_industry') candidate = Candidate(name=new_name, surname=new_surname, date_of_birth=new_date_of_birth, city=new_city, region=new_region, email=new_email, phone=new_phone, facebook_link=new_facebook_link, linkedin_link=new_linkedin_link, address=new_address, work_experience=new_work_experience, education=new_education, seeking_job=new_seeking_job, desired_salary=new_desired_salary, desired_industry=new_desired_industry) candidate.insert() return jsonify({'success': True}) except Exception: print(sys.exc_info()) abort(422)