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
-
Method Summary
Modifier and TypeMethodDescriptionTHis method returns a list of all ucsborgnization.deleteOrganizations
(String orgCode) Delete a organizations.This method returns a single organizations.postOrganizations
(String orgCode, String orgTranslationShort, String orgTranslation, boolean inactive) This method creates a new organizations.updateOrganizations
(String orgCode, @Valid UCSBOrganization incoming) Update a single organizations.Methods inherited from class edu.ucsb.cs156.example.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException
-
Constructor Details
-
UCSBOrganizationController
public UCSBOrganizationController()
-
-
Method Details
-
allOrganizations
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBOrganization> allOrganizations()THis method returns a list of all ucsborgnization.- Returns:
- a list of all ucsborgnization
-
postOrganizations
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBOrganization postOrganizations(@RequestParam String orgCode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive) This method creates a new organizations. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
orgCode
- code of the organizationsorgTranslationShort
- name of the organizationsorgTranslation
- whether or not the organizations has sack mealsinactive
- whether or not the organizations has take out meals- Returns:
- the save organizations
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrganization getById(@RequestParam String orgCode) This method returns a single organizations.- Parameters:
orgCode
- code of the organizations- Returns:
- a single organizations
-
updateOrganizations
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBOrganization updateOrganizations(@RequestParam String orgCode, @RequestBody @Valid @Valid UCSBOrganization incoming) Update a single organizations. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
orgCode
- code of the organizationsincoming
- the new organizations contents- Returns:
- the updated organizations object
-
deleteOrganizations
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteOrganizations(@RequestParam String orgCode) Delete a organizations. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
orgCode
- code of the organizations- Returns:
- a message indiciating the organizations was deleted
-