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
This is a REST controller for UCSBOrganizations
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionDelete an organization.This method returns a single organizations.postOrganizations(String orgCode, String orgTranslationShort, String orgTranslation, boolean inactive) This method creates a new organizations.updateOrganization(String id, @Valid UCSBOrganizations incoming) Update a single organizations.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() - 
getById
@PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBOrganizations getById(@RequestParam String id) This method returns a single organizations.- Parameters:
 code- code of the organizations- Returns:
 - a single organizations
 
 - 
postOrganizations
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBOrganizations 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:
 code- code of the organizationsname- name of the organizationshasSackMeal- whether or not the commons has sack mealshasTakeOutMeal- whether or not the commons has take out mealshasDiningCam- whether or not the commons has a dining camlatitude- latitude of the commonslongitude- logitude of the commons- Returns:
 - the save organizations
 
 - 
deleteOrganizations
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteOrganizations(@RequestParam String id) Delete an organization. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
 code- code of the organization- Returns:
 - a message indiciating the commons was deleted
 
 - 
updateOrganization
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBOrganizations updateOrganization(@RequestParam String id, @RequestBody @Valid @Valid UCSBOrganizations incoming) Update a single organizations. Accessible only to users with the role "ROLE_ADMIN".- Parameters:
 incoming- the new commons contentscode- code of the organizations- Returns:
 - the updated commons object
 
 
 -