Skip to content

Commit e81b2ce

Browse files
committed
♻️ refactor: dto 이름 변경(MyPage -> MyPageInfo)
1 parent 449f3b7 commit e81b2ce

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

backend/src/main/java/io/f1/backend/domain/stat/dao/StatRedisRepository.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import io.f1.backend.domain.stat.dto.StatPageResponse;
66
import io.f1.backend.domain.stat.dto.StatResponse;
77
import io.f1.backend.domain.stat.dto.StatWithNicknameAndUserId;
8-
import io.f1.backend.domain.user.dto.MyPage;
8+
import io.f1.backend.domain.user.dto.MyPageInfo;
99

1010
import lombok.RequiredArgsConstructor;
1111

@@ -152,7 +152,7 @@ private long getUserIdFromNickname(String nickname) {
152152
return ((Number) requireNonNull(valueOps.get(getStatNickname(nickname)))).longValue();
153153
}
154154

155-
public MyPage getStatByUserId(long userId) {
155+
public MyPageInfo getStatByUserId(long userId) {
156156
String statUserKey = getStatUserKey(userId);
157157

158158
Long rank = zSetOps.reverseRank(STAT_RANK, userId);
@@ -163,7 +163,7 @@ public MyPage getStatByUserId(long userId) {
163163
throw new IllegalStateException("User not found in Redis: " + userId);
164164
}
165165

166-
return new MyPage(
166+
return new MyPageInfo(
167167
(String) statMap.get("nickname"),
168168
rank + 1,
169169
(long) statMap.get("totalGames"),

backend/src/main/java/io/f1/backend/domain/stat/dao/StatRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.f1.backend.domain.stat.dao;
22

33
import io.f1.backend.domain.stat.dto.StatPageResponse;
4-
import io.f1.backend.domain.user.dto.MyPage;
4+
import io.f1.backend.domain.user.dto.MyPageInfo;
55

66
import org.springframework.data.domain.Pageable;
77

@@ -19,5 +19,5 @@ public interface StatRepository {
1919

2020
void removeUser(long userId);
2121

22-
MyPage getMyPageByUserId(long userId);
22+
MyPageInfo getMyPageByUserId(long userId);
2323
}

backend/src/main/java/io/f1/backend/domain/stat/dao/StatRepositoryAdapter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import io.f1.backend.domain.stat.dto.StatPageResponse;
66
import io.f1.backend.domain.stat.dto.StatWithNickname;
77
import io.f1.backend.domain.stat.dto.StatWithNicknameAndUserId;
8-
import io.f1.backend.domain.user.dto.MyPage;
8+
import io.f1.backend.domain.user.dto.MyPageInfo;
99
import io.f1.backend.global.exception.CustomException;
1010
import io.f1.backend.global.exception.errorcode.RoomErrorCode;
1111
import io.f1.backend.global.exception.errorcode.UserErrorCode;
@@ -101,7 +101,7 @@ private Pageable getPageableFromNickname(String nickname, int pageSize) {
101101
}
102102

103103
@Override
104-
public MyPage getMyPageByUserId(long userId) {
104+
public MyPageInfo getMyPageByUserId(long userId) {
105105
try {
106106
return redisRepository.getStatByUserId(userId);
107107
} catch (Exception e) {
@@ -111,7 +111,7 @@ public MyPage getMyPageByUserId(long userId) {
111111
StatWithNicknameAndUserId stat = findFirstMatchingStat(userId);
112112
long rank = jpaRepository.countByScoreGreaterThan(stat.score()) + 1;
113113

114-
return new MyPage(
114+
return new MyPageInfo(
115115
stat.nickname(), rank, stat.totalGames(), stat.winningGames(), stat.score());
116116
}
117117

backend/src/main/java/io/f1/backend/domain/user/api/UserController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import static io.f1.backend.global.util.SecurityUtils.logout;
44

55
import io.f1.backend.domain.user.app.UserService;
6-
import io.f1.backend.domain.user.dto.MyPage;
6+
import io.f1.backend.domain.user.dto.MyPageInfo;
77
import io.f1.backend.domain.user.dto.SignupRequest;
88
import io.f1.backend.domain.user.dto.UserPrincipal;
99

@@ -46,8 +46,8 @@ public ResponseEntity<Void> updateNickname(
4646
}
4747

4848
@GetMapping
49-
public ResponseEntity<MyPage> getMyPage(@AuthenticationPrincipal UserPrincipal userPrincipal) {
50-
MyPage response = userService.getMyPage(userPrincipal);
49+
public ResponseEntity<MyPageInfo> getMyPage(@AuthenticationPrincipal UserPrincipal userPrincipal) {
50+
MyPageInfo response = userService.getMyPage(userPrincipal);
5151
return ResponseEntity.ok(response);
5252
}
5353
}

backend/src/main/java/io/f1/backend/domain/user/app/UserService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import io.f1.backend.domain.stat.dao.StatRepository;
1111
import io.f1.backend.domain.user.dao.UserRepository;
1212
import io.f1.backend.domain.user.dto.AuthenticationUser;
13-
import io.f1.backend.domain.user.dto.MyPage;
13+
import io.f1.backend.domain.user.dto.MyPageInfo;
1414
import io.f1.backend.domain.user.dto.SignupRequest;
1515
import io.f1.backend.domain.user.dto.UserPrincipal;
1616
import io.f1.backend.domain.user.dto.UserSummary;
@@ -127,7 +127,7 @@ public void checkNickname(String nickname) {
127127
}
128128

129129
@Transactional(readOnly = true)
130-
public MyPage getMyPage(UserPrincipal userPrincipal) {
130+
public MyPageInfo getMyPage(UserPrincipal userPrincipal) {
131131
Long userId = userPrincipal.getUserId();
132132
return statRepository.getMyPageByUserId(userId);
133133
}

backend/src/main/java/io/f1/backend/domain/user/dto/MyPage.java

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package io.f1.backend.domain.user.dto;
2+
3+
public record MyPageInfo(String nickname, long rank, long score, long totalGames, long winningGames) {}

0 commit comments

Comments
 (0)