Package idatt2106.group3.backend.Web
Class ActivityController
- java.lang.Object
-
- idatt2106.group3.backend.Web.ActivityController
-
@RestController @RequestMapping("/api/v1/activities") public class ActivityController extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ActivityController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<UserDTO>
addUserToActivity(long activityId, long userId)
org.springframework.http.ResponseEntity<ActivityDTO>
createActivity(ActivityRegistrationDTO activity)
org.springframework.http.ResponseEntity<java.lang.String>
deleteActivity(long activityId)
org.springframework.http.ResponseEntity<java.util.Set<java.lang.Long>>
editAbsence(long activityId, AbsenceDTO absenceDTO)
org.springframework.http.ResponseEntity<ActivityDTO>
editActivity(long activityId, ActivityRegistrationDTO activityRegDTO)
org.springframework.http.ResponseEntity<java.util.List<ActivityDTO>>
getActivities()
org.springframework.http.ResponseEntity<java.util.List<ActivityDTO>>
getActivitiesWithFilterAndSorting(SortFilterQueryDTO filter)
org.springframework.http.ResponseEntity<ActivityDTO>
getActivity(long activityId)
org.springframework.http.ResponseEntity<Chat>
getActivityChat(long activityId)
org.springframework.http.ResponseEntity<java.util.List<UserNameDTO>>
getUsersOfActivity(long activityId)
org.springframework.http.ResponseEntity<java.lang.Boolean>
isOrganizerOfActivity(long activityId, long userId)
org.springframework.http.ResponseEntity<java.lang.Boolean>
isUserParticipantOfActivity(long activityId, long userId)
-
-
-
Method Detail
-
getActivity
@GetMapping("/{activity_id}") public org.springframework.http.ResponseEntity<ActivityDTO> getActivity(@PathVariable("activity_id") long activityId)
-
getActivities
@GetMapping public org.springframework.http.ResponseEntity<java.util.List<ActivityDTO>> getActivities()
-
getActivitiesWithFilterAndSorting
@PostMapping("/alternatives") public org.springframework.http.ResponseEntity<java.util.List<ActivityDTO>> getActivitiesWithFilterAndSorting(@RequestBody SortFilterQueryDTO filter)
-
createActivity
@PostMapping public org.springframework.http.ResponseEntity<ActivityDTO> createActivity(@RequestBody ActivityRegistrationDTO activity)
-
editActivity
@PutMapping("/{activity_id}") @PreAuthorize("@activityService.checkIfOrganizerOfActivity(#activityId, principal.userId)") public org.springframework.http.ResponseEntity<ActivityDTO> editActivity(@PathVariable("activity_id") long activityId, @RequestBody ActivityRegistrationDTO activityRegDTO)
-
deleteActivity
@DeleteMapping("/{activity_id}") @PreAuthorize("@activityService.checkIfOrganizerOfActivity(#activityId, principal.userId)") public org.springframework.http.ResponseEntity<java.lang.String> deleteActivity(@PathVariable("activity_id") long activityId)
-
addUserToActivity
@PostMapping("/{activity_id}/users/{user_id}") @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')") public org.springframework.http.ResponseEntity<UserDTO> addUserToActivity(@PathVariable("activity_id") long activityId, @PathVariable("user_id") long userId)
-
isOrganizerOfActivity
@GetMapping("/{activity_id}/organizer/{user_id}") public org.springframework.http.ResponseEntity<java.lang.Boolean> isOrganizerOfActivity(@PathVariable("activity_id") long activityId, @PathVariable("user_id") long userId)
-
isUserParticipantOfActivity
@GetMapping("/{activity_id}/users/{user_id}") public org.springframework.http.ResponseEntity<java.lang.Boolean> isUserParticipantOfActivity(@PathVariable("activity_id") long activityId, @PathVariable("user_id") long userId)
-
getUsersOfActivity
@GetMapping("/{activity_id}/users") public org.springframework.http.ResponseEntity<java.util.List<UserNameDTO>> getUsersOfActivity(@PathVariable("activity_id") long activityId)
-
getActivityChat
@GetMapping("/{activity_id}/chat") public org.springframework.http.ResponseEntity<Chat> getActivityChat(@PathVariable("activity_id") long activityId)
-
editAbsence
@PostMapping("/{activity_id}/absences") @PreAuthorize("@activityService.checkIfOrganizerOfActivity(#activityId, principal.userId)") public org.springframework.http.ResponseEntity<java.util.Set<java.lang.Long>> editAbsence(@PathVariable("activity_id") long activityId, @RequestBody AbsenceDTO absenceDTO)
-
-