Skip to content

Commit 01fd0ae

Browse files
authored
[Modify] #667 마이 솝트로그 필드 수정 (#669)
2 parents ab1efb2 + c523a02 commit 01fd0ae

File tree

4 files changed

+101
-39
lines changed

4 files changed

+101
-39
lines changed

src/main/java/org/sopt/app/application/appjamuser/AppjamUserService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ public TeamSummary getTeamSummaryByUserId(Long userId) {
2626
.orElseThrow(() -> new NotFoundException(ErrorCode.TEAM_NOT_FOUND));
2727
return TeamSummary.from(appjamUser);
2828
}
29+
30+
public boolean isAppjamParticipant(Long userId) {
31+
return appjamUserRepository.existsByUserId(userId);
32+
}
2933
}

src/main/java/org/sopt/app/facade/UserFacade.java

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.List;
55
import lombok.RequiredArgsConstructor;
66

7+
import org.sopt.app.application.appjamuser.AppjamUserService;
78
import org.sopt.app.application.fortune.FortuneService;
89
import org.sopt.app.application.friend.FriendService;
910
import org.sopt.app.application.platform.PlatformService;
@@ -40,6 +41,7 @@ public class UserFacade {
4041
private final PokeService pokeService;
4142
private final FortuneService fortuneService;
4243
private final UserService userService;
44+
private final AppjamUserService appjamUserService;
4345

4446
@Transactional(readOnly = true)
4547
public MainView getMainViewInfo(Long userId) {
@@ -81,6 +83,8 @@ public UserResponse.MySoptLog getMySoptLog(Long userId) {
8183
UserStatus userStatus = platformService.getStatus(userId);
8284
boolean isActive = (userStatus == UserStatus.ACTIVE);
8385

86+
boolean isAppjamParticipant = appjamUserService.isAppjamParticipant(userId);
87+
8488
boolean isFortuneChecked = fortuneService.isExistTodayFortune(userId);
8589
String todayFortuneText = isFortuneChecked
8690
? fortuneService.getTodayFortuneWordByUserId(userId, LocalDate.now()).title()
@@ -94,13 +98,31 @@ public UserResponse.MySoptLog getMySoptLog(Long userId) {
9498
int soulmatesPokeCount = friendService.sumPokeCountByFriendship(
9599
userId, Friendship.SOULMATE.getLowerLimit(), Friendship.SOULMATE.getUpperLimit());
96100

97-
if (isActive) {
101+
boolean isSoptampIncluded = isActive || isAppjamParticipant;
102+
103+
if (isSoptampIncluded) {
98104
int soptampCount = stampService.getCompletedMissionCount(userId);
99105
int viewCount = stampService.getTotalViewCount(userId);
100106
int myClapCount = stampService.getTotalReceivedClapCount(userId);
101107
int clapCount = clapService.getTotalGivenClapCount(userId);
102108

103-
return UserResponse.MySoptLog.ofActive(
109+
if (isActive) {
110+
return UserResponse.MySoptLog.ofActive(
111+
isAppjamParticipant,
112+
isFortuneChecked,
113+
todayFortuneText,
114+
soptampCount,
115+
viewCount,
116+
myClapCount,
117+
clapCount,
118+
totalPokeCount,
119+
newFriendsPokeCount,
120+
bestFriendsPokeCount,
121+
soulmatesPokeCount
122+
);
123+
}
124+
125+
return UserResponse.MySoptLog.ofInactiveAppjamParticipant(
104126
isFortuneChecked,
105127
todayFortuneText,
106128
soptampCount,
@@ -114,7 +136,7 @@ public UserResponse.MySoptLog getMySoptLog(Long userId) {
114136
);
115137
}
116138

117-
return UserResponse.MySoptLog.ofInactive(
139+
return UserResponse.MySoptLog.ofInactiveNonAppjam(
118140
isFortuneChecked,
119141
todayFortuneText,
120142
totalPokeCount,

src/main/java/org/sopt/app/interfaces/postgres/AppjamUserRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ public interface AppjamUserRepository extends JpaRepository<AppjamUser, Long> {
1818
List<AppjamUser> findAllByTeamNumberIn(Collection<TeamNumber> teamNumbers);
1919

2020
List<AppjamUser> findAllByUserIdIn(Collection<Long> userIds);
21+
22+
boolean existsByUserId(Long userId);
2123
}

src/main/java/org/sopt/app/presentation/user/UserResponse.java

Lines changed: 70 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public static class MainView {
3434

3535
public static MainView unauthenticatedMainView() {
3636
return MainView.builder()
37-
.user(Playground.unauthenticatedUser())
38-
.operation(Operation.defaultOperation())
39-
.isAllConfirm(false)
40-
.build();
37+
.user(Playground.unauthenticatedUser())
38+
.operation(Operation.defaultOperation())
39+
.isAllConfirm(false)
40+
.build();
4141
}
4242
}
4343

@@ -57,11 +57,11 @@ public static class Playground {
5757

5858
public static Playground unauthenticatedUser() {
5959
return Playground.builder()
60-
.status("UNAUTHENTICATED")
61-
.name("")
62-
.profileImage("")
63-
.generationList(List.of())
64-
.build();
60+
.status("UNAUTHENTICATED")
61+
.name("")
62+
.profileImage("")
63+
.generationList(List.of())
64+
.build();
6565
}
6666

6767
}
@@ -78,9 +78,9 @@ public static class Operation {
7878

7979
public static Operation defaultOperation() {
8080
return Operation.builder()
81-
.attendanceScore(0D)
82-
.announcement("")
83-
.build();
81+
.attendanceScore(0D)
82+
.announcement("")
83+
.build();
8484
}
8585
}
8686

@@ -131,10 +131,10 @@ public static class AppService {
131131

132132
public static AppService of(final AppServiceInfo appServiceInfo) {
133133
return AppService.builder()
134-
.serviceName(appServiceInfo.getServiceName())
135-
.activeUser(appServiceInfo.getActiveUser())
136-
.inactiveUser(appServiceInfo.getInactiveUser())
137-
.build();
134+
.serviceName(appServiceInfo.getServiceName())
135+
.activeUser(appServiceInfo.getActiveUser())
136+
.inactiveUser(appServiceInfo.getInactiveUser())
137+
.build();
138138
}
139139
}
140140

@@ -167,26 +167,26 @@ public static class SoptLog {
167167
private String todayFortuneText;
168168

169169
public static SoptLog of(int soptLevel, Long pokeCount, Long soptampRank, Long during, Boolean isActive,
170-
List<String> icons,
171-
PlaygroundProfile playgroundProfile,boolean partTypeToKorean,
172-
boolean isFortuneChecked, String fortuneText) {
170+
List<String> icons,
171+
PlaygroundProfile playgroundProfile, boolean partTypeToKorean,
172+
boolean isFortuneChecked, String fortuneText) {
173173
return SoptLog.builder()
174-
.soptLevel("Lv." + soptLevel)
175-
.pokeCount(pokeCount + "회")
176-
.soptampRank(soptampRank != null ? soptampRank + "등" : "공개 예정!")
177-
.userName(playgroundProfile.getName())
178-
.profileImage(playgroundProfile.getProfileImage() != null ? playgroundProfile.getProfileImage() : "")
179-
.part(playgroundProfile.getAllActivities().stream()
180-
.map(c -> c.getPlaygroundPart().getPartName())
181-
.filter(c -> !c.equals(SoptPart.NONE.getPartName()))
182-
.collect(Collectors.joining("/")))
183-
.profileMessage(playgroundProfile.getIntroduction() != null ? playgroundProfile.getIntroduction() : "")
184-
.during(during != null ? during + "개월" : "")
185-
.isActive(isActive)
186-
.icons(icons)
187-
.isFortuneChecked(isFortuneChecked)
188-
.todayFortuneText(fortuneText)
189-
.build();
174+
.soptLevel("Lv." + soptLevel)
175+
.pokeCount(pokeCount + "회")
176+
.soptampRank(soptampRank != null ? soptampRank + "등" : "공개 예정!")
177+
.userName(playgroundProfile.getName())
178+
.profileImage(playgroundProfile.getProfileImage() != null ? playgroundProfile.getProfileImage() : "")
179+
.part(playgroundProfile.getAllActivities().stream()
180+
.map(c -> c.getPlaygroundPart().getPartName())
181+
.filter(c -> !c.equals(SoptPart.NONE.getPartName()))
182+
.collect(Collectors.joining("/")))
183+
.profileMessage(playgroundProfile.getIntroduction() != null ? playgroundProfile.getIntroduction() : "")
184+
.during(during != null ? during + "개월" : "")
185+
.isActive(isActive)
186+
.icons(icons)
187+
.isFortuneChecked(isFortuneChecked)
188+
.todayFortuneText(fortuneText)
189+
.build();
190190
}
191191
}
192192

@@ -203,6 +203,9 @@ public record MySoptLog(
203203
@Schema(description = "활동 기수 여부")
204204
boolean isActive,
205205

206+
@Schema(description = "앱잼 참여 여부")
207+
boolean isAppjamParticipant,
208+
206209
@Schema(description = "오늘의 운세 확인 여부")
207210
boolean isFortuneChecked,
208211

@@ -234,7 +237,7 @@ public record MySoptLog(
234237
int soulmatesPokeCount
235238
) {
236239

237-
public static MySoptLog ofInactive(
240+
public static MySoptLog ofInactiveNonAppjam(
238241
boolean isFortuneChecked,
239242
String todayFortuneText,
240243
int totalPokeCount,
@@ -243,6 +246,7 @@ public static MySoptLog ofInactive(
243246
int soulmatesPokeCount
244247
) {
245248
return new MySoptLog(
249+
false,
246250
false,
247251
isFortuneChecked,
248252
todayFortuneText,
@@ -257,7 +261,36 @@ public static MySoptLog ofInactive(
257261
);
258262
}
259263

264+
public static MySoptLog ofInactiveAppjamParticipant(
265+
boolean isFortuneChecked,
266+
String todayFortuneText,
267+
int soptampCount,
268+
int viewCount,
269+
int myClapCount,
270+
int clapCount,
271+
int totalPokeCount,
272+
int newFriendsPokeCount,
273+
int bestFriendsPokeCount,
274+
int soulmatesPokeCount
275+
) {
276+
return new MySoptLog(
277+
false,
278+
true,
279+
isFortuneChecked,
280+
todayFortuneText,
281+
soptampCount,
282+
viewCount,
283+
myClapCount,
284+
clapCount,
285+
totalPokeCount,
286+
newFriendsPokeCount,
287+
bestFriendsPokeCount,
288+
soulmatesPokeCount
289+
);
290+
}
291+
260292
public static MySoptLog ofActive(
293+
boolean isAppjamParticipant,
261294
boolean isFortuneChecked,
262295
String todayFortuneText,
263296
int soptampCount,
@@ -271,6 +304,7 @@ public static MySoptLog ofActive(
271304
) {
272305
return new MySoptLog(
273306
true,
307+
isAppjamParticipant,
274308
isFortuneChecked,
275309
todayFortuneText,
276310
soptampCount,

0 commit comments

Comments
 (0)