Class UserController

java.lang.Object
org.example.crmedu.application.controller.UserController

@RestController @RequestMapping("api/v1/users") public class UserController extends Object
REST controller for managing users. Provides endpoints to create, retrieve, update and delete users.
  • Constructor Details

    • UserController

      public UserController()
  • Method Details

    • getUsers

      @GetMapping @Secured({"SUPERUSER","ORG_ADMIN"}) public org.springframework.http.ResponseEntity<PageDTO<GetUserResponse>> getUsers(org.springframework.data.domain.Pageable pageable)
      Retrieves a paginates list of users.
      Parameters:
      pageable - an object specifying pagination parameters (page number and size)
      Returns:
      a ResponseEntity containing a paginated list of users wrapped in PageDTO of GetUserResponse
    • getUser

      @GetMapping("/{id}") @Secured({"SUPERUSER","ORG_ADMIN"}) public org.springframework.http.ResponseEntity<GetUserResponse> getUser(@PathVariable Long id)
      Retrieves a user by its unique identifier.
      Parameters:
      id - the unique identifier of the user
      Returns:
      a ResponseEntity containing the subject data in GetUserResponse
    • createUser

      @PostMapping @Secured({"SUPERUSER","ORG_ADMIN"}) public org.springframework.http.ResponseEntity<CreateUserResponse> createUser(@Valid @RequestBody @Valid CreateUserRequest request)
      Creates a new user based on the provided request data.
      Parameters:
      request - an object containing the user details
      Returns:
      a ResponseEntity with the created subject data in CreateUserResponse
    • updateUser

      @PutMapping("/{id}") @Secured({"SUPERUSER","ORG_ADMIN"}) public org.springframework.http.ResponseEntity<Void> updateUser(@Valid @RequestBody @Valid UpdateUserRequest request, @PathVariable Long id)
      Updates an existing user by its unique identifier.
      Parameters:
      request - an object containing the updated user details
      id - the unique identifier of the user to update
      Returns:
      a ResponseEntity
    • deleteUser

      @DeleteMapping("/{id}") @Secured({"SUPERUSER","ORG_ADMIN"}) public org.springframework.http.ResponseEntity<Void> deleteUser(@PathVariable Long id)
      Deletes a user by its unique identifier.
      Parameters:
      id - the unique identifier of the user to delete
      Returns:
      a ResponseEntity