Skip to content

Commit

Permalink
[refac] divide method
Browse files Browse the repository at this point in the history
  • Loading branch information
kgy1008 committed Jul 16, 2024
1 parent b0478ba commit 120b83b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ public void validateDuplicatedStore(final StoreValidationCommand command) {
}

private void findUniversityStore(final Long universityId, final Store store) {
if (universityStoreFinder.findByUniversityIdAndStore(universityId, store)) {
if (isExistedUniversityStore(universityId, store)) {
throw new ConflictException(StoreErrorCode.STORE_ALREADY_REGISTERED);
}
}

private boolean isExistedUniversityStore(final Long universityId, final Store store) {
return universityStoreFinder.existsByUniversityIdAndStore(universityId, store);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class UniversityStoreFinder {

private final UniversityStoreRepository universityStoreRepository;

protected boolean findByUniversityIdAndStore(final Long universityId, final Store store) {
protected boolean existsByUniversityIdAndStore(final Long universityId, final Store store) {
return universityStoreRepository.existsByUniversityIdAndStore(universityId, store);
}
}

0 comments on commit 120b83b

Please sign in to comment.