Class LocationController

java.lang.Object
restapi.controllers.LocationController

@RestController public class LocationController extends Object
  • Field Details

    • messagingTemplate

      @NonNull private final @NonNull org.springframework.messaging.simp.SimpMessagingTemplate messagingTemplate
    • locationService

      @NonNull private final @NonNull LocationService locationService
    • contactService

      @NonNull private final @NonNull ContactService contactService
    • userService

      @NonNull private final @NonNull UserService userService
    • dateService

      @NonNull private final @NonNull DateService dateService
    • logger

      private final Logger logger
  • Constructor Details

    • LocationController

      public LocationController()
  • Method Details

    • updateLocation

      public void updateLocation(@RequestParam LocationDTO locationDTO)
      Updates user's location on the system and sends notification to all users involved in a match.
      Parameters:
      locationDTO - requested param with new location of the logged user
    • updateLocationAsync

      @PutMapping("/location/update") public void updateLocationAsync(@AuthenticationPrincipal LoggedUser user, @RequestParam double latitude, @RequestParam double longitude)
      Update location of user and search for contacts nearby. Then it sends a message with the match to both users through websocket. endpoint /location/update (PUT)
      Parameters:
      user - Authenticated LoggedUser from token
      latitude - Location latitude of user in grades
      longitude - Location longitude of user in grades
    • updateLocationSync

      @PostMapping("/location/update") public void updateLocationSync(@AuthenticationPrincipal LoggedUser user, @RequestBody List<? extends Map<String,Double>> body)
      Updates user's location on the system and sends notification to all users involved in a match. Meant for location update on background. endpoint /location/update (POST)
      Parameters:
      user - Authenticated LoggedUser from token
      body - Contains Location in form of json: {lat: latitude, lon: longitude}