Package idatt2106.group3.backend.Web
Class UserController
- java.lang.Object
-
- idatt2106.group3.backend.Web.UserController
-
@RestController @RequestMapping("/api/v1/users") public class UserController extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description UserController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<UserRegistrationCallbackDTO>
createUser(UserWithPasswordDTO user)
org.springframework.http.ResponseEntity<java.lang.String>
deleteUser(long userId)
org.springframework.http.ResponseEntity<UserDTO>
editUser(long userId, UserEditDTO userEditDTO)
org.springframework.http.ResponseEntity<java.util.List<Activity>>
getFutureActivities(java.lang.Long userId)
org.springframework.http.ResponseEntity<java.util.List<Activity>>
getOrganizedActivities(java.lang.Long userId)
org.springframework.http.ResponseEntity<UserDTO>
getUser(long userId)
org.springframework.http.ResponseEntity<java.util.Set<Activity>>
getUserActivities(long userId)
org.springframework.http.ResponseEntity<java.lang.String>
removeUserFromActivity(long userId, long activityId)
-
-
-
Method Detail
-
getUser
@GetMapping("/{user_id}") @PreAuthorize("hasAnyRole(\'ROLE_USER\',\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<UserDTO> getUser(@PathVariable("user_id") long userId)
-
createUser
@PostMapping public org.springframework.http.ResponseEntity<UserRegistrationCallbackDTO> createUser(@RequestBody UserWithPasswordDTO user)
-
editUser
@PostMapping("/{user_id}") @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<UserDTO> editUser(@PathVariable("user_id") long userId, @RequestBody UserEditDTO userEditDTO)
-
deleteUser
@DeleteMapping("/{user_id}") @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<java.lang.String> deleteUser(@PathVariable("user_id") long userId)
-
getUserActivities
@GetMapping("/{user_id}/activities") @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<java.util.Set<Activity>> getUserActivities(@PathVariable("user_id") long userId)
-
removeUserFromActivity
@DeleteMapping("/{user_id}/activities/{activity_id}") @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<java.lang.String> removeUserFromActivity(@PathVariable("user_id") long userId, @PathVariable("activity_id") long activityId)
-
getFutureActivities
@GetMapping("/{user_id}/my-activities") @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<java.util.List<Activity>> getFutureActivities(@PathVariable("user_id") java.lang.Long userId)
-
getOrganizedActivities
@GetMapping("/{user_id}/organized-activities") @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<java.util.List<Activity>> getOrganizedActivities(@PathVariable("user_id") java.lang.Long userId)
-
-