please?
https://gist.github.com/invzbl3/14a3a6700ec8b89c1090ac0741b71513#file-projectcontroller-java-L48
I'm trying to understand if I need to pass as the parameter to the method Entity and do I need to convert it before saving?
If you need some more information, I can provide without any problem. Just let me know, please.
I've received as result: @PostMapping @Operation(summary = "Add new project") public ResponseEntity<ProjectDTO> addProject(@RequestBody Project project) { logger.info("addProject() is calling..."); if (project != null) { Project entity = projectRepository.save(project); ProjectDTO projectDTO = projectAdaptor.databaseModelToUiDto(entity); return new ResponseEntity<>(projectDTO, HttpStatus.OK); } return new ResponseEntity<>(new ProjectDTO("","",""), HttpStatus.BAD_REQUEST); } but, maybe, it'd be good if in the input parameters was DTO?
I've received as result: @PostMapping @Operation(summary = "Add new project") public ResponseEntity<ProjectDTO> addProject(@RequestBody Project project) { logger.info("addProject() is calling..."); if (project != null) { Project entity = projectRepository.save(project); ProjectDTO projectDTO = projectAdaptor.databaseModelToUiDto(entity); return new ResponseEntity<>(projectDTO, HttpStatus.OK); } return new ResponseEntity<>(new ProjectDTO("","",""), HttpStatus.BAD_REQUEST); } but, maybe, it'd be good if in the input parameters was DTO, right?
You need to pass the entity, not DTO
Обсуждают сегодня