antonov_dmitry_lab3_done

This commit is contained in:
DmitriyAntonov 2023-12-04 18:25:17 +04:00
parent fe7928f10c
commit 45d977f668

View File

@ -51,7 +51,7 @@ def update_patient(id):
if patient['id'] == id:
patient.update(request.json)
# отправляем запрос другому сервису
response = requests.put(f"{doctor_service_url}/doctors/1/patients/{id}", json=request.json)
requests.put(f"{doctor_service_url}/doctors/1/patients/{id}", json=request.json)
return jsonify(patient), 200
return jsonify({'error': 'Пациент не найден'}), 404
@ -59,7 +59,7 @@ def update_patient(id):
@app.route('/patients/<int:id>', methods=['DELETE'])
def delete_patient(id):
# отправляем запрос другому сервису
response = requests.delete(f"{doctor_service_url}/doctors/1/patients/{id}")
requests.delete(f"{doctor_service_url}/doctors/1/patients/{id}")
global patients_data
patients_data = [patient for patient in patients_data if patient['id'] != id]