-
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.
- Loading branch information
Showing
13 changed files
with
213 additions
and
20 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
11 changes: 11 additions & 0 deletions
11
src/main/java/io/oeid/mogakgo/domain/chat/application/dto/req/ChatRoomCreateReq.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,11 @@ | ||
package io.oeid.mogakgo.domain.chat.application.dto.req; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class ChatRoomCreateReq { | ||
private Long projectId; | ||
private Long senderId; | ||
} |
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
28 changes: 28 additions & 0 deletions
28
src/main/java/io/oeid/mogakgo/domain/chat/application/dto/res/ChatRoomDataRes.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,28 @@ | ||
package io.oeid.mogakgo.domain.chat.application.dto.res; | ||
|
||
import io.oeid.mogakgo.domain.chat.application.vo.ChatData; | ||
import io.oeid.mogakgo.domain.chat.application.vo.ChatRoomProjectInfo; | ||
import io.oeid.mogakgo.domain.chat.entity.document.ChatMessage; | ||
import io.oeid.mogakgo.domain.project.domain.entity.vo.MeetingInfo; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Schema(description = "채팅방 데이터 조회 응답") | ||
@Getter | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor | ||
public class ChatRoomDataRes { | ||
|
||
private ChatRoomProjectInfo project; | ||
private List<ChatData> data; | ||
|
||
public static ChatRoomDataRes of(MeetingInfo meetingInfo, List<ChatMessage> data) { | ||
ChatRoomProjectInfo project = new ChatRoomProjectInfo(meetingInfo.getMeetDetail(), | ||
meetingInfo.getMeetStartTime(), meetingInfo.getMeetEndTime()); | ||
return new ChatRoomDataRes(project, data.stream().map(ChatData::from).toList()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/io/oeid/mogakgo/domain/chat/application/dto/res/ChatRoomPublicRes.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,5 +1,27 @@ | ||
package io.oeid.mogakgo.domain.chat.application.dto.res; | ||
|
||
import io.oeid.mogakgo.domain.chat.application.vo.ChatUserInfo; | ||
import io.oeid.mogakgo.domain.chat.entity.enums.ChatStatus; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Schema(description = "채팅방 리스트 조회 응답") | ||
@Getter | ||
@AllArgsConstructor | ||
public class ChatRoomPublicRes { | ||
@Schema(description = "프로젝트 ID") | ||
private Long projectId; | ||
@Schema(description = "채팅방 ID") | ||
private String chatRoomId; | ||
@Schema(description = "마지막 메시지") | ||
private String lastMessage; | ||
@Schema(description = "마지막 메시지 생성 시간") | ||
private LocalDateTime lastMessageCreatedAt; | ||
@Schema(description = "채팅방 상태") | ||
private ChatStatus status; | ||
|
||
private List<ChatUserInfo> profiles; | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/io/oeid/mogakgo/domain/chat/application/vo/ChatData.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,29 @@ | ||
package io.oeid.mogakgo.domain.chat.application.vo; | ||
|
||
import io.oeid.mogakgo.domain.chat.entity.document.ChatMessage; | ||
import io.oeid.mogakgo.domain.chat.entity.enums.ChatMessageType; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDateTime; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Schema(description = "채팅 데이터") | ||
@Getter | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class ChatData { | ||
|
||
@Schema(description = "메시지 타입") | ||
private ChatMessageType messageType; | ||
@Schema(description = "보낸 사람 ID") | ||
private Long senderId; | ||
@Schema(description = "메시지") | ||
private String message; | ||
@Schema(description = "생성 시간") | ||
private LocalDateTime createdAt; | ||
|
||
public static ChatData from(ChatMessage chatMessage) { | ||
return new ChatData(chatMessage.getMessageType(), chatMessage.getSenderId(), | ||
chatMessage.getMessage(), chatMessage.getCreatedAt()); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/io/oeid/mogakgo/domain/chat/application/vo/ChatRoomProjectInfo.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,19 @@ | ||
package io.oeid.mogakgo.domain.chat.application.vo; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDateTime; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Schema(description = "채팅방 프로젝트 정보") | ||
@Getter | ||
@AllArgsConstructor | ||
public class ChatRoomProjectInfo { | ||
|
||
@Schema(description = "프로젝트 설명") | ||
private String meetDetail; | ||
@Schema(description = "프로젝트 시작 시간") | ||
private LocalDateTime meetStartTime; | ||
@Schema(description = "프로젝트 종료 시간") | ||
private LocalDateTime meetEndTime; | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/io/oeid/mogakgo/domain/chat/application/vo/ChatUserInfo.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,17 @@ | ||
package io.oeid.mogakgo.domain.chat.application.vo; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Schema(description = "채팅방 유저 정보") | ||
@Getter | ||
@AllArgsConstructor | ||
public class ChatUserInfo { | ||
@Schema(description = "유저 ID") | ||
private Long userId; | ||
@Schema(description = "유저 이름") | ||
private String username; | ||
@Schema(description = "유저 프로필 이미지 URL") | ||
private String avatarUrl; | ||
} |
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
30 changes: 30 additions & 0 deletions
30
src/main/java/io/oeid/mogakgo/domain/chat/presentation/ChatController.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 io.oeid.mogakgo.domain.chat.presentation; | ||
|
||
import io.oeid.mogakgo.common.annotation.UserId; | ||
import io.oeid.mogakgo.domain.chat.application.ChatService; | ||
import io.oeid.mogakgo.domain.chat.application.dto.res.ChatRoomDataRes; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/chat") | ||
public class ChatController { | ||
|
||
private final ChatService chatService; | ||
|
||
@GetMapping | ||
public void getChatRoomList(@UserId Long userId) { | ||
chatService.findAllChatRoomByUserId(userId); | ||
} | ||
|
||
@GetMapping("/{chatRoomId}") | ||
public ResponseEntity<ChatRoomDataRes> getChatRoomDetailData(@UserId Long userId, | ||
@PathVariable String chatRoomId) { | ||
return ResponseEntity.ok(chatService.findAllChatInChatRoom(userId, chatRoomId)); | ||
} | ||
} |
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