示例#1
0
def create_sample_employee(): 
    for emp in emp_list:
        session = Session()
        emp_object = session.query(employee).filter(employee.emp_id==emp['emp_id']).first()
        if emp_object==None:
            emp_data = employee(emp_id = emp['emp_id'].lower(),
                            manager_id = emp['manager_id'].lower(),
                            email = emp['email'].lower(),
                            first_name = emp['first_name'].lower(),
                            last_name = emp['last_name'].lower(),
                            sur_name = emp['sur_name'].lower(),
                            initial = emp['initial'].lower(),
                            salutation = emp['salutation'].lower(),
                            project_code = emp['project_code'].lower(),
                            dept = emp['dept'].lower(),
                            designation = emp['designation'].lower(),
                            emp_start_date = emp['emp_start_date'],
                            emp_last_working_date = emp['emp_last_working_date'],
                            emp_project_assigned_date = emp['emp_project_assigned_date'],
                            emp_project_end_date = emp['emp_project_end_date'],
                            employment_status = emp['employment_status'].lower(),
                            manager_name = emp['manager_name'].lower(),
                            manager_dept = emp['manager_dept'].lower(),
                            resource_status = emp['resource_status'].lower(),
                            delivery_type = emp['delivery_type'].lower(),
                            skills = emp['skills'].lower(),
                            roles = emp['roles'].lower()

                            )
            session.add(emp_data)
            session.commit()
        session.close()
示例#2
0
def create_sample_employee(): 
    session = Session()
    emp_objects = session.query(employee).first()
    #serialized_obj = serialize_all(emp_objects)
    if not emp_objects:
        emp_data = employee(emp_id = "i3128",
                            first_name="ashok" , 
                            last_name = "kumar", 
                            sur_name= "", 
                            initial= "P", 
                            salutation= "Mr", 
                            project_code= "DIGI12345", 
                            dept= "DIGITAL", 

                            emp_start_date= datetime.datetime.now(),
                            emp_last_working_date=datetime.datetime.now(),
                            emp_project_assigned_date=datetime.datetime.now(),
                            emp_project_end_date=datetime.datetime.now(),

                            employment_status="INPROJECT", 
                            manager_name="NATARAJ", 
                            manager_dept="DIGITAL", 
                            resource_status = "BILLABLE",
                            delivery_type = "MANAGED SERVICES",
                            additional_allocation = "",
                            skills = "APP developement",
                            roles = "ADMIN"
                            )
        session.add(emp_data)
        session.commit()
        session.close()
示例#3
0
def addProject():
    data = request.get_json()

    session = Session()
    existing_project = session.query(project).filter(project.project_code==data.get("projectcode")).first()
    if existing_project:
        session.close()
        return jsonify({'warning':'Project with ID: {} already exist !'.format(data.get("projectcode"))})
    try:     
        project_data = project(client_name = data.get("clientname").lower(),
                                project_code=data.get("projectcode").lower(),
                                project_name=data.get("projectname").lower(),
                                project_start_date=data.get("project_start_date",None),                                
                                project_status=data.get("projectstatus").lower(),
                                billing_type=data.get("billingtype").lower(),
                                segment=data.get("segment").lower(),
                                geography=data.get("geography").lower(),
                                solution_category =data.get("solutioncategory").lower(),
                                financial_year = data.get("financialyear").lower()
        
        )
        session = Session()
        session.add(project_data)
        session.commit()
        session.close()
        return jsonify({"success":"added data to the table successfully"}), 201
    except:
        return jsonify({"error":"Something happened while adding the data to the table, please check the data and try again"}), 500
示例#4
0
def forgot_pass_create_token():
    session = Session()
    email_id = request.json.get("email_id")
    emp_objects = session.query(employee).filter(employee.email == email_id).first()
    if emp_objects == None:
        return jsonify({"error":" Please enter Valid employee Email Id"})

    emp_id = emp_objects.emp_id
    forget_pass_data = session.query(forget_pass).filter(forget_pass.user_id == emp_id,
                                                         forget_pass.email_address == email_id,
                                                         ).first()
    access_token = create_access_token(identity=emp_id)
    current_date = datetime.datetime.now()

    if forget_pass_data == None:
        forget_pass_obj = forget_pass(user_id=emp_id, email_address=email_id, reset_token=access_token, create_date=current_date)
        session.add(forget_pass_obj)
        session.commit()
        session.close()

    else:
        forget_pass_data.reset_token = access_token
        forget_pass_data.create_data = current_date
        session.add(forget_pass_data)
        session.commit()
        session.close()

        html_body = render_template('frontend/frontend/src/app/reset-password/reset-password.component.html',
                                    user=email_id, token=access_token)
        text_body = "http://localhost:4200/" + 'resetpassword/?token='+access_token +'&'+'email='+email_id
        entities.mail.send_mail("Forgot password setup", Config.MAIL_USERNAME, email_id, html_body, text_body)

        return jsonify(text_body), 201
示例#5
0
def reset_pass():
    session = Session()
    email = request.json.get('email')
    password = request.json.get('password')
    confirm_pass = request.json.get('password')
    token = request.json.get('reset_token')

    if email is None:
        return jsonify({"error:": "incorrect username or password"}), 400

    forget_pass_objects = session.query(forget_pass).filter(forget_pass.email_address == email)
    forget_pass_obj = serialize_all(forget_pass_objects)

    reset_token = forget_pass_obj[0]['reset_token']
    if reset_token == token:
        # update auth table password
        auth_object = session.query(authUser).filter(authUser.email == email).first()
        if auth_object is None:
            return jsonify({'error': 'User not found, This user is not added yet'}), 401
        auth_object.password = password
        session.add(auth_object)
        session.commit()

        return "Password Reset successfully", 200
    else:
        return "Please generate token for reset password  token expired"
示例#6
0
def add_announcements():
    data = request.get_json()
    announcement_data = announcements (user_id =data.get('user_id').lower(),
                                       announcement_info = data.get('announcement_info').lower(),
                                       announcement_category=data.get('announcement_category').lower(),
                                       date_logged = datetime.datetime.now(),
                                        )
    session = Session()
    session.add(announcement_data)
    session.commit()    
    return ({'success':'Announcements are added sucessfully '})
示例#7
0
def time_master():
    session = Session()
    time_objects = session.query(TimeMaster).first()
    if not time_objects:
        time_objects = TimeMaster(emp_id="i3128",
                                  month="01",
                                  year="2021",
                                  timedata=""
                                  )
        session.add(time_objects)
        session.commit()
        session.close()
示例#8
0
def setpassword():
    session = Session()
    emp_id = request.json.get("emp_id", None)
    password = request.json.get("password", None)
    auth_object = session.query(authUser).filter(authUser.emp_id == emp_id).first()
    if auth_object is None:
        return jsonify({'error':'User not found, This user is not added yet'}), 200
    auth_object.password=password
    session.add(auth_object)
    session.commit()
    session.close()
    return jsonify({'success':'password set successfully ! Please login with your new password'}),200
示例#9
0
def create_sample_authUser():    
    for authUsers in authUser_list:
        session = Session()
        auth_objects = session.query(authUser).filter(authUser.emp_id==authUsers["emp_id"]).first()
        if auth_objects==None: 
            auth_data = authUser( emp_id =authUsers["emp_id"].lower(), 
                                    email = authUsers["email"].lower(),
                                    password = authUsers["password"].lower(),
                                    roles = authUsers["roles"].lower()
                                    )
            print(auth_data)
            session.add(auth_data)
            session.commit()  
        session.close()    
示例#10
0
def addProjectResource():
    session = Session()
    data = request.get_json()
    resource_id = data.get("emp_id")
    project_code = data.get("project_id")
    existing_emp = session.query(employee).filter(employee.emp_id==resource_id).first()
    if existing_emp==None:
        return jsonify({'success':'Employee with ID: {} Does not Exist !'.format(resource_id)})
    
    existing_project = session.query(project).filter(project.project_code==project_code).first()
    if existing_project==None:
        return jsonify({'error':'Project with ID: {} Does not Exist !'.format(project_code)})
    print(existing_emp)
    print("<<<<<<<<<<")
    resource_data=existing_emp.emp_id
    print(resource_data)
    if existing_emp.project_code == None:
        existing_emp.project_code=project_code
        session.add(existing_emp)
        session.commit()
    else:
        existing_proj_code= existing_emp.project_code
        existing_proj_list = stringToList(existing_proj_code)
        if project_code in existing_proj_list:
            return jsonify({'error':'resource exist already in the project'})
        existing_proj_list.append(project_code)
        
        existing_emp.project_code = listToString(existing_proj_list)# check if the string sanitation is required
        print(type(existing_emp.project_code))
        session.add(existing_emp)
        session.commit()

    # existing_emp.project_code=project_code
    # session.add(existing_emp)
    # session.commit()
    if existing_project.resource_info == None:
        existing_project.resource_info=resource_id
        session.add(existing_project)
        session.commit()
    
    else:
        existing_resource = existing_project.resource_info
        print(existing_resource)
        existing_resource_list=stringToList(existing_resource)#stringToList fn convert str to list 
        print(type(existing_resource_list))
        print(existing_resource_list)
        if resource_id in existing_resource_list:
            return jsonify({'error':'resource exist already in the project'})
        existing_resource_list.append(resource_id )
        existing_project.resource_info = listToString(existing_resource_list)#listToString convert list to str 
        print(existing_resource_list)
        session.add(existing_project)
        session.commit()

    session.close()
    return jsonify({"success":"Employee {} and Project {} Linked".format(resource_id,project_code)})
示例#11
0
def removeresource():
    session=Session()
    data=request.get_json()
    emp_id=data.get("emp_id")
    project_code=data.get("project_id")
    print("<<<<<<<<<<<<")
    print(emp_id)
    print("<<<<<<<<<<<<")
    print(project_code)
    project_=session.query(project).filter(project.project_code==project_code).first()
    project_resources_list=project_.resource_info.split(",")
    print("<<<<<<<<<<<<")
    print(project_resources_list)
    try:
        project_resources_list.remove(emp_id)
    except:
        pass
    print(project_resources_list)
    out_PM =''
    for i in project_resources_list:
        out_PM = i + "," + out_PM

    project_.resource_info = out_PM
    session.add(project_)
    session.commit()
    session.close()

    emp_=session.query(employee).filter(employee.emp_id==emp_id).first()
    emp_project_list=emp_.project_code.split(",")
    print("<<<<<<<<<<<<<<")
    print(emp_project_list)
    try:
        emp_project_list.remove(project_code)
    except:
        pass
    print(emp_project_list)
    out_proj=""
    for i in emp_project_list:
        out_proj= i+","+out_proj
    
    emp_.project_code=out_proj
    session.add(emp_)
    session.commit()   
    session.close()

    return jsonify({"success":"Resource {} removed from project".format(emp_id)})
示例#12
0
def create_sample_timesubmissions():    
    for timesubmission in timesubmission_list: 
        session = Session()
        sub_objects = session.query(timesubmissions).filter(timesubmissions.date_info==timesubmission["date"]).first()
        if sub_objects==None:
            sub_data = timesubmissions( date_info=timesubmission['date'],
                                            hours = timesubmission['hours'],
                                            user_id = timesubmission['user_id'].lower(),
                                            project_code = timesubmission['project_id'].lower(),
                                            manager_id = timesubmission['manager_id'].lower(),
                                            time_type = timesubmission['time_type'].lower(),
                                            status = timesubmission["status"].lower(),
                                            submission_id = timesubmission["submission_id"].lower()    
                                    )
            print(sub_data)
            session.add(sub_data)
            session.commit()    
        session.close()
示例#13
0
def addtimesubmissions():    
    data = request.get_json() 
    user_id = data.get('user_id')
    session = Session()
    existing_emp = session.query(employee).filter(employee.emp_id == user_id ).first()
    if existing_emp == None:
        return jsonify({'error':'user not available in the employee table'}),200
    sub_data = timesubmissions( date_info = data.get('date'),
                                    hours = data.get('hours').lower(),
                                    user_id = data.get('user_name').lower(),
                                    project_code = data.get('project_id').lower(),
                                    manager_id = data.get('manager_name').lower(),
                                    time_type = data.get('time_type').lower(),
                                    status = 'submitted-pending approval',
                                    submission_id = data.get('user_id') + data.get('user_id') + data.get('time_type')     
                               )
    session = Session()
    session.add(sub_data)
    session.commit()
    return jsonify({'success':'Your Time has been  submitted for: {}'.format(data.get('date'))}),200
示例#14
0
def create_sample_project(): 
    session = Session()
    project_objects = session.query(project).first()
    #serialized_obj = serialize_all(emp_objects)
    if not project_objects:
        project_objects = project(client_name = "Pi-Lit",
                            project_code="DIGI12345" , 
                            project_name = "Pi-lit", 
                            project_start_date=  datetime.datetime.now(),
                            project_status= "In Progress", 
                            billing_type= "F", 
                            segment= "Consulting Services", 
                            geography= "US", 
                            solution_category="Product Development", 
                            financial_year="2020", 
                            
                            )
        session.add(project_objects)
        session.commit()
        session.close()
示例#15
0
def create_sample_project(): 
    for sample in project_list:
        session = Session()
        sample_objects = session.query(project).filter(project.project_code==sample["projectcode"]).first()
        #serialized_obj = serialize_all(emp_objects)
        if sample_objects==None:
            sample_data = project(client_name = sample["clientname"].lower(),
                                    project_code=sample["projectcode"].lower(),
                                    project_name=sample["projectname"].lower(),
                                    project_start_date=sample["project_start_date"].lower(),
                                    project_status=sample["projectstatus"].lower(),
                                    billing_type=sample["billingtype"].lower(),
                                    segment=sample["segment"].lower(),
                                    geography=sample["geography"].lower(),
                                    solution_category =sample["solution_category"].lower(),
                                    financial_year = sample["financialyear"].lower(),
                                    resource_info = sample["resource_info"].lower()
                                )         
            print(sample_data)  
            session.add(sample_data)
            session.commit()
        session.close()
示例#16
0
def addProjectmanager():
    session = Session()
    data = request.get_json()
    project_code = data.get("project_id")
    project_manager=data.get('manager_id')
    print(project_code)
    print(project_manager)
    existing_project = session.query(project).filter(project.project_code==project_code).first()
    if existing_project==None:
        return jsonify({'error':'Project with ID: {} Does not Exist !'.format(project_code)})
    
    existing_project_manager= session.query(employee).filter(employee.manager_id==project_manager).first()
    if existing_project_manager==None:
        return jsonify({"error":"Manager ID {} Does not Exists !".format(project_manager)})

    #existing_project_manager.project_code = project_code
    #session.add(existing_project_manager)
    #session.commit()
    if existing_project.project_manager_id == None:
        existing_project.project_manager_id = project_manager
        session.add(existing_project)
        session.commit()
    else:
        existing_PM = existing_project.project_manager_id
        print(existing_PM)
        existing_PM_list = stringToList(existing_PM)
        print(existing_PM_list)
        if project_manager in existing_PM_list:
            return  jsonify({'error':'Project Manager already Exists in the project'})
        existing_PM_list.append(project_manager)
        print(existing_PM_list)
        existing_project.project_manager_id=listToString(existing_PM_list)
        print(existing_PM_list)
        session.add(existing_project)
        session.commit()
    session.close()
    return jsonify({"success":"Manager {} and Project {} Linked".format(project_manager,project_code)})
示例#17
0
def addEmployee():
    data = request.get_json()
    print(data)
    session = Session()
    existing_emp = session.query(employee).filter(
        employee.emp_id == data.get("emp_id")).first()
    if existing_emp:
        session.close()
        return jsonify({
            'warning':
            'User ID: {} already exist !'.format(data.get("emp_id"))
        })

    existing_emp = session.query(employee).filter(
        employee.email == data.get("email")).first()
    if existing_emp:
        session.close()
        return jsonify({
            'warning':
            'Email ID: {} already exist !'.format(data.get("email"))
        })

    try:
        emp_data = employee(
            emp_id=data.get("emp_id"),
            email=data.get("email"),
            first_name=data.get("first_name"),
            last_name=data.get("last_name"),
            sur_name=data.get("sur_name"),
            initial=data.get("initial"),
            salutation=data.get("salutation"),
            project_code=data.get("project_code"),
            dept=data.get("dept"),
            designation=data.get("designation"),
            emp_start_date=datetime.datetime.now(),
            emp_last_working_date=datetime.datetime.now(),
            emp_project_assigned_date=datetime.datetime.now(),
            emp_project_end_date=datetime.datetime.now(),
            employment_status=data.get("employment_status"),
            manager_name=data.get("manager_name"),
            manager_dept=data.get("manager_dept"),
            resource_status=data.get("resource_status"),
            delivery_type=data.get("delivery_type"),
            additional_allocation=data.get("additional_allocation"),
            skills=data.get("skills"),
            roles=data.get("roles"),
        )
        session = Session()
        session.add(emp_data)
        session.commit()
        auth_data = authUser(emp_id=data.get("emp_id"),
                             email=data.get("email"),
                             roles=data.get("roles"))
        session = Session()
        session.add(auth_data)
        session.commit()
        return jsonify({
            "success":
            "successfully added employee {}".format(data.get("emp_id"))
        }), 200
    except:
        return jsonify({"error":
                        "Some error happened in adding the employee"}), 500
示例#18
0
def addProjectResource():
    session = Session()
    data = request.get_json()
    resource_id = data.get("emp_id")
    project_code = data.get("project_id")
    print(resource_id)
    print(project_code)

    existing_emp = session.query(employee).filter(
        employee.emp_id == resource_id).first()
    if existing_emp == None:
        return jsonify({
            'success':
            'Employee with ID: {} Does not Exist !'.format(resource_id)
        })

    existing_project = session.query(project).filter(
        project.project_code == project_code).first()
    if existing_project == None:
        return jsonify({
            'error':
            'Project with ID: {} Does not Exist !'.format(project_code)
        })

    existing_emp.project_code = project_code
    session.add(existing_emp)
    session.commit()

    print(existing_project.resource_info)
    if existing_project.resource_info == None:
        existing_project.resource_info = resource_id
        session.add(existing_project)
        session.commit()

    else:
        print("coming here")
        existing_resource = existing_project.resource_info
        existing_resource_list = existing_resource.split(",")
        print(existing_resource_list)
        for i in existing_resource_list:
            if i == "":
                existing_resource_list.remove(i)
        print(existing_resource_list)
        if resource_id in existing_resource_list:
            return jsonify({'error': 'resource exist already in the project'})
        existing_resource_list.append(resource_id)
        print(existing_resource_list)

        out_resource = ''
        for i in existing_resource_list:
            print(i)
            out_resource = i + "," + out_resource
        print(out_resource)
        existing_project.resource_info = out_resource[:-1]
        session.add(existing_project)
        session.commit()

    session.close()
    return jsonify({
        "success":
        "Employee {} and Project {} Linked".format(resource_id, project_code)
    })
示例#19
0
def review_time():
    data = request.get_json()
    #print(data)
    if data['reviewd']==True:
        session = Session()
        username = data['user_name']
        date = data['date']
        time_type = data['time_type']
        hours = data['hours']
        datee = datetime.datetime.strptime(date, "%Y-%m-%d")
        month = datee.month
        year = datee.year
        time_obj = session.query(timesubmissions).filter(timesubmissions.date_info == date,timesubmissions.user_id == username,timesubmissions.time_type == time_type,timesubmissions.hours == hours).first()
        time_obj.status = "approved"
        session.add(time_obj)
        session.commit()
        session.close()
        return jsonify({"info":"Time has been reviewed"})
        # username = data['user_name']
        # date = data['date']
        # time_type = data['time_type']
        # hours = data['hours']
        # session = Session()
        # datee = datetime.datetime.strptime(date, "%Y-%m-%d")
        # month = datee.month
        # year = datee.year
        # existing_emp = session.query(TimeMaster).filter(TimeMaster.month==month,TimeMaster.year==year,TimeMaster.emp_id==username).first()
        # if existing_emp:
        #     #month Information has been already added just need to add the date to the month data
        #     timedata = json.loads(existing_emp.timedata)
        #     if date in timedata.keys():
        #         date_info = timedata[date]
        #         print(">>>>>>>>>>>>>>>>>")
        #         print(date_info)
        #         if time_type in date_info.keys():
        #             print("time type already present")
        #             session = Session()
        #             del_obj = session.query(timesubmissions).filter(timesubmissions.date_info==date,timesubmissions.user_id==username,timesubmissions.time_type==time_type,timesubmissions.hours==hours).first()
        #             #session.delete(del_obj)
        #             session.commit()
        #             session.close()
        #             return jsonify({"error":"Info already in the Data"}),200
        #         else:
        #             date_info[time_type]=hours
        #             timedata[date]=date_info
        #             existing_emp.timedata = json.dumps(timedata)
        #             #session = Session()
        #             session.add(existing_emp)
        #             session.commit()
        #             session.close()
        #             return jsonify({"success":"Time has been reviewed"})

        #     else:
        #         timedata[date] = {time_type:hours}
        #         existing_emp.timedata = json.dumps(timedata)
        #         session.add(existing_emp)
        #         session.commit()
        #         session.close()

        #         session = Session()
        #         del_obj = session.query(timesubmissions).filter(timesubmissions.date_info==date,timesubmissions.user_id==username,timesubmissions.time_type==time_type,timesubmissions.hours==hours).first()
        #         #session.delete(del_obj)
        #         session.commit()
        #         session.close()
                
        #         return jsonify({"success":"Time has been reviewed"})
           
        # else:
        #     #month information is not present already. hence create the month information along with the existing data
        #     time_obj = TimeMaster(emp_id = username,
        #                           month = month , 
        #                           year = year,
        #                           timedata = json.dumps({date:{time_type:hours}})
        #         )
        #     session.add(time_obj)
        #     session.commit()
        #     session.close()

        #     session = Session()
        #     del_obj = session.query(timesubmissions).filter(timesubmissions.date_info==date,timesubmissions.user_id==username,timesubmissions.time_type==time_type,timesubmissions.hours==hours).first()
        #     #session.delete(del_obj)
        #     session.commit()
        #     session.close()

        #     return jsonify({"success":"Time has been reviewed"})

    elif data['reviewd']==False:
        session = Session()
        username = data['user_name']
        date = data['date']
        time_type = data['time_type']
        hours = data['hours']
        datee = datetime.datetime.strptime(date, "%Y-%m-%d")
        month = datee.month
        year = datee.year
        time_obj = session.query(timesubmissions).filter(timesubmissions.date_info == date,timesubmissions.user_id == username,timesubmissions.time_type == time_type,timesubmissions.hours == hours).first()
        time_obj.status = "denied"
        session.add(time_obj)
        session.commit()
        session.close()
        return jsonify({"info":"Time has been reviewed"})
示例#20
0
def addEmployee():
    data = request.get_json()
    session = Session()
    existing_emp = session.query(employee).filter(employee.emp_id==data.get("emp_id")).first()
    if existing_emp:
        session.close()
        return jsonify({'warning':'User ID: {} already exist !'.format(data.get("emp_id"))})
    
    existing_emp = session.query(employee).filter(employee.email==data.get("email")).first()
    if existing_emp:
        session.close()
        return jsonify({'warning':'Email ID: {} already exist !'.format(data.get("email"))})
    existing_project = session.query(project).filter(project.project_code==data.get("project_code")).first()
    if existing_project==None:
        return jsonify({'error':'Project with ID: {} Does not Exist !'.format(project_code)})

    project_list=stringToList(existing_project)
    if project_code in project_list:
        return jsonify({'error':'Employee is already working in the project'})
    project_list.append(project_code)
        
    existing_project.project_code =listToString(project_list)
    session.add(existing_project)
    session.commit()

    try: 
        emp_data = employee(emp_id=data.get("emp_id").lower() , 
                            manager_id = data.get("manager_id").lower(),
                            email = data.get("email").lower() , 
                            first_name = data.get("first_name").lower(), 
                            last_name= data.get("last_name").lower(), 
                            sur_name= data.get("sur_name").lower(), 
                            initial= data.get("initial").lower(), 
                            salutation= data.get("salutation").lower(), 
                            project_code= data.get("project_code").lower(), 
                            dept= data.get("dept").lower(),
                            designation = data.get("designation").lower(),
                            emp_start_date= data.get("emp_start_date",None),
                            emp_last_working_date=data.get("emp_last_date",None),
                            emp_project_assigned_date=data.get("emp_project_assigned_date",None),
                            emp_project_end_date=data.get("emp_project_end",None),

                            employment_status=data.get("employment_status").lower(), 
                            manager_name=data.get("manager_name").lower(), 
                            manager_dept=data.get("manager_dept").lower(), 
                            resource_status=data.get("resource_status").lower(),
                            delivery_type=data.get("delivery_type").lower(),
                            additional_allocation=data.get("additional_allocation").lower(),
                            skills=data.get("skills").lower(),
                            roles=data.get("roles").lower(),

                            )
        session = Session()
        session.add(emp_data)
        session.commit()
        auth_data = authUser(emp_id = data.get("emp_id").lower(),
                            email=data.get("email").lower(),
                            roles=data.get("roles").lower())
        session = Session()
        session.add(auth_data)
        session.commit()     
        return jsonify({"success":"successfully added employee {}".format(data.get("emp_id"))}),200     
    except:
        return jsonify({"error":"Some error happened in adding the employee"}),500