Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
d246ea1
[#609] feat: SoptampUserFixture 복원 및 개선
jher235 Sep 22, 2025
dd7d027
[#609] feat: SoptampFixture 주석 해제
jher235 Sep 22, 2025
ea777c6
[#609] feat: SoptampFixture 주석 해제 및 Stamp 생성 메서드 추가
jher235 Sep 22, 2025
3886b9c
[#609] feat: Repository 단 통합 테스트 환경 분리
jher235 Sep 22, 2025
1389e16
[#609] feat: findAllByUserId 테스트 작성
jher235 Sep 22, 2025
164a9ca
[#609] feat: findByUserIdAndMissionId 테스트 작성
jher235 Sep 22, 2025
1e263b9
[#609] feat: UserFixture 중앙인증화로 수정된 유저에 맞게 수정
jher235 Sep 22, 2025
9ea0a73
[#609] feat: deleteAllByUserId 테스트 작성
jher235 Sep 22, 2025
ac21f26
[#609] feat: findByIdAndUserId 테스트 작성
jher235 Sep 22, 2025
a9ca767
[#609] feat: findByNickname 테스트 작성
jher235 Sep 23, 2025
bb3a25e
[#609] feat: findAllByPartAndCurrentGeneration 테스트 작성
jher235 Sep 23, 2025
62c2da8
[#609] feat: findById 테스트 작성
jher235 Sep 23, 2025
27e6884
[#609] feat: findStamp 테스트 작성
jher235 Sep 23, 2025
c1c4717
[#609] feat: uploadStamp 메서드 테스트 작성
jher235 Sep 23, 2025
70a45cb
[#609] feat: editStampContents 메서드 테스트 작성
jher235 Sep 24, 2025
e590a8c
[#609] feat: checkDuplicateStamp 메서드 테스트 작성
jher235 Sep 24, 2025
0363f18
[#609] feat: deleteStampById 메서드 테스트 작성
jher235 Sep 24, 2025
9841d43
[#609] feat: deleteAllStamps 메서드 테스트 작성
jher235 Sep 24, 2025
f3bcab4
[#609] feat: getMissionIdByStampId 메서드 테스트 작성
jher235 Sep 24, 2025
fec8b3b
[#609] feat: deprecated 된 메서드 테스트 삭제
jher235 Sep 24, 2025
63bab17
[#609] feat: getSoptampUserInfo 메서드 테스트 작성
jher235 Sep 24, 2025
f468456
[#609] feat: editProfileMessage 메서드 테스트 작성
jher235 Sep 25, 2025
9f5afdb
[#609] feat: addPointByLevel 메서드 테스트 작성
jher235 Sep 25, 2025
9c48d63
[#609] feat: subtractPointByLevel 메서드 테스트 작성
jher235 Sep 25, 2025
7ddf250
[#609] feat: initPoint 메서드 테스트 작성
jher235 Sep 25, 2025
a04a57b
[#609] feat: upsertSoptampUser 메서드 테스트 작성
jher235 Sep 27, 2025
1256f10
[#609] feat: SoptPart Enum 네이밍 변경 반영
jher235 Sep 29, 2025
17c9a63
[#609] feat: uploadStamp 메서드 테스트 작성
jher235 Oct 3, 2025
c2a5674
[#609] feat: editStamp 메서드 테스트 작성
jher235 Oct 3, 2025
9b9dce8
[#609] feat: deleteStamp 메서드 테스트 작성
jher235 Oct 3, 2025
0e2abb1
[#609] feat: 혼용되고 있던 USER_ID, SOPTAMP_USER_ID 네이밍에 맞게 정리
jher235 Oct 3, 2025
aca1b76
[#609] feat: deleteStampAll 메서드 테스트 작성
jher235 Oct 3, 2025
f05bedb
[#609] feat: editSoptampUserProfileMessage 메서드 테스트 작성
jher235 Oct 3, 2025
e7858a7
[#609] feat: getStampInfo 메서드 테스트 작성
jher235 Oct 3, 2025
7ee548d
[#609] feat: findSoptampUserAndCompletedMissionByNickname 메서드 테스트 작성
jher235 Oct 4, 2025
7d133e6
[#609] chore: 불필요한 주석 및 import 문 삭제
jher235 Oct 4, 2025
7c3c371
[#609] feat: findCurrentRanks 메서드 테스트 작성
jher235 Oct 5, 2025
3d43c31
[#609] feat: findCurrentRanksByPart 메서드 테스트 작성
jher235 Oct 5, 2025
5b85118
[#609] feat: findAllPartRanks 메서드 테스트 작성
jher235 Oct 5, 2025
c9d5cbd
[#609] feat: findPartRank 메서드 테스트 작성
jher235 Oct 6, 2025
484e6ef
[#609] feat: findUserRank 메서드 테스트 작성
jher235 Oct 6, 2025
52e5b28
[#609] feat: 캐시 관련 Fixture 추가
jher235 Oct 6, 2025
7e858dd
[#609] feat: FindCurrentRanks 테스트 의 캐시 히트, 미스 여부에 따른 테스트 분리
jher235 Oct 6, 2025
27d43ad
[#609] feat: FindUserRank 테스트 의 캐시 히트 여부에 따른 테스트 분리
jher235 Oct 7, 2025
bcd096c
[#609] feat: 메서드 명에서 파라미터를 구체적으로 명시하도록 수정
jher235 Oct 7, 2025
ccf5ac1
[#609] feat: findAllMission 메서드 테스트 작성
jher235 Oct 7, 2025
94e6281
[#609] feat: uploadMission 메서드 테스트 작성
jher235 Oct 7, 2025
9c105f0
[#609] feat: getCompleteMission 메서드 테스트 작성
jher235 Oct 7, 2025
2339409
[#609] feat: getIncompleteMission 메서드 테스트 작성
jher235 Oct 8, 2025
1abdb64
[#609] refactor: getMissionById 메서드명 수정 및 예외처리 통일
jher235 Oct 8, 2025
7af650c
[#609] feat: getMissionLevelById 메서드 테스트 작성
jher235 Oct 8, 2025
bb37bfe
[#609] feat: validate 메서드 테스트 작성
jher235 Oct 8, 2025
eb5b46d
[#609] fix: 솝탬프 포인트 랭킹 파트 순서 테스트 수정
jher235 Oct 8, 2025
bc598a7
[#609] refactor: extracting 의 파라미터 부분을 메서드 참조로 변경
jher235 Oct 8, 2025
d77d9f7
[#609] feat: getIncompleteMission 검증 로직 수정
jher235 Oct 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import java.util.function.Predicate;
import lombok.RequiredArgsConstructor;
import lombok.val;
import org.sopt.app.common.exception.NotFoundException;
import org.sopt.app.common.response.ErrorCode;
import org.sopt.app.domain.entity.soptamp.Mission;
import org.sopt.app.domain.entity.soptamp.Stamp;
import org.sopt.app.interfaces.postgres.MissionRepository;
Expand Down Expand Up @@ -82,10 +84,10 @@ public List<Mission> getIncompleteMission(Long userId) {
return missionRepository.findMissionInOrderByLevelAndTitleAndDisplayTrue(inCompleteIdList);
}

public MissionInfo.Level getMissionById(Long missionId) {
public MissionInfo.Level getMissionLevelById(Long missionId) {
Comment on lines -85 to +87
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

꼼꼼한 변수명 수정 좋네요 👍🏻

val mission = missionRepository.findById(missionId).orElseThrow(
() -> new IllegalArgumentException("해당 미션을 찾을 수 없습니다.")
);
() -> new NotFoundException(ErrorCode.MISSION_NOT_FOUND));

return MissionInfo.Level.of(mission.getLevel());
}

Expand Down
12 changes: 12 additions & 0 deletions src/main/java/org/sopt/app/application/stamp/StampInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,17 @@ public static class Stamp {
private String activityDate;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;

public static Stamp from(org.sopt.app.domain.entity.soptamp.Stamp stamp) {
Copy link
Member

@huncozyboy huncozyboy Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

org.sopt.app.domain.entity.soptamp.Stamp처럼 패키지 명을 전부 포함시켜서 Stamp 클래스를 선언해주신 특별한 이유가 있으셨을까요 ??

의도된 설계가 아니라면, FQCN을 직접 사용하는 방식은 통일성이랑 가독성 측면에서 수정해주시는게 좋아보였어요

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이게 아마 Stamp 클래스명이 중복으로 사용돼서 컴파일 시 오류가 발생할거에요... 저희 클래스명이 살짝 중구난방이어서... 지금 보시면 리턴 타입도 Stamp고 파라미터 타입도 Stamp인데 둘의 타입이 달라서요....

return StampInfo.Stamp.builder()
.id(stamp.getId())
.contents(stamp.getContents())
.images(stamp.getImages())
.activityDate(stamp.getActivityDate())
.missionId(stamp.getMissionId())
.createdAt(stamp.getCreatedAt())
.updatedAt(stamp.getUpdatedAt())
.build();
}
}
}
31 changes: 4 additions & 27 deletions src/main/java/org/sopt/app/application/stamp/StampService.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,7 @@ public StampInfo.Stamp findStamp(Long missionId, Long userId) {
val entity = stampRepository.findByUserIdAndMissionId(userId, missionId)
.orElseThrow(() -> new BadRequestException(ErrorCode.STAMP_NOT_FOUND));
entity.validate();
return StampInfo.Stamp.builder()
.id(entity.getId())
.contents(entity.getContents())
.images(entity.getImages())
.activityDate(entity.getActivityDate())
.createdAt(entity.getCreatedAt())
.updatedAt(entity.getUpdatedAt())
.missionId(entity.getMissionId())
.build();
return StampInfo.Stamp.from(entity);
}

@Transactional
Expand All @@ -54,15 +46,8 @@ public StampInfo.Stamp uploadStampDeprecated(
val imgList = new ArrayList<>(imgPaths);
val stamp = this.convertStampImgDeprecated(stampRequest, imgList, userId, missionId);
val newStamp = stampRepository.save(stamp);
return StampInfo.Stamp.builder()
.id(newStamp.getId())
.contents(newStamp.getContents())
.images(newStamp.getImages())
.activityDate(newStamp.getActivityDate())
.createdAt(newStamp.getCreatedAt())
.updatedAt(newStamp.getUpdatedAt())
.missionId(newStamp.getMissionId())
.build();

return StampInfo.Stamp.from(newStamp);
}

@Transactional
Expand All @@ -78,15 +63,7 @@ public StampInfo.Stamp uploadStamp(
.build();

val newStamp = stampRepository.save(stamp);
return StampInfo.Stamp.builder()
.id(newStamp.getId())
.contents(newStamp.getContents())
.images(newStamp.getImages())
.activityDate(newStamp.getActivityDate())
.createdAt(newStamp.getCreatedAt())
.updatedAt(newStamp.getUpdatedAt())
.missionId(newStamp.getMissionId())
.build();
return StampInfo.Stamp.from(newStamp);
}

@Transactional
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/sopt/app/facade/RankFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public PartRank findPartRank(Part part) {

@Transactional(readOnly = true)
public Long findUserRank(Long userId) {
Set<TypedTuple<Long>> sortedScoreCaches = rankCacheService.getRanking();
Set<TypedTuple<Long>> sortedScoreCaches = rankCacheService.getRanking();
if (sortedScoreCaches != null && !sortedScoreCaches.isEmpty()) {
Long rank = 1L;
for(TypedTuple<Long> cache : sortedScoreCaches){
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/sopt/app/facade/SoptampFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.List;

import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
Expand Down Expand Up @@ -39,7 +38,7 @@ public class SoptampFacade {
public Stamp uploadStamp(Long userId, RegisterStampRequest registerStampRequest){
stampService.checkDuplicateStamp(userId, registerStampRequest.getMissionId());
Stamp result = stampService.uploadStamp(registerStampRequest, userId);
Level mission = missionService.getMissionById(registerStampRequest.getMissionId());
Level mission = missionService.getMissionLevelById(registerStampRequest.getMissionId());
soptampUserService.addPointByLevel(userId, mission.getLevel());
return result;
}
Expand All @@ -52,7 +51,7 @@ public Stamp editStamp(Long userId, StampRequest.EditStampRequest request){
@Transactional
public void deleteStamp(Long userId, Long stampId){
val stamp = stampService.getStampForDelete(stampId, userId);
val mission = missionService.getMissionById(stamp.getMissionId());
val mission = missionService.getMissionLevelById(stamp.getMissionId());
soptampUserService.subtractPointByLevel(userId, mission.getLevel());

stampService.deleteStampById(stampId);
Expand Down
Loading