From c76f57da934e729e25b84c37fe62ada227f671d6 Mon Sep 17 00:00:00 2001 From: Petr Rudichev Date: Thu, 20 Feb 2025 10:48:23 +0300 Subject: [PATCH] fix: fix bugs OfficeController and Terminal --- .../com/example/nto/controller/OfficeController.java | 11 ++++++----- .../java/com/example/nto/domain/entity/Terminal.java | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/example/nto/controller/OfficeController.java b/src/main/java/com/example/nto/controller/OfficeController.java index 276935b..46d74bb 100644 --- a/src/main/java/com/example/nto/controller/OfficeController.java +++ b/src/main/java/com/example/nto/controller/OfficeController.java @@ -42,9 +42,10 @@ public class OfficeController { return ResponseEntity.ok(officeService.update(officeId, officeDTO)); } - @DeleteMapping("/{officeId}") - public ResponseEntity deleteOffice(@PathVariable long officeId) { - officeService.delete(officeId); - return ResponseEntity.noContent().build(); - } +// Тут баг с ссылочной целостностью +// @DeleteMapping("/{officeId}") +// public ResponseEntity deleteOffice(@PathVariable long officeId) { +// officeService.delete(officeId); +// return ResponseEntity.noContent().build(); +// } } diff --git a/src/main/java/com/example/nto/domain/entity/Terminal.java b/src/main/java/com/example/nto/domain/entity/Terminal.java index 2bacdf8..6808ce7 100644 --- a/src/main/java/com/example/nto/domain/entity/Terminal.java +++ b/src/main/java/com/example/nto/domain/entity/Terminal.java @@ -39,7 +39,7 @@ public class Terminal { private String code; // todo: Протестировать нужен ли тут каскад тип - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "office_id", nullable = false) private Office office;