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/repository/jpa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaLocationRepository.java

    rbdd6491 rb738035  
    109109    List<Location> getVillages();
    110110
     111    @Query(value = "SELECT * FROM locations AS l WHERE l.id_city = :cityId", nativeQuery = true)
     112    List<Location> getLocationsForCity(@Param("cityId") Long cityId);
    111113}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaPlannerRepository.java

    rbdd6491 rb738035  
    1616        List<Planner> getPlannersByUser(@Param("username") String username );
    1717
    18         @Query(value = "delete from planners_contain WHERE planners_contain.id_location = :locationId", nativeQuery = true)
    19         void deleteLocationFromPlanner(@Param("locationId") Long locationId);
     18        @Query(value = "DELETE planners_contain " +
     19                "FROM planners_contain " +
     20                "JOIN planners ON planners_contain.id_planner = planners.id_planner " +
     21                "JOIN locations ON planners_contain.id_location = locations.id_location " +
     22                "WHERE planners_contain.id_planner = :plannerId AND planners_contain.id_location = :locationId", nativeQuery = true)
     23        void deleteLocationFromPlanner(@Param("plannerId") Long plannerId, @Param("locationId") Long locationId);
    2024}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaUserRepository.java

    rbdd6491 rb738035  
    22
    33import finki.diplomska.tripplanner.models.User;
     4import org.springframework.data.jpa.repository.Query;
    45import org.springframework.data.repository.CrudRepository;
     6import org.springframework.data.repository.query.Param;
    57import org.springframework.stereotype.Repository;
     8
     9import java.util.List;
     10import java.util.Optional;
    611
    712@Repository
     
    914    User findByUsername(String username);
    1015    User getById(Long id);
     16
     17    @Query(value = "SELECT u.username FROM users AS u", nativeQuery = true)
     18    List<String> getAllUsernames();
     19
     20    @Query(value = "SELECT u.password FROM users AS u WHERE u.username LIKE :username ", nativeQuery = true)
     21    Optional<String> getPassword(@Param("username") String username);
     22
    1123}
Note: See TracChangeset for help on using the changeset viewer.