-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] 채팅 관련 REST API 구현 #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
de77a9d
[feat] 채팅방 생성 api 구현 (#60)
buzz0331 d804a1c
[chore] mongoDB 및 websocket 의존성 주입 (#60)
buzz0331 47d8b25
[chore] mongoDB 관련 환경변수 설정 (#60)
buzz0331 17c8dc3
[chore] ChatMessage를 MongoDB용 객체로 수정 (#60)
buzz0331 b0d2590
[chore] Stomp를 위한 설정 파일 (#60)
buzz0331 aab874c
[chore] ChatRoom의 연관관계 수정 (Owner -> FoodTruck) (#60)
buzz0331 765edab
[feat] 채팅방 상단에 채팅 상대 표시용 API 구현 (#60)
buzz0331 fa9c15f
[refactor] 사장님끼리 채팅할 경우의 발생할 수 있는 오류로 인해 코드 수정 (#60)
buzz0331 bbbbbff
[refactor] 채팅 상대 조회 응답 형식 변경 (#60)
buzz0331 4b1a6dc
[feat] 채팅 api 구현 (#60)
buzz0331 3276efc
[refactor] 채팅방에 예약 연관관계 주입 (#60)
buzz0331 8199551
[feat] 필요한 에러 메시지 선언 (#60)
buzz0331 9c9ca48
[feat] 채팅 api dto 정의 (#60)
buzz0331 3cf1826
[feat] 채팅방 목록 조회 dto 및 핸들러 구성 (#60)
buzz0331 4f989f4
[refactor] 채팅방이 이미 같은 멤버와 푸드트럭 사이에 존재한다면 새로 생성하지 않고 기존 채팅방 id 반환 (#60)
buzz0331 b1077d6
[feat] LocalDateTime을 문자열로 변환하는 메서드 선언 (#60)
buzz0331 b83585e
[feat] 웹소켓용 인터셉터 선언 (#60)
buzz0331 b8d0338
[feat] ChatRoomMetaData 선언 (#60)
buzz0331 79081a1
[feat] 채팅방 목록 조회 api 구현 (#60)
buzz0331 0a92563
[feat] 채팅방 내 메시지 읽음 표시 api 구현 (#60)
buzz0331 3c8ae4a
[feat] ChatRoomFilter 제거 (#60)
buzz0331 965f82b
[fix] Id import 경로 수정 (#60)
buzz0331 2abc494
[refactor] dto schema 및 validation 추가 (#60)
buzz0331 c155765
[refactor] 채팅방 메타데이터 생성시 sortKey 유니크하도록 수정 (#60)
buzz0331 f580a07
[refactor] Reservation과 ChatRoom 연관관계 맺기 (#60)
buzz0331 687c97b
[refactor] 채팅 상대 이름 조회 -> 채팅방 메타데이터 조회로 이름 수정 (#60)
buzz0331 c4690d1
[refactor] 채팅방 메타데이터 조회 api에서 관련된 예약 ID 조회 (#60)
buzz0331 9c2ed7b
[refactor] 채팅방 내 읽음 처리 api 성능 개선 (#60)
buzz0331 4e7cf65
[refactor] ChatMessage 인덱스 교체 (#60)
buzz0331 539bd6e
[refactor] 채팅방 목록 조회시에 예약 확정 여부 반환 (#60)
buzz0331 6ce9df5
[fix] 지원안하는 파싱 오류 수정 (Map -> Projection) (#60)
buzz0331 c3b74c9
[refactor] Param 추가 (#60)
buzz0331 48f106b
[refactor] 필요없는 import 제거 (#60)
buzz0331 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
67 changes: 67 additions & 0 deletions
67
src/main/java/konkuk/chacall/domain/chat/application/ChatService.java
This file contains hidden or 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,4 +1,71 @@ | ||
| package konkuk.chacall.domain.chat.application; | ||
|
|
||
| import konkuk.chacall.domain.chat.application.message.ChatMessageService; | ||
| import konkuk.chacall.domain.chat.application.room.ChatRoomService; | ||
| import konkuk.chacall.domain.chat.presentation.dto.request.GetChatRoomRequest; | ||
| import konkuk.chacall.domain.chat.presentation.dto.request.SendChatMessageRequest; | ||
| import konkuk.chacall.domain.chat.presentation.dto.response.ChatMessageResponse; | ||
| import konkuk.chacall.domain.chat.presentation.dto.response.ChatRoomMetaDataResponse; | ||
| import konkuk.chacall.domain.chat.presentation.dto.response.ChatRoomIdResponse; | ||
| import konkuk.chacall.domain.chat.presentation.dto.response.ChatRoomResponse; | ||
| import konkuk.chacall.domain.member.application.validator.MemberValidator; | ||
| import konkuk.chacall.domain.user.domain.model.User; | ||
| import konkuk.chacall.global.common.dto.CursorPagingRequest; | ||
| import konkuk.chacall.global.common.dto.CursorPagingResponse; | ||
| import konkuk.chacall.global.common.dto.SortType; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| @Transactional(readOnly = true) | ||
| public class ChatService { | ||
|
|
||
| private final ChatRoomService chatRoomService; | ||
| private final ChatMessageService chatMessageService; | ||
|
|
||
| private final MemberValidator memberValidator; | ||
|
|
||
| @Transactional | ||
| public ChatRoomIdResponse createChatRoom(Long memberId, Long foodTruckId) { | ||
| User member = memberValidator.validateAndGetMember(memberId); | ||
|
|
||
| return chatRoomService.createChatRoom(member, foodTruckId); | ||
| } | ||
|
|
||
| public ChatRoomMetaDataResponse getChatRoomMetaData(Long memberId, Long roomId, boolean isOwner) { | ||
| User user = memberValidator.validateAndGetMember(memberId); | ||
|
|
||
| return chatRoomService.getChatRoomMetaData(user, roomId, isOwner); | ||
| } | ||
|
|
||
| @Transactional | ||
| public ChatMessageResponse sendMessage(Long roomId, Long userId, SendChatMessageRequest request) { | ||
| User senderUser = memberValidator.validateAndGetMember(userId); | ||
|
|
||
| return chatMessageService.sendMessage(roomId, senderUser, request); | ||
| } | ||
|
|
||
| public List<ChatMessageResponse> getChatMessages(Long memberId, Long roomId, int page, int size) { | ||
| User user = memberValidator.validateAndGetMember(memberId); | ||
|
|
||
| return chatMessageService.getChatMessages(roomId, user, page, size); | ||
| } | ||
|
|
||
| public CursorPagingResponse<ChatRoomResponse> getChatRooms(Long memberId, GetChatRoomRequest request) { | ||
| User member = memberValidator.validateAndGetMember(memberId); | ||
|
|
||
| CursorPagingRequest cursorPagingRequest = request.pagingOrDefault(SortType.NEWEST); | ||
| return chatRoomService.getChatRooms(member, request.isOwner(), cursorPagingRequest.cursor(), cursorPagingRequest.size()); | ||
| } | ||
|
|
||
| @Transactional | ||
| public void markMessagesAsRead(Long userId, Long roomId) { | ||
| User user = memberValidator.validateAndGetMember(userId); | ||
|
|
||
| chatMessageService.markMessagesAsRead(user, roomId); | ||
| } | ||
| } |
70 changes: 70 additions & 0 deletions
70
src/main/java/konkuk/chacall/domain/chat/application/message/ChatMessageService.java
This file contains hidden or 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,70 @@ | ||
| package konkuk.chacall.domain.chat.application.message; | ||
|
|
||
| import konkuk.chacall.domain.chat.domain.ChatMessage; | ||
| import konkuk.chacall.domain.chat.domain.ChatRoomMetaData; | ||
| import konkuk.chacall.domain.chat.domain.repository.ChatMessageRepository; | ||
| import konkuk.chacall.domain.chat.domain.repository.ChatRoomMetaDataRepository; | ||
| import konkuk.chacall.domain.chat.presentation.dto.request.SendChatMessageRequest; | ||
| import konkuk.chacall.domain.chat.presentation.dto.response.ChatMessageResponse; | ||
| import konkuk.chacall.domain.user.domain.model.User; | ||
| import konkuk.chacall.global.common.exception.EntityNotFoundException; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.data.domain.PageRequest; | ||
| import org.springframework.data.domain.Sort; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import static konkuk.chacall.global.common.exception.code.ErrorCode.*; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| public class ChatMessageService { | ||
|
|
||
| private final ChatMessageRepository chatMessageRepository; | ||
| private final ChatRoomMetaDataRepository chatRoomMetaDataRepository; | ||
|
|
||
| public ChatMessageResponse sendMessage(Long roomId, User senderUser, SendChatMessageRequest request) { | ||
|
|
||
| ChatRoomMetaData chatRoomMetaData = chatRoomMetaDataRepository.findByRoomId(roomId) | ||
| .orElseThrow(() -> new EntityNotFoundException(CHAT_ROOM_NOT_FOUND)); | ||
|
|
||
| chatRoomMetaData.validateParticipant(senderUser); | ||
|
|
||
| ChatMessage chatMessage = ChatMessage.createChatMessage( | ||
| chatRoomMetaData.getRoomId(), | ||
| senderUser, | ||
| request.content(), | ||
| request.contentType() | ||
| ); | ||
|
|
||
| ChatMessage savedMessage = chatMessageRepository.save(chatMessage); | ||
| chatRoomMetaData.updateLastMessage(savedMessage.getContent(), savedMessage.getSendTime()); | ||
| chatRoomMetaDataRepository.save(chatRoomMetaData); | ||
|
|
||
| return ChatMessageResponse.from(savedMessage); | ||
| } | ||
|
|
||
| public List<ChatMessageResponse> getChatMessages(Long roomId, User user, int page, int size) { | ||
| ChatRoomMetaData chatRoomMetaData = chatRoomMetaDataRepository.findByRoomId(roomId) | ||
| .orElseThrow(() -> new EntityNotFoundException(CHAT_ROOM_NOT_FOUND)); | ||
|
|
||
| chatRoomMetaData.validateParticipant(user); | ||
|
|
||
| var pageable = PageRequest.of(page, size, Sort.by(Sort.Direction.DESC, "sendTime")); | ||
|
|
||
| return chatMessageRepository.findByRoomId(chatRoomMetaData.getRoomId(), pageable) | ||
| .stream() | ||
| .map(ChatMessageResponse::from) | ||
| .toList(); | ||
| } | ||
|
|
||
| public void markMessagesAsRead(User user, Long roomId) { | ||
| ChatRoomMetaData chatRoomMetaData = chatRoomMetaDataRepository.findByRoomId(roomId) | ||
| .orElseThrow(() -> new EntityNotFoundException(CHAT_ROOM_NOT_FOUND)); | ||
|
|
||
| chatRoomMetaData.validateParticipant(user); | ||
|
|
||
| chatMessageRepository.markMessagesAsReadByUserInRoom(user.getUserId(), roomId); | ||
| } | ||
| } |
133 changes: 133 additions & 0 deletions
133
src/main/java/konkuk/chacall/domain/chat/application/room/ChatRoomService.java
This file contains hidden or 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,133 @@ | ||
| package konkuk.chacall.domain.chat.application.room; | ||
|
|
||
| import konkuk.chacall.domain.chat.domain.ChatRoom; | ||
| import konkuk.chacall.domain.chat.domain.ChatRoomMetaData; | ||
| import konkuk.chacall.domain.chat.domain.repository.ChatRoomMetaDataRepository; | ||
| import konkuk.chacall.domain.chat.domain.repository.ChatRoomRepository; | ||
| import konkuk.chacall.domain.chat.domain.repository.dto.ChatRoomMetaDataProjection; | ||
| import konkuk.chacall.domain.chat.presentation.dto.response.ChatRoomMetaDataResponse; | ||
| import konkuk.chacall.domain.chat.presentation.dto.response.ChatRoomIdResponse; | ||
| import konkuk.chacall.domain.chat.presentation.dto.response.ChatRoomResponse; | ||
| import konkuk.chacall.domain.foodtruck.domain.model.FoodTruck; | ||
| import konkuk.chacall.domain.foodtruck.domain.repository.FoodTruckRepository; | ||
| import konkuk.chacall.domain.reservation.domain.model.Reservation; | ||
| import konkuk.chacall.domain.reservation.domain.repository.ReservationRepository; | ||
| import konkuk.chacall.domain.reservation.domain.repository.dto.ReservationConfirmedProjection; | ||
| import konkuk.chacall.domain.user.domain.model.Role; | ||
| import konkuk.chacall.domain.user.domain.model.User; | ||
| import konkuk.chacall.global.common.dto.CursorPagingResponse; | ||
| import konkuk.chacall.global.common.exception.BusinessException; | ||
| import konkuk.chacall.global.common.exception.EntityNotFoundException; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.function.Function; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import static konkuk.chacall.global.common.exception.code.ErrorCode.*; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| public class ChatRoomService { | ||
|
|
||
| private final ChatRoomRepository chatRoomRepository; | ||
| private final FoodTruckRepository foodTruckRepository; | ||
| private final ChatRoomMetaDataRepository chatRoomMetaDataRepository; | ||
| private final ReservationRepository reservationRepository; | ||
|
|
||
| public ChatRoomIdResponse createChatRoom(User member, Long foodTruckId) { | ||
| FoodTruck foodTruck = foodTruckRepository.findById(foodTruckId) | ||
| .orElseThrow(() -> new EntityNotFoundException(FOOD_TRUCK_NOT_FOUND)); | ||
|
|
||
| // 채팅방이 이미 존재하는지 확인 | ||
| ChatRoom chatRoom = chatRoomRepository.findByMemberAndFoodTruck(member, foodTruck) | ||
| .orElseGet(() -> chatRoomRepository.save(ChatRoom.createChatRoom(member, foodTruck))); | ||
|
|
||
| // MongoDB 메타데이터 존재 여부 확인 | ||
| chatRoomMetaDataRepository.findByRoomId(chatRoom.getChatRoomId()) | ||
| .orElseGet(() -> { | ||
| // 없을 경우 새로 생성 | ||
| ChatRoomMetaData metaData = ChatRoomMetaData.from(chatRoom); | ||
| return chatRoomMetaDataRepository.save(metaData); | ||
| }); | ||
|
|
||
| return ChatRoomIdResponse.of(chatRoom); | ||
| } | ||
|
|
||
| public ChatRoomMetaDataResponse getChatRoomMetaData(User user, Long roomId, boolean isOwner) { | ||
| ChatRoom chatRoom = chatRoomRepository.findById(roomId) | ||
| .orElseThrow(() -> new EntityNotFoundException(CHAT_ROOM_NOT_FOUND)); | ||
|
|
||
| Long reservationId = reservationRepository.findByChatRoom(chatRoom) | ||
| .map(Reservation::getReservationId) | ||
| .orElse(null); // 없으면 null | ||
|
|
||
| if(isOwner && user.getRole() != Role.OWNER) { | ||
| throw new BusinessException(USER_FORBIDDEN); | ||
| } | ||
|
|
||
| // 푸드트럭 사장일 경우 예약자 이름 반환 | ||
| if(isOwner) return ChatRoomMetaDataResponse.of(chatRoom.getMember().getName(), null, reservationId); | ||
|
|
||
| // 예약자일 경우 푸드트럭 사장 이름 및 푸드트럭 이름 반환 | ||
| FoodTruck foodTruck = chatRoom.getFoodTruck(); | ||
| return ChatRoomMetaDataResponse.of(foodTruck.getOwner().getName(), foodTruck.getFoodTruckInfo().getName(), reservationId); | ||
| } | ||
|
|
||
| public CursorPagingResponse<ChatRoomResponse> getChatRooms(User member, Boolean isOwner, Long cursor, Integer size) { | ||
| int pageSize = (size == null || size < 1) ? 20 : size; | ||
|
|
||
| Long cursorSortKey = (cursor != null) ? cursor : Long.MAX_VALUE; | ||
| int limit = pageSize + 1; | ||
|
|
||
| // 1. MongoDB에서 메타데이터 + unreadCount 조회 | ||
| List<ChatRoomMetaDataProjection> metaList = | ||
| chatRoomMetaDataRepository.findChatRoomsForUser(member.getUserId(), isOwner, cursorSortKey, limit); | ||
|
|
||
| boolean hasNext = metaList.size() > pageSize; | ||
| if (hasNext) { | ||
| metaList = metaList.subList(0, pageSize); | ||
| } | ||
|
|
||
| // 2. roomId 리스트로 RDB에서 ChatRoom 배치 조회 | ||
| List<Long> roomIds = metaList.stream() | ||
| .map(ChatRoomMetaDataProjection::getRoomId) | ||
| .toList(); | ||
|
|
||
| List<ChatRoom> chatRooms = chatRoomRepository.findByChatRoomIdIn(roomIds); | ||
| Map<Long, ChatRoom> chatRoomMap = chatRooms.stream() | ||
| .collect(Collectors.toMap(ChatRoom::getChatRoomId, Function.identity())); | ||
|
|
||
| // 3. 예약 확정 여부 조회 | ||
| Map<Long, Boolean> reservationConfirmedMap; | ||
| if (roomIds.isEmpty()) { | ||
| reservationConfirmedMap = Collections.emptyMap(); | ||
| } else { | ||
| List<ReservationConfirmedProjection> confirmedList = reservationRepository.findReservationConfirmedByChatRoomIds(roomIds); | ||
|
|
||
| reservationConfirmedMap = confirmedList.stream() | ||
| .collect(Collectors.toMap( | ||
| ReservationConfirmedProjection::getRoomId, | ||
| ReservationConfirmedProjection::getConfirmed | ||
| )); | ||
| } | ||
|
|
||
| // 4. 메타데이터 + RDB 정보 조합해서 ChatRoomResponse 생성 | ||
| List<ChatRoomResponse> responses = metaList.stream() | ||
| .map(meta -> ChatRoomResponse.from(chatRoomMap.get(meta.getRoomId()), meta, isOwner, | ||
| reservationConfirmedMap.getOrDefault(meta.getRoomId(), false))) | ||
| .toList(); | ||
|
|
||
| // 5. CursorPagingResponse 생성 | ||
| Long lastCursor = responses.isEmpty() ? null : metaList.get(metaList.size() - 1).getSortKey(); | ||
| return new CursorPagingResponse<>( | ||
| responses, | ||
| lastCursor, | ||
| hasNext, | ||
| null | ||
| ); | ||
| } | ||
| } | ||
62 changes: 32 additions & 30 deletions
62
src/main/java/konkuk/chacall/domain/chat/domain/ChatMessage.java
This file contains hidden or 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,43 +1,45 @@ | ||
| package konkuk.chacall.domain.chat.domain; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import konkuk.chacall.domain.chat.domain.value.MessageContentType; | ||
| import konkuk.chacall.domain.user.domain.model.User; | ||
| import konkuk.chacall.global.common.domain.BaseEntity; | ||
| import lombok.AccessLevel; | ||
| import lombok.NoArgsConstructor; | ||
| import lombok.*; | ||
| import org.springframework.data.annotation.Id; | ||
| import org.springframework.data.mongodb.core.index.CompoundIndex; | ||
| import org.springframework.data.mongodb.core.mapping.Document; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| @Entity | ||
| @Table(name = "chat_messages") | ||
| @Getter | ||
| @Document(collection = "chat_messages") | ||
| @CompoundIndex( | ||
| name = "room_sender_read_time_idx", | ||
| def = "{'roomId': 1, 'senderId': 1, 'read': 1, 'sendTime': 1}" | ||
| ) | ||
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class ChatMessage extends BaseEntity { | ||
| public class ChatMessage { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(nullable = false) | ||
| private Long chatMessageId; | ||
| private String id; | ||
|
|
||
| @Column(name = "content", nullable = false, length = 1000) | ||
| private Long roomId; | ||
| private Long senderId; | ||
| private String content; | ||
|
|
||
| @Column(nullable = false) | ||
| private LocalDateTime sendTime; | ||
|
|
||
| @Column(name = "is_read", nullable = false) | ||
| private boolean isRead; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY, optional = false) | ||
| @JoinColumn(name = "chat_room_id", nullable = false) | ||
| private ChatRoom chatRoom; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY, optional = false) | ||
| @JoinColumn(name = "user_id", nullable = false) | ||
| private User senderUser; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(nullable = false, length = 20) | ||
| private MessageContentType contentType; | ||
|
|
||
| private String contentType; | ||
|
|
||
| @Builder.Default | ||
| private LocalDateTime sendTime = LocalDateTime.now(); | ||
|
|
||
| @Builder.Default | ||
| private boolean read = false; | ||
|
|
||
| public static ChatMessage createChatMessage(Long roomId, User sender, String content, MessageContentType contentType) { | ||
| return ChatMessage.builder() | ||
| .roomId(roomId) | ||
| .senderId(sender.getUserId()) | ||
| .content(content) | ||
| .contentType(contentType.name()) | ||
| .build(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서 isOwner 는 '차콜 서비스 자체에서 사장님으로 등록되어있는지' 를 의미하는 게 아니라, 채팅방 내의 예약자 <-> 사장님 관계에서 예약중인 푸드트럭의 사장님인지 여부를 의미하는 거라고 생각하면 되죠?
다른 푸드트럭의 사장님도 예약자 신분이 될 수 있다보니까 이런 식으로 구분해야 뷰에 차이를 둘 수 있긴 하겠네요 좋슴다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네넵 초기에 isOwner라는 플래그를 프론트로부터 받지 않고 구현을 하니 사장님과 사장님간의 채팅시에 논리적인 모순이 생기더라구요. 따라서, isOwner는 말씀하신대로 현재 예약자와 사장님의 관계를 구별해주기 위한 용도라고 생각하시면 될 것 같습니다. 프론트 쪽은 사장님과 예약자 뷰가 명확하게 나뉘어져 있으니 이를 보내주는 것이 쉬울거라고 판단했습니다!