Skip to content

Commit cf194df

Browse files
committed
refact: 컨벤션에 따른 패키지 수정
1 parent d448d2a commit cf194df

File tree

10 files changed

+249
-356
lines changed

10 files changed

+249
-356
lines changed

src/main/java/targeter/aim/domain/user/controller/MyPageController.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/main/java/targeter/aim/domain/user/controller/ProfileController.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/main/java/targeter/aim/domain/user/controller/UserController.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
import lombok.RequiredArgsConstructor;
99
import org.springframework.security.core.annotation.AuthenticationPrincipal;
1010
import org.springframework.web.bind.annotation.GetMapping;
11+
import org.springframework.web.bind.annotation.PathVariable;
1112
import org.springframework.web.bind.annotation.RequestMapping;
1213
import org.springframework.web.bind.annotation.RestController;
1314
import targeter.aim.domain.user.dto.UserDto;
1415
import targeter.aim.domain.user.service.UserService;
16+
import targeter.aim.system.exception.model.ErrorCode;
17+
import targeter.aim.system.exception.model.RestException;
1518
import targeter.aim.system.security.annotation.NoJwtAuth;
1619
import targeter.aim.system.security.model.UserDetails;
1720

@@ -26,7 +29,7 @@ public class UserController {
2629
private final UserService userService;
2730

2831
@GetMapping("/profile")
29-
@Operation(summary = "프로필 조회(프로필 연동용)", description = "현재 로그인된 사용자의 프로필을 조회합니다. 연동 테스트용이기 때문에 수정이 필요합니다.")
32+
@Operation(summary = "프로필 조회(테스트용, 실사용 X)", description = "현재 로그인된 사용자의 프로필을 조회합니다. 연동 테스트용이기 때문에 수정이 필요합니다.")
3033
public UserDto.UserResponse getUserProfile(@Parameter(hidden = true) @AuthenticationPrincipal UserDetails userDetails) {
3134
return userService.getUserProfile(userDetails.getUser().getId());
3235
}
@@ -37,4 +40,36 @@ public UserDto.UserResponse getUserProfile(@Parameter(hidden = true) @Authentica
3740
public List<UserDto.RankTop10Response> getTop10UserRank() {
3841
return userService.getTop10UserRank();
3942
}
43+
44+
@GetMapping("/mypage")
45+
@Operation(
46+
summary = "마이페이지 레벨/티어 조회",
47+
description = "로그인한 사용자의 레벨, 티어, 티어 진행률, 다음 티어 정보를 조회합니다."
48+
)
49+
public UserDto.MyPageResponse getMyPage(
50+
@AuthenticationPrincipal UserDetails userDetails
51+
) {
52+
return userService.getMyPage(userDetails);
53+
}
54+
55+
@GetMapping("/me/profile")
56+
@Operation(summary = "내 프로필 조회", description = "내 프로필(유저 정보 + 통계 + 관심사/분야)을 조회합니다.")
57+
public UserDto.ProfileResponse getMyProfile(
58+
@AuthenticationPrincipal UserDetails userDetails
59+
) {
60+
if (userDetails == null) {
61+
throw new RestException(ErrorCode.AUTH_LOGIN_REQUIRED);
62+
}
63+
64+
return userService.getProfile(userDetails.getUser().getId(), userDetails);
65+
}
66+
67+
@GetMapping("/{userId}/profile")
68+
@Operation(summary = "유저 프로필 조회", description = "특정 유저의 프로필(유저 정보 + 통계 + 관심사/분야)을 조회합니다.")
69+
public UserDto.ProfileResponse getUserProfile(
70+
@PathVariable Long userId,
71+
@AuthenticationPrincipal UserDetails userDetails
72+
) {
73+
return userService.getProfile(userId, userDetails);
74+
}
4075
}

src/main/java/targeter/aim/domain/user/dto/MyPageDto.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/main/java/targeter/aim/domain/user/dto/ProfileDto.java

Lines changed: 0 additions & 76 deletions
This file was deleted.

src/main/java/targeter/aim/domain/user/dto/UserDto.java

Lines changed: 88 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import java.time.LocalDate;
1111
import java.time.LocalDateTime;
12+
import java.util.List;
1213

1314
public class UserDto {
1415

@@ -54,12 +55,6 @@ public static class UserResponse {
5455
@Schema(description = "사용자 프로필 이미지")
5556
private FileDto.FileResponse profileImage;
5657

57-
@Schema(description = "계정 생성 시간", example = "ISO Datetime")
58-
private LocalDateTime createdAt;
59-
60-
@Schema(description = "마지막 정보 수정 시간", example = "ISO Datetime")
61-
private LocalDateTime lastModifiedAt;
62-
6358
public static UserResponse from(User user) {
6459
boolean isNewUser = user.isSocialUser()
6560
&& (user.getBirthday() == null || user.getGender() == null);
@@ -76,8 +71,6 @@ public static UserResponse from(User user) {
7671
.profileImage(FileDto.FileResponse.from(user.getProfileImage()))
7772
.socialLogin(user.getSocialLogin() == null ? null : user.getSocialLogin())
7873
.isNewUser(isNewUser)
79-
.createdAt(user.getCreatedAt())
80-
.lastModifiedAt(user.getLastModifiedAt())
8174
.build();
8275
}
8376
}
@@ -109,4 +102,91 @@ public static RankTop10Response of(Integer rank, User user) {
109102
.build();
110103
}
111104
}
105+
106+
@Getter
107+
@NoArgsConstructor
108+
@AllArgsConstructor
109+
public static class MyPageResponse {
110+
111+
@Schema(description = "현재 레벨", example = "37")
112+
private int level;
113+
114+
@Schema(description = "현재 티어", example = "SILVER")
115+
private TierDto.TierResponse tier;
116+
117+
@Schema(description = "티어 진행률 (%)", example = "45")
118+
private int tierProgressPercent;
119+
120+
@Schema(
121+
description = "다음 티어 (다이아몬드인 경우 null)",
122+
example = "GOLD",
123+
nullable = true
124+
)
125+
private TierDto.TierResponse nextTier;
126+
}
127+
128+
@Data
129+
@Builder
130+
@NoArgsConstructor
131+
@AllArgsConstructor
132+
@Schema(description = "프로필 조회 응답")
133+
public static class ProfileResponse {
134+
135+
@Schema(description = "유저 아이디(DB PK)", example = "1")
136+
private Long userId;
137+
138+
@Schema(description = "프로필 이미지")
139+
private FileDto.FileResponse profileImage;
140+
141+
@Schema(description = "유저 닉네임", example = "닉네임")
142+
private String nickname;
143+
144+
@Schema(description = "로그인 아이디", example = "testuser1")
145+
private String loginId;
146+
147+
@Schema(description = "티어 정보")
148+
private TierDto.TierResponse tier;
149+
150+
@Schema(description = "레벨", example = "1")
151+
private Integer level;
152+
153+
@Schema(description = "관심사(태그)", example = "[\"태그1\"]")
154+
private List<String> tags;
155+
156+
@Schema(description = "관심 분야", example = "[\"IT\"]")
157+
private List<String> fields;
158+
159+
@Schema(description = "전체 챌린지 기록")
160+
private ChallengeRecord allChallengeRecord;
161+
162+
@Schema(description = "SOLO 기록")
163+
private ChallengeRecord soloChallengeRecord;
164+
165+
@Schema(description = "VS 기록")
166+
private ChallengeRecord vsChallengeRecord;
167+
168+
@Schema(description = "본인 프로필 여부")
169+
private Boolean isMine;
170+
}
171+
172+
@Data
173+
@Builder
174+
@NoArgsConstructor
175+
@AllArgsConstructor
176+
@Schema(description = "챌린지 기록(시도/성공/실패/성공률)")
177+
public static class ChallengeRecord {
178+
179+
@Schema(description = "성공률(0~100)")
180+
private Double successRate;
181+
182+
@Schema(description = "시도 횟수", example = "30")
183+
private Long attemptCount;
184+
185+
@Schema(description = "성공 횟수", example = "20")
186+
private Long successCount;
187+
188+
@Schema(description = "실패 횟수", example = "10")
189+
private Long failCount;
190+
191+
}
112192
}

0 commit comments

Comments
 (0)