def delete_achievement(id): try: selected_achievement = sess.query(achievement).filter(achievement.id == id).first() if selected_achievement is not None: sess.delete(selected_achievement) sess.commit() ret = { 'status': 200, 'message': 'Data deleted!' } return ret else: ret = { 'status': 200, 'message': "Achievement is not registered" } return ret except Exception as e: sess.rollback() ret = { 'status': 200, 'message': e.args, } return ret finally: sess.close()
def delete_publication(cat, id): try: # selected_publication = sess.query(cat).filter(cat.id == id).first() if cat == 'journal': selected_publication = sess.query(journal).filter( journal.id == id).first() elif cat == 'patent': selected_publication = sess.query(patent).filter( patent.id == id).first() elif cat == 'other': selected_publication = sess.query(other_publication).filter( other_publication.id == id).first() else: ret = {'status': 400, 'message': "Wrong category"} return ret if selected_publication is not None: sess.delete(selected_publication) sess.commit() ret = {'status': 200, 'message': 'Data deleted!'} return ret else: ret = {'status': 200, 'message': "Publication is not registered"} return ret except Exception as e: sess.rollback() ret = {'status': 200, 'message': e.args} return ret finally: sess.close()
def delete_research(id): try: selected_research = sess.query(research).filter(research.id == id).first() if selected_research is not None: sess.delete(selected_research) sess.commit() ret = { 'status': 200, 'message': 'Data deleted!' } return ret else: ret = { 'status': 200, 'message': "Research is not registered" } return ret except Exception as e: sess.rollback() ret = { 'status': 200, 'message': e.args } return ret finally: sess.close()
def delete(self, auth_id): try: selected_admin = sess.query(admin).filter(admin.auth_id == auth_id).first() if selected_admin is not None: sess.delete(selected_admin) sess.commit() ret = { 'status': 200, 'message': 'Data deleted!' } return ret else: ret = { 'status': 200, 'message': "Auth_ID is not registered" } return ret except Exception as e: sess.rollback() ret = { 'status': 200, 'message': e.args, } return ret finally: sess.close()
def delete(self, nip): try: selected_lecturer = sess.query(lecturer).filter(lecturer.nip == nip).first() if selected_lecturer is not None: sess.delete(selected_lecturer) sess.commit() ret = { 'status': 200, 'message': 'Data deleted!' } return ret else: ret = { 'status': 200, 'message': "NIP is not registered" } return ret except Exception as e: sess.rollback() ret = { 'status': 200, 'message': e.args, } return ret finally: sess.close()
def delete_experience(id): try: selected_experience = sess.query(experience).filter( experience.id == id).first() if selected_experience is not None: sess.delete(selected_experience) sess.commit() ret = {'status': 200, 'message': 'Data deleted!'} return ret else: ret = {'status': 200, 'message': "Experience is not registered"} return ret except Exception as e: sess.rollback() ret = {'status': 200, 'message': e.args} return ret finally: sess.close()
def deleteTask(id): try: selected_final_task = sess.query(finalTask).filter( finalTask.id == id).first() if selected_final_task is not None: sess.delete(selected_final_task) sess.commit() ret = {'status': 200, 'message': 'Data deleted!'} return ret else: ret = {'status': 200, 'message': "Final Task is not registered"} return ret except Exception as e: sess.rollback() ret = {'status': 200, 'message': e.args} return ret finally: sess.close()
def delete(self, academic_id): try: selected_course = sess.query(academic).filter( academic.id == academic_id).first() if selected_course is not None: sess.delete(selected_course) sess.commit() ret = {'status': 200, 'message': 'Data deleted!'} return ret else: ret = {'status': 200, 'message': "Course ID is not registered"} return ret except Exception as e: sess.rollback() ret = {'status': 200, 'message': e.args} return ret finally: sess.close()
def delete(self, id): try: selected_academic_lecturer = sess.query(academic_lecturer).filter( academic_lecturer.id == id).first() if selected_academic_lecturer is not None: sess.delete(selected_academic_lecturer) sess.commit() ret = {'status': 200, 'message': 'Data deleted!'} return ret else: ret = { 'status': 200, 'message': "Academic Lecturer is not registered" } return ret except Exception as e: sess.rollback() ret = {'status': 200, 'message': e.args} return ret finally: sess.close()