Find the code snippet for updateUser() operation:
// Updating a User
@PutMapping(path = ["/user/{id}"])
fun updateUser(@RequestBody userModel: UserModel, @PathVariable("id") id: Int): ResponseEntity<UserModel> {
userService.updateUser(userModel, id)
return ResponseEntity(userModel, HttpStatus.OK)
}
The @PutMapping(path = ["/user/{id}"]) annotation is the URL path of "/user/{id}", and it is a PUT request with a specific ID. Here, we will update the specific user details in the database.