Class UCSBOrganizationController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBOrganizationController
@RequestMapping("/api/ucsborganization")
@RestController
public class UCSBOrganizationController
extends ApiController
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionallOrgs()THis method returns a list of all ucsborganizations.deleteOrganization(String orgCode) Delete a organization.This method returns a single diningcommons.This method creates a new organization.updateOrganization(String orgCode, @Valid UCSBOrganization incoming) Update a single organization.Methods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException 
- 
Constructor Details
- 
UCSBOrganizationController
public UCSBOrganizationController() 
 - 
 - 
Method Details
- 
allOrgs
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBOrganization> allOrgs()THis method returns a list of all ucsborganizations.- Returns:
 - a list of all ucsborganizations
 
 - 
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrganization getById(@RequestParam String orgCode) This method returns a single diningcommons.- Parameters:
 orgCode- orgCode of the diningcommons- Returns:
 - a single diningcommons
 
 - 
postOrgs
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBOrganization postOrgs(@RequestParam String orgCode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive) This method creates a new organization. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
 orgCode- code of the organizationorgTranslationShort- shortened translation of org nameorgTranslation- full org nameinactive- whether the org is active or not- Returns:
 - the saved organization
 
 - 
deleteOrganization
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteOrganization(@RequestParam String orgCode) Delete a organization. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
 orgCode- orgCode of the commons- Returns:
 - a message indiciating the organization was deleted
 
 - 
updateOrganization
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBOrganization updateOrganization(@RequestParam String orgCode, @RequestBody @Valid @Valid UCSBOrganization incoming) Update a single organization. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
 orgCode- code of the organizationincoming- the new organization contents- Returns:
 - the updated organization object
 
 
 -