Ignore:
Timestamp:
01/24/22 21:08:32 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
76712b2
Parents:
bdd6491
Message:

signup/login server errors on front and remove location from planner

Location:
trip-planner/src/main/java/finki/diplomska/tripplanner/service
Files:
6 edited

Legend:

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

    rbdd6491 rb738035  
    2525    List<Location> getVillages();
    2626    List<Long> getAllLocationIdsForPlanner(Long plannerId);
     27    List<Location> getLocationsForCity(Long cityId);
    2728}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/service/PlannerService.java

    rbdd6491 rb738035  
    44import finki.diplomska.tripplanner.models.Planner;
    55import finki.diplomska.tripplanner.models.dto.PlannerDto;
     6import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
     7import org.springframework.http.ResponseEntity;
    68
    79import java.util.List;
     
    1820        Optional<Planner> newPlanner(PlannerDto plannerDto, String username);
    1921        void deletePlannerById(Long id);
    20         void deleteLocationFromPlanner(Long locationId);
     22        ResponseEntity deleteLocationFromPlanner(PlannerLocationDto plannerLocationDto);
    2123}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/service/UserService.java

    rbdd6491 rb738035  
    44import finki.diplomska.tripplanner.models.dto.UserDto;
    55
     6import java.util.List;
    67import java.util.Optional;
    78
     
    1011
    1112    User saveUser (User user);
    12 
     13    List<String> getAllUsernames();
     14    Optional<String> getPassword(UserDto userDto);
     15    Optional<User> findById(Long id);
    1316}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/LocationServiceImpl.java

    rbdd6491 rb738035  
    183183        return this.locationRepository.getAllLocationIdsForPlanner(plannerId);
    184184    }
     185
     186    @Override
     187    public List<Location> getLocationsForCity(Long cityId) {
     188        return this.locationRepository.getLocationsForCity(cityId);
     189    }
    185190}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/PlannerServiceImpl.java

    rbdd6491 rb738035  
    55import finki.diplomska.tripplanner.models.User;
    66import finki.diplomska.tripplanner.models.dto.PlannerDto;
     7import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
    78import finki.diplomska.tripplanner.models.exceptions.LocationNotFoundException;
    89import finki.diplomska.tripplanner.models.exceptions.PlannerNotFoundException;
     
    1112import finki.diplomska.tripplanner.repository.jpa.JpaUserRepository;
    1213import finki.diplomska.tripplanner.service.PlannerService;
     14import org.springframework.http.ResponseEntity;
    1315import org.springframework.stereotype.Service;
    1416
     
    6769
    6870    @Override
    69     public void deleteLocationFromPlanner(Long locationId) {
    70         this.plannerRepository.deleteLocationFromPlanner(locationId);
     71    public ResponseEntity deleteLocationFromPlanner(PlannerLocationDto plannerLocationDto) {
     72        plannerRepository.deleteLocationFromPlanner(plannerLocationDto.getPlannerId(), plannerLocationDto.getLocationId());
     73        return null;
    7174    }
    7275
  • trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/UserServiceImpl.java

    rbdd6491 rb738035  
    77import finki.diplomska.tripplanner.service.UserService;
    88import org.springframework.beans.factory.annotation.Autowired;
     9import org.springframework.http.ResponseEntity;
    910import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
    1011import org.springframework.stereotype.Service;
    1112
     13import java.util.List;
    1214import java.util.Optional;
    1315
     
    3436            throw new UsernameAlreadyExistsException("Username '"+newUser.getUsername()+ "' already exists");
    3537        }
     38    }
    3639
     40    @Override
     41    public List<String> getAllUsernames() {
     42        return this.userRepository.getAllUsernames();
     43    }
     44
     45    @Override
     46    public Optional<String> getPassword(UserDto userDto) {
     47         this.userRepository.getPassword(userDto.getUsername());
     48         return null;
     49    }
     50
     51    @Override
     52    public Optional<User> findById(Long id) {
     53        return this.userRepository.findById(id);
    3754    }
    3855
Note: See TracChangeset for help on using the changeset viewer.