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 @@ -229,8 +229,8 @@ public SuggestionAutoResponse createAutoSuggestions(
request.put("repo_url", repoUrl);
request.put("prompt", prompt);
request.put("include_children", true);
request.put("max_files", 10);
request.put("return_code", false);
request.put("max_files", 12);
request.put("return_code", true);

try {
return webClient.post()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import com.teamEWSN.gitdeun.common.jwt.CustomUserDetails;
import com.teamEWSN.gitdeun.mindmap.dto.*;
import com.teamEWSN.gitdeun.mindmap.dto.prompt.MindmapPromptAnalysisDto;
import com.teamEWSN.gitdeun.mindmap.dto.prompt.PromptApplyRequestDto;
import com.teamEWSN.gitdeun.mindmap.dto.prompt.PromptHistoryResponseDto;
import com.teamEWSN.gitdeun.mindmap.dto.prompt.PromptPreviewResponseDto;
import com.teamEWSN.gitdeun.mindmap.dto.request.MindmapCreateRequestDto;
import com.teamEWSN.gitdeun.mindmap.service.MindmapOrchestrationService;
import com.teamEWSN.gitdeun.mindmap.service.MindmapService;
Expand Down Expand Up @@ -103,7 +101,7 @@ public ResponseEntity<Void> refreshMindmap(
}

// ๋น„๋™๊ธฐ ์„œ๋น„์Šค ํ˜ธ์ถœ
mindmapOrchestrationService.refreshMindmap(mapId, authorizationHeader);
mindmapOrchestrationService.refreshMindmap(mapId, userDetails.getId(), authorizationHeader);

// ์ฆ‰์‹œ 202 Accepted ์‘๋‹ต ๋ฐ˜ํ™˜
return ResponseEntity.accepted().build();
Expand All @@ -130,39 +128,43 @@ public ResponseEntity<Void> deleteMindmap(
// ํ”„๋กฌํ”„ํŠธ ๊ธฐ๋ก ๊ด€๋ จ

/**
* ํ”„๋กฌํ”„ํŠธ ๋ถ„์„ ๋ฐ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์ƒ์„ฑ
* ํ”„๋กฌํ”„ํŠธ ๋ถ„์„์š”์ฒญ ๋ฐ ์ ์šฉ
*/
@PostMapping("/{mapId}/prompts")
public ResponseEntity<PromptPreviewResponseDto> analyzePromptPreview(
public ResponseEntity<Void> analyzePrompt(
@PathVariable Long mapId,
@AuthenticationPrincipal CustomUserDetails userDetails,
@RequestBody MindmapPromptAnalysisDto request,
@RequestHeader("Authorization") String authorizationHeader
@RequestHeader("Authorization") String authorizationHeader,
@RequestParam(name = "apply-immediately", defaultValue = "true") boolean applyImmediately
) {
PromptPreviewResponseDto responseDto = promptHistoryService.createPromptPreview(
mapId,
userDetails.getId(),
request,
authorizationHeader
);
return ResponseEntity.ok(responseDto);
// ๊ถŒํ•œ ๊ฒ€์ฆ์€ ๋™๊ธฐ์ ์œผ๋กœ ๋จผ์ € ์ˆ˜ํ–‰
if (!mindmapAuthService.hasEdit(mapId, userDetails.getId())) {
throw new GlobalException(ErrorCode.FORBIDDEN_ACCESS);
}

// ๋น„๋™๊ธฐ ์„œ๋น„์Šค ํ˜ธ์ถœ
mindmapOrchestrationService.promptMindmap(mapId, request.getPrompt(), userDetails.getId(), authorizationHeader, applyImmediately);

// ์ฆ‰์‹œ 202 Accepted ์‘๋‹ต ๋ฐ˜ํ™˜
return ResponseEntity.accepted().build();
}

/**
* ํ”„๋กฌํ”„ํŠธ ํžˆ์Šคํ† ๋ฆฌ ์ ์šฉ
*/
@PostMapping("/{mapId}/prompts/apply")
public ResponseEntity<MindmapDetailResponseDto> applyPromptHistory(
@PathVariable Long mapId,
@AuthenticationPrincipal CustomUserDetails userDetails,
@RequestBody PromptApplyRequestDto request,
@RequestHeader("Authorization") String authorizationHeader
) {
promptHistoryService.applyPromptHistory(mapId, userDetails.getId(), request);

MindmapDetailResponseDto responseDto = mindmapService.getMindmap(mapId, userDetails.getId(), authorizationHeader);
return ResponseEntity.ok(responseDto);
}
// @PostMapping("/{mapId}/prompts/{historyId}")
// public ResponseEntity<MindmapDetailResponseDto> applyPromptHistory(
// @PathVariable Long mapId,
// @PathVariable Long historyId,
// @AuthenticationPrincipal CustomUserDetails userDetails,
// @RequestHeader("Authorization") String authorizationHeader
// ) {
// promptHistoryService.applyPromptHistory(mapId, historyId, userDetails.getId());
//
// MindmapDetailResponseDto responseDto = mindmapService.getMindmap(mapId, userDetails.getId(), authorizationHeader);
// return ResponseEntity.ok(responseDto);
// }

/**
* ํ”„๋กฌํ”„ํŠธ ํžˆ์Šคํ† ๋ฆฌ ๋ชฉ๋ก ์กฐํšŒ (ํŽ˜์ด์ง•)
Expand All @@ -182,15 +184,15 @@ public ResponseEntity<Page<PromptHistoryResponseDto>> getPromptHistories(
/**
* ํŠน์ • ํ”„๋กฌํ”„ํŠธ ํžˆ์Šคํ† ๋ฆฌ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์กฐํšŒ
*/
@GetMapping("/{mapId}/prompts/histories/{historyId}/preview")
public ResponseEntity<PromptPreviewResponseDto> getPromptHistoryPreview(
@PathVariable Long mapId,
@PathVariable Long historyId,
@AuthenticationPrincipal CustomUserDetails userDetails
) {
PromptPreviewResponseDto responseDto = promptHistoryService.getPromptHistoryPreview(mapId, historyId, userDetails.getId());
return ResponseEntity.ok(responseDto);
}
// @GetMapping("/{mapId}/prompts/histories/{historyId}/preview")
// public ResponseEntity<PromptPreviewResponseDto> getPromptHistoryPreview(
// @PathVariable Long mapId,
// @PathVariable Long historyId,
// @AuthenticationPrincipal CustomUserDetails userDetails
// ) {
// PromptPreviewResponseDto responseDto = promptHistoryService.getPromptHistoryPreview(mapId, historyId, userDetails.getId());
// return ResponseEntity.ok(responseDto);
// }

/**
* ํ”„๋กฌํ”„ํŠธ ํžˆ์Šคํ† ๋ฆฌ ์‚ญ์ œ (์ ์šฉ๋˜์ง€ ์•Š์€ ๊ฒƒ๋งŒ)
Expand All @@ -213,6 +215,6 @@ public ResponseEntity<PromptHistoryResponseDto> getAppliedPromptHistory(
@PathVariable Long mapId,
@AuthenticationPrincipal CustomUserDetails userDetails
) {
return ResponseEntity.ok(promptHistoryService.getAppliedPromptHistory(mapId, userDetails.getId()));
return ResponseEntity.ok(promptHistoryService.getAppliedPromptHistory(mapId, userDetails.getId()));
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class PromptHistoryResponseDto {
private Long historyId;
private String prompt;
private String title;
private String summary;
private Boolean applied;
private LocalDateTime createdAt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class PromptPreviewResponseDto {
private Long historyId;
private String prompt;
private String title;
private String summary;

// TODO: ํ”„๋กฌํ”„ํŠธ ๋ฏธ๋ฆฌ๋ณด๊ธฐ์šฉ ๋งต ๋ฐ์ดํ„ฐ
private MindmapGraphResponseDto mindmapGraph;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.teamEWSN.gitdeun.common.exception.ErrorCode;
import com.teamEWSN.gitdeun.common.exception.GlobalException;
import com.teamEWSN.gitdeun.common.fastapi.FastApiClient;
import com.teamEWSN.gitdeun.common.fastapi.FastApiClient.SuggestionAutoResponse;
import com.teamEWSN.gitdeun.common.fastapi.dto.AnalysisResultDto;
import com.teamEWSN.gitdeun.mindmap.dto.request.MindmapCreateRequestDto;
import com.teamEWSN.gitdeun.mindmap.dto.request.ValidatedMindmapRequest;
Expand All @@ -19,17 +20,20 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.concurrent.CompletableFuture;

import static com.teamEWSN.gitdeun.notification.entity.NotificationType.*;


@Slf4j
@Service
@RequiredArgsConstructor
public class MindmapOrchestrationService {

private final FastApiClient fastApiClient;
private final MindmapService mindmapService;
private final PromptHistoryService promptHistoryService;
private final NotificationService notificationService;
private final UserRepository userRepository;
private final MindmapRepository mindmapRepository;
Expand Down Expand Up @@ -68,18 +72,19 @@ public void createMindmap(MindmapCreateRequestDto request, Long userId, String a
}).whenComplete((mindmap, throwable) -> {
// 3. ์ตœ์ข… ๊ฒฐ๊ณผ์— ๋”ฐ๋ผ ์•Œ๋ฆผ ์ „์†ก
if (throwable != null) {
handleFailureAndNotify(throwable, userId, normalizedUrl);
handleFailureAndNotify(throwable, userId, normalizedUrl, "์ƒ์„ฑ์—", MINDMAP_CREATE);
} else {
handleSuccessAndNotify(mindmap, userId);
handleSuccessAndNotify(mindmap, userId, "์ƒ์„ฑ์ด", MINDMAP_CREATE);
}
});
}

@Async("mindmapExecutor")
public void refreshMindmap(Long mapId, String authHeader) {
public void refreshMindmap(Long mapId, Long userId, String authHeader) {
Mindmap mindmap = null;
try {
log.info("๋น„๋™๊ธฐ ์ƒˆ๋กœ๊ณ ์นจ ์‹œ์ž‘ - ๋งˆ์ธ๋“œ๋งต ID: {}", mapId);
Mindmap mindmap = mindmapRepository.findByIdAndDeletedAtIsNull(mapId)
mindmap = mindmapRepository.findByIdAndDeletedAtIsNull(mapId)
.orElseThrow(() -> new GlobalException(ErrorCode.MINDMAP_NOT_FOUND));

PromptHistory appliedPrompt = mindmap.getAppliedPromptHistory();
Expand All @@ -94,12 +99,19 @@ public void refreshMindmap(Long mapId, String authHeader) {
authHeader
);

// ๋ถ„์„ ๊ฒฐ๊ณผ๋ฅผ DB์— ์—…๋ฐ์ดํŠธ (ํŠธ๋žœ์žญ์…˜)
// ๋ถ„์„ ๊ฒฐ๊ณผ๋ฅผ DB์— ์—…๋ฐ์ดํŠธ (ํŠธ๋žœ์žญ์…˜) ๋ฐ SSE ๋ธŒ๋กœ๋“œ์บ์ŠคํŠธ
mindmapService.updateMindmapFromAnalysis(mapId, authHeader, analysisResult);
log.info("๋น„๋™๊ธฐ ์ƒˆ๋กœ๊ณ ์นจ ์„ฑ๊ณต - ๋งˆ์ธ๋“œ๋งต ID: {}", mapId);

// ์„ฑ๊ณต ์•Œ๋ฆผ ์ „์†ก
handleSuccessAndNotify(mindmap, userId, "์ƒˆ๋กœ๊ณ ์นจ์ด", MINDMAP_UPDATE);

} catch (Exception e) {
log.error("๋น„๋™๊ธฐ ์ƒˆ๋กœ๊ณ ์นจ ์‹คํŒจ - ๋งˆ์ธ๋“œ๋งต ID: {}, ์›์ธ: {}", mapId, e.getMessage(), e);
// ์‹คํŒจ ์•Œ๋ฆผ ์ „์†ก
if (mindmap != null) {
handleFailureAndNotify(e, userId, mindmap.getRepo().getGithubRepoUrl(), "์ƒˆ๋กœ๊ณ ์นจ์—", MINDMAP_UPDATE);
}
}
}

Expand All @@ -111,45 +123,91 @@ public void cleanUpMindmapData(String repoUrl, String authorizationHeader) {
try {
fastApiClient.deleteMindmapData(repoUrl, authorizationHeader);
log.info("ArangoDB ๋ฐ์ดํ„ฐ ๋น„๋™๊ธฐ ์‚ญ์ œ ์™„๋ฃŒ: {}", repoUrl);

} catch (Exception e) {
log.error("ArangoDB ๋ฐ์ดํ„ฐ ๋น„๋™๊ธฐ ์‚ญ์ œ ์‹คํŒจ - ์ €์žฅ์†Œ: {}, ์›์ธ: {}", repoUrl, e.getMessage());
// TODO: ์‹คํŒจ ์‹œ ์žฌ์‹œ๋„ ๋กœ์ง ๋˜๋Š” ๊ด€๋ฆฌ์ž ์•Œ๋ฆผ ๋“ฑ์˜ ํ›„์† ์ฒ˜๋ฆฌ ๊ตฌํ˜„ ๊ฐ€๋Šฅ

}
}

private void handleSuccessAndNotify(Mindmap mindmap, Long userId) {
/**
* ํ”„๋กฌํ”„ํŠธ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๋งˆ์ธ๋“œ๋งต์„ ๋ถ„์„ํ•˜๊ณ  ๋ฏธ๋ฆฌ๋ณด๊ธฐ๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋น„๋™๊ธฐ ํ”„๋กœ์„ธ์Šค
*/
@Async("mindmapExecutor")
public void promptMindmap(Long mapId, String prompt, Long userId, String authHeader, boolean applyImmediately) {
Mindmap mindmap = null;
try {
log.info("๋น„๋™๊ธฐ ํ”„๋กฌํ”„ํŠธ ๋ถ„์„ ์‹œ์ž‘ - ๋งˆ์ธ๋“œ๋งต ID: {}", mapId);
mindmap = mindmapRepository.findByIdAndDeletedAtIsNull(mapId)
.orElseThrow(() -> new GlobalException(ErrorCode.MINDMAP_NOT_FOUND));

String repoUrl = mindmap.getRepo().getGithubRepoUrl();

// FastAPI์— ์ž๋™ ๋ถ„์„ ์š”์ฒญ
SuggestionAutoResponse suggestionResponse = fastApiClient.createAutoSuggestions(repoUrl, prompt, authHeader);

// ๋ถ„์„ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๋งˆ์ธ๋“œ๋งต ๊ทธ๋ž˜ํ”„ ๋ฐ์ดํ„ฐ ์—…๋ฐ์ดํŠธ ๋ฐ ์บ์‹œ ๊ฐฑ์‹ 
mindmapService.updateMindmapFromPromptAnalysis(mapId, authHeader);

// ๋ถ„์„ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ PromptHistory ์ƒ์„ฑ ๋ฐ SSE ์•Œ๋ฆผ
PromptHistory newHistory = promptHistoryService.createPromptHistoryFromSuggestion(mapId, prompt, suggestionResponse);

// ํ”„๋กฌํ”„ํŠธ ์ ์šฉ ์—ฌ๋ถ€ ํ™•์ธ ํ›„ ์•Œ๋ฆผ
if (applyImmediately) {
promptHistoryService.applyPromptHistory(mapId, newHistory.getId(), userId);

log.info("๋น„๋™๊ธฐ ํ”„๋กฌํ”„ํŠธ ๋ถ„์„ ๋ฐ ์ ์šฉ ์„ฑ๊ณต - ๋งˆ์ธ๋“œ๋งต ID: {}", mapId);
handleSuccessAndNotify(mindmap, userId, "ํ”„๋กฌํ”„ํŠธ ๋ถ„์„ ๋ฐ ์ ์šฉ์ด", ANALYSIS_PROMPT);
} else {
log.info("๋น„๋™๊ธฐ ํ”„๋กฌํ”„ํŠธ ๋ถ„์„ ์„ฑ๊ณต - ๋งˆ์ธ๋“œ๋งต ID: {}", mapId);
handleSuccessAndNotify(mindmap, userId, "ํ”„๋กฌํ”„ํŠธ ๋ถ„์„์ด", ANALYSIS_PROMPT);
}

} catch (Exception e) {
log.error("๋น„๋™๊ธฐ ํ”„๋กฌํ”„ํŠธ ๋ถ„์„ ์‹คํŒจ - ๋งˆ์ธ๋“œ๋งต ID: {}, ์›์ธ: {}", mapId, e.getMessage(), e);
// ์‹คํŒจ ์•Œ๋ฆผ ์ „์†ก
if (mindmap != null) {
handleFailureAndNotify(e, userId, mindmap.getRepo().getGithubRepoUrl(), "ํ”„๋กฌํ”„ํŠธ ๋ถ„์„์—", ANALYSIS_PROMPT);
}
}
}


// ์„ฑ๊ณต ์•Œ๋ฆผ (๋ฉ”์‹œ์ง€ ๋™์  ์ƒ์„ฑ)
private void handleSuccessAndNotify(Mindmap mindmap, Long userId, String action, NotificationType type) {
try {
User user = userRepository.findByIdAndDeletedAtIsNull(userId)
.orElseThrow(() -> new GlobalException(ErrorCode.USER_NOT_FOUND_BY_ID));

String successMessage = String.format("๋งˆ์ธ๋“œ๋งต '%s' ์ƒ์„ฑ์ด ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", mindmap.getTitle());
String successMessage = String.format("๋งˆ์ธ๋“œ๋งต '%s'์˜ %s ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", mindmap.getTitle(), action);
notificationService.createAndSendNotification(
NotificationCreateDto.actionable(
user,
NotificationType.SYSTEM_UPDATE,
type,
successMessage,
mindmap.getId(),
null
)
);
log.info("๋งˆ์ธ๋“œ๋งต ์ƒ์„ฑ ์„ฑ๊ณต ๋ฐ ์•Œ๋ฆผ ์ „์†ก ์™„๋ฃŒ - ID: {}, ์‚ฌ์šฉ์ž: {}", mindmap.getId(), userId);
log.info("๋งˆ์ธ๋“œ๋งต {} ์„ฑ๊ณต ๋ฐ ์•Œ๋ฆผ ์ „์†ก ์™„๋ฃŒ - ID: {}, ์‚ฌ์šฉ์ž: {}", action, mindmap.getId(), userId);
} catch (Exception e) {
log.error("์„ฑ๊ณต ์•Œ๋ฆผ ์ „์†ก ์‹คํŒจ - ๋งˆ์ธ๋“œ๋งต ID: {}, ์‚ฌ์šฉ์ž ID: {}, ์˜ค๋ฅ˜: {}",
mindmap.getId(), userId, e.getMessage());
}
}

private void handleFailureAndNotify(Throwable throwable, Long userId, String repoUrl) {
// ์‹คํŒจ ์•Œ๋ฆผ (๋ฉ”์‹œ์ง€ ๋™์  ์ƒ์„ฑ)
private void handleFailureAndNotify(Throwable throwable, Long userId, String repoUrl, String action, NotificationType type) {
final Throwable cause = throwable.getCause() != null ? throwable.getCause() : throwable;
log.error("๋งˆ์ธ๋“œ๋งต ์ƒ์„ฑ ์ตœ์ข… ์‹คํŒจ - ์‚ฌ์šฉ์ž: {}, ์ €์žฅ์†Œ: {}, ์›์ธ: {}", userId, repoUrl, cause.getMessage());
log.error("๋งˆ์ธ๋“œ๋งต {} ์ตœ์ข… ์‹คํŒจ - ์‚ฌ์šฉ์ž: {}, ์ €์žฅ์†Œ: {}, ์›์ธ: {}", action, userId, repoUrl, cause.getMessage());

try {
userRepository.findByIdAndDeletedAtIsNull(userId).ifPresent(user -> {
String errorMessage = "๋งˆ์ธ๋“œ๋งต ์ƒ์„ฑ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: " + getSimplifiedErrorMessage(cause);
String errorMessage = String.format("๋งˆ์ธ๋“œ๋งต %s ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: %s", action, getSimplifiedErrorMessage(cause));
notificationService.createAndSendNotification(
NotificationCreateDto.simple(
user,
NotificationType.SYSTEM_UPDATE,
type,
errorMessage
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,50 @@ public MindmapDetailResponseDto updateMindmapTitle(Long mapId, Long userId, Mind
return responseDto;
}

// ๋ถ„์„ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๊ธฐ์กด ๋งˆ์ธ๋“œ๋งต์„ ์—…๋ฐ์ดํŠธ (์ƒˆ๋กœ๊ณ ์นจ)
/**
* ๋ถ„์„ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๊ธฐ์กด ๋งˆ์ธ๋“œ๋งต์„ ์—…๋ฐ์ดํŠธ (์ƒˆ๋กœ๊ณ ์นจ)
*/
@Transactional
public MindmapDetailResponseDto updateMindmapFromAnalysis(Long mapId, String authHeader, AnalysisResultDto analysisResult) {
Mindmap mindmap = mindmapRepository.findByIdAndDeletedAtIsNull(mapId)
.orElseThrow(() -> new GlobalException(ErrorCode.MINDMAP_NOT_FOUND));

mindmap.getRepo().updateWithAnalysis(analysisResult);

// ์ƒˆ๋กœ๊ณ ์นจ ์‹œ ๊ทธ๋ž˜ํ”„ ์บ์‹œ ๋ฌดํšจํ™”
// ๊ณตํ†ต ๋กœ์ง ํ˜ธ์ถœ
return evictCacheAndBroadcastUpdate(mindmap, authHeader);
}

/**
* ํ”„๋กฌํ”„ํŠธ ๋ถ„์„ ํ›„ ๋งˆ์ธ๋“œ๋งต์„ ์—…๋ฐ์ดํŠธ (์บ์‹œ ๊ฐฑ์‹  ๋ฐ SSE ๋ธŒ๋กœ๋“œ์บ์ŠคํŠธ)
*/
@Transactional
public MindmapDetailResponseDto updateMindmapFromPromptAnalysis(Long mapId, String authHeader) {
Mindmap mindmap = mindmapRepository.findByIdAndDeletedAtIsNull(mapId)
.orElseThrow(() -> new GlobalException(ErrorCode.MINDMAP_NOT_FOUND));

// ๊ณตํ†ต ๋กœ์ง ํ˜ธ์ถœ
return evictCacheAndBroadcastUpdate(mindmap, authHeader);
}

/**
* ๋งˆ์ธ๋“œ๋งต ์—…๋ฐ์ดํŠธ ์‹œ ๊ณตํ†ต ๋กœ์ง (์บ์‹œ ๋ฌดํšจํ™”, ์ƒˆ ๋ฐ์ดํ„ฐ ์กฐํšŒ, SSE ์ „์†ก)
*/
private MindmapDetailResponseDto evictCacheAndBroadcastUpdate(Mindmap mindmap, String authHeader) {
// ๊ทธ๋ž˜ํ”„ ์บ์‹œ ๋ฌดํšจํ™”
mindmapGraphCache.evictCache(mindmap.getRepo().getGithubRepoUrl());

// ์ƒˆ๋กœ์šด ๊ทธ๋ž˜ํ”„ ๋ฐ์ดํ„ฐ ์กฐํšŒ
MindmapGraphResponseDto graphData = mindmapGraphCache.getGraphWithHybridCache(
mindmap.getRepo().getGithubRepoUrl(),
authHeader
);

// DTO ๋ณ€ํ™˜ ๋ฐ SSE ๋ธŒ๋กœ๋“œ์บ์ŠคํŠธ
MindmapDetailResponseDto responseDto = mindmapMapper.toDetailResponseDto(mindmap, graphData);
mindmapSseService.broadcastUpdate(mapId, responseDto);
mindmapSseService.broadcastUpdate(mindmap.getId(), responseDto);

log.info("๋งˆ์ธ๋“œ๋งต ์ƒˆ๋กœ๊ณ ์นจ DB ์—…๋ฐ์ดํŠธ ์™„๋ฃŒ - ID: {}", mapId);
log.info("๋งˆ์ธ๋“œ๋งต ๋ฐ์ดํ„ฐ ์—…๋ฐ์ดํŠธ ๋ฐ SSE ๋ธŒ๋กœ๋“œ์บ์ŠคํŠธ ์™„๋ฃŒ - ID: {}", mindmap.getId());
return responseDto;
}

Expand All @@ -160,6 +184,8 @@ public Repo deleteMindmap(Long mapId, Long userId) {
return mindmap.getRepo(); // ํ›„์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด Repo ๋ฐ˜ํ™˜
}



/**
* TODO: Webhook์„ ํ†ตํ•œ ๋งˆ์ธ๋“œ๋งต ์—…๋ฐ์ดํŠธ
*/
Expand Down
Loading