forked from codesquad-members-2023/second-hand-max
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #106 fix: ChatRoom 생성자 매개변수 변경 * #106 fix: null 처리 * #106 fix: validateIsSeller 개선 * #106 fix: 상품을 찾지 못한 경우 에러 코드를 NOT_FOUND로 설정 * #106 fix: 주석 제거 * #106 fix: 중복된 메소드 제거 * #106 fix: deleteAllInBatch 제거 * #106 fix: 매직넘버 제거 * #106 fix: 정적 임포트 제거 * #106 fix: 레디스 서비스에서 Oauth 도메인 부분을 따로 빼서 OauthRedisService로 분리 * #106 fix: 레디스 서비스 도메인별 분리 * #106 fix: 회원 동네 선택시 쿼리 개선 * #106 fix: 디미터의 법칙 개선 * [feat] 채팅 목록 조회 API 구현 (#113) * [fix] 상품 목록 조회시 tradingRegion, status 응답형식 변경 (#108) * #107 fix: regions.csv 수정 * #107 fix: 응답형식 문제 해결 * #111 fix: 썸네일 저장 로직 추가 (#112) * #96 feat: 한 채팅방안에 채팅 메시지 조회 API 구현 * #96 feat: messageIndex를 이용한 채팅 로그 목록 조회 * #96 feat: toString 정의 * #96 test: readMessages 테스트 코드 추가 * #96 feat: 채팅 메시지 목록 요청시 대기시간 10초로 증가 및 조건문 추가 - 조건문 내용은 messageIndex가 채팅 리스트의 개수보다 큰 경우 빈 컬렉션을 반환하도록 합니다. * #96 fix: 응답형식 변경 * #96 fix: 응답형식 변경 * #114 fix: buyer추가
- Loading branch information
1 parent
4c4feb0
commit 50e71fb
Showing
43 changed files
with
661 additions
and
260 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
backend/src/main/java/codesquard/app/annotation/MessageIndex.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package codesquard.app.annotation; | ||
|
||
import static java.lang.annotation.ElementType.*; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import javax.validation.Constraint; | ||
|
||
import codesquard.app.config.validation.MessageIndexValidator; | ||
|
||
@Target(value = {PARAMETER, FIELD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Constraint(validatedBy = MessageIndexValidator.class) | ||
public @interface MessageIndex { | ||
|
||
String message() default "messageIndex는 0 이상이어야 합니다."; | ||
|
||
Class[] groups() default {}; | ||
|
||
Class[] payload() default {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
backend/src/main/java/codesquard/app/api/chat/response/ChatLogItemResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package codesquard.app.api.chat.response; | ||
|
||
import codesquard.app.domain.item.Item; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class ChatLogItemResponse { | ||
private String title; | ||
private String thumbnailUrl; | ||
private Long price; | ||
|
||
public static ChatLogItemResponse from(Item item) { | ||
return new ChatLogItemResponse(item.getTitle(), item.getThumbnailUrl(), item.getPrice()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("%s, %s(title=%s, price=%d)", "채팅 메시지 아이템 응답", this.getClass().getSimpleName(), title, | ||
price); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
backend/src/main/java/codesquard/app/api/chat/response/ChatLogListResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package codesquard.app.api.chat.response; | ||
|
||
import java.util.List; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@AllArgsConstructor | ||
public class ChatLogListResponse { | ||
private String chatPartnerName; | ||
private ChatLogItemResponse item; | ||
private List<ChatLogMessageResponse> chat; | ||
|
||
@JsonIgnore | ||
public boolean isEmptyChat() { | ||
return chat.isEmpty(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("%s, %s(chatPartnerName=%s, item=%s, chat=%s)", "채팅 메시지 목록 응답", | ||
this.getClass().getSimpleName(), chatPartnerName, item, chat); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
backend/src/main/java/codesquard/app/api/chat/response/ChatLogMessageResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package codesquard.app.api.chat.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import codesquard.app.domain.chat.ChatLog; | ||
import codesquard.app.domain.oauth.support.Principal; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class ChatLogMessageResponse { | ||
private int messageIndex; | ||
private boolean isMe; | ||
private String message; | ||
|
||
public static ChatLogMessageResponse from(int messageIndex, ChatLog chatLog, Principal principal) { | ||
boolean isMe = chatLog.isSender(principal.getLoginId()); | ||
return new ChatLogMessageResponse(messageIndex, isMe, chatLog.getMessage()); | ||
} | ||
|
||
@JsonProperty("isMe") | ||
public boolean isMe() { | ||
return isMe; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("%s, %s(messageIndex=%d, isMe=%s, message=%s)", "채팅 메시지 응답", | ||
this.getClass().getSimpleName(), messageIndex, isMe, message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.