-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactor] 코드 리뷰하면서 확인했던 코드 리팩토링 #294
Open
limbaba1120
wants to merge
1
commit into
Kernel360:develop
Choose a base branch
from
limbaba1120:refactor/#293/review-refactor
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
35 changes: 35 additions & 0 deletions
35
backend/src/main/java/org/example/user/controller/member/AdminStatsController.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,35 @@ | ||
package org.example.user.controller.member; | ||
|
||
import java.util.Map; | ||
|
||
import org.example.config.log.LogExecution; | ||
import org.example.post.service.PostStatsService; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Controller | ||
@RequiredArgsConstructor | ||
public class AdminStatsController { | ||
|
||
private final PostStatsService postStatsService; | ||
|
||
@LogExecution | ||
@GetMapping("/admin/stats") | ||
public String getPostStats(Model model) { | ||
// 서비스에서 데이터 조회 | ||
Map<String, Object> statsData = postStatsService.getPostStats(); | ||
|
||
// 모델에 데이터 추가 | ||
model.addAttribute("posts", statsData.get("posts")); | ||
model.addAttribute("labelsByPostId", statsData.get("labelsByPostId")); | ||
model.addAttribute("hitsDataByPostId", statsData.get("hitsDataByPostId")); | ||
model.addAttribute("likeDataByPostId", statsData.get("likeDataByPostId")); | ||
model.addAttribute("todayHitsByPostId", statsData.get("todayHitsByPostId")); | ||
model.addAttribute("todayLikesByPostId", statsData.get("todayLikesByPostId")); | ||
|
||
return "adminStats"; // Thymeleaf 템플릿 이름 | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 되면 env에 있는 WEBSITE_DOMAIN이랑 API_DOMAIN을 사용하지 않으시는 것 같은데 comment에 추가해주셨으면 좋겠습니다