Class UCSBOrganizationsController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBOrganizationsController
@RequestMapping("/api/ucsborganizations")
@RestController
public class UCSBOrganizationsController
extends ApiController
This is a REST controller for UCSBOrganizations
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionTHis method returns a list of all ucsborganizations.deleteOrganizations
(String orgcode) Delete a diningcommons.This method returns a single UCSBOrganizations.postOrganizations
(String orgcode, String orgTranslationShort, String orgTranslation, boolean inactive) This method creates a new UCSBOrganizations.updateOrganizations
(String orgcode, @Valid UCSBOrganizations incoming) Update a single diningcommons.Methods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBOrganizationsController
public UCSBOrganizationsController()
-
-
Method Details
-
allOrganizations
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBOrganizations> allOrganizations()THis method returns a list of all ucsborganizations.- Returns:
- a list of all ucsborganizations
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrganizations getById(@RequestParam String orgcode) This method returns a single UCSBOrganizations.- Parameters:
orgcode
- orgcode of the UCSBOrganizations- Returns:
- a single UCSBOrganizations
-
postOrganizations
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBOrganizations postOrganizations(@RequestParam String orgcode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive) This method creates a new UCSBOrganizations. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
orgcode
- orgcode of the UCSBOrganizationsorgTranslationShort
- orgTranslationShort of the UCSBOrganizationsorgTranslation
- orgTranslation of the UCSBOrganizationsinactive
- whether or not the UCSBOrganizations are inactive
-
deleteOrganizations
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteOrganizations(@RequestParam String orgcode) Delete a diningcommons. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
orgcode
- code of the commons- Returns:
- a message indiciating the commons was deleted
-
updateOrganizations
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBOrganizations updateOrganizations(@RequestParam String orgcode, @RequestBody @Valid @Valid UCSBOrganizations incoming) Update a single diningcommons. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
orgcode
- code of the diningcommonsincoming
- the new commons contents- Returns:
- the updated commons object
-