added security and fix edit profile
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.krylov.refound.controller;
|
||||
|
||||
import com.krylov.refound.dto.UserResponseDto;
|
||||
import com.krylov.refound.dto.UserUpdateDto;
|
||||
import com.krylov.refound.service.UserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/users")
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class UserController {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
@PutMapping("/{id}")
|
||||
public ResponseEntity<UserResponseDto> updateUser(@PathVariable Long id, @ModelAttribute UserUpdateDto userUpdateDto) {
|
||||
log.info("updateUser, id={}", id);
|
||||
UserResponseDto userResponseDto = userService.updateUser(id, userUpdateDto);
|
||||
return ResponseEntity.ok(userResponseDto);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user