Class CommisionController

java.lang.Object
com.plannaplan.controllers.TokenBasedController
com.plannaplan.controllers.CommisionController

@RestController
@CrossOrigin
@RequestMapping("/api/v1/commisions")
public class CommisionController
extends TokenBasedController
Rest controller to Commision and Assignment related endpoints. More detailed api docs is available via swagger
  • Constructor Details

    • CommisionController

      public CommisionController()
  • Method Details

    • addCommision

      @PostMapping({"/user","/user/{id}"}) public org.springframework.http.ResponseEntity<java.lang.String> addCommision​(@RequestBody java.util.List<java.lang.Long> groups, @PathVariable(name="id",required=false) java.lang.Long userId)
      Parameters:
      groups - to make assignmetns
      userId - user to assign to groups
      Returns:
      was operations success
    • getAlCommisions

      @GetMapping("/user") public org.springframework.http.ResponseEntity<java.util.List<? extends CommisionResponse>> getAlCommisions​(@RequestParam(name="groups",defaultValue="false") java.lang.Boolean groups, @RequestParam(name="extraInfo",defaultValue="false") java.lang.Boolean extraInfo) throws com.plannaplan.exceptions.UserNotFoundException
      Parameters:
      groups - should include groups list in response
      Returns:
      list of user all commisions (history of schedules)
      Throws:
      com.plannaplan.exceptions.UserNotFoundException - if user was found
    • getAllAssignmets

      @GetMapping("/user/assignments") public org.springframework.http.ResponseEntity<java.util.List<AssignmentDetailedResponse>> getAllAssignmets() throws com.plannaplan.exceptions.UserNotFoundException
      Returns:
      list of user latests assignmets
      Throws:
      com.plannaplan.exceptions.UserNotFoundException - if user was not found bny token
    • getCurrentAssignments

      @GetMapping("/user/schedule") public org.springframework.http.ResponseEntity<java.util.List<AssignmentResponse>> getCurrentAssignments() throws java.lang.Exception
      Returns:
      current schedule of user indenified via token
      Throws:
      java.lang.Exception - if incorrect role was trying to see self schedule (for example DEANERY don't have a schedule)
    • getCommision

      @PreAuthorize("hasRole(\'ROLE_DEANERY\')") @GetMapping("/user/{id}") public org.springframework.http.ResponseEntity<java.util.List<? extends CommisionResponse>> getCommision​(@PathVariable(name="id") java.lang.Long userId, @RequestParam(name="groups",defaultValue="false") java.lang.Boolean groups) throws com.plannaplan.exceptions.UserNotFoundException
      Parameters:
      userId - user id in db
      groups - should commision include assigned groups list
      Returns:
      list of commisions for given user
      Throws:
      com.plannaplan.exceptions.UserNotFoundException
    • getCurrentAssignmentsDeanery

      @PreAuthorize("hasRole(\'ROLE_DEANERY\')") @GetMapping("/user/{id}/schedule") public org.springframework.http.ResponseEntity<java.util.List<AssignmentResponse>> getCurrentAssignmentsDeanery​(@PathVariable(name="id") java.lang.Long userId) throws java.lang.Exception
      Parameters:
      userId - schedule to display owner
      Returns:
      user's schedule
      Throws:
      java.lang.Exception - if incorrect access atempt occured
    • getFile

      @GetMapping("/export/csv") @PreAuthorize("hasRole(\'ROLE_ADMIN\')") public void getFile​(javax.servlet.http.HttpServletResponse response)
      Parameters:
      response - spring response to set headers