Skip to content

Commit

Permalink
�[feat #146] 채팅 상세조회 응답 dto 필드명 수정 (#147)
Browse files Browse the repository at this point in the history
* [feat] : 채팅방 상세 조회 필드명 수정

* [test] : 채팅방 상세 조회 필드명 테스트 반영

* [feat] : 채팅 요청의 응답 필드명 수정

* [test] : 채팅 요청의 응답 필드명 수정 테스트 반영

* [fix] : 잘못 변경된 필드명 원복

* [feat] : 채팅요청 응답 필드 수정

* [test] : 채팅요청 응답 필드 수정 반영
  • Loading branch information
hyun2371 authored Nov 16, 2024
1 parent c95de3c commit 2727bc4
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class ChatInquiry extends TimeBaseEntity {
@Column(name = "status", nullable = false)
private InquiryStatus status;

@Column(name = "inquiryMessage", nullable = false)
@Column(name = "message", nullable = false)
private String message;

private ChatInquiry(QuestionPost questionPost, Member inquirer, Member answerer, String message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

public record ChatInquiryResponse(
Long chatInquiryId,
String message,
String inquiryMessage,
String inquiryStatus,
boolean isInquirer,
MemberInfo partnerInfo
MemberInfo chatPartner
) {
@QueryProjection
public ChatInquiryResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public record CreateChatInquiryResponse(
Long chatInquiryId,
String inquiryMessage,
String inquiryStatus,
MemberInfo partnerInfo
MemberInfo chatPartner
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ResponseEntity<PageResponse<ChatMessageResponse>> getChatMessages(
return ResponseEntity.ok(response);
}

@Operation(summary = "채팅방 활성화 목록 조회 API", description = "회원의 채팅방 목록을 조회한다.")
@Operation(summary = "채팅방 목록 조회 API", description = "회원의 채팅방 목록을 조회한다.")
@GetMapping("/api/chat-rooms")
public ResponseEntity<PageResponse<ChatRoomSimpleResponse>> getChatRoomsByMember(
@AuthenticationPrincipal Member member,
Expand All @@ -47,7 +47,7 @@ public ResponseEntity<PageResponse<ChatRoomSimpleResponse>> getChatRoomsByMember
return ResponseEntity.ok(response);
}

@Operation(summary = "채팅방 조회 API", description = "채팅방 아이디로 채팅방을 조회한다.")
@Operation(summary = "채팅방 상세조회 API", description = "채팅방 아이디로 채팅방을 조회한다.")
@GetMapping("/api/chat-rooms/{chatRoomId}")
public ResponseEntity<ChatRoomDetailResponse> createChatRoom(
@PathVariable("chatRoomId") Long chatRoomId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public record ChatRoomDetailResponse(
Long questionPostId,
String targetJobGroup,
String title,
MemberInfo receiverInfo,
MemberInfo chatPartner,
boolean isInquirer
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ void getChatRoomById() throws Exception {
.andExpect(jsonPath("$.questionPostId").value(questionPost.getId()))
.andExpect(jsonPath("$.targetJobGroup").value(questionPost.getJobGroup().getLabel()))
.andExpect(jsonPath("$.title").value(questionPost.getTitle()))
.andExpect(jsonPath("$.receiverInfo.memberId").value(inquirer.getId()))
.andExpect(jsonPath("$.receiverInfo.nickname").value(inquirer.getNickname()))
.andExpect(jsonPath("$.receiverInfo.memberJobGroup").value(inquirer.getJobGroup().getLabel()))
.andExpect(jsonPath("$.receiverInfo.profileImageNo").value(inquirer.getProfileImageNo()))
.andExpect(jsonPath("$.chatPartner.memberId").value(inquirer.getId()))
.andExpect(jsonPath("$.chatPartner.nickname").value(inquirer.getNickname()))
.andExpect(jsonPath("$.chatPartner.memberJobGroup").value(inquirer.getJobGroup().getLabel()))
.andExpect(jsonPath("$.chatPartner.profileImageNo").value(inquirer.getProfileImageNo()))
.andExpect(jsonPath("$.isInquirer").value(false));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void getChatRoomById_Inquirer() {
assertAll(
() -> assertThat(response.questionPostId())
.isEqualTo(questionPost.getId()),
() -> assertThat(response.receiverInfo().memberId())
() -> assertThat(response.chatPartner().memberId())
.isEqualTo(answerer.getId())
);
}
Expand All @@ -154,7 +154,7 @@ void getChatRoomById_Answerer() {
assertAll(
() -> assertThat(response.questionPostId())
.isEqualTo(questionPost.getId()),
() -> assertThat(response.receiverInfo().memberId())
() -> assertThat(response.chatPartner().memberId())
.isEqualTo(inquirer.getId())
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ void getChatInquiresByMember() throws Exception {
.andExpect(status().isOk())
.andExpect(jsonPath("$.size").value(2))
.andExpect(jsonPath("$.content[0].chatInquiryId").value(chatInquiry2.getId())) // 내림차순
.andExpect(jsonPath("$.content[0].partnerInfo.memberId").value(member2.getId()))
.andExpect(jsonPath("$.content[0].chatPartner.memberId").value(member2.getId()))
.andExpect(jsonPath("$.content[0].isInquirer").value(true))
.andExpect(jsonPath("$.content[0].inquiryStatus").value(InquiryStatus.PENDING.getLabel()))

.andExpect(jsonPath("$.content[1].chatInquiryId").value(chatInquiry1.getId()))
.andExpect(jsonPath("$.content[1].partnerInfo.memberId").value(member1.getId()))
.andExpect(jsonPath("$.content[1].chatPartner.memberId").value(member1.getId()))
.andExpect(jsonPath("$.content[1].isInquirer").value(false))
.andExpect(jsonPath("$.content[1].inquiryStatus").value(InquiryStatus.PENDING.getLabel()))
.andDo(MockMvcResultHandlers.print());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ void getChatInquiresByMember() {
Assertions.assertAll(
() -> assertThat(responses).hasSize(2),
() -> assertThat(responses.get(0).chatInquiryId()).isEqualTo(chatInquiries.get(1).getId()),
() -> assertThat(responses.get(0).partnerInfo().memberId()).isEqualTo(questioner.getId()),
() -> assertThat(responses.get(0).chatPartner().memberId()).isEqualTo(questioner.getId()),
() -> assertThat(responses.get(1).chatInquiryId()).isEqualTo(chatInquiries.get(0).getId()),
() -> assertThat(responses.get(1).partnerInfo().memberId()).isEqualTo(answerer.getId())
() -> assertThat(responses.get(1).chatPartner().memberId()).isEqualTo(answerer.getId())
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void createInquiry() {
assertAll(
() -> assertThat(response.chatInquiryId())
.isEqualTo(chatInquiryId),
() -> assertThat(response.partnerInfo().memberId())
() -> assertThat(response.chatPartner().memberId())
.isEqualTo(answerer.getId()),
() -> assertThat(response.inquiryMessage())
.isEqualTo(INQUIRY_MESSAGE)
Expand Down Expand Up @@ -153,9 +153,9 @@ void getChatInquiresByMember() {
() -> assertThat(response).hasSize(1),
() -> assertThat(response.get(0).chatInquiryId())
.isEqualTo(chatInquiryId),
() -> assertThat(response.get(0).partnerInfo().memberId())
() -> assertThat(response.get(0).chatPartner().memberId())
.isEqualTo(partner.getId()),
() -> assertThat(response.get(0).message())
() -> assertThat(response.get(0).inquiryMessage())
.isEqualTo(INQUIRY_MESSAGE)
);
}
Expand Down

0 comments on commit 2727bc4

Please sign in to comment.