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 TypeMethodDescriptionThis method returns a list of all UCSBOrganizations.This method returns a single Organization.postOrganization(String orgCode, String orgTranslationShort, String orgTranslation, boolean inactive) This method creates a new UCSBOrganization.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 UCSBOrganizations.- 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 UCSBOrganization. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
orgCode- code of the organizationorgTranslationShort- short translation of the organizationorgTranslation- full translation of the organizationinactive- whether or not the organization is inactive- Returns:
- the saved UCSBOrganization
-
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrganization getById(@RequestParam String code) This method returns a single Organization.- Parameters:
code- code of the Organization- Returns:
- a single Organization
-