-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from catchroom/develop
์ฑํ ๋ฐฉ ๋๊ฐ๊ธฐ, ๋ฑ์ฅํ๊ธฐ ๊ธฐ๋ฅ ๋ฐฐํฌ
- Loading branch information
Showing
13 changed files
with
45 additions
and
132 deletions.
There are no files selected for viewing
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
23 changes: 0 additions & 23 deletions
23
src/main/java/com/catchroom/chat/chatroom/dto/ChatRoomCreateRequest.java
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
src/main/java/com/catchroom/chat/chatroom/dto/ChatRoomCreateResponse.java
This file was deleted.
Oops, something went wrong.
17 changes: 6 additions & 11 deletions
17
src/main/java/com/catchroom/chat/chatroom/dto/ChatRoomListGetResponse.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 |
---|---|---|
@@ -1,25 +1,20 @@ | ||
package com.catchroom.chat.chatroom.dto; | ||
|
||
import com.catchroom.chat.chatroom.entity.ChatRoom; | ||
import com.catchroom.chat.message.type.UserIdentity; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class ChatRoomListGetResponse { | ||
private List<ChatRoom> ChatRoomListUserIsBuyer; | ||
private List<ChatRoom> ChatRoomListUserIsSeller; | ||
private String chatRoomNumber; | ||
private Long buyerId; | ||
private Long sellerId; | ||
private Long productId; | ||
private UserIdentity loginUserIdentity; | ||
|
||
public static ChatRoomListGetResponse of(List<ChatRoom> ChatRoomListUserIsBuyer, List<ChatRoom> ChatRoomListUserIsSeller) { | ||
return ChatRoomListGetResponse.builder() | ||
.ChatRoomListUserIsBuyer(ChatRoomListUserIsBuyer) | ||
.ChatRoomListUserIsSeller(ChatRoomListUserIsSeller) | ||
.build(); | ||
} | ||
} |
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
25 changes: 4 additions & 21 deletions
25
src/main/java/com/catchroom/chat/chatroom/service/ChatRoomService.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 |
---|---|---|
@@ -1,42 +1,25 @@ | ||
package com.catchroom.chat.chatroom.service; | ||
|
||
import com.catchroom.chat.chatroom.dto.ChatRoomCreateRequest; | ||
import com.catchroom.chat.chatroom.dto.ChatRoomCreateResponse; | ||
import com.catchroom.chat.chatroom.dto.ChatRoomListGetResponse; | ||
import com.catchroom.chat.chatroom.entity.ChatRoom; | ||
import com.catchroom.chat.chatroom.repository.ChatRoomRepositoryJPA; | ||
import com.catchroom.chat.message.feign.MainFeignClient; | ||
import jakarta.annotation.Resource; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.redis.core.HashOperations; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.List; | ||
|
||
@RequiredArgsConstructor | ||
@Service | ||
public class ChatRoomService { | ||
private final ChatRoomRepositoryJPA chatRoomRepository; | ||
private final MainFeignClient mainFeignClient; | ||
@Resource(name = "redisTemplate") //redisTemplate bean ์ฃผ์ . | ||
private HashOperations<String, String, ChatRoom> opsHashChatRoom; | ||
private static final String CHAT_ROOMS = "CHAT_ROOM_REDIS"; | ||
|
||
@Transactional(readOnly = true) | ||
public ChatRoomListGetResponse findChatRoomListByMemberId(Long userId) { | ||
List<ChatRoom> ChatRoomListUserIsBuyer = chatRoomRepository.findAllByBuyerId(userId); | ||
|
||
List<ChatRoom> ChatRoomListUserIsSeller = chatRoomRepository.findAllBySellerId(userId); | ||
return ChatRoomListGetResponse.of(ChatRoomListUserIsBuyer, ChatRoomListUserIsSeller); | ||
} | ||
|
||
@Transactional | ||
public ChatRoomCreateResponse createChatRoom(ChatRoomCreateRequest chatRoomCreateRequest) { | ||
ChatRoom chatRoom = ChatRoom.create( | ||
chatRoomCreateRequest.getSellerId(), | ||
chatRoomCreateRequest.getBuyerId(), | ||
chatRoomCreateRequest.getProductId()); | ||
chatRoomRepository.save(chatRoom); | ||
opsHashChatRoom.put(CHAT_ROOMS, chatRoom.getChatRoomNumber(), chatRoom); | ||
return ChatRoomCreateResponse.fromEntity(chatRoom); | ||
public ChatRoomListGetResponse getChatRoomList() { | ||
return mainFeignClient.getChatRoomList(); | ||
} | ||
} |
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
4 changes: 2 additions & 2 deletions
4
...ssage/controller/MainFeignController.java โ ...feign/controller/MainFeignController.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
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
5 changes: 5 additions & 0 deletions
5
src/main/java/com/catchroom/chat/message/type/UserIdentity.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,5 @@ | ||
package com.catchroom.chat.message.type; | ||
|
||
public enum UserIdentity { | ||
NONLOGINUSER,BUYER,SELLER | ||
} |