Package com.unosquare.carmigo.controller
Class PassengerController
java.lang.Object
com.unosquare.carmigo.controller.PassengerController
Handles Passenger APIs.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<PassengerResponse>
Enables logged-in users to create a passenger's profile.org.springframework.http.ResponseEntity<PassengerResponse>
createPassengerById
(int passengerId) Enables logged-in admin users to create a passenger's profile for another user.org.springframework.http.ResponseEntity<?>
Enables logged-in user's to delete their passenger's profile.org.springframework.http.ResponseEntity<?>
deletePassengerById
(int passengerId) Enables logged-in admin users to delete a passenger's profile.org.springframework.http.ResponseEntity<PassengerResponse>
Enables logged-in users to see their passenger's profiles.org.springframework.http.ResponseEntity<PassengerResponse>
getPassengerById
(int passengerId) Enables logged-in admin users to see other passenger's profiles.
-
Constructor Details
-
PassengerController
public PassengerController()
-
-
Method Details
-
createPassenger
@PostMapping(value="/create", produces="application/json") @PreAuthorize("hasAuthority(\'ACTIVE\') or hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<PassengerResponse> createPassenger()Enables logged-in users to create a passenger's profile.- Returns:
- Response body as
PassengerResponse
.
-
createPassengerById
@PostMapping(value="/{passengerId}", produces="application/json") @PreAuthorize("hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<PassengerResponse> createPassengerById(@PathVariable int passengerId) Enables logged-in admin users to create a passenger's profile for another user.- Parameters:
passengerId
- the user to become a passenger.- Returns:
- Response body as
PassengerResponse
.
-
getCurrentPassengerProfile
@GetMapping(value="/profile", produces="application/json") @PreAuthorize("hasAuthority(\'ACTIVE\') or hasAuthority(\'SUSPENDED\') or hasAuthority(\'ADMIN\') or hasAuthority(\'DEV\')") public org.springframework.http.ResponseEntity<PassengerResponse> getCurrentPassengerProfile()Enables logged-in users to see their passenger's profiles.- Returns:
- Response body as
PassengerResponse
.
-
getPassengerById
@GetMapping(value="/{passengerId}", produces="application/json") @PreAuthorize("hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<PassengerResponse> getPassengerById(@PathVariable int passengerId) Enables logged-in admin users to see other passenger's profiles.- Parameters:
passengerId
- the passenger's id.- Returns:
- Response body as
PassengerResponse
.
-
deleteCurrentPassenger
@DeleteMapping @PreAuthorize("hasAuthority(\'ACTIVE\') or hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<?> deleteCurrentPassenger()Enables logged-in user's to delete their passenger's profile.- Returns:
- an empty body.
-
deletePassengerById
@DeleteMapping("/{passengerId}") @PreAuthorize("hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<?> deletePassengerById(@PathVariable int passengerId) Enables logged-in admin users to delete a passenger's profile.- Parameters:
passengerId
- the user to become a passenger.- Returns:
- an empty body.
-