Skip to content
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 @@ -4,6 +4,7 @@
import com.umc.finly.domain.analysis.emotion.dto.response.GoldenTimeResDTO;
import com.umc.finly.domain.analysis.emotion.dto.response.ShakenKeywordsResDTO;
import com.umc.finly.domain.market.stock.entity.Stock;

import com.umc.finly.domain.record.enums.Session;
import org.springframework.stereotype.Component;

Expand Down Expand Up @@ -54,6 +55,7 @@ public static ShakenKeywordsResDTO toShakenKeywordsResDTO(

// 감정 골든 타임 응답 DTO 변환
public GoldenTimeResDTO toGoldenTimeResDTO(
String nickname,
Stock stock,
int totalRecords,
Session goldenTime,
Expand All @@ -73,6 +75,7 @@ public GoldenTimeResDTO toGoldenTimeResDTO(
.build();

return GoldenTimeResDTO.builder()
.nickname(nickname)
.stock(stockDto)
.summary(summaryDto)
.session(sessions)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.umc.finly.domain.analysis.emotion.dto.response;

import com.umc.finly.domain.member.entity.Member;
import com.umc.finly.domain.record.enums.Session;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -14,6 +15,7 @@
@AllArgsConstructor
public class GoldenTimeResDTO {

private String nickname;
private SelectedStock stock;
private Summary summary;
private List<Sessions> session;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import com.umc.finly.domain.analysis.emotion.util.KeywordExtractor;
import com.umc.finly.domain.market.stock.entity.Stock;
import com.umc.finly.domain.market.stock.repository.StockRepository;
import com.umc.finly.domain.member.entity.Member;
import com.umc.finly.domain.member.exception.code.MemberErrorCode;
import com.umc.finly.domain.member.repository.MemberRepository;
import com.umc.finly.domain.record.entity.RecordEntry;
import com.umc.finly.domain.record.enums.EmotionCode;
import com.umc.finly.domain.record.enums.Session;
Expand All @@ -31,6 +34,7 @@ public class EmotionAnalysisServiceImpl implements EmotionAnalysisService {

// 키워드 추출 상위 8개
private static final int MAX_KEYWORDS = 8;
private final MemberRepository memberRepository;

@Override
public EmotionDistributionResDTO getEmotionDistribution(Long memberId, String symbol) {
Expand Down Expand Up @@ -170,6 +174,12 @@ public GoldenTimeResDTO getEmotionGoldenTime(Long memberId, String symbol) {
throw new CustomException(ErrorCode.INVALID_REQUEST);
}

// Member nickname
Member member = memberRepository.findById(memberId)
.orElseThrow(() -> new CustomException(MemberErrorCode.MEMBER_NOT_FOUND));

String nickname = member.getNickname();

// 종목 조회
Stock stock = stockRepository.findBySymbol(symbol)
.orElseThrow(() -> new CustomException(EmotionAnalysisErrorCode.ANALYSIS_EMOTION_STOCK_NOT_FOUND));
Expand Down Expand Up @@ -232,6 +242,7 @@ public GoldenTimeResDTO getEmotionGoldenTime(Long memberId, String symbol) {

// Converter로 최종 응답 조립
return emotionAnalysisConverter.toGoldenTimeResDTO(
nickname,
stock,
totalRecords,
goldenTime,
Expand Down