Skip to content
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

[fix]:Main 채팅방 개설시 이미지 추가 #164

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ public class ChatContent {
private String userName;
private String content;
private LocalDateTime time;
private String image;

public static ChatContent createChatContent(String userName, String content, Room room) {
public static ChatContent createChatContent(String userName, String content, Room room,String image) {
ChatContent chatContent = ChatContent.builder()
.userName(userName)
.content(content)
.time(LocalDateTime.now())
.image(image)
.build();
if(room==null)
return chatContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void createRoom(List<User> userList, Boolean isPossible, Long syncId, Use
);
for (User user : userList) {
if (sync.getUser().getId().equals(user.getId())) {
ChatContent chatContent = ChatContent.createChatContent(user.getUserName(), "환영합니다", room);
ChatContent chatContent = ChatContent.createChatContent(user.getUserName(), "환영합니다", room,"https://sync-content-bucket-01.s3.ap-northeast-2.amazonaws.com/94f1a566-0072-45e9-944f-707a6e21bbbf.png");
contents.add(chatContent);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void chat(@UserId Long userId, @RequestBody ChatReq chatReq){
query.addCriteria(Criteria.where("roomName").is(chatReq.roomName()));
Room room = mongoTemplate.findOne(query, Room.class);

ChatContent chatContent = ChatContent.createChatContent(user.getUserName(), chatReq.content(), room);
ChatContent chatContent = ChatContent.createChatContent(user.getUserName(), chatReq.content(), room, "https://sync-content-bucket-01.s3.ap-northeast-2.amazonaws.com/94f1a566-0072-45e9-944f-707a6e21bbbf.png");
// room.addChatContent(chatContent);
roomRepository.save(room);

Expand Down