Class UCSBDatesController

java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.UCSBDatesController

@RequestMapping("/api/ucsbdates") @RestController public class UCSBDatesController extends ApiController
This is a REST controller for UCSBDates
  • Constructor Details

    • UCSBDatesController

      public UCSBDatesController()
  • Method Details

    • allUCSBDates

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<UCSBDate> allUCSBDates()
      List all UCSB dates
      Returns:
      an iterable of UCSBDate
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public UCSBDate getById(@RequestParam Long id)
      Get a single date by id
      Parameters:
      id - the id of the date
      Returns:
      a UCSBDate
    • postUCSBDate

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public UCSBDate postUCSBDate(@RequestParam String quarterYYYYQ, @RequestParam String name, @RequestParam("localDateTime") @DateTimeFormat(iso=DATE_TIME) LocalDateTime localDateTime) throws com.fasterxml.jackson.core.JsonProcessingException
      Create a new date
      Parameters:
      quarterYYYYQ - the quarter in the format YYYYQ
      name - the name of the date
      localDateTime - the date
      Returns:
      the saved ucsbdate
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deleteUCSBDate

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteUCSBDate(@RequestParam Long id)
    • updateUCSBDate

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public UCSBDate updateUCSBDate(@RequestParam Long id, @RequestBody @Valid @Valid UCSBDate incoming)
      Update a single date
      Parameters:
      id - id of the date to update
      incoming - the new date
      Returns:
      the updated date object