Class CommissionController
- java.lang.Object
-
- edu.cnm.deepdive.albuquirky.controller.CommissionController
-
@RestController @RequestMapping("/commissions") @ExposesResourceFor(Commission.class) public class CommissionController extends ObjectThe CommissionController class is theRestControllerthat maps the endpoints of "/commissions" for the communication between the server-side and client-side forCommission.
-
-
Constructor Summary
Constructors Constructor Description CommissionController(CommissionService commissionService)Constructs the instance of CommissionService object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<Long>deleteCommission(long commissionId, Commission commission, Profile profile)The Delete method that returns a response entity indicating success or failure.CommissiongetCommission(long commissionId)The Get method that returns the commission by commission idStringgetCommissionRequest(long commissionId)The Get method that returns the commission request by commission idList<Commission>getCommissionsWhereCommissioner(org.springframework.security.core.Authentication auth)The Get method which returns a list of commission from commissioner(buyer)List<Commission>getCommissionsWhereSeller(org.springframework.security.core.Authentication auth)The Get method which returns a list of commission from sellerCommissionpost(Commission commission, org.springframework.security.core.Authentication auth)The Post method for creating a new commission.StringupdateCommissionRequest(String request, long commissionId)The Put method which allows update to the commission request
-
-
-
Constructor Detail
-
CommissionController
public CommissionController(CommissionService commissionService)
Constructs the instance of CommissionService object- Parameters:
commissionService- TheCommissionServiceto 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
ListofCommissionobjects 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
ListofCommissionobjects 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- TheCommissionto be created.auth- The authorization for the user.- Returns:
- The
Commissionobject 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 theCommission.- Returns:
- The matching
Commissionobject.
-
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 theCommissionto be deleted.profile- The userProfile.- Returns:
- A
ResponseEntityindicating 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 theCommission.- Returns:
- The matching
Commissionobject.
-
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 theCommissionrequest.commissionId- The ID of theCommission.- Returns:
- The updated
Commissionrequest field content.
-
-