-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ArnaudFonzam
committed
Feb 16, 2024
1 parent
6865413
commit 2257cca
Showing
38 changed files
with
236 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 41 additions & 40 deletions
81
src/main/java/org/isf/admission/rest/AdmissionController.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ | |
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.http.ResponseEntity.BodyBuilder; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
|
@@ -244,10 +245,10 @@ public ResponseEntity<DiseaseDTO> getDiseaseByCode(@PathVariable("code") String | |
public ResponseEntity<?> newDisease(@Valid @RequestBody DiseaseDTO diseaseDTO) throws OHServiceException { | ||
Disease disease = mapper.map2Model(diseaseDTO); | ||
if (diseaseManager.isCodePresent(disease.getCode())) { | ||
return ResponseEntity.badRequest().body(new OHExceptionMessage("Duplicated disease code.")); | ||
return ResponseEntity.internalServerError().body(new OHExceptionMessage("Duplicated disease code.")); | ||
} | ||
if (diseaseManager.descriptionControl(disease.getDescription(), disease.getType().getCode())) { | ||
return ResponseEntity.badRequest().body(new OHExceptionMessage("Duplicated disease description for the same disease type.")); | ||
return ResponseEntity.internalServerError().body(new OHExceptionMessage("Duplicated disease description for the same disease type.")); | ||
} | ||
try { | ||
diseaseManager.newDisease(disease); | ||
|
@@ -267,7 +268,7 @@ public ResponseEntity<?> newDisease(@Valid @RequestBody DiseaseDTO diseaseDTO) t | |
public ResponseEntity<?> updateDisease(@Valid @RequestBody DiseaseDTO diseaseDTO) throws OHServiceException { | ||
Disease disease = mapper.map2Model(diseaseDTO); | ||
if (!diseaseManager.isCodePresent(disease.getCode())) { | ||
return ResponseEntity.badRequest().body(new OHExceptionMessage("Disease not found.")); | ||
return ((BodyBuilder) ResponseEntity.notFound()).body(new OHExceptionMessage("Disease not found.")); | ||
} | ||
disease.setLock(diseaseDTO.getLock()); | ||
try { | ||
|
@@ -299,7 +300,7 @@ public ResponseEntity<?> deleteDisease(@PathVariable("code") String code) throws | |
result.put("deleted", isDeleted); | ||
return ResponseEntity.ok(result); | ||
} else { | ||
return ResponseEntity.badRequest().body("No disease found with the specified code."); | ||
return ((BodyBuilder) ResponseEntity.notFound()).body("No disease found with the specified code."); | ||
This comment has been minimized.
Sorry, something went wrong.
dbmalkovsky
Collaborator
|
||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Shouldn't there be a: new OHExceptionMessage() here too?