Skip to content

Commit

Permalink
feat : (Admin)existsByRouteId로 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyaak committed Aug 29, 2024
1 parent 6734a9d commit b4f431d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ public interface CollectBusRouteRepository extends JpaRepository<CollectBusRoute
@Transactional
@Query("delete from collect_bus_route c where c.route.id = :routeId")
void deleteByRouteId(@Param("routeId") Long routeId);

boolean existsByRouteId(Long routeId);
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class CollectBusRouteService {
public CollectBusRouteRespDto createCollectBusRoute(CollectBusRouteCreateDto dto) throws
CollectBusRouteNotFoundException,
CollectBusRouteAlreadyExistsException {
if (collectBusRouteRepository.findByRouteId(dto.routeId()).isPresent()) {
if (collectBusRouteRepository.existsByRouteId(dto.routeId())) {
throw new CollectBusRouteAlreadyExistsException();
}
BusRouteEntity route = busRouteRepository.findById(dto.routeId())
Expand Down

0 comments on commit b4f431d

Please sign in to comment.