Class UserController
java.lang.Object
org.training.user.service.controller.UserController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Response>createUser(CreateUser userDto) Creates a new user.Retrieves all users.org.springframework.http.ResponseEntity<UserDto>readUserByAccountId(String accountId) Retrieves the user with the specified account ID.org.springframework.http.ResponseEntity<UserDto>readUserByAuthId(String authId) Retrieves a user by their authentication ID.org.springframework.http.ResponseEntity<UserDto>readUserById(Long userId) Retrieves a user by their ID.org.springframework.http.ResponseEntity<Response>updateUser(Long id, UserUpdate userUpdate) Updates a user with the given ID.org.springframework.http.ResponseEntity<Response>updateUserStatus(Long id, UserUpdateStatus userUpdate) Updates the status of a user.
-
Constructor Details
-
UserController
public UserController()
-
-
Method Details
-
createUser
@PostMapping("/register") public org.springframework.http.ResponseEntity<Response> createUser(@RequestBody CreateUser userDto) Creates a new user.- Parameters:
userDto- the user data transfer object- Returns:
- the response entity containing the response
-
readAllUsers
Retrieves all users.- Returns:
- The list of user DTOs
-
readUserByAuthId
@GetMapping("auth/{authId}") public org.springframework.http.ResponseEntity<UserDto> readUserByAuthId(@PathVariable String authId) Retrieves a user by their authentication ID.- Parameters:
authId- The authentication ID of the user.- Returns:
- The response entity containing the user DTO.
-
updateUserStatus
@PatchMapping("/{id}") public org.springframework.http.ResponseEntity<Response> updateUserStatus(@PathVariable Long id, @RequestBody UserUpdateStatus userUpdate) Updates the status of a user.- Parameters:
id- The ID of the user to update.userUpdate- The updated status of the user.- Returns:
- The response entity containing the updated user and HTTP status.
-
updateUser
@PutMapping("{id}") public org.springframework.http.ResponseEntity<Response> updateUser(@PathVariable Long id, @RequestBody UserUpdate userUpdate) Updates a user with the given ID.- Parameters:
id- The ID of the user to update.userUpdate- The updated user information.- Returns:
- The response with the updated user information.
-
readUserById
@GetMapping("/{userId}") public org.springframework.http.ResponseEntity<UserDto> readUserById(@PathVariable Long userId) Retrieves a user by their ID.- Parameters:
userId- the ID of the user to retrieve- Returns:
- the user details as a ResponseEntity
-
readUserByAccountId
@GetMapping("/accounts/{accountId}") public org.springframework.http.ResponseEntity<UserDto> readUserByAccountId(@PathVariable String accountId) Retrieves the user with the specified account ID.- Parameters:
accountId- The account ID of the user to retrieve.- Returns:
- The user DTO associated with the account ID.
-