-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REFACTOR] fortuneId -> fortuneWordId로 네이밍 변경 및 자잘한 리팩토링 (#393)
- Loading branch information
Showing
6 changed files
with
55 additions
and
57 deletions.
There are no files selected for viewing
37 changes: 0 additions & 37 deletions
37
src/main/java/org/sopt/app/application/fortune/FortuneGenerator.java
This file was deleted.
Oops, something went wrong.
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
20 changes: 20 additions & 0 deletions
20
src/main/java/org/sopt/app/application/fortune/FortuneWordIdGenerator.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,20 @@ | ||
package org.sopt.app.application.fortune; | ||
|
||
import java.util.List; | ||
import java.util.Random; | ||
import lombok.RequiredArgsConstructor; | ||
import org.sopt.app.interfaces.postgres.fortune.FortuneWordRepository; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class FortuneWordIdGenerator { | ||
|
||
private final FortuneWordRepository fortuneWordRepository; | ||
private final Random random = new Random(); | ||
|
||
public Long generateRandomFortuneWordId() { | ||
List<Long> fortuneWordIds = fortuneWordRepository.findAllIds(); | ||
return fortuneWordIds.get(random.nextInt(fortuneWordIds.size())); | ||
} | ||
} |
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