Package restapi.controllers
Class LocationController
java.lang.Object
restapi.controllers.LocationController
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull ContactService
private final @NonNull DateService
private final @NonNull LocationService
private final Logger
private final @NonNull org.springframework.messaging.simp.SimpMessagingTemplate
private final @NonNull UserService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
updateLocation
(LocationDTO locationDTO) Updates user's location on the system and sends notification to all users involved in a match.void
updateLocationAsync
(LoggedUser user, double latitude, double longitude) Update location of user and search for contacts nearby.void
updateLocationSync
(LoggedUser user, List<? extends Map<String, Double>> body) Updates user's location on the system and sends notification to all users involved in a match.
-
Field Details
-
messagingTemplate
@NonNull private final @NonNull org.springframework.messaging.simp.SimpMessagingTemplate messagingTemplate -
locationService
-
contactService
-
userService
-
dateService
-
logger
-
-
Constructor Details
-
LocationController
public LocationController()
-
-
Method Details
-
updateLocation
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 tokenlatitude
- Location latitude of user in gradeslongitude
- 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 tokenbody
- Contains Location in form of json: {lat: latitude, lon: longitude}
-