Skip to content

Commit 4a6e59d

Browse files
min0962chw0912rjswjddnchcch529gffd94
authored
release: 코드 병합 (#142)
* feat: workflow에 EC2 자동 배포 추가 (#78) * feat: workflow에 EC2 자동 배포 추가 * chore: appleboy/ssh-action 최신버전으로 변경 * feat: 발표방 캐싱 및 인덱싱 적용 feat 새로운 기능 추가 (#80) * docs: 발표방 생성 요청 dto 스웨거 수정 * feat: Room secretCode Unique 설정 * feat: Room 캐시 적용 * test: Room 캐시 테스트 * test: 비밀코드 중복 문제 해결 * fix: 로그인 500에러 수정 * fix: 로그인 500에러 수정 * feat: 카카오 로그인 API (#86) * fix: cors disable 추가 * feat: 카카오 로그인 API * feat: 시큐리티에 카카오 로그인 url 추가 * docs: swagger 수정 * test: test yml 수정 * refactor: Presigned URL 업로드용, 조회용 로직 분리 (#84) * refactor: 기존 presigned-url 발급 로직을 업로드용, 조회용으로 분리 * docs: 발표자료 Swagger tag 추가 * refactor: profiles 환경 변수 주입으로 변경 (#90) * feat: 카카오 로그인 재시도 로직, 방 참가자 관리 동시성 수정 (#91) * feat: restTemplate 재시도 로직 추가 * feat: 방 참가자 관리 동시성 수정 및 비밀코드 방 참가 수정 * refactor,fix: 2회차 멘토링 기반 리팩토링 (#94) * fix: MemberController 수정 (#96) * fix: existsMemberByEmail에 RequestBody 추가 * fix: existsMemberByEmail 수정 * feat: 로그인 API 반환 수정 * 답변 조회 기능 수정 (#98) * feat: cors 설정 (#102) * Refactor/101 room detail (#104) * feat: cors 설정 * 웹소켓 * 웹소켓 * Refactor/101 room detail (#106) * feat: cors 설정 * 웹소켓 * 웹소켓 * 웹소켓 * Refactor/101 room detail (#108) * feat: cors 설정 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * Refactor/101 room detail (#110) * feat: cors 설정 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * Update WebSocketConfig.java * Refactor/101 room detail (#114) * feat: cors 설정 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * Refactor/101 room detail (#116) * feat: cors 설정 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * Refactor/101 room detail (#118) * feat: cors 설정 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 인터셉터, 핸들러 재추가 * 핸들러 다시 추가 * Refactor/101 room detail (#120) * feat: cors 설정 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 인터셉터, 핸들러 재추가 * 핸들러 다시 추가 * 핸들러 다시 주석 * sockjs만 살리기 * test: 질문 생성 테스트 배포 (#122) * feat: cors 설정 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 웹소켓 * 인터셉터, 핸들러 재추가 * 핸들러 다시 추가 * 핸들러 다시 주석 * sockjs만 살리기 * dev 와 병합 * 질문 생성 변경 * fix: stomp controller 수정 (#125) * fix: Stomp 컨트롤러 수정 * test: 테스트 코드 수정 * fix: 답변 기능 수정 (#128) * fix: 답변 조회 수정 * test: 답변 조회 테스트 수정 * fix: cors 메서드 수정 (#131) * fix: 에러 코드 변경 * fix: cors 허용 메서드 수정 * fix: 시큐리티 수정 (#133) * fix: 에러 코드 변경 * fix: cors 허용 메서드 수정 * fix: 로그인 anonymous 해제 * fix: 시큐리티 컨픽 불필요한 부분 삭제 * fix: 시큐리티 permitAll 추가 (#135) * fix: 에러 코드 변경 * fix: cors 허용 메서드 수정 * fix: 로그인 anonymous 해제 * fix: 시큐리티 컨픽 불필요한 부분 삭제 * fix: 시큐리티 컨픽 permitall 추가 * fix: 답변율 퍼센트 수정 (#138) * fix: 참여한 발표방 조회 시 생성일, 참여일이 나오게 변경 (#141) * fix: 참여한 발표방 조회 시 생성일, 참여일이 나오게 변경 * test: 변경에 따른 테스트 코드 수정 --------- Co-authored-by: Huiwoong Choi <95081400+chw0912@users.noreply.github.com> Co-authored-by: 김건우 <96411818+rjswjddn@users.noreply.github.com> Co-authored-by: 김건우 <rjswjddn@gmail.com> Co-authored-by: chcch529 <146617430+chcch529@users.noreply.github.com> Co-authored-by: SeungTae <122506273+gffd94@users.noreply.github.com>
1 parent ac354df commit 4a6e59d

File tree

2 files changed

+62
-57
lines changed

2 files changed

+62
-57
lines changed

src/main/java/com/oronaminc/join/member/util/MyPageMapper.java

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,44 @@
44
import com.oronaminc.join.member.dto.MyRoomsGetResponse;
55
import com.oronaminc.join.member.dto.ParticipationType;
66
import com.oronaminc.join.participant.domain.Participant;
7+
import com.oronaminc.join.participant.domain.ParticipantType;
78
import com.oronaminc.join.room.domain.Room;
8-
import java.util.Map;
99
import lombok.AccessLevel;
1010
import lombok.NoArgsConstructor;
1111
import org.springframework.data.domain.Page;
1212

13+
import java.time.LocalDate;
14+
import java.util.Map;
15+
1316
@NoArgsConstructor(access = AccessLevel.PRIVATE)
1417
public class MyPageMapper {
1518
public static MyRoomsGetResponse toMyRoomsGetResponse(Page<MyRoomsDto> response) {
1619
return MyRoomsGetResponse.builder()
17-
.content(response.getContent())
18-
.currentPage(response.getNumber())
19-
.size(response.getSize())
20-
.totalElements(response.getTotalElements())
21-
.totalPages(response.getTotalPages())
22-
.build();
20+
.content(response.getContent())
21+
.currentPage(response.getNumber())
22+
.size(response.getSize())
23+
.totalElements(response.getTotalElements())
24+
.totalPages(response.getTotalPages())
25+
.build();
2326
}
2427

2528
public static MyRoomsDto toMyRoomsDto(Participant p, Map<Long, Long> countMap) {
2629
Room room = p.getRoom();
30+
LocalDate date;
31+
if (p.getParticipantType() == ParticipantType.PRESENTER) {
32+
date = room.getCreatedAt().toLocalDate();
33+
} else {
34+
date = p.getCreatedAt().toLocalDate();
35+
}
2736
return MyRoomsDto.builder()
28-
.roomId(room.getId())
29-
.title(room.getTitle())
30-
.emojiCount(room.getEmojiCount())
31-
.status(room.getRoomStatus())
32-
.startedAt(room.getCreatedAt().toLocalDate())
33-
.participationType(ParticipationType.from(p.getParticipantType()))
34-
.questions(countMap.getOrDefault(room.getId(), 0L))
35-
.build();
37+
.roomId(room.getId())
38+
.title(room.getTitle())
39+
.emojiCount(room.getEmojiCount())
40+
.status(room.getRoomStatus())
41+
.startedAt(date)
42+
.participationType(ParticipationType.from(p.getParticipantType()))
43+
.questions(countMap.getOrDefault(room.getId(), 0L))
44+
.build();
3645
}
3746
}
3847

src/test/java/com/oronaminc/join/member/service/MyPageServiceTests.java

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package com.oronaminc.join.member.service;
22

3-
import static org.assertj.core.api.Assertions.*;
4-
import static org.mockito.Mockito.*;
5-
6-
import java.time.LocalDateTime;
7-
import java.util.List;
8-
3+
import com.oronaminc.join.member.domain.Member;
4+
import com.oronaminc.join.member.dto.*;
5+
import com.oronaminc.join.participant.domain.Participant;
6+
import com.oronaminc.join.participant.domain.ParticipantType;
7+
import com.oronaminc.join.participant.service.ParticipantReader;
8+
import com.oronaminc.join.question.service.QuestionReader;
9+
import com.oronaminc.join.room.domain.Room;
910
import org.junit.jupiter.api.DisplayName;
1011
import org.junit.jupiter.api.Test;
1112
import org.junit.jupiter.api.extension.ExtendWith;
@@ -18,18 +19,11 @@
1819
import org.springframework.data.domain.Pageable;
1920
import org.springframework.test.util.ReflectionTestUtils;
2021

21-
import com.oronaminc.join.member.domain.Member;
22-
import com.oronaminc.join.member.dto.MyPageType;
23-
import com.oronaminc.join.member.dto.MyProfileGetResponse;
24-
import com.oronaminc.join.member.dto.MyProfileUpdateRequest;
25-
import com.oronaminc.join.member.dto.MyRoomsGetResponse;
26-
import com.oronaminc.join.member.dto.ParticipantCountDto;
27-
import com.oronaminc.join.member.dto.ParticipationType;
28-
import com.oronaminc.join.participant.domain.Participant;
29-
import com.oronaminc.join.participant.domain.ParticipantType;
30-
import com.oronaminc.join.participant.service.ParticipantReader;
31-
import com.oronaminc.join.question.service.QuestionReader;
32-
import com.oronaminc.join.room.domain.Room;
22+
import java.time.LocalDateTime;
23+
import java.util.List;
24+
25+
import static org.assertj.core.api.Assertions.assertThat;
26+
import static org.mockito.Mockito.when;
3327

3428
@ExtendWith(MockitoExtension.class)
3529
class MyPageServiceTests {
@@ -54,14 +48,14 @@ void getMyProfile_success_test() {
5448
Member member = Member.builder().build();
5549

5650
List<ParticipantCountDto> pc = List.of(
57-
new ParticipantCountDto(ParticipantType.PRESENTER, 1L),
58-
new ParticipantCountDto(ParticipantType.TEAM, 1L),
59-
new ParticipantCountDto(ParticipantType.GUEST, 1L)
51+
new ParticipantCountDto(ParticipantType.PRESENTER, 1L),
52+
new ParticipantCountDto(ParticipantType.TEAM, 1L),
53+
new ParticipantCountDto(ParticipantType.GUEST, 1L)
6054
);
6155

6256
when(memberReader.getById(member.getId())).thenReturn(member);
6357
when(participantReader.countByMemberIdGroupByParticipantType(member.getId()))
64-
.thenReturn(pc);
58+
.thenReturn(pc);
6559

6660
// when
6761
MyProfileGetResponse myProfile = myPageService.getMyProfile(member.getId());
@@ -84,7 +78,7 @@ void getMyProfile_success_test2() {
8478

8579
when(memberReader.getById(member.getId())).thenReturn(member);
8680
when(participantReader.countByMemberIdGroupByParticipantType(member.getId()))
87-
.thenReturn(pc);
81+
.thenReturn(pc);
8882

8983
// when
9084
MyProfileGetResponse myProfile = myPageService.getMyProfile(member.getId());
@@ -127,8 +121,8 @@ void getMyRooms_success_test() {
127121
Pageable pageable = PageRequest.of(0, 10);
128122

129123
Room room1 = Room.builder()
130-
.title("~1~의 정석")
131-
.build();
124+
.title("~1~의 정석")
125+
.build();
132126
Room room2 = Room.builder().title("~2~의 정석").build();
133127
Room room3 = Room.builder().title("~3~의 정석").build();
134128
ReflectionTestUtils.setField(room1, "id", 100L);
@@ -139,33 +133,35 @@ void getMyRooms_success_test() {
139133
ReflectionTestUtils.setField(room3, "createdAt", LocalDateTime.now());
140134

141135
Participant participant1 = Participant.builder()
142-
.room(room1)
143-
.member(member)
144-
.participantType(ParticipantType.PRESENTER)
145-
.build();
136+
.room(room1)
137+
.member(member)
138+
.participantType(ParticipantType.PRESENTER)
139+
.build();
146140
Participant participant2 = Participant.builder()
147-
.room(room2)
148-
.member(member)
149-
.participantType(ParticipantType.TEAM)
150-
.build();
141+
.room(room2)
142+
.member(member)
143+
.participantType(ParticipantType.TEAM)
144+
.build();
151145
Participant participant3 = Participant.builder()
152-
.room(room3)
153-
.member(member)
154-
.participantType(ParticipantType.GUEST)
155-
.build();
146+
.room(room3)
147+
.member(member)
148+
.participantType(ParticipantType.GUEST)
149+
.build();
150+
ReflectionTestUtils.setField(participant2, "createdAt", LocalDateTime.now());
151+
ReflectionTestUtils.setField(participant3, "createdAt", LocalDateTime.now());
156152

157153
List<Participant> pc = List.of(participant1, participant2, participant3);
158154
Page<Participant> participantPage = new PageImpl<>(pc, pageable, 1);
159155

160156
List<Long> roomIds = List.of(room1.getId(), room2.getId(), room3.getId());
161157
List<Object[]> questions = List.of(
162-
new Object[]{room1.getId(), 1L},
163-
new Object[]{room2.getId(), 2L},
164-
new Object[]{room3.getId(), 3L}
158+
new Object[]{room1.getId(), 1L},
159+
new Object[]{room2.getId(), 2L},
160+
new Object[]{room3.getId(), 3L}
165161
);
166162

167163
when(participantReader.findByMemberId(memberId, pageable))
168-
.thenReturn(participantPage);
164+
.thenReturn(participantPage);
169165
when(questionReader.countByRoomIds(roomIds)).thenReturn(questions);
170166

171167
// when
@@ -176,7 +172,7 @@ void getMyRooms_success_test() {
176172
assertThat(result.content().getFirst().roomId()).isEqualTo(100L);
177173
assertThat(result.content().getFirst().title()).isEqualTo("~1~의 정석");
178174
assertThat(result.content().getFirst().participationType()).isEqualTo(
179-
ParticipationType.CREATED);
175+
ParticipationType.CREATED);
180176
assertThat(result.content().get(1).participationType()).isEqualTo(ParticipationType.JOINED);
181177

182178
}

0 commit comments

Comments
 (0)