Skip to content

Commit

Permalink
fix users controller syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
AO-StreetArt committed Dec 26, 2018
1 parent 73ccb3a commit 5ba9a2e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/main/java/com/ao/adrestia/controller/UsersController.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private BasicDBObject genIdQuery(String id) {
* Update an existing user.
*/
@PutMapping("/{key}")
public ResponseEntity<ApplicationUser> updateUser(
public ResponseEntity<String> updateUser(
@RequestBody ApplicationUser user,
@PathVariable("key") String key) {
log.info("Updating Existing User");
Expand All @@ -151,12 +151,6 @@ public ResponseEntity<ApplicationUser> updateUser(
if (user.getEmail() != null && !(user.getEmail().isEmpty())) {
updateQuery.put("email", user.getEmail());
}
if (user.getIsAdmin() != null) {
updateQuery.put("isAdmin", user.getIsAdmin());
}
if (user.getIsActive() != null) {
updateQuery.put("isActive", user.getIsActive());
}

UpdateResult result = mongoCollection.updateOne(genIdQuery(key),
new BasicDBObject("$set", updateQuery), new UpdateOptions());
Expand All @@ -165,7 +159,7 @@ public ResponseEntity<ApplicationUser> updateUser(
HttpStatus returnCode = HttpStatus.OK;
if (result.getModifiedCount() < 1) {
returnCode = HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE;
logger.debug("No documents modified for user update");
log.debug("No documents modified for user update");
}
HttpHeaders responseHeaders = new HttpHeaders();
return new ResponseEntity<String>("", responseHeaders, returnCode);
Expand Down

0 comments on commit 5ba9a2e

Please sign in to comment.