Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a3c9a37
#250 [Fix] 투표 비율 계산 기준을 preVoteOption에서 postVoteOption으로 수정 (#252)
HYH0804 May 27, 2026
a38c141
#254 [Refactor] 관점 등록/수정 시 GPT 검수 코드 제거 (#256)
HYH0804 Jun 3, 2026
cee2c5d
#255 [Refactor] VoteStatsResponse OptionStat에 title 필드 추가 (#257)
HYH0804 Jun 3, 2026
53533b8
#258 [Feat] 출석체크 API 추가
si-zero Jun 3, 2026
77db7a1
#260 [Feat] 스웨거 어드민/유저 분리
si-zero Jun 4, 2026
a9d4293
[Feat] 알림기능 (#263)
HYH0804 Jun 11, 2026
b5a681b
#262 [Fix] APNs 자격증명 S3 다운로드 시 임시파일 충돌 오류 수정
HYH0804 Jun 11, 2026
d281fa3
#264 [Fix] AdMob SSV 포인트 미적립 버그 수정
si-zero Jun 11, 2026
968d6a3
#262 merge (#266)
HYH0804 Jun 14, 2026
d041631
[Chore] adMob 크롤링 파일 설정: adMob 크롤링 파일 설정 #269
si-zero Jun 16, 2026
ec25882
#270 [Feat] 설정 파일 추가
si-zero Jun 16, 2026
4c45999
[Chore] JWT필터 설정 #271
si-zero Jun 16, 2026
e0c9c1c
#275 [Fix] AdMob SSV 콜백 파라미터 optional 처리 및 서명 검증 활성화
si-zero Jun 18, 2026
ab2cb78
#277 [Fix] AdMob SSV 콜백 URL 검증 요청 처리 실패
si-zero Jun 18, 2026
04d947c
#279 [Fix] AdMob SSV 엔드포인트 검증 실패 시 항상 200 반환
si-zero Jun 18, 2026
d9ea3b5
#283 [Fix] /me/content-activities voteSide null 반환 버그
si-zero Jun 19, 2026
ec27b01
#285 [Feat] content-activities 응답에 option_title 필드 추가
si-zero Jun 20, 2026
6663e7a
#287 [Fix] AdMob SSV 서명 검증 오류로 인한 포인트 미지급 버그
si-zero Jun 24, 2026
39aca84
#289 [Fix] 오늘의 배틀 개수 변경
si-zero Jul 5, 2026
11e2da1
#293 [Fix] 사전투표 철학자 아이콘 미노출
si-zero Jul 5, 2026
aa449f0
#297 [Fix] 댓글 작성 시각이 9시간 전으로 표시되는 버그
si-zero Jul 6, 2026
3259a1a
#301 [Fix] robots.txt 파일 부재로 AdMob app-ads.txt 크롤링 차단
si-zero Jul 6, 2026
e91819b
#305 [Fix] S3 오디오 조각 재다운로드 시 FileAlreadyExistsException으로 TTS 파이프라인 실패
si-zero Jul 6, 2026
d64d5ca
#309 [Fix] JwtFilter 자체 화이트리스트에 /robots.txt 누락으로 401 발생
si-zero Jul 6, 2026
ff16d85
#316 [Fix] 포인트 정책표 대비 코드 불일치 4건 수정
si-zero Jul 7, 2026
f50c749
Merge branch 'main' into dev
si-zero Jul 7, 2026
d9e28a1
#321 [Feat] 알림 미읽음 여부 확인 API 추가
si-zero Jul 7, 2026
4279341
#313 [Hotfix] Railway 배포 환경 FFmpeg 자동 설치 적용 (#320)
jucheonsu Jul 7, 2026
f77048c
#327 [Fix] 알림 전체 읽음 처리 후 모두 읽음 신호가 전달되지 않던 문제 수정
si-zero Jul 13, 2026
99886f9
#331 [Docs] 출석체크 API 명세서를 실제 코드에 맞춰 갱신
si-zero Jul 13, 2026
087b8c0
#333 [Fix] app-ads.txt가 text/html로 응답되어 AdMob 크롤러가 무시하는 문제 수정
si-zero Jul 13, 2026
d33ff1f
#337 [Feat] 인앱 알림 테스트용 API 추가
si-zero Jul 14, 2026
17f35a4
#341 [Fix] 미문서화/중복 포인트 지급 로직 정리
si-zero Jul 15, 2026
acbe078
관리자 페이지를 새 admin-web(Next.js) 앱으로 리다이렉트 (#346)
Roy-wonji Jul 15, 2026
de75bdf
#349 [Feat] admin.web.url env 주입 + 기본값 picke.up.railway.app (#350)
Roy-wonji Jul 15, 2026
9493351
#352 [Fix] JwtFilter 화이트리스트 /api/v1/auth 전체 매칭으로 logout 인증 우회, 500 에러 발생
si-zero Jul 16, 2026
00bfcb3
#356 [Feat] 이용약관/개인정보처리방침 페이지 백엔드 서빙
si-zero Jul 20, 2026
99c936d
#361 [Feat] 관리자용 테스트 계정 로컬 로그인 기능 추가
si-zero Jul 24, 2026
f0a837d
#360 [Refactor] 1인 1관점 제한을 해제하고 1인 다수 관점 등록 허용
si-zero Jul 24, 2026
9fb601f
#366 [Feat] 내 콘텐츠 활동 내역(댓글 탭)에 내가 작성한 관점 포함
si-zero Jul 24, 2026
a60ccee
Merge branch 'main' into merge/#368
si-zero Jul 24, 2026
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 @@ -12,6 +12,10 @@ public interface PerspectiveRepository extends JpaRepository<Perspective, Long>

List<Perspective> findByBattleIdAndUserIdOrderByCreatedAtDesc(Long battleId, Long userId);

List<Perspective> findByUserIdOrderByCreatedAtDesc(Long userId, Pageable pageable);

long countByUserId(Long userId);

List<Perspective> findByBattleIdAndStatusOrderByCreatedAtDesc(Long battleId, PerspectiveStatus status, Pageable pageable);

List<Perspective> findByBattleIdAndStatusAndCreatedAtBeforeOrderByCreatedAtDesc(Long battleId, PerspectiveStatus status, LocalDateTime cursor, Pageable pageable);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.swyp.picke.domain.perspective.service;

import com.swyp.picke.domain.perspective.entity.Perspective;
import com.swyp.picke.domain.perspective.entity.PerspectiveComment;
import com.swyp.picke.domain.perspective.entity.PerspectiveLike;
import com.swyp.picke.domain.perspective.repository.PerspectiveCommentRepository;
import com.swyp.picke.domain.perspective.repository.PerspectiveLikeRepository;
import com.swyp.picke.domain.perspective.repository.PerspectiveRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
Expand All @@ -18,16 +20,26 @@ public class PerspectiveQueryService {

private final PerspectiveCommentRepository perspectiveCommentRepository;
private final PerspectiveLikeRepository perspectiveLikeRepository;
private final PerspectiveRepository perspectiveRepository;

public List<PerspectiveComment> findUserComments(Long userId, int offset, int size) {
PageRequest pageable = PageRequest.of(offset / size, size);
public List<PerspectiveComment> findUserComments(Long userId, int limit) {
PageRequest pageable = PageRequest.of(0, limit);
return perspectiveCommentRepository.findByUserIdOrderByCreatedAtDesc(userId, pageable);
}

public long countUserComments(Long userId) {
return perspectiveCommentRepository.countByUserId(userId);
}

public List<Perspective> findUserPerspectives(Long userId, int limit) {
PageRequest pageable = PageRequest.of(0, limit);
return perspectiveRepository.findByUserIdOrderByCreatedAtDesc(userId, pageable);
}

public long countUserPerspectives(Long userId) {
return perspectiveRepository.countByUserId(userId);
}

public List<PerspectiveLike> findUserLikes(Long userId, int offset, int size) {
PageRequest pageable = PageRequest.of(offset / size, size);
return perspectiveLikeRepository.findByUserIdOrderByCreatedAtDesc(userId, pageable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

public enum ActivityType {
COMMENT,
LIKE
LIKE,
PERSPECTIVE
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Stream;
import java.util.Map;

@Service
Expand Down Expand Up @@ -190,25 +192,40 @@ public ContentActivityListResponse getContentActivities(Integer offset, Integer
}

private ContentActivityListResponse buildCommentActivities(User user, int pageOffset, int pageSize) {
List<PerspectiveComment> comments = perspectiveQueryService.findUserComments(user.getId(), pageOffset, pageSize);
long totalCount = perspectiveQueryService.countUserComments(user.getId());
int limit = pageOffset + pageSize;

List<PerspectiveComment> comments = perspectiveQueryService.findUserComments(user.getId(), limit);
List<Perspective> myPerspectives = perspectiveQueryService.findUserPerspectives(user.getId(), limit);

UserProfile profile = userService.findUserProfile(user.getId());
String myCharacterImageUrl = resolveCharacterImageUrl(profile.getCharacterType());

List<Perspective> perspectives = comments.stream().map(PerspectiveComment::getPerspective).toList();
Map<Long, Battle> battleMap = loadBattles(perspectives);
Map<Long, BattleOption> optionMap = loadOptions(perspectives);
List<Perspective> lookupTargets = new ArrayList<>(comments.stream().map(PerspectiveComment::getPerspective).toList());
lookupTargets.addAll(myPerspectives);
Map<Long, Battle> battleMap = loadBattles(lookupTargets);
Map<Long, BattleOption> optionMap = loadOptions(lookupTargets);

List<ContentActivityListResponse.ContentActivityItem> items = comments.stream()
Stream<ContentActivityListResponse.ContentActivityItem> commentItems = comments.stream()
.map(comment -> {
Perspective p = comment.getPerspective();
return toActivityItem(comment.getId().toString(), ActivityType.COMMENT, p,
battleMap.get(p.getBattle().getId()), optionMap.get(p.getOption().getId()),
comment.getContent(), comment.getCreatedAt(), myCharacterImageUrl);
})
});

Stream<ContentActivityListResponse.ContentActivityItem> perspectiveItems = myPerspectives.stream()
.map(p -> toActivityItem(p.getId().toString(), ActivityType.PERSPECTIVE, p,
battleMap.get(p.getBattle().getId()), optionMap.get(p.getOption().getId()),
p.getContent(), p.getCreatedAt(), myCharacterImageUrl));

List<ContentActivityListResponse.ContentActivityItem> items = Stream.concat(commentItems, perspectiveItems)
.sorted(Comparator.comparing(ContentActivityListResponse.ContentActivityItem::createdAt).reversed())
.skip(pageOffset)
.limit(pageSize)
.toList();

long totalCount = perspectiveQueryService.countUserComments(user.getId())
+ perspectiveQueryService.countUserPerspectives(user.getId());
int nextOffset = pageOffset + pageSize;
boolean hasNext = nextOffset < totalCount;
return new ContentActivityListResponse(items, hasNext ? nextOffset : null, hasNext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,10 @@ void getContentActivities_returns_comments() {

when(userService.findCurrentUser()).thenReturn(user);
when(userService.findUserProfile(1L)).thenReturn(profile);
when(perspectiveQueryService.findUserComments(1L, 0, 20)).thenReturn(List.of(comment));
when(perspectiveQueryService.findUserComments(1L, 20)).thenReturn(List.of(comment));
when(perspectiveQueryService.findUserPerspectives(1L, 20)).thenReturn(List.of());
when(perspectiveQueryService.countUserComments(1L)).thenReturn(1L);
when(perspectiveQueryService.countUserPerspectives(1L)).thenReturn(0L);
when(battleQueryService.findBattlesByIds(List.of(battleId))).thenReturn(Map.of(battleId, battle));
when(battleQueryService.findOptionsByIds(List.of(optionId))).thenReturn(Map.of(optionId, option));
when(userService.findSummaryById(1L)).thenReturn(new UserSummary("tag", "nick", "OWL"));
Expand All @@ -261,6 +263,60 @@ void getContentActivities_returns_comments() {
assertThat(response.items().get(0).content()).isEqualTo("댓글");
}

@Test
@DisplayName("COMMENT 타입으로 조회하면 내가 작성한 관점과 댓글이 최신순으로 병합되어 반환된다")
void getContentActivities_merges_perspectives_and_comments_by_created_at() {
User user = createUser(1L, "tag");
UserProfile profile = createProfile(user, "nick", CharacterType.OWL);
Battle battle = createBattle("배틀");
Long battleId = battle.getId();
BattleOption option = createOption(battle, BattleOptionLabel.A);
Long optionId = option.getId();

Perspective myPerspective = Perspective.builder()
.battle(battle)
.user(user)
.option(option)
.content("내가 쓴 관점")
.build();
ReflectionTestUtils.setField(myPerspective, "id", generateId());
ReflectionTestUtils.setField(myPerspective, "createdAt", LocalDateTime.now());

Perspective othersPerspective = Perspective.builder()
.battle(battle)
.user(user)
.option(option)
.content("다른 사람 관점")
.build();
ReflectionTestUtils.setField(othersPerspective, "id", generateId());

PerspectiveComment comment = PerspectiveComment.builder()
.perspective(othersPerspective)
.user(user)
.content("내가 남긴 댓글")
.build();
ReflectionTestUtils.setField(comment, "id", generateId());
ReflectionTestUtils.setField(comment, "createdAt", LocalDateTime.now().minusMinutes(1));

when(userService.findCurrentUser()).thenReturn(user);
when(userService.findUserProfile(1L)).thenReturn(profile);
when(perspectiveQueryService.findUserComments(1L, 20)).thenReturn(List.of(comment));
when(perspectiveQueryService.findUserPerspectives(1L, 20)).thenReturn(List.of(myPerspective));
when(perspectiveQueryService.countUserComments(1L)).thenReturn(1L);
when(perspectiveQueryService.countUserPerspectives(1L)).thenReturn(1L);
when(battleQueryService.findBattlesByIds(List.of(battleId))).thenReturn(Map.of(battleId, battle));
when(battleQueryService.findOptionsByIds(List.of(optionId))).thenReturn(Map.of(optionId, option));
when(userService.findSummaryById(1L)).thenReturn(new UserSummary("tag", "nick", "OWL"));

ContentActivityListResponse response = mypageService.getContentActivities(null, null, ActivityType.COMMENT);

assertThat(response.items()).hasSize(2);
assertThat(response.items().get(0).activityType()).isEqualTo(ActivityType.PERSPECTIVE);
assertThat(response.items().get(0).content()).isEqualTo("내가 쓴 관점");
assertThat(response.items().get(1).activityType()).isEqualTo(ActivityType.COMMENT);
assertThat(response.items().get(1).content()).isEqualTo("내가 남긴 댓글");
}

@Test
@DisplayName("LIKE 타입으로 좋아요활동을 반환한다")
void getContentActivities_returns_likes() {
Expand Down
Loading