Skip to content

Commit

Permalink
✨ feat: 내 정보 조회 API 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
woosung1223 committed Aug 18, 2024
1 parent 5b8d31d commit 4e3438c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 33 deletions.
25 changes: 0 additions & 25 deletions src/main/java/slvtwn/khu/toyouserver/application/UserService.java

This file was deleted.

7 changes: 6 additions & 1 deletion src/main/java/slvtwn/khu/toyouserver/dto/UserResponse.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package slvtwn.khu.toyouserver.dto;

import java.time.LocalDate;
import slvtwn.khu.toyouserver.domain.User;

public record UserResponse(Long id, String name, LocalDate birthday, String imageUrl) {
public record UserResponse(Long id, String name, LocalDate birthday, String introduction, String imageUrl) {

public static UserResponse of(User user) {
return new UserResponse(user.getId(), user.getName(), user.getBirthday(), user.getIntroduction(), user.getProfilePicture());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import slvtwn.khu.toyouserver.application.UserService;
import slvtwn.khu.toyouserver.common.UserAuthentication;
import slvtwn.khu.toyouserver.domain.User;
import slvtwn.khu.toyouserver.dto.UserResponse;
Expand All @@ -12,10 +11,8 @@
@RestController
public class UserController {

private final UserService userService;

@GetMapping("/users")
public UserResponse findUser(@UserAuthentication User user) {
return userService.findUser(user.getId());
}
@GetMapping("/me")
public UserResponse getProfile(@UserAuthentication User user) {
return UserResponse.of(user);
}
}

0 comments on commit 4e3438c

Please sign in to comment.