Class UCSBSubjectsController

java.lang.Object
edu.ucsb.cs156.courses.controllers.ApiController
edu.ucsb.cs156.courses.controllers.UCSBSubjectsController
All Implemented Interfaces:
org.springframework.boot.ApplicationRunner

@RequestMapping("/api/UCSBSubjects") @RestController public class UCSBSubjectsController extends ApiController implements org.springframework.boot.ApplicationRunner
  • Constructor Details

    • UCSBSubjectsController

      public UCSBSubjectsController()
  • Method Details

    • allSubjects

      @GetMapping("/all") public Iterable<UCSBSubject> allSubjects()
    • loadSubjects

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/load") public List<UCSBSubject> loadSubjects() throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getSubjectById

      @PreAuthorize("hasRole(\'ROLE_USER\') || hasRole(\'ROLE_ADMIN\')") @GetMapping("") public UCSBSubject getSubjectById(@RequestParam String subjectCode) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deleteSubject

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteSubject(@RequestParam String subjectCode)
    • deleteAllSubjects

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("/all") public Object deleteAllSubjects()
    • run

      public void run(org.springframework.boot.ApplicationArguments args) throws Exception
      Specified by:
      run in interface org.springframework.boot.ApplicationRunner
      Throws:
      Exception