Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
correct all mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudFonzam committed Feb 16, 2024
1 parent a26e2a3 commit 6865413
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/isf/ward/rest/WardController.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public ResponseEntity<?> newWard(@RequestBody WardDTO newWard) throws OHServiceE
if (wardCreated == null) {
return ResponseEntity.internalServerError().body(new OHExceptionMessage("Ward not created."));
}
return ResponseEntity.ok().body(mapper.map2DTO(wardCreated));
return ResponseEntity.status(HttpStatus.CREATED).body(mapper.map2DTO(wardCreated));
}

/**
Expand Down Expand Up @@ -165,18 +165,18 @@ public ResponseEntity<?> updateWard(@RequestBody WardDTO updateWard) throws OHSe
* @throws OHServiceException
*/
@DeleteMapping(value = "/wards/{code}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> deleteWard(@PathVariable String code) throws OHServiceException {
public ResponseEntity<?> deleteWard(@PathVariable String code) throws OHServiceException {
LOGGER.info("Delete Ward with code: {}", code);
Ward ward = wardManager.findWard(code);
if (ward != null) {
try {
wardManager.deleteWard(ward);
} catch (OHServiceException serviceException) {
throw new OHAPIException(new OHExceptionMessage("Ward not deleted."));
return ResponseEntity.internalServerError().body(new OHExceptionMessage("Ward not deleted."));
}
return ResponseEntity.ok(true);
}
return ResponseEntity.notFound().build();
return ResponseEntity.badRequest().body("No ward found with the specified code.");
}

/**
Expand Down

0 comments on commit 6865413

Please sign in to comment.