From f6b08c36d43ce25f361e91f7b12f0843ddce4194 Mon Sep 17 00:00:00 2001 From: hanamgyu Date: Thu, 29 Aug 2024 02:16:46 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EC=B1=84=ED=8C=85=20=EB=A9=94?= =?UTF-8?q?=EC=8B=9C=EC=A7=80=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 채팅 메시지 전송 및 조회를 위한 WebSocket과 챗 메시지 서비스, 엔티티, 리포지토리 등을 추가. 관련된 MongoDB 설정과 예외 처리를 포함하여 전체 기능이 원활히 동작하도록 설정. --- build.gradle | 10 +- .../chat/config/WebSocketConfig.java | 30 ++++++ .../chat/dto/ChatMessageDto.java | 31 ++++++ .../chat/entity/ChatMessage.java | 29 +++++ .../chat/entity/ChatRoomEntity.java | 101 +++++++++--------- .../chat/entity/type/MessageType.java | 5 + .../repository/ChatMessageRepository.java | 11 ++ .../chat/service/ChatMessageService.java | 11 ++ .../service/impl/ChatMessageServiceImpl.java | 56 ++++++++++ .../chat/web/ChatMessageController.java | 32 ++++++ .../global/config/MongoConfig.java | 32 ++++++ .../global/exception/type/ErrorCode.java | 1 + .../impl/AccompanyMemberServiceImplTest.java | 81 -------------- 13 files changed, 299 insertions(+), 131 deletions(-) create mode 100644 src/main/java/connectripbe/connectrip_be/chat/config/WebSocketConfig.java create mode 100644 src/main/java/connectripbe/connectrip_be/chat/dto/ChatMessageDto.java create mode 100644 src/main/java/connectripbe/connectrip_be/chat/entity/type/MessageType.java create mode 100644 src/main/java/connectripbe/connectrip_be/chat/repository/ChatMessageRepository.java create mode 100644 src/main/java/connectripbe/connectrip_be/chat/service/ChatMessageService.java create mode 100644 src/main/java/connectripbe/connectrip_be/chat/service/impl/ChatMessageServiceImpl.java create mode 100644 src/main/java/connectripbe/connectrip_be/chat/web/ChatMessageController.java create mode 100644 src/main/java/connectripbe/connectrip_be/global/config/MongoConfig.java delete mode 100644 src/test/java/connectripbe/connectrip_be/accompany_member/service/impl/AccompanyMemberServiceImplTest.java diff --git a/build.gradle b/build.gradle index 8167104f..36838ea2 100644 --- a/build.gradle +++ b/build.gradle @@ -76,14 +76,20 @@ dependencies { annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta" annotationProcessor "jakarta.annotation:jakarta.annotation-api" annotationProcessor "jakarta.persistence:jakarta.persistence-api" - + // MongoDB implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' // RabbitMQ implementation 'org.springframework.boot:spring-boot-starter-amqp' - // STOMP + // websocket + implementation 'org.springframework.boot:spring-boot-starter-websocket' + + // Messaging + implementation 'org.springframework:spring-messaging' + + } tasks.named('bootBuildImage') { diff --git a/src/main/java/connectripbe/connectrip_be/chat/config/WebSocketConfig.java b/src/main/java/connectripbe/connectrip_be/chat/config/WebSocketConfig.java new file mode 100644 index 00000000..2b5e09af --- /dev/null +++ b/src/main/java/connectripbe/connectrip_be/chat/config/WebSocketConfig.java @@ -0,0 +1,30 @@ +package connectripbe.connectrip_be.chat.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.messaging.simp.config.MessageBrokerRegistry; +import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; +import org.springframework.web.socket.config.annotation.StompEndpointRegistry; +import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; + +@Configuration +@EnableWebSocketMessageBroker +public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { + + @Override + public void registerStompEndpoints(StompEndpointRegistry registry) { + // 클라이언트가 WebSocket에 연결할 수 있는 엔드포인트를 등록. + registry.addEndpoint("/ws") // 클라이언트가 "/ws" 엔드포인트로 WebSocket 연결을 시도할 수 있도록 설정. + .setAllowedOrigins("*"); // 모든 도메인에서의 CORS (Cross-Origin) 요청을 허용. + } + + @Override + public void configureMessageBroker(MessageBrokerRegistry registry) { + // 메시지를 라우팅할 때 사용할 애플리케이션 목적지 프리픽스를 설정합니다. + // 클라이언트가 메시지를 보낼 때 "/pub" 프리픽스를 사용. + registry.setApplicationDestinationPrefixes("/pub"); + + // "/sub"로 시작하는 경로를 구독한 클라이언트에게 메시지를 전달. + // 메시지를 구독하는 목적지 경로의 프리픽스를 "/sub"으로 설정. + registry.enableSimpleBroker("/sub"); + } +} \ No newline at end of file diff --git a/src/main/java/connectripbe/connectrip_be/chat/dto/ChatMessageDto.java b/src/main/java/connectripbe/connectrip_be/chat/dto/ChatMessageDto.java new file mode 100644 index 00000000..2a145a60 --- /dev/null +++ b/src/main/java/connectripbe/connectrip_be/chat/dto/ChatMessageDto.java @@ -0,0 +1,31 @@ +package connectripbe.connectrip_be.chat.dto; + +import connectripbe.connectrip_be.chat.entity.ChatMessage; +import connectripbe.connectrip_be.chat.entity.type.MessageType; +import java.time.LocalDateTime; +import lombok.Builder; + +@Builder +public record ChatMessageDto( + String id, + MessageType type, + Long chatRoomId, + Long senderId, + String senderNickname, + String senderProfileImage, + String content, + LocalDateTime createdAt +) { + public static ChatMessageDto fromEntity(ChatMessage chatMessage) { + return ChatMessageDto.builder() + .id(chatMessage.getId()) + .type(chatMessage.getType()) + .chatRoomId(chatMessage.getChatRoomId()) + .senderId(chatMessage.getSenderId()) + .senderNickname(chatMessage.getSenderNickname()) + .senderProfileImage(chatMessage.getSenderProfileImage()) + .content(chatMessage.getContent()) + .createdAt(chatMessage.getCreatedAt()) + .build(); + } +} diff --git a/src/main/java/connectripbe/connectrip_be/chat/entity/ChatMessage.java b/src/main/java/connectripbe/connectrip_be/chat/entity/ChatMessage.java index a83afaa7..68683b4f 100644 --- a/src/main/java/connectripbe/connectrip_be/chat/entity/ChatMessage.java +++ b/src/main/java/connectripbe/connectrip_be/chat/entity/ChatMessage.java @@ -1,26 +1,55 @@ package connectripbe.connectrip_be.chat.entity; +import connectripbe.connectrip_be.chat.entity.type.MessageType; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; import jakarta.persistence.Id; +import java.time.LocalDateTime; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; +import org.springframework.data.annotation.CreatedDate; import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Field; +import org.springframework.data.mongodb.core.mapping.FieldType; @Document(collection = "chat_message") @Getter @AllArgsConstructor @NoArgsConstructor +@Builder public class ChatMessage { + /** + * 몽고디비 설정해서 연결 확인 1. application.properties에 몽고디비 설정 추가 2. MognoDBConfig 클래스 생성 + */ @Id + @Field(value = "_id", targetType = FieldType.OBJECT_ID) private String id; + @Field + @Enumerated(EnumType.STRING) + private MessageType type; + @Field("chat_room_id") private Long chatRoomId; @Field("sender_id") private Long senderId; + @Field("sender_nickname") + private String senderNickname; + + @Field("sender_profile_image") + private String senderProfileImage; + + @Field("content") + private String content; + + @Field("created_at") + @CreatedDate + private LocalDateTime createdAt; + } diff --git a/src/main/java/connectripbe/connectrip_be/chat/entity/ChatRoomEntity.java b/src/main/java/connectripbe/connectrip_be/chat/entity/ChatRoomEntity.java index de3c6b58..ac32fd04 100644 --- a/src/main/java/connectripbe/connectrip_be/chat/entity/ChatRoomEntity.java +++ b/src/main/java/connectripbe/connectrip_be/chat/entity/ChatRoomEntity.java @@ -29,54 +29,59 @@ @Builder public class ChatRoomEntity extends BaseEntity { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - - @OneToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "accompany_post_id") - private AccompanyPostEntity accompanyPost; - - // 방장 설정: ChatRoomMember의 ID를 참조 - @OneToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "leader_id") - private ChatRoomMemberEntity currentLeader; - - @Enumerated(EnumType.STRING) - private ChatRoomType chatRoomType; - - private String lastChatMessage; - - // 마지막 채팅 시간. 정렬을 위해 기본적으로 CreatedAt 값을 사용하고, 채팅이 발생할 때마다 업데이트 - @CreatedDate - private LocalDateTime lastChatTime; - - @Builder.Default - @OneToMany(mappedBy = "chatRoom") - private List chatRoomMembers = new ArrayList<>(); - - /** - * ChatRoomMember 추가 및 양방향 관계 설정 메서드 - * @param chatRoomMember 채팅참여자 객체 - */ - public void addChatRoomMember(ChatRoomMemberEntity chatRoomMember) { - this.chatRoomMembers.add(chatRoomMember); - chatRoomMember.assignChatRoom(this); - } - - // 방장 설정 메서드 (초기 방장 설정) - public void setInitialLeader(ChatRoomMemberEntity leader) { - this.currentLeader = leader; - this.addChatRoomMember(leader); - } - - - // 채팅방 상태 변경 메서드 - public void changeChatRoomType(ChatRoomType chatRoomType) { - this.chatRoomType = chatRoomType; - } - - //TODO 마지막 채팅 메시지 및 시간 업데이트 메서드 + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "accompany_post_id") + private AccompanyPostEntity accompanyPost; + + // 방장 설정: ChatRoomMember의 ID를 참조 + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "leader_id") + private ChatRoomMemberEntity currentLeader; + + @Enumerated(EnumType.STRING) + private ChatRoomType chatRoomType; + + private String lastChatMessage; + + // 마지막 채팅 시간. 정렬을 위해 기본적으로 CreatedAt 값을 사용하고, 채팅이 발생할 때마다 업데이트 + @CreatedDate + private LocalDateTime lastChatTime; + + @Builder.Default + @OneToMany(mappedBy = "chatRoom") + private List chatRoomMembers = new ArrayList<>(); + + /** + * ChatRoomMember 추가 및 양방향 관계 설정 메서드 + * + * @param chatRoomMember 채팅참여자 객체 + */ + public void addChatRoomMember(ChatRoomMemberEntity chatRoomMember) { + this.chatRoomMembers.add(chatRoomMember); + chatRoomMember.assignChatRoom(this); + } + + // 방장 설정 메서드 (초기 방장 설정) + public void setInitialLeader(ChatRoomMemberEntity leader) { + this.currentLeader = leader; + this.addChatRoomMember(leader); + } + + + // 채팅방 상태 변경 메서드 + public void changeChatRoomType(ChatRoomType chatRoomType) { + this.chatRoomType = chatRoomType; + } + + //마지막 채팅 메시지 및 시간 업데이트 메서드 + public void updateLastChatMessage(String message, LocalDateTime time) { + this.lastChatMessage = message; + this.lastChatTime = time; + } } diff --git a/src/main/java/connectripbe/connectrip_be/chat/entity/type/MessageType.java b/src/main/java/connectripbe/connectrip_be/chat/entity/type/MessageType.java new file mode 100644 index 00000000..9c0a4747 --- /dev/null +++ b/src/main/java/connectripbe/connectrip_be/chat/entity/type/MessageType.java @@ -0,0 +1,5 @@ +package connectripbe.connectrip_be.chat.entity.type; + +public enum MessageType { + ENTER, TALK, LEAVE +} diff --git a/src/main/java/connectripbe/connectrip_be/chat/repository/ChatMessageRepository.java b/src/main/java/connectripbe/connectrip_be/chat/repository/ChatMessageRepository.java new file mode 100644 index 00000000..72af4061 --- /dev/null +++ b/src/main/java/connectripbe/connectrip_be/chat/repository/ChatMessageRepository.java @@ -0,0 +1,11 @@ +package connectripbe.connectrip_be.chat.repository; + +import connectripbe.connectrip_be.chat.entity.ChatMessage; +import java.util.List; +import org.springframework.data.mongodb.repository.MongoRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface ChatMessageRepository extends MongoRepository { + List findByChatRoomId(Long chatRoomId); +} diff --git a/src/main/java/connectripbe/connectrip_be/chat/service/ChatMessageService.java b/src/main/java/connectripbe/connectrip_be/chat/service/ChatMessageService.java new file mode 100644 index 00000000..50dcc20e --- /dev/null +++ b/src/main/java/connectripbe/connectrip_be/chat/service/ChatMessageService.java @@ -0,0 +1,11 @@ +package connectripbe.connectrip_be.chat.service; + +import connectripbe.connectrip_be.chat.dto.ChatMessageDto; +import java.util.List; + +public interface ChatMessageService { + + ChatMessageDto saveMessage(ChatMessageDto chatMessage); + + List getMessages(Long chatRoomId); +} diff --git a/src/main/java/connectripbe/connectrip_be/chat/service/impl/ChatMessageServiceImpl.java b/src/main/java/connectripbe/connectrip_be/chat/service/impl/ChatMessageServiceImpl.java new file mode 100644 index 00000000..edd3301f --- /dev/null +++ b/src/main/java/connectripbe/connectrip_be/chat/service/impl/ChatMessageServiceImpl.java @@ -0,0 +1,56 @@ +package connectripbe.connectrip_be.chat.service.impl; + +import connectripbe.connectrip_be.chat.dto.ChatMessageDto; +import connectripbe.connectrip_be.chat.entity.ChatMessage; +import connectripbe.connectrip_be.chat.entity.ChatRoomEntity; +import connectripbe.connectrip_be.chat.repository.ChatMessageRepository; +import connectripbe.connectrip_be.chat.repository.ChatRoomRepository; +import connectripbe.connectrip_be.chat.service.ChatMessageService; +import connectripbe.connectrip_be.global.exception.GlobalException; +import connectripbe.connectrip_be.global.exception.type.ErrorCode; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class ChatMessageServiceImpl implements ChatMessageService { + + private final ChatMessageRepository chatMessageRepository; + private final ChatRoomRepository chatRoomRepository; + + @Override + public ChatMessageDto saveMessage(ChatMessageDto chatMessageDto) { + ChatMessage chatMessage = + ChatMessage.builder() + .id(chatMessageDto.id()) + .type(chatMessageDto.type()) + .chatRoomId(chatMessageDto.chatRoomId()) + .senderId(chatMessageDto.senderId()) + .senderNickname(chatMessageDto.senderNickname()) + .senderProfileImage(chatMessageDto.senderProfileImage()) + .content(chatMessageDto.content()) + .createdAt(chatMessageDto.createdAt()) + .build(); + + ChatMessage saved = chatMessageRepository.save(chatMessage); + + ChatRoomEntity chatRoom = chatRoomRepository.findById(saved.getChatRoomId()) + .orElseThrow(() -> new GlobalException(ErrorCode.CHAT_ROOM_NOT_FOUND)); + + // 채팅방 테이블에 채팅 마지막 내용과 마지막 시간 업데이트 + chatRoom.updateLastChatMessage(saved.getContent(), saved.getCreatedAt()); + chatRoomRepository.save(chatRoom); + + return ChatMessageDto.fromEntity(saved); + } + + @Override + public List getMessages(Long chatRoomId) { + List chatMessages = chatMessageRepository.findByChatRoomId(chatRoomId); + + return chatMessages.stream() + .map(ChatMessageDto::fromEntity) + .toList(); + } +} diff --git a/src/main/java/connectripbe/connectrip_be/chat/web/ChatMessageController.java b/src/main/java/connectripbe/connectrip_be/chat/web/ChatMessageController.java new file mode 100644 index 00000000..3575309f --- /dev/null +++ b/src/main/java/connectripbe/connectrip_be/chat/web/ChatMessageController.java @@ -0,0 +1,32 @@ +package connectripbe.connectrip_be.chat.web; + +import connectripbe.connectrip_be.chat.dto.ChatMessageDto; +import connectripbe.connectrip_be.chat.service.ChatMessageService; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.messaging.handler.annotation.MessageMapping; +import org.springframework.messaging.handler.annotation.Payload; +import org.springframework.messaging.simp.SimpMessagingTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +public class ChatMessageController { + + private final ChatMessageService chatMessageService; + private final SimpMessagingTemplate simpMessagingTemplate; + + @MessageMapping("/chat/message") + public void senMessage(@Payload ChatMessageDto chatMessage) { + ChatMessageDto savedMessage = chatMessageService.saveMessage(chatMessage); + simpMessagingTemplate.convertAndSend("/sub/chat/room/" + savedMessage.chatRoomId(), savedMessage); + } + + @GetMapping("/api/v1/chatRoom/{chatRoomId}/messages") + public ResponseEntity> getChatRoomMessages(@PathVariable Long chatRoomId) { + return ResponseEntity.ok(chatMessageService.getMessages(chatRoomId)); + } +} diff --git a/src/main/java/connectripbe/connectrip_be/global/config/MongoConfig.java b/src/main/java/connectripbe/connectrip_be/global/config/MongoConfig.java new file mode 100644 index 00000000..60c9b205 --- /dev/null +++ b/src/main/java/connectripbe/connectrip_be/global/config/MongoConfig.java @@ -0,0 +1,32 @@ +package connectripbe.connectrip_be.global.config; + +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.mongodb.MongoDatabaseFactory; +import org.springframework.data.mongodb.config.EnableMongoAuditing; +import org.springframework.data.mongodb.core.convert.DbRefResolver; +import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver; +import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper; +import org.springframework.data.mongodb.core.convert.MappingMongoConverter; +import org.springframework.data.mongodb.core.mapping.MongoMappingContext; + +@Configuration +@EnableMongoAuditing +@RequiredArgsConstructor +public class MongoConfig { + + private final MongoMappingContext mongoMappingContext; + + @Bean + public MappingMongoConverter mappingMongoConverter( + MongoDatabaseFactory mongoDatabaseFactory, + MongoMappingContext mongoMappingContext + ) { + + DbRefResolver dbRefResolver = new DefaultDbRefResolver(mongoDatabaseFactory); + MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, mongoMappingContext); + converter.setTypeMapper(new DefaultMongoTypeMapper(null)); + return converter; + } +} diff --git a/src/main/java/connectripbe/connectrip_be/global/exception/type/ErrorCode.java b/src/main/java/connectripbe/connectrip_be/global/exception/type/ErrorCode.java index 7aaa4005..1c8dbd88 100644 --- a/src/main/java/connectripbe/connectrip_be/global/exception/type/ErrorCode.java +++ b/src/main/java/connectripbe/connectrip_be/global/exception/type/ErrorCode.java @@ -82,6 +82,7 @@ public enum ErrorCode { CHAT_ROOM_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 채팅방을 찾을 수 없습니다."), POST_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 글을 찾을 수 없습니다."), CHATROOM_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 채팅방을 찾을 수 없습니다."), + CHAT_MESSAGE_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 채팅 메세지를 찾을 수 없습니다."), /** * 409 Conflict diff --git a/src/test/java/connectripbe/connectrip_be/accompany_member/service/impl/AccompanyMemberServiceImplTest.java b/src/test/java/connectripbe/connectrip_be/accompany_member/service/impl/AccompanyMemberServiceImplTest.java deleted file mode 100644 index 6ef19532..00000000 --- a/src/test/java/connectripbe/connectrip_be/accompany_member/service/impl/AccompanyMemberServiceImplTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package connectripbe.connectrip_be.accompany_member.service.impl; - -import connectripbe.connectrip_be.accompany_member.dto.AccompanyMemberResponse; -import connectripbe.connectrip_be.accompany_member.entity.AccompanyMemberEntity; -import connectripbe.connectrip_be.accompany_member.entity.type.AccompanyMemberStatus; -import connectripbe.connectrip_be.accompany_member.repository.AccompanyMemberRepository; -import connectripbe.connectrip_be.member.entity.MemberEntity; -import connectripbe.connectrip_be.post.entity.AccompanyPostEntity; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import java.util.Arrays; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.when; - -class AccompanyMemberServiceImplTest { - - @Mock - private AccompanyMemberRepository accompanyMemberRepository; - - @InjectMocks - private AccompanyMemberServiceImpl accompanyMemberService; - - @BeforeEach - void setUp() { - MockitoAnnotations.openMocks(this); - } - - @Test - void testGetAccompanyMemberList() { - // Given - Long accompanyPostId = 1L; - MemberEntity member1 = MemberEntity.builder() - .id(1L) - .nickname("nickname1") - .profileImagePath("path/to/profile1") - .build(); - MemberEntity member2 = MemberEntity.builder() - .id(2L) - .nickname("nickname2") - .profileImagePath("path/to/profile2") - .build(); - - AccompanyPostEntity accompanyPost = AccompanyPostEntity.builder() - .id(accompanyPostId) - .build(); - - AccompanyMemberEntity accompanyMember1 = AccompanyMemberEntity.builder() - .id(1L) - .member(member1) - .accompanyPost(accompanyPost) - .status(AccompanyMemberStatus.ACTIVE) - .build(); - - AccompanyMemberEntity accompanyMember2 = AccompanyMemberEntity.builder() - .id(2L) - .member(member2) - .accompanyPost(accompanyPost) - .status(AccompanyMemberStatus.ACTIVE) - .build(); - - List accompanyMemberList = Arrays.asList(accompanyMember1, accompanyMember2); - - when(accompanyMemberRepository.findAllByAccompanyPost_Id(accompanyPostId)).thenReturn(accompanyMemberList); - - // When - List result = accompanyMemberService.getAccompanyMemberList(accompanyPostId); - - // Then - assertEquals(2, result.size()); - assertEquals("nickname1", result.get(0).nickname()); - assertEquals("nickname2", result.get(1).nickname()); - } - - -} \ No newline at end of file From 034fdef0634c831385a86843c6a531cc75110228 Mon Sep 17 00:00:00 2001 From: hanamgyu Date: Fri, 30 Aug 2024 15:33:41 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=EB=A1=9C=EC=BB=AC=20MongoDB=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit application-local.yml 파일에 로컬 MongoDB 설정을 추가하였습니다. --- src/main/resources/application-local.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index f88a3076..995955e7 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -21,6 +21,14 @@ spring: host: ${LOCAL_REDIS_HOST} port: ${LOCAL_REDIS_PORT} + mongodb: + host: ${LOCAL_MONGODB_HOST} + port: ${LOCAL_MONGODB_PORT} + database: ${LOCAL_MONGODB_DATABASE} + username: ${LOCAL_MONGODB_USERNAME} + password: ${LOCAL_MONGODB_PASSWORD} + + auth: success-redirect-url: ${LOCAL_KAKAO_SUCCESS_REDIRECT_URL} kakao: