def delete_employee(current_user_token,id):
    employee = Employee.query.get(id)

    db.session.delete(employee)
    db.session.commit()

    result = employee_schema.dump(employee)
    return jsonify(result)
Exemple #2
0
def delete_employee(id):
    employee = Employee.query.get(int(id))
    db.session.delete(employee)
    db.session.commit()
    result = employee_schema.dump(employee)
    return jsonify(result)


# CRUD Operations complete: Create, Retrieve, Update and Delete
Exemple #3
0
def create_employee():
    name = request.json['full_name']
    gender = request.json['gender']
    address = request.json['address']
    ssn = request.json['ssn']
    email = request.json['email']

    employee = Employee(name, gender, address, ssn, email)

    db.session.add(employee)
    db.session.commit()
    results = employee_schema.dump(employee)
    return jsonify(results)
def create_patient(current_user_token):
    name = request.json['full_name']
    gender = request.json['gender']
    address = request.json['address']
    ssn = request.json['ssn']
    blood_type = request.json['blood_type']
    email = request.json['email']

    employee = Employee(name, gender, address, ssn, blood_type, email)

    db.session.add(employee)
    db.session.commit()

    results = employee_schema.dump(employee)
    return jsonify(results)
def get_employee(current_user_token,id):
    employee = Employee.query.get(id)
    results = employee_schema.dump(employee)
    return jsonify(results)
Exemple #6
0
def get_employee(id):
    employee = Employee.query.get(id)
    results = employee_schema.dump(employee)
    return jsonify(results)