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 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 organizations
      name - name of the organizations
      hasSackMeal - whether or not the commons has sack meals
      hasTakeOutMeal - whether or not the commons has take out meals
      hasDiningCam - whether or not the commons has a dining cam
      latitude - latitude of the commons
      longitude - 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 contents
      code - code of the organizations
      Returns:
      the updated commons object