File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/main/java/sopt/org/hmh/domain/app/service Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 77import sopt .org .hmh .domain .app .domain .exception .AppError ;
88import sopt .org .hmh .domain .app .domain .exception .AppException ;
99import sopt .org .hmh .domain .app .dto .request .ChallengeAppRequest ;
10- import sopt .org .hmh .domain .app .repository .ChallengeAppRepository ;
10+ import sopt .org .hmh .domain .app .repository .challenge_app . ChallengeAppRepository ;
1111import sopt .org .hmh .domain .challenge .domain .Challenge ;
1212
1313@ Service
@@ -18,7 +18,7 @@ public class ChallengeAppService {
1818
1919 public void removeApp (Challenge challenge , String appcode , String os ) {
2020 ChallengeApp appToRemove =
21- challengeAppRepository .findFirstByChallengeIdAndAppCodeAndOsOrElseThrow (challenge .getId (), appcode , os );
21+ this .findFirstByChallengeIdAndAppCodeAndOsOrElseThrow (challenge .getId (), appcode , os );
2222 challengeAppRepository .delete (appToRemove );
2323 }
2424
@@ -46,4 +46,9 @@ private void validateAppExist(ChallengeApp challengeApp) {
4646 throw new AppException (AppError .APP_EXIST_ALREADY );
4747 }
4848 }
49+
50+ private ChallengeApp findFirstByChallengeIdAndAppCodeAndOsOrElseThrow (Long challengeId , String appCode , String os ) {
51+ return challengeAppRepository .findFirstByChallengeIdAndAppCodeAndOs (challengeId , appCode , os )
52+ .orElseThrow (() -> new AppException (AppError .APP_NOT_FOUND ));
53+ }
4954}
You can’t perform that action at this time.
0 commit comments