diff --git a/backend/src/main/java/com/spaceme/collection/service/CollectionService.java b/backend/src/main/java/com/spaceme/collection/service/CollectionService.java index 1a39eb4..9e184fa 100644 --- a/backend/src/main/java/com/spaceme/collection/service/CollectionService.java +++ b/backend/src/main/java/com/spaceme/collection/service/CollectionService.java @@ -56,7 +56,8 @@ private List getPlanetThemeResponses(Long galaxyThemeId, Ma private ThemeStatus determineStatus(Status status) { return switch (status) { case CLEAR -> ACQUIRED; - case SOON, FAILED, ACQUIRABLE, ON_PROGRESS -> DISCOVERED; + case FAILED, ACQUIRABLE, ON_PROGRESS -> DISCOVERED; + case SOON -> HIDDEN; }; } } diff --git a/backend/src/main/java/com/spaceme/planet/controller/PlanetController.java b/backend/src/main/java/com/spaceme/planet/controller/PlanetController.java index 9ba0a56..35de49b 100644 --- a/backend/src/main/java/com/spaceme/planet/controller/PlanetController.java +++ b/backend/src/main/java/com/spaceme/planet/controller/PlanetController.java @@ -33,4 +33,9 @@ public ResponseEntity acquirePlanet( ) { return ResponseEntity.ok(planetService.acquirePlanet(userId, planetId)); } + + @PutMapping("/test/{planetId}") + public void updatePlanetAndMissions(@PathVariable Long planetId) { + planetService.updatePlanetAndMissions(planetId); + } } \ No newline at end of file diff --git a/backend/src/main/java/com/spaceme/planet/service/PlanetService.java b/backend/src/main/java/com/spaceme/planet/service/PlanetService.java index 3b0df2d..5ffcad8 100644 --- a/backend/src/main/java/com/spaceme/planet/service/PlanetService.java +++ b/backend/src/main/java/com/spaceme/planet/service/PlanetService.java @@ -1,9 +1,11 @@ package com.spaceme.planet.service; import com.spaceme.collection.service.DynamicProbabilityGenerator; +import com.spaceme.common.domain.Status; import com.spaceme.common.exception.BadRequestException; import com.spaceme.common.exception.ForbiddenException; import com.spaceme.common.exception.NotFoundException; +import com.spaceme.mission.domain.Mission; import com.spaceme.mission.repository.MissionRepository; import com.spaceme.mission.service.MissionService; import com.spaceme.planet.domain.Planet; @@ -101,4 +103,15 @@ public void validatePlanet(Long userId, Long planetId) { .filter(Boolean::booleanValue) .orElseThrow(() -> new ForbiddenException("접근 권한이 없습니다.")); } + + @Transactional + public void updatePlanetAndMissions(Long planetId) { + + Planet planet = planetRepository.findById(planetId) + .orElseThrow(() -> new NotFoundException("행성을 찾을 수 없습니다.")); + + List missions = missionRepository.findAllByPlanetId(planet.getId()); + missions.forEach(mission -> mission.updateStatus(Status.CLEAR)); + planet.updateStatus(Status.ACQUIRABLE); + } }