Class ActivityController


  • @RestController
    @RequestMapping("/api/v1/activities")
    public class ActivityController
    extends java.lang.Object
    • Constructor Detail

      • ActivityController

        public ActivityController()
    • 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)
      • 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)