Class CommissionController


  • @RestController
    @RequestMapping("/commissions")
    @ExposesResourceFor(Commission.class)
    public class CommissionController
    extends Object
    The CommissionController class is the RestController that maps the endpoints of "/commissions" for the communication between the server-side and client-side for Commission.
    • Constructor Detail

      • CommissionController

        public CommissionController​(CommissionService commissionService)
        Constructs the instance of CommissionService object
        Parameters:
        commissionService - The CommissionService to initialize.
    • Method Detail

      • getCommissionsWhereSeller

        @GetMapping(value="/seller",
                    produces="application/json")
        public List<Commission> getCommissionsWhereSeller​(org.springframework.security.core.Authentication auth)
        The Get method which returns a list of commission from seller
        Parameters:
        auth - The authorization for the user.
        Returns:
        A List of Commission objects representing the user's waitlist.
      • getCommissionsWhereCommissioner

        @GetMapping(value="/buyer",
                    produces="application/json")
        public List<Commission> getCommissionsWhereCommissioner​(org.springframework.security.core.Authentication auth)
        The Get method which returns a list of commission from commissioner(buyer)
        Parameters:
        auth - The authorization for the user.
        Returns:
        A List of Commission objects representing those the user commissioned.
      • post

        @PostMapping(consumes={"application/json","text/plain"},
                     produces={"application/json","text/plain"})
        public Commission post​(@RequestBody
                               Commission commission,
                               org.springframework.security.core.Authentication auth)
        The Post method for creating a new commission.
        Parameters:
        commission - The Commission to be created.
        auth - The authorization for the user.
        Returns:
        The Commission object that was created.
      • getCommission

        @GetMapping(value="/{commissionId:\\d+}",
                    produces="application/json")
        public Commission getCommission​(@PathVariable
                                        long commissionId)
        The Get method that returns the commission by commission id
        Parameters:
        commissionId - The ID of the Commission.
        Returns:
        The matching Commission object.
      • deleteCommission

        @DeleteMapping(value="/{commissionId:\\d+}",
                       consumes="application/json")
        public org.springframework.http.ResponseEntity<Long> deleteCommission​(@PathVariable
                                                                              long commissionId,
                                                                              Commission commission,
                                                                              Profile profile)
        The Delete method that returns a response entity indicating success or failure.
        Parameters:
        commissionId - The ID of the Commission to be deleted.
        profile - The user Profile.
        Returns:
        A ResponseEntity indicating the status of the delete attempt.
      • getCommissionRequest

        @GetMapping(value="/{commissionId:\\d+}/commission-request",
                    produces="application/json")
        public String getCommissionRequest​(@PathVariable
                                           long commissionId)
        The Get method that returns the commission request by commission id
        Parameters:
        commissionId - The ID of the Commission.
        Returns:
        The matching Commission object.
      • updateCommissionRequest

        @PutMapping(value="/{commissionId:\\d+}/commission-request",
                    consumes={"application/json","text/plain"},
                    produces={"application/json","text/plain"})
        public String updateCommissionRequest​(@RequestBody
                                              String request,
                                              @PathVariable
                                              long commissionId)
        The Put method which allows update to the commission request
        Parameters:
        request - The String content of the Commission request.
        commissionId - The ID of the Commission.
        Returns:
        The updated Commission request field content.