Class CoursesController
java.lang.Object
edu.ucsb.cs156.organic.controllers.ApiController
edu.ucsb.cs156.organic.controllers.CoursesController
@RequestMapping("/api/courses")
@RestController
public class CoursesController
extends ApiController
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondeleteCourse
(Long id) deleteStaff
(Long id) postCourse
(String name, String schoolAbbrev, String term, LocalDateTime startDate, LocalDateTime endDate, String githubOrg) updateCourse
(Long id, String name, String schoolAbbrev, String term, LocalDateTime startDate, LocalDateTime endDate, String githubOrg) Methods inherited from class edu.ucsb.cs156.organic.controllers.ApiController
genericMessage, getCurrentUser, getMapper, handleAccessDeniedException, handleGenericException, handleIllegalArgumentException, mapperThatIgnoresMockitoMocks
-
Constructor Details
-
CoursesController
public CoursesController()
-
-
Method Details
-
allCourses
-
getById
-
postCourse
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\',\'ROLE_INSTRUCTOR\')") @PostMapping("/post") public Course postCourse(@RequestParam String name, @RequestParam String schoolAbbrev, @RequestParam String term, @RequestParam("startDate") @DateTimeFormat(iso=DATE_TIME) LocalDateTime startDate, @RequestParam("endDate") @DateTimeFormat(iso=DATE_TIME) LocalDateTime endDate, @RequestParam String githubOrg) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
addStaff
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/addStaff") public Staff addStaff(@RequestParam Long courseId, @RequestParam String githubLogin) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getStaff
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @GetMapping("/getStaff") public Iterable<Staff> getStaff(@RequestParam Long courseId) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
deleteStaff
-
updateCourse
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_INSTRUCTOR\')") @PutMapping("/update") public Course updateCourse(@RequestParam Long id, @RequestParam String name, @RequestParam String schoolAbbrev, @RequestParam String term, @RequestParam("startDate") @DateTimeFormat(iso=DATE_TIME) LocalDateTime startDate, @RequestParam("endDate") @DateTimeFormat(iso=DATE_TIME) LocalDateTime endDate, @RequestParam String githubOrg) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
deleteCourse
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_INSTRUCTOR\')") @DeleteMapping("/delete") public Course deleteCourse(@RequestParam Long id) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-