fix: fix bugs OfficeController and Terminal

This commit is contained in:
Petr Rudichev 2025-02-20 10:48:23 +03:00
parent fa27254abf
commit c76f57da93
2 changed files with 7 additions and 6 deletions

View File

@ -42,9 +42,10 @@ public class OfficeController {
return ResponseEntity.ok(officeService.update(officeId, officeDTO));
}
@DeleteMapping("/{officeId}")
public ResponseEntity<Void> deleteOffice(@PathVariable long officeId) {
officeService.delete(officeId);
return ResponseEntity.noContent().build();
}
// Тут баг с ссылочной целостностью
// @DeleteMapping("/{officeId}")
// public ResponseEntity<Void> deleteOffice(@PathVariable long officeId) {
// officeService.delete(officeId);
// return ResponseEntity.noContent().build();
// }
}

View File

@ -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;