POST -> GET
This commit is contained in:
parent
239d16cfc4
commit
18d916391f
@ -6,10 +6,7 @@ import lombok.NonNull;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This controller is responsible for
|
* This controller is responsible for
|
||||||
@ -36,7 +33,7 @@ public final class UserController {
|
|||||||
*
|
*
|
||||||
* @return the currently authenticated user
|
* @return the currently authenticated user
|
||||||
*/
|
*/
|
||||||
@PostMapping("/@me") @ResponseBody @NonNull
|
@GetMapping("/@me") @ResponseBody @NonNull
|
||||||
public ResponseEntity<UserDTO> getUser() {
|
public ResponseEntity<UserDTO> getUser() {
|
||||||
return ResponseEntity.ok(userService.getUser());
|
return ResponseEntity.ok(userService.getUser());
|
||||||
}
|
}
|
||||||
|
@ -33,16 +33,16 @@ public final class UserDTO {
|
|||||||
*/
|
*/
|
||||||
@NonNull private final UserTier tier;
|
@NonNull private final UserTier tier;
|
||||||
|
|
||||||
/**
|
|
||||||
* The date this user last logged in.
|
|
||||||
*/
|
|
||||||
@NonNull private final Date lastLogin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The flags for this user.
|
* The flags for this user.
|
||||||
*/
|
*/
|
||||||
private final int flags;
|
private final int flags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The date this user last logged in.
|
||||||
|
*/
|
||||||
|
@NonNull private final Date lastLogin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date this user was created.
|
* The date this user was created.
|
||||||
*/
|
*/
|
||||||
@ -57,8 +57,8 @@ public final class UserDTO {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public static UserDTO asDTO(@NonNull User user, @NonNull Date creationTime) {
|
public static UserDTO asDTO(@NonNull User user, @NonNull Date creationTime) {
|
||||||
return new UserDTO(user.getSnowflake(), user.getEmail(), user.getUsername(), user.getTier(),
|
return new UserDTO(user.getSnowflake(), user.getEmail(), user.getUsername(),
|
||||||
user.getLastLogin(), user.getFlags(), creationTime
|
user.getTier(), user.getFlags(), user.getLastLogin(), creationTime
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user