Class CoursesController

java.lang.Object
edu.ucsb.cs156.happiercows.controllers.ApiController
edu.ucsb.cs156.happiercows.controllers.CoursesController

@RequestMapping("/api/courses") @RestController public class CoursesController extends ApiController
  • Constructor Details

    • CoursesController

      public CoursesController()
  • Method Details

    • allCourses

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

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

      @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Courses postCourse(@RequestParam String name, @RequestParam String term) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • updateCourse

      @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\')") @PutMapping("/update") public Courses updateCourse(@RequestParam Long id, @RequestParam String name, @RequestParam String term) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deleteCourse

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