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 Summary
-
Method Summary
Modifier and TypeMethodDescriptiondeleteSubject
(String subjectCode) getSubjectById
(String subjectCode) void
run
(org.springframework.boot.ApplicationArguments args) Methods inherited from class edu.ucsb.cs156.courses.controllers.ApiController
genericMessage, getCurrentUser, handleGenericException, handleIllegalArgumentException
-
Constructor Details
-
UCSBSubjectsController
public UCSBSubjectsController()
-
-
Method Details
-
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
-
deleteAllSubjects
-
run
- Specified by:
run
in interfaceorg.springframework.boot.ApplicationRunner
- Throws:
Exception
-