def create(i_interview): try: interview = Interview(**i_interview) session.add(interview) session.commit() session.refresh(interview) return interview except exc.IntegrityError as err: raise APIException("", "", err.message)
def create(i_recording): try: recording = Recording(**i_recording) session.add(recording) session.commit() session.refresh(recording) return recording except exc.IntegrityError as err: raise APIException("", "", err.message)
def create(i_question): try: question = Question(**i_question) session.add(question) session.commit() session.refresh(question) return question except exc.IntegrityError as err: raise APIException("", "", err.message)
def action(recording_id, action): try: recording = Recording.get(recording_id=recording_id) recording.r_sid = "" recording.status = RECORDING.STATUS.COMPLETE session.commit() session.refresh(recording) return recording except exc.IntegrityError as err: raise APIException("", "", err.message)
def init_call(interview_id): try: interview = Interview.get(interview_id=interview_id) call_sid = InterviewTask.init_call(BASE_URL + "/questions/1.xml", "+16073388347", interview_id) interview.call_sid = call_sid interview.status = INTERVIEW.STATUS.INIT session.commit() session.refresh(interview) return interview except exc.IntegrityError as err: raise APIException("", "", err.message)