Class UCSBOrganizationController
java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBOrganizationController
@RequestMapping("/api/ucsborganizations")
@RestController
public class UCSBOrganizationController
extends ApiController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns all UCSB organizations.deleteOrganization(String orgCode) Delete a UCSB organization.This method returns a single UCSB organization.postOrganization(String orgCode, String orgTranslationShort, String orgTranslation, boolean inactive) Creates a UCSB organization.updateOrganization(String orgCode, @Valid UCSBOrganization incoming) Update a single UCSB organization.Methods inherited from class ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBOrganizationController
public UCSBOrganizationController()
-
-
Method Details
-
allOrganizations
@PreAuthorize("hasRole('ROLE_USER')") @GetMapping("/all") public Iterable<UCSBOrganization> allOrganizations()Returns all UCSB organizations.- Returns:
- all organization records
-
getById
@PreAuthorize("hasRole('ROLE_USER')") @GetMapping("") public UCSBOrganization getById(@RequestParam String orgCode) This method returns a single UCSB organization.- Parameters:
orgCode- code of the organization- Returns:
- a single UCSB organization
-
postOrganization
@PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping("/post") public UCSBOrganization postOrganization(@RequestParam String orgCode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive) Creates a UCSB organization. Accessible only to administrators.- Parameters:
orgCode- unique organization codeorgTranslationShort- short organization nameorgTranslation- full organization nameinactive- whether the organization is inactive- Returns:
- the saved organization
-
updateOrganization
@PreAuthorize("hasRole('ROLE_ADMIN')") @PutMapping("") public UCSBOrganization updateOrganization(@RequestParam String orgCode, @RequestBody @Valid @Valid UCSBOrganization incoming) Update a single UCSB organization. Accessible only to administrators.- Parameters:
orgCode- code of the organizationincoming- the new organization contents- Returns:
- the updated organization
-
deleteOrganization
-