コード例 #1
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
 def save(self):
     try:
         check_user = sess.query(admin).filter(admin.auth_id == self.auth_id).first()
         if check_user is not None:
             ret = {
                 'status': 200,
                 'message': "Auth_ID already registered, try again another Auth_ID"
             }
             return ret
         sess.add(self)
         sess.commit()
         new_admin = {
             'id': self.id,
             'auth_id': self.auth_id,
             'name': self.name,
             'role': self.role,
             'email': self.email
         }
         ret = {
             'status': 200,
             'message': 'Admin Registered',
             'results': new_admin
         }
         return ret
     except Exception as e:
         sess.rollback()
         ret = {
             'status': 200,
             'message': e.args,
         }
         return ret
     finally:
             sess.close()
コード例 #2
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
 def save(self):
     try:
         check_user = sess.query(lecturer).filter(lecturer.nip == self.nip).first()
         if check_user is not None:
             ret = {
                 'status': 200,
                 'message': "NIP already registered, try again another NIP"
             }
             return ret
         new_lecturer = {
             'name': self.name,
             'role': self.role,
             'nip': self.nip,
             'email': self.email
         }
         ret = {
             'status': 200,
             'message': 'Lecturer Registered',
             'results': new_lecturer
         }
         sess.add(self)
         sess.commit()
         return ret
     except Exception as e:
         sess.rollback()
         ret = {
             'status': 200,
             'message': e.args,
         }
         return ret
     finally:
             sess.close()
コード例 #3
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
 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()
コード例 #4
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def edit_final_task_lecturer(id, request):
    try:
        selected_final_task_lecturer = sess.query(finalTask_lecturer).filter(
            finalTask_lecturer.final_task_id == id)
        if selected_final_task_lecturer.first() is not None:
            # data_finalTask = {}
            # for k in request.keys():
            #     param = k
            #     data_finalTask[k] = request[param]
            # edit = selected_final_task_lecturer.update(data_finalTask, synchronize_session=False)
            edit = selected_final_task_lecturer.update(
                request, synchronize_session=False)
            sess.commit()
            if edit == 1:
                ret = {'status': 200, 'message': 'Data updated!'}
            else:
                ret = {
                    'status':
                    500,
                    'message':
                    "Something's went wrong with our server. Please try again later!"
                }
            return ret
        else:
            ret = {'status': 400, 'message': "Final Task is not registered"}
            return ret
    except Exception as e:
        sess.rollback()
        ret = {
            'status': 500,
            'message': e.args,
        }
        return ret
    finally:
        sess.close()
コード例 #5
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
 def save(self):
     try:
         sess.add(self)
         sess.commit()
         new_final_task_lecturer = {
             'id': self.id,
             'final_task_id': self.final_task_id,
             'lecturer_nip': self.lecturer_nip,
             'lecturer_position': self.lecturer_position,
         }
         ret = {
             'status': 200,
             'message': 'New Final Task Lecturer Registered',
             'results': "Sukses"
         }
         return ret
     except Exception as e:
         sess.rollback()
         ret = {
             'status': 200,
             'message': e.args,
         }
         return ret
     finally:
         sess.close()
コード例 #6
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
 def save(self):
     try:
         sess.add(self)
         sess.commit()
         new_final_task = {
             'id': self.id,
             'student_name': self.student_name,
             'student_nim': self.student_nim,
             'student_type': self.student_type,
             'title': self.title,
             'starting_date': self.starting_date,
             'graduation_date': self.graduation_date
         }
         ret = {
             'status': 200,
             'message': 'New Final Task Registered',
             'results': new_final_task
         }
         return ret
     except Exception as e:
         sess.rollback()
         ret = {
             'status': 200,
             'message': e.args,
         }
         return ret
     finally:
         sess.close()
コード例 #7
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def get_all_final_task():
    try:
        final_task = sess.query(finalTask, finalTask_file, finalTask_lecturer).\
            filter(finalTask.id == finalTask_file.final_task_id).\
            filter(finalTask.id == finalTask_lecturer.final_task_id).all()
        res = []
        for data in final_task:
            temp = {
                'final_task_id': data.finalTask.id,
                'student_name': data.finalTask.student_name,
                'student_nim': data.finalTask.student_nim,
                'student_type': data.finalTask.student_type,
                'title': data.finalTask.title,
                'lecturer_nip': data.finalTask_lecturer.lecturer_nip,
                'lecturer_position': data.finalTask_lecturer.lecturer_position,
                'file_path': data.finalTask_file.file_path,
                'starting_date': data.finalTask.starting_date,
                'graduation_date': data.finalTask.graduation_date,
            }
            res.append(temp)
        ret = {
            'status': 200,
            'message': 'these are the registered final tasks',
            'results': res
        }
        return ret
    except Exception as e:
        ret = {
            'status': 200,
            'message': e.args,
        }
        return ret
    finally:
        sess.close()
コード例 #8
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def get_finalTask_byID(id):
    try:
        data = sess.query(finalTask, finalTask_file, finalTask_lecturer).filter(finalTask.id == id).\
            filter(finalTask.id == finalTask_file.final_task_id).\
            filter(finalTask.id == finalTask_lecturer.final_task_id).first()
        res = {
            'final_task_id': data.finalTask.id,
            'student_name': data.finalTask.student_name,
            'student_nim': data.finalTask.student_nim,
            'student_type': data.finalTask.student_type,
            'title': data.finalTask.title,
            'lecturer_nip': data.finalTask_lecturer.lecturer_nip,
            'lecturer_position': data.finalTask_lecturer.lecturer_position,
            'file_path': data.finalTask_file.file_path,
            'starting_date': data.finalTask.starting_date,
            'graduation_date': data.finalTask.graduation_date,
        }
        ret = {
            'status': 200,
            'message': 'This is the registered final tasks',
            'results': res
        }
        return ret
    except Exception as e:
        ret = {
            'status': 500,
            'message': e.args,
        }
        return ret
    finally:
        sess.close()
コード例 #9
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def get_academic_byLecturer(nip):
    try:
        datas = sess.query(academic, lecturer, academic_lecturer).filter(academic_lecturer.lecturer_nip == nip).\
            filter(academic.course_id == academic_lecturer.course_id).\
            filter(lecturer.nip == academic_lecturer.lecturer_nip).all()
        if datas is not None:
            res = []
            for data in datas:
                temp = {
                    'id': data.academic_lecturer.id,
                    'course_id': data.academic.course_id,
                    'course_name': data.academic.course_name,
                    'total_credit': data.academic_lecturer.total_credit,
                    'class': data.academic_lecturer.course_class,
                    'lecturer(s)': data.lecturer.name,
                    'lecturer_credit': data.academic_lecturer.lecturer_credit
                }
                res.append(temp)
            ret = {
                'status': 200,
                'message': 'These are the registered academic lecturer',
                'results': res
            }
            return ret
        else:
            ret = {'status': 200, 'message': 'ID is not registered'}
            return ret
    except Exception as e:
        ret = {
            'status': 200,
            'message': e.args,
        }
        return ret
    finally:
        sess.close()
コード例 #10
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def get_all_courses():
    try:
        datas = sess.query(academic).all()
        res = []
        for data in datas:
            temp = {
                'id': data.id,
                'course_id': data.course_id,
                'course_name': data.course_name,
                'total_classes': data.total_classes
            }
            res.append(temp)
        ret = {
            'status': 200,
            'message': 'This are the registered courses',
            'results': res
        }
        return ret
    except Exception as e:
        ret = {
            'status': 200,
            'message': e.args,
        }
        return ret
    finally:
        sess.close()
コード例 #11
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
 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()
コード例 #12
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
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()
コード例 #13
0
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()
コード例 #14
0
def get_experience_byID(id):
    try:
        data = sess.query(experience).filter(experience.id == id).first()
        selected_experience = {
            'id': data.id,
            'lecturer_nip': data.lecturer_nip,
            'job_name': data.job_name,
            'job_type': data.job_type,
            'year': data.year,
            'term': data.term,
            'filepath': data.filepath
        }
        ret = {
            'status': 200,
            'message': 'This is the ' + data.lecturer_nip + ' Experience',
            'results': selected_experience
        }
        return ret
    except Exception as e:
        ret = {
            'status': 200,
            'message': e.args,
        }
        return ret
    finally:
        sess.close()
コード例 #15
0
def edit_experience(id, request):
    try:
        selected_experience = sess.query(experience).filter(
            experience.id == id).first()
        if selected_experience is not None:
            data = {}
            for k in request.keys():
                param = k
                data[k] = request[param]
            edit = sess.query(experience).filter(experience.id == id).update(
                data, synchronize_session=False)
            sess.commit()
            if edit == 1:
                ret = {'status': 200, 'message': 'Data updated!'}
            else:
                ret = {
                    'status':
                    500,
                    'message':
                    "Something's went wrong with our server. Please try again later!"
                }
            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()
コード例 #16
0
def get_all_experiences():
    try:
        experiences = sess.query(experience).all()
        res = []
        for data in experiences:
            temp = {
                'id': data.id,
                'lecturer_nip': data.lecturer_nip,
                'job_name': data.job_name,
                'job_type': data.job_type,
                'year': data.year,
                'term': data.term,
                'filepath': data.filepath
            }
            res.append(temp)
        ret = {
            'status': 200,
            'message': 'This are the registered Experience',
            'results': res
        }
        return ret
    except Exception as e:
        ret = {
            'status': 200,
            'message': e.args,
        }
        return ret
    finally:
        sess.close()
コード例 #17
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def get_all_research():
    try:
        #research_datas = sess.query(research, research_file).filter(research.id == research_file.research_id).all()
        research_datas = sess.query(research).all()

        research_res = []
        for data in research_datas:
            res = {
                'id': data.id,
                'lecturer_nip': data.lecturer_nip,
                'title': data.title,
                'investor': data.investor,
                'amount': data.amount,
                'position': data.position,
                'year': data.year,
                #'term': data.term,
                'filepath': data.filepath
                #'filepath': data_file.filepath
            }
            research_res.append(res)
        ret = {
            'status': 200,
            'message': 'These are the registered research',
            'results': research_res
        }
        return ret
    except Exception as e:
        ret = {
            'status': 200,
            'message': e.args
        }
        return ret
    finally:
        sess.close()
コード例 #18
0
def get_experience_byLecturer(id):
    try:
        datas = sess.query(experience).filter(
            experience.lecturer_nip == id).all()
        if datas is not None:
            res = []
            for data in datas:
                temp = {
                    'id': data.id,
                    'lecturer_nip': data.lecturer_nip,
                    'job_name': data.job_name,
                    'job_type': data.job_type,
                    'year': data.year,
                    'term': data.term,
                    'filepath': data.filepath
                }
                res.append(temp)
            ret = {
                'status': 200,
                'message': 'This is the Experience',
                'results': res
            }
            return ret
        else:
            ret = {'status': 200, 'message': 'ID is not registered'}
            return ret
    except Exception as e:
        ret = {
            'status': 200,
            'message': e.args,
        }
        return ret
    finally:
        sess.close()
コード例 #19
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def edit_research_file(id, filepath):
    try:
        selected_research = sess.query(research_file).filter(research_file.research_id == id).first()
        if selected_research is not None:
            data = {
                'filepath': filepath
            }
            edit = sess.query(research_file).filter(research_file.research_id == id).update(data, synchronize_session=False)
            sess.commit()
            if edit == 1:
                ret = {
                    'status': 200,
                    'message': 'Data updated!'
                }
            else:
                ret = {
                    'status': 500,
                    'message': "Something's went wrong with our server. Please try again later!"
                }
            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()
コード例 #20
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
 def save(self):
     try:
         check_achievement = sess.query(achievement).filter(achievement.lecturer_nip == self.lecturer_nip).filter(achievement.title==self.title).\
             filter(achievement.year == self.year).first()
         if check_achievement is None:
             sess.add(self)
             sess.commit()
             new_achievement = {
                 'id': self.id,
                 'lecturer_nip': self.lecturer_nip,
                 'title': self.title,
                 'issuer': self.issuer,
                 'year': self.year,
                 'filepath': self.filepath
             }
             ret = {
                 'status': 200,
                 'message': 'New Achievement Registered',
                 'results': new_achievement
             }
         else:
             ret = {
                 'status': 200,
                 'message': 'Your achievement already registered before, please try again another achievement!'
             }
         return ret
     except Exception as e:
         ret = {
             'status': 200,
             'message': e.args,
         }
         return ret
     finally:
             sess.close()
コード例 #21
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def get_achievement_byID(id):
    try:
        data = sess.query(achievement).filter(achievement.id == id).first()
        selected_achievement = {
            'id': data.id,
            'lecturer_nip': data.lecturer_nip,
            'title': data.title,
            'issuer': data.issuer,
            'year': data.year,
            'filepath': data.filepath
        }
        ret = {
            'status': 200,
            'message': 'This is the '+data.lecturer_nip+' Achievement',
            'results': selected_achievement
        }
        return ret
    except Exception as e:
        ret = {
            'status': 200,
            'message': e.args,
        }
        return ret
    finally:
            sess.close()
コード例 #22
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def get_research_byID(id):
    try:
        # research_datas = sess.query(research, research_file).filter(research.id == id). \
        #     filter(research.id == research_file.research_id).first()

        research_datas = sess.query(research).filter(research.id == id).first()

        res = {
            'id': research_datas.id,
            'lecturer_nip': research_datas.lecturer_nip,
            'title': research_datas.title,
            'investor': research_datas.investor,
            'amount': research_datas.amount,
            'position': research_datas.position,
            'year': research_datas.year,
            # 'term': research_datas.term,
            'filepath': research_datas.filepath
        }
        ret = {
            'status': 200,
            'message': 'These are the registered research',
            'results': res
        }
        return ret
    except Exception as e:
        ret = {
            'status': 500,
            'message': e.args
        }
        return ret
    finally:
        sess.close()
コード例 #23
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def get_all_achievements():
    try:
        achievements = sess.query(achievement).all()
        res = []
        for data in achievements:
            temp = {
                'id': data.id,
                'lecturer_nip': data.lecturer_nip,
                'title': data.title,
                'issuer': data.issuer,
                'year': data.year,
                'filepath': data.filepath
            }
            res.append(temp)
        ret = {
            'status': 200,
            'message': 'These are the registered Achievements',
            'results': res
        }
        return ret
    except Exception as e:
        ret = {
            'status': 200,
            'message': e.args,
        }
        return ret
    finally:
            sess.close()
コード例 #24
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def get_achievement_byLecturer(nip):
    try:
        datas = sess.query(achievement).filter(achievement.lecturer_nip == nip).all()
        if datas is not None:
            res = []
            for data in datas:
                temp = {
                    'id': data.id,
                    'lecturer_nip': data.lecturer_nip,
                    'title': data.title,
                    'issuer': data.issuer,
                    'year': data.year,
                    'filepath': data.filepath
                }
                res.append(temp)
            ret = {
                'status': 200,
                'message': 'These are the registered achievements by lecturer',
                'results': res
            }
            return ret
        else:
            ret = {
                'status': 200,
                'message': 'ID is not registered'
            }
            return ret
    except Exception as e:
        ret = {
            'status': 200,
            'message': e.args,
        }
        return ret
    finally:
            sess.close()
コード例 #25
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def get_academicLecturer_byID(id):
    try:
        data = sess.query(academic, lecturer, academic_lecturer).filter(academic_lecturer.id == id). \
            filter(academic.course_id == academic_lecturer.course_id). \
            filter(lecturer.nip == academic_lecturer.lecturer_nip).first()
        if data is not None:
            res = {
                'id': data.academic_lecturer.id,
                'course_id': data.academic.course_id,
                'course_name': data.academic.course_name,
                'total_credit': data.academic_lecturer.total_credit,
                'class': data.academic_lecturer.course_class,
                'lecturer(s)': data.lecturer.name,
                'lecturer_credit': data.academic_lecturer.lecturer_credit
            }
            ret = {
                'status': 200,
                'message': 'This is the selected course',
                'results': res
            }
            return ret
        else:
            ret = {'status': 200, 'message': 'ID is not registered'}
            return ret
    except Exception as e:
        ret = {'status': 200, 'message': e.args}
        return ret
    finally:
        sess.close()
コード例 #26
0
 def save(self):
     try:
         check_others = sess.query(other_publication).filter(other_publication.lecturer_nip == self.lecturer_nip). \
             filter(other_publication.title == self.title).first()
         if check_others is None:
             sess.add(self)
             sess.commit()
             new_other_publication = {
                 'id': self.id,
                 'lecturer_nip': self.lecturer_nip,
                 'title': self.title,
                 'year': self.year,
                 'publisher': self.publisher,
                 'filepath': self.filepath
             }
             ret = {
                 'status': 200,
                 'message': 'New Publication Registered',
                 'results': new_other_publication
             }
         else:
             ret = {
                 'status':
                 200,
                 'message':
                 'Your publication already registered before, please try again another publication!'
             }
         return ret
     except Exception as e:
         sess.rollback()
         ret = {'status': 200, 'message': e.args}
         return ret
     finally:
         sess.close()
コード例 #27
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
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()
コード例 #28
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
 def save(self):
     try:
         check_course = sess.query(academic).filter(
             academic.course_id == self.course_id).first()
         if check_course is not None:
             ret = {
                 'status':
                 200,
                 'message':
                 "Course already registered, try again another Course"
             }
             return ret
         sess.add(self)
         sess.commit()
         new_course = {
             'id': self.id,
             'course_id': self.course_id,
             'course_name': self.course_name,
             'total_classes': self.total_classes
         }
         ret = {
             'status': 200,
             'message': 'Course Registered',
             'results': new_course
         }
         return ret
     except Exception as e:
         sess.rollback()
         ret = {
             'status': 200,
             'message': e.args,
         }
         return ret
     finally:
         sess.close()
コード例 #29
0
ファイル: models.py プロジェクト: Kimia-IS/back-end
def getByID(cat, id):
    try:
        if cat == 'lecturer':
            lecturers = sess.query(lecturer).filter(lecturer.nip == id).first()
            if lecturers is not None:
                res = {
                    'id': lecturers.id,
                    'name': lecturers.name,
                    'role': roles[lecturers.role],
                    'nip': lecturers.nip,
                    'email': lecturers.email
                }
                ret ={
                    'status': 200,
                    'results': res,
                    'message': 'This is lecturer with NIP '+ lecturers.nip
                }
            else:
                ret = {
                    'status': 200,
                    'message': 'NIP is not registered'
                }
        elif cat == 'admin':
            admins = sess.query(admin).filter(admin.auth_id == id).first()
            if admins is not None:
                res = {
                    'id': admins.id,
                    'name': admins.name,
                    'role': roles[admins.role],
                    'auth_id': admins.auth_id,
                    'email': admins.email
                }
                ret = {
                    'status': 200,
                    'results': res,
                    'message': 'This is admin with auth id ' + admins.auth_id
                }
            else:
                ret = {
                    'status': 200,
                    'message': 'ID is not registered'
                }
        else:
            ret = {
                'status': 200,
                'message': 'Category not recognized'
            }
        return ret
    except Exception as e:
        ret = {
            'status': 200,
            'message': e.args,
        }
        return ret
    finally:
            sess.close()
コード例 #30
0
    def save(self):
        global saveJourCorr
        try:
            check_journal = sess.query(journal).filter(journal.lecturer_nip == self.lecturer_nip). \
                filter(journal.title == self.title).first()
            if check_journal is None:
                sess.add(self)
                sess.commit()
                new_journal = {
                    'lecturer_nip': self.lecturer_nip,
                    'title': self.title,
                    'issue': self.issue,
                    'year': self.year,
                    'number': self.number,
                    'total_page': self.total_page,
                    'type': self.type,
                    'doi': self.doi,
                    'link': self.link,
                    'filepath': self.filepath,
                    'names': self.names
                }

                # savejourCorr = True
                # for name in self.names:
                #     if saveJourCorr:
                #         saveJourCorr = journalCorrespondingAuthor(journal_id=self.id, names=name).save()
                #     else:
                #         return {'status': 200,
                #                 'message': 'something went wrong when we try to save corresponding author!'}
                if self.names:
                    names = self.names.split(",")
                    for name in names:
                        journalCorrespondingAuthor(journal_id=self.id,
                                                   names=name).save()
                # else:
                #     return {'status': 200, 'message': 'no corresponding author'}

                ret = {
                    'status': 200,
                    'message': 'New Journal Registered',
                    'results': new_journal
                }
            else:
                ret = {
                    'status':
                    200,
                    'message':
                    'Your journal already registered before, please try again another journal!'
                }
            return ret
        except Exception as e:
            sess.rollback()
            ret = {'status': 200, 'message': e.args}
            return ret
        finally:
            sess.close()