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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionList all UCSB OrgsdeleteOrganizations
(String orgCode) Get a single org by idpostOrganization
(String orgCode, String orgTranslationShort, String orgTranslation, boolean inactive) updateOrganizations
(String orgCode, @Valid UCSBOrganizations incoming) Update a single org.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()List all UCSB Orgs- Returns:
- an iterable of UCSBOrganizations
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrganizations getById(@RequestParam String orgCode) Get a single org by id- Parameters:
orgCode
- the id of the date- Returns:
- a UCSBOrg
-
updateOrganizations
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBOrganizations updateOrganizations(@RequestParam String orgCode, @RequestBody @Valid @Valid UCSBOrganizations incoming) Update a single org. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
orgCode
- code of the orgincoming
- the new org contents- Returns:
- the updated org object
-
postOrganization
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBOrganizations postOrganization(@RequestParam String orgCode, @RequestParam String orgTranslationShort, @RequestParam String orgTranslation, @RequestParam boolean inactive) -
deleteOrganizations
-