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
This is a REST controller for UCSBOrganization
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallorgss()THis method returns a list of all UCSBOrganization.postOrganization(String orgCode, String orgTranslationShort, String orgTranslation, boolean inactive) This method creates a new diningorgs.Methods inherited from class ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBOrganizationController
public UCSBOrganizationController()
-
-
Method Details
-
allorgss
@PreAuthorize("hasRole('ROLE_USER')") @GetMapping("/all") public Iterable<UCSBOrganization> allorgss()THis method returns a list of all UCSBOrganization.- Returns:
- a list of all UCSBOrganizations
-
postOrganization
@PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping("/post") public UCSBOrganization postOrganization(@RequestParam String orgCode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive) This method creates a new diningorgs. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
orgCode- code of the organization (e.g. ZPR)orgTranslationShort- short name of the organizationorgTranslation- full name of the organizationinactive- whether or not the organization is inactive- Returns:
- the saved organization
-