Skip to content
Open
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 @@ -24,6 +24,16 @@ public AdminBadgeController(BadgeService badgeService) {
}


/**
* 뱃지 데이터 init
*/
@PostMapping("/upload-badge")
public ResponseEntity<String> triggerUpload() {
badgeService.uploadToS3();
return ResponseEntity.ok("Badge uploaded to S3 successfully.");
}


/**
* 뱃지 승인 요청 한 목록 조회
*/
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/goteego/badge/service/BadgeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,17 @@ public List<BadgeResponse> getBadgesByUserId(Long userId) {
return userBadges.stream().map(userBadge -> BadgeResponse.from(userBadge.getBadge())).toList();
}

/**
* 뱃지 데이터 생성 -> api호출
*/
public void uploadToS3() {
if (badgeRepository.count() == 0) {
createBadgeData();
}
}

/**
* 서비스가 제공하는 뱃지 데이터 생성
* 서비스가 제공하는 뱃지 데이터 생성 -> 서버 재시작 용
*/
@PostConstruct
public void initBadgeData() {
Expand Down