|
1 | 1 | package cmf.commitField.domain.chat.chatRoom.controller;
|
2 | 2 |
|
| 3 | +import cmf.commitField.domain.File.service.FileService; |
3 | 4 | import cmf.commitField.domain.chat.chatRoom.controller.request.ChatRoomRequest;
|
4 | 5 | import cmf.commitField.domain.chat.chatRoom.controller.request.ChatRoomUpdateRequest;
|
5 | 6 | import cmf.commitField.domain.chat.chatRoom.dto.ChatRoomDto;
|
|
29 | 30 | public class ChatRoomController {
|
30 | 31 | private final ChatRoomService chatRoomService;
|
31 | 32 | private final S3Service s3Service; // S3 파일 저장을 위한 서비스
|
| 33 | + private final FileService fileService; //local file 저장을 위한 서비스 |
32 | 34 |
|
33 | 35 | // 채팅방 생성 (파일 업로드 포함)
|
34 | 36 | @PostMapping(value = "/room", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@@ -57,6 +59,7 @@ public GlobalResponse<Object> createRoom(
|
57 | 59 | }
|
58 | 60 | }
|
59 | 61 |
|
| 62 | + |
60 | 63 | //채팅방 입장
|
61 | 64 | @PostMapping("/room/join/{roomId}")
|
62 | 65 | public GlobalResponse<Object> joinRoom(@PathVariable Long roomId, @RequestBody ChatRoomRequest chatRoomRequest) {
|
@@ -252,8 +255,33 @@ public GlobalResponse<Object> searchRoomName(
|
252 | 255 | }
|
253 | 256 | }
|
254 | 257 |
|
255 |
| - |
256 |
| - |
| 258 | +// // 채팅방 생성 (파일 업로드 포함) |
| 259 | +// @PostMapping(value = "/room", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| 260 | +// public GlobalResponse<Object> createRoom( |
| 261 | +// @ModelAttribute @Valid ChatRoomRequest chatRoomRequest) throws IOException { |
| 262 | +// |
| 263 | +// |
| 264 | +// // 인증 확인 |
| 265 | +// Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); |
| 266 | +// |
| 267 | +// if (authentication instanceof OAuth2AuthenticationToken) { |
| 268 | +// CustomOAuth2User principal = (CustomOAuth2User) authentication.getPrincipal(); |
| 269 | +// Long userId = principal.getId(); // getId()를 통해 userId를 추출 |
| 270 | +// |
| 271 | +// // 파일 업로드 처리 |
| 272 | +// String imageUrl = null; |
| 273 | +// if (chatRoomRequest.getFile() != null && !chatRoomRequest.getFile().isEmpty()) { |
| 274 | +// imageUrl = fileService.saveFile(chatRoomRequest.getFile()); // 파일 저장 |
| 275 | +// } |
| 276 | +// |
| 277 | +// // 채팅방 생성 서비스 호출 (이미지 URL 포함) |
| 278 | +// chatRoomService.createRoom(chatRoomRequest, userId, imageUrl); |
| 279 | +// |
| 280 | +// return GlobalResponse.success("채팅방을 생성하였습니다."); |
| 281 | +// } else { |
| 282 | +// throw new IllegalArgumentException("로그인 후에 이용해 주세요."); |
| 283 | +// } |
| 284 | +// } |
257 | 285 |
|
258 | 286 |
|
259 | 287 | }
|
0 commit comments