Exemplo n.º 1
0
def add_parts():
    part_name = request.json['part_name']
    service_type = request.json['service_type']
    serial = request.json['serial']

    new_parts = parts(part_name,service_type,serial)

    db.session.add(new_parts)
    db.session.commit()

    return service_schema.jsonify(new_parts)
Exemplo n.º 2
0
def add_service():
    mechanic_name = request.json['mechanic_name']
    service_type = request.json['service_type']
    serial = request.json['serial']
    price = request.json['price']

    new_service = Service(mechanic_name,service_type,serial,price)

    db.session.add(new_service)
    db.session.commit()

    return service_schema.jsonify(new_service)
Exemplo n.º 3
0
def update_service(id):
    service = Service.query.get(id)

    mechanic_name = request.json['mechanic_name']
    service_type = request.json['service_type']
    serial = request.json['serial']
    price = request.json['price']

    service.mechanic_name = mechanic_name
    service.service_type = service_type
    service.serial = serial
    service.price = price

    db.session.commit()

    return service_schema.jsonify(service)
Exemplo n.º 4
0
def deleted_service(id):
    service = service.query.get(id)
    db.session.deleted(service)
    db.session.commit()

    return service_schema.jsonify(service)
Exemplo n.º 5
0
def get_service(id):
    service = Service.query.get(id)
    return service_schema.jsonify(service)