-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
22 changed files
with
317 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 11 additions & 13 deletions
24
backend/src/main/java/com/hjjang/backend/domain/user/controller/UserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
package com.hjjang.backend.domain.user.controller; | ||
|
||
import com.hjjang.backend.domain.user.entity.User; | ||
import com.hjjang.backend.domain.user.service.UserService; | ||
import com.hjjang.backend.global.dto.ApiResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.core.context.SecurityContextHolder; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.hjjang.backend.domain.user.dto.UserProfileDTO; | ||
import com.hjjang.backend.domain.user.service.UserProfileService; | ||
import com.hjjang.backend.global.dto.ApiResponse; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequestMapping("/api/v1/users") | ||
@RequiredArgsConstructor | ||
public class UserController { | ||
|
||
private final UserService userService; | ||
|
||
@GetMapping | ||
public ApiResponse getUser() { | ||
org.springframework.security.core.userdetails.User principal = (org.springframework.security.core.userdetails.User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); | ||
|
||
User user = userService.getUser(principal.getUsername()); | ||
private final UserProfileService userProfileService; | ||
|
||
return ApiResponse.success("user", user); | ||
@GetMapping("/profile") | ||
public ApiResponse getProfile() { | ||
UserProfileDTO userProfile = userProfileService.getUserProfile(); | ||
return ApiResponse.success("userProfile", userProfile); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
backend/src/main/java/com/hjjang/backend/domain/user/dto/UserProfileDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.hjjang.backend.domain.user.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class UserProfileDTO { | ||
|
||
private String userNickname; | ||
|
||
private String userImageUrl; | ||
|
||
private String userEmail; | ||
|
||
private Long userMannerTemperature; | ||
|
||
private String userUnivName; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...end/src/main/java/com/hjjang/backend/domain/user/exception/UserDoesNotExistException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.hjjang.backend.domain.user.exception; | ||
|
||
public class UserDoesNotExistException { | ||
public UserDoesNotExistException() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.