Class PlatformUserController

java.lang.Object
com.unosquare.carmigo.controller.PlatformUserController

@RestController @RequestMapping("/v1/users") public class PlatformUserController extends Object
Handles Platform User APIs.
  • Constructor Details

    • PlatformUserController

      public PlatformUserController()
  • Method Details

    • createPlatformUser

      @PostMapping(value="/create", produces="application/json") public org.springframework.http.ResponseEntity<PlatformUserResponse> createPlatformUser(@Valid @RequestBody @Valid PlatformUserRequest platformUserRequest)
      Enables a user to create an account. This new user's access status is set to STAGED.
      Parameters:
      platformUserRequest - Request body as PlatformUserRequest.
      Returns:
      Response body as PlatformUserResponse.
    • confirmEmail

      @PostMapping("/confirm-email") public org.springframework.http.ResponseEntity<?> confirmEmail(@RequestParam String email)
      Enables user to confirm their email after creating an account. Upon confirmation, their access status is set to ACTIVE.
      Parameters:
      email - the email used to create an account.
      Returns:
      an empty body.
    • getCurrentPlatformUserProfile

      @GetMapping(value="/profile", produces="application/json") @PreAuthorize("hasAuthority(\'ACTIVE\') or hasAuthority(\'SUSPENDED\') or hasAuthority(\'ADMIN\') or hasAuthority(\'DEV\')") public org.springframework.http.ResponseEntity<PlatformUserResponse> getCurrentPlatformUserProfile(@RequestParam(value="refreshCache",required=false) boolean refreshCache)
      Enables logged-in users to see their profiles.
      Returns:
      Response body as PlatformUserResponse.
    • getPlatformUserById

      @GetMapping(value="/{platformUserId}", produces="application/json") @PreAuthorize("hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<PlatformUserResponse> getPlatformUserById(@PathVariable int platformUserId, @RequestParam(value="refreshCache",required=false) boolean refreshCache)
      Enables logged-in admin users to see other user's profiles.
      Parameters:
      platformUserId - the platform user's id.
      Returns:
      Response body as PlatformUserResponse.
    • patchCurrentPlatformUser

      @PatchMapping(consumes="application/json-patch+json") @PreAuthorize("hasAuthority(\'ACTIVE\') or hasAuthority(\'SUSPENDED\') or hasAuthority(\'ADMIN\') or hasAuthority(\'DEV\')") public org.springframework.http.ResponseEntity<PlatformUserResponse> patchCurrentPlatformUser(@RequestBody com.github.fge.jsonpatch.JsonPatch patch)
      Enables logged-in users to correct their profiles.
      Parameters:
      patch - Request body as JsonPatch.
      Returns:
      Response body as PlatformUserResponse.
    • patchPlatformUserById

      @PatchMapping(value="/{platformUserId}", consumes="application/json-patch+json") @PreAuthorize("hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<PlatformUserResponse> patchPlatformUserById(@PathVariable int platformUserId, @RequestBody com.github.fge.jsonpatch.JsonPatch patch)
      Enables admin logged-in users to correct other user's profiles.
      Parameters:
      platformUserId - the platform user's id.
      patch - Request body as JsonPatch.
      Returns:
      Response body as PlatformUserResponse.
    • deleteCurrentPlatformUser

      @DeleteMapping @PreAuthorize("hasAuthority(\'ACTIVE\') or hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<?> deleteCurrentPlatformUser()
      Enables logged-in user's to delete their profile.
      Returns:
      an empty body.
    • deletePlatformUserById

      @DeleteMapping("/{platformUserId}") @PreAuthorize("hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<?> deletePlatformUserById(@PathVariable int platformUserId)
      Enables logged-in admin users to delete a user's profile.
      Parameters:
      platformUserId - the platform user's id.
      Returns:
      an empty body.