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 Details

    • CoursesController

      public CoursesController()
  • Method Details

    • allCourses

      @PreAuthorize("hasAnyRole(\'ROLE_USER\', \'ROLE_ADMIN\')") @GetMapping("/all") public Iterable<Course> allCourses()
    • getById

      @PreAuthorize("hasAnyRole(\'ROLE_USER\', \'ROLE_ADMIN\')") @GetMapping("") public Course getById(@RequestParam Long id)
    • postCourse

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Course postCourse(@RequestParam String name, @RequestParam String school, @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
    • deleteStaff

      @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_INSTRUCTOR\')") @DeleteMapping("/staff") public Object deleteStaff(@RequestParam Long id) 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
    • updateCourse

      @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_INSTRUCTOR\')") @PutMapping("") public Course updateCourse(@RequestParam Long courseId, @RequestBody @Valid @Valid Course incoming) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deleteCourse

      @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_INSTRUCTOR\')") @DeleteMapping("") public Object deleteCourse(@RequestParam Long id) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException