-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat: 채팅방 개별 조회 API * Feat: chatRoom-service cors 설정 * Feat: category -> hashTag로 네이밍 변경
- Loading branch information
Showing
8 changed files
with
104 additions
and
13 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
...ain/java/com/tadak/chatroomservice/domain/chatmember/dto/response/ChatMemberResponse.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,22 @@ | ||
package com.tadak.chatroomservice.domain.chatmember.dto.response; | ||
|
||
import com.tadak.chatroomservice.domain.chatmember.entity.ChatMember; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class ChatMemberResponse { | ||
|
||
private String username; | ||
|
||
public static ChatMemberResponse from(ChatMember chatMember){ | ||
return ChatMemberResponse.builder() | ||
.username(chatMember.getUsername()) | ||
.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
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
31 changes: 31 additions & 0 deletions
31
...main/java/com/tadak/chatroomservice/domain/chatroom/dto/response/OneChatRoomResponse.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,31 @@ | ||
package com.tadak.chatroomservice.domain.chatroom.dto.response; | ||
|
||
import com.tadak.chatroomservice.domain.chatmember.dto.response.ChatMemberResponse; | ||
import com.tadak.chatroomservice.domain.chatroom.entity.ChatRoom; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class OneChatRoomResponse { | ||
|
||
private String roomName; | ||
private Integer participation; | ||
private String owner; | ||
private List<ChatMemberResponse> chatMemberResponses; | ||
|
||
public static OneChatRoomResponse of(ChatRoom chatRoom, List<ChatMemberResponse> chatMemberResponses){ | ||
return OneChatRoomResponse.builder() | ||
.roomName(chatRoom.getRoomName()) | ||
.participation(chatRoom.getParticipation()) | ||
.owner(chatRoom.getOwner()) | ||
.chatMemberResponses(chatMemberResponses) | ||
.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: 25 additions & 0 deletions
25
...nd/chatroom-service/src/main/java/com/tadak/chatroomservice/global/config/CorsConfig.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,25 @@ | ||
package com.tadak.chatroomservice.global.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.cors.CorsConfiguration; | ||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; | ||
import org.springframework.web.filter.CorsFilter; | ||
|
||
@Configuration | ||
public class CorsConfig { | ||
@Bean | ||
public CorsFilter corsFilter() { | ||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | ||
CorsConfiguration config = new CorsConfiguration(); | ||
config.setAllowCredentials(true); | ||
config.addAllowedOriginPattern("*"); | ||
config.addAllowedHeader("*"); | ||
config.addAllowedMethod("*"); | ||
config.addExposedHeader("Accesstoken, Refreshtoken"); | ||
|
||
source.registerCorsConfiguration("/**", config); | ||
return new CorsFilter(source); | ||
} | ||
} | ||
|