Update
Service
public DepartmentDTO update(UUID id, DepartmentDTO dto) {
Department entity = departmentRepository.getById(id);
entity.setName(dto.getName());
departmentRepository.save(entity);
return new DepartmentDTO(entity);
}
Controller
@PutMapping(value = "/{id}")
public ResponseEntity<DepartmentDTO> update(@PathVariable UUID id, @RequestBody DepartmentDTO dto) {
dto = departmentService.update(id, dto);
return ResponseEntity.ok().body(dto);
}
Atualizado