Exemplo n.º 1
0
def get_interviews_by_job_id(job_id):
    interview_list1 = []
    return_job = db_session.query(JobHasCandidate).filter(
        JobHasCandidate.position_id == job_id)
    for row in return_job:
        jhcid = row.id
        print(jhcid)
        # get list of interviews for that job_has_candidate_id
        result11 = db_session.query(Interview).filter(
            Interview.job_has_candidate_id == jhcid)
        # Loop through  interview list, convert to json and add to result list
        for interview in result11:
            interview_list1.append(interview.serialize())
    return jsonify(interview_list1)
Exemplo n.º 2
0
def get_interviews_by_candidate_id(candi_id):
    interview_list = []
    # Get entries from JobHasCandidate table for the specific candidate id
    return_interview = db_session.query(JobHasCandidate).filter(
        JobHasCandidate.candidate_id == candi_id)
    for row in return_interview:
        jhcid = row.id
        # get list of interviews for that job_has_candidate_id
        result = db_session.query(Interview).filter(
            Interview.job_has_candidate_id == jhcid)
        # Loop through  interview list, convert to json and add to result list
        for interview in result:
            interview_list.append(interview.serialize())
    return jsonify(interview_list)
def get_interview_by_candidate_id(id):
    result = db_session.query(Interview).filter(
        Interview.job_has_candidate_id == id)
    candidate_list = []
    for value in result:
        candidate_list.append(value.serialize())
    return jsonify(candidate_list)
Exemplo n.º 4
0
def get_interview_by_date(days):
    current_date = datetime.now()
    search_date = datetime.now() + timedelta(days=int(days))
    results = db_session.query(Interview).filter(Interview.schedule_time.between(current_date, search_date))
    date_list = []
    for value in results:
        date_list.append(value.serialize())
    return jsonify(date_list)
Exemplo n.º 5
0
def update_interview(id):
   content = request.get_json()
   interviewUpdatedObj = Interview(content)
   # interviewObj.id = id
   # db_session.add(interviewObj)
   interviewObj = db_session.query(Interview).get(id)
   interviewObj = interviewUpdatedObj
   db_session.commit()
   return {"id": interviewObj.id,"status": "OK"}
Exemplo n.º 6
0
def patch_interview(id):
    content = request.get_json()
    db_value = db_session.query(Interview).get(id)
    key_list = content.keys()
    if 'comment' in key_list:
        db_value.comment = content['comment']
    if 'feedback' in key_list:
        db_value.feedback = content['feedback']
    db_session.commit()
    return {"id": id, "status": "Feedback recorded"}
Exemplo n.º 7
0
def patch_interview(id):
    content = request.get_json()
    db_value = db_session.query(Interview).get(id)
    key_list = content.keys()
    if 'channel' in key_list:
        db_value.channel=content['channel']
    if 'location' in key_list:
        db_value.location = content['location']
    if 'comment' in key_list:
        db_value.comment = content['comment']
    if 'feedback' in key_list:
        db_value.feedback = content['feedback']
    db_session.commit()
    return "Row updated"
Exemplo n.º 8
0
def delete_interview(id):
    x = db_session.query(Interview).get(id)
    db_session.delete(x)
    db_session.commit()
    return {"status": "OK"}
Exemplo n.º 9
0
def get_interview(id):
    return jsonify(db_session.query(Interview).get(id).serialize())
Exemplo n.º 10
0
def get_interviews():
    interviews = db_session.query(Interview).all()
    interview_list = []
    for interview in interviews:
        interview_list.append(interview.serialize())
    return jsonify(interview_list)
Exemplo n.º 11
0
def get_interview(id):
    interview_obj = db_session.query(Interview).get(id)
    if interview_obj == None:
        abort(404)
    return jsonify(interview_obj.serialize())