Skip to content

Commit

Permalink
Merge pull request #154 from masters2023-4th-project-carrot-talk/dev
Browse files Browse the repository at this point in the history
[be] 채팅 알림 리팩토링, 채팅 내역 조회 응답 형식 변경 배포
  • Loading branch information
chunghye98 authored Oct 4, 2023
2 parents 2e3566b + 43c170d commit 49eb066
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.example.carrot.category.service;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.stereotype.Service;

Expand All @@ -21,7 +20,8 @@ public List<CategoryResponseDto> findCategories() {
List<Category> categories = categoryRepository.findAll();
return categories.stream()
.map(CategoryResponseDto::of)
.collect(Collectors.toUnmodifiableList());
// TODO: 일급 컬렉션으로 추출한 후 해당 메소드를 인스턴스 단위의 메소드로 구현하기(?)
.toList();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ChatMessageResponseDtos {
@JsonProperty("chattings")
private List<ChatMessageResponseDto> chatMessageResponseDtos;

@JsonProperty("next")
@JsonProperty("nextId")
private Long nextId;

@Builder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
package com.example.carrot.notification.controller;

import java.io.IOException;

import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import com.example.carrot.global.common.ApiResponse;
import com.example.carrot.global.exception.CustomException;
import com.example.carrot.global.exception.StatusCode;
import com.example.carrot.notification.component.SseEmitters;
import com.example.carrot.notification.service.NotificationService;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@RequestMapping("/api/notification")
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import org.springframework.stereotype.Service;

import com.example.carrot.global.exception.CustomException;
import com.example.carrot.global.exception.StatusCode;
import com.example.carrot.notification.component.SseEmitters;
import com.example.carrot.notification.entity.Notification;
import com.example.carrot.user.entity.User;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ private ProductDetailResponseDto makeProduct(Product product, Long userId) {
String content = product.getContent();
LocalDateTime createdAt = product.getCreatedAt();

// TODO: 채팅 기능 완료 후 추가
Long chatCount = 0L;
Long chatCount = (long)product.getChatRooms().size();

// 상품 조회할 때마다 조회수 1 증가 (이거 때문에 @Transactional 사용)
product.increaseHit();
Expand Down

0 comments on commit 49eb066

Please sign in to comment.