Ignore:
Timestamp:
11/11/21 12:59:26 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
59329aa
Parents:
6c1585f
Message:

add location to planner

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/PlannerServiceImpl.java

    r6c1585f rceaed42  
    2222    private final JpaPlannerRepository plannerRepository;
    2323    private final JpaLocationRepository locationRepository;
    24     private final LocationService locationService;
    2524
    26     public PlannerServiceImpl(JpaPlannerRepository plannerRepository, JpaLocationRepository locationRepository, LocationService locationService) {
     25    public PlannerServiceImpl(JpaPlannerRepository plannerRepository, JpaLocationRepository locationRepository) {
    2726        this.plannerRepository = plannerRepository;
    2827        this.locationRepository = locationRepository;
    29         this.locationService = locationService;
    3028    }
    3129
     
    4038    }
    4139
    42     @Override
    43     public Planner addLocationToPlanner(Long plannerId, Long locationId) {
    44         Location location = this.locationService.findById(locationId)
    45                 .orElseThrow(() -> new LocationNotFoundException(locationId));
    46         Planner planner = this.plannerRepository.getById(plannerId);
    47         planner.getLocationList().add(location);
    48         return this.plannerRepository.save(planner);
    49     }
    5040
    5141    @Override
     
    8474        planner.setName(plannerDto.getName());
    8575        planner.setDescription(plannerDto.getDescription());
    86 
     76/*
    8777        List<Location> locationList  = new ArrayList<>();
    8878        for(Long location : plannerDto.getLocationList()){
     
    9282        }
    9383        planner.setLocationList(locationList);
     84
     85 */
    9486        return Optional.of(this.plannerRepository.save(planner));
    9587    }
Note: See TracChangeset for help on using the changeset viewer.