Skip to content

Commit 946b364

Browse files
committed
standardized delete endpoints
1 parent 601b84d commit 946b364

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

app/controllers/api/v1/event_procedures_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def destroy
5353
result = EventProcedures::Destroy.result(id: event_procedure.id.to_s)
5454

5555
if result.success?
56-
render json: { message: "EventProcedure deleted successfully." }, status: :ok
56+
deleted_successfully_render(result.event_procedure)
5757
else
5858
render json: result.error, status: :unprocessable_entity
5959
end

app/controllers/api/v1/hospitals_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def destroy
3939
result = Hospitals::Destroy.result(id: hospital.id.to_s)
4040

4141
if result.success?
42-
render json: { message: "Hospital deleted successfully." }, status: :ok
42+
deleted_successfully_render(result.hospital)
4343
else
4444
render json: result.error, status: :unprocessable_entity
4545
end

app/controllers/api/v1/medical_shifts_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def destroy
7171
result = MedicalShifts::Destroy.result(id: medical_shift.id.to_s)
7272

7373
if result.success?
74-
render json: { message: "MedicalShift deleted successfully." }, status: :ok
74+
deleted_successfully_render(result.medical_shift)
7575
else
7676
render json: result.error, status: :unprocessable_entity
7777
end

app/controllers/api/v1/patients_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def destroy
4343
result = Patients::Destroy.result(id: patient.id.to_s)
4444

4545
if result.success?
46-
render json: { message: "Patient deleted successfully." }, status: :ok
46+
deleted_successfully_render(result.patient)
4747
else
4848
render json: result.error, status: :unprocessable_entity
4949
end

app/controllers/api/v1/procedures_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def destroy
4141
result = Procedures::Destroy.result(id: procedure.id.to_s)
4242

4343
if result.success?
44-
render json: { message: "Procedure deleted successfully." }, status: :ok
44+
deleted_successfully_render(result.procedure)
4545
else
4646
render json: result.error, status: :unprocessable_entity
4747
end

0 commit comments

Comments
 (0)