Skip to content

Commit

Permalink
[BE] FIX: Redis to DB coin 임시 메서드 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
enaenen committed Jul 2, 2024
1 parent 99e60d9 commit 663a1e5
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 39 deletions.
19 changes: 0 additions & 19 deletions backend/src/main/java/org/ftclub/cabinet/ping/PingController.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package org.ftclub.cabinet.ping;

import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.ftclub.cabinet.auth.domain.AuthGuard;
import org.ftclub.cabinet.auth.domain.AuthLevel;
import org.ftclub.cabinet.item.service.ItemCommandService;
import org.ftclub.cabinet.item.service.ItemRedisService;
import org.ftclub.cabinet.lent.service.LentFacadeService;
import org.ftclub.cabinet.user.domain.User;
import org.ftclub.cabinet.user.service.LentExtensionManager;
import org.ftclub.cabinet.user.service.UserCommandService;
import org.ftclub.cabinet.user.service.UserQueryService;
Expand Down Expand Up @@ -55,21 +53,4 @@ public String ok() {
lentExtensionManager.issueLentExtension();
return "ok";
}

/**
* 임시 메소드 (Redis to DB coin update)
*
* @return
*/
@GetMapping("/item")
@AuthGuard(level = AuthLevel.ADMIN_ONLY)
public String ok2() {
List<User> allUsers = userQueryService.findAllUsers();
allUsers.stream().map(User::getId).forEach(userId -> {
long coinAmount = itemRedisService.getCoinAmount(userId);
userCommandService.overwriteCoinAmount(userId, coinAmount);
});
return "ok";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,4 @@ public void addCoin(Long reward) {
this.coin += reward;
}

/**
* 임시 메소드
*/
public void setCoin(Long coin) {
this.coin = coin;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,4 @@ public void updateCoinAmount(Long userId, Long reward) {
.orElseThrow(ExceptionStatus.NOT_FOUND_USER::asServiceException);
user.addCoin(reward);
}

/**
* 임시 메소드
*/
public void overwriteCoinAmount(Long userId, Long coin) {
User user = userRepository.findById(userId)
.orElseThrow(ExceptionStatus.NOT_FOUND_USER::asServiceException);
user.setCoin(coin);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,4 @@ public List<User> findAllUsersByNames(List<String> userNames) {
}


public List<User> findAllUsers() {
return userRepository.findAllDeletedAtIsNull();
}

}

0 comments on commit 663a1e5

Please sign in to comment.