Class CourseController

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

@RequestMapping("/api/course") @RestController public class CourseController extends ApiController
  • Constructor Details

    • CourseController

      public CourseController()
  • Method Details

    • allOrganisations

      @PreAuthorize("hasRole('ROLE_USER')") @GetMapping("/all") public Iterable<Course> allOrganisations()
      This method returns a list of all courses.
      Returns:
      a list of all courses
    • getActiveSchools

      @PreAuthorize("hasRole('ROLE_USER')") @GetMapping("/schools") public List<School> getActiveSchools()
      The schools offered in the Course create/edit dropdown. Only "active" schools are returned; see School for schools kept in the codebase as examples but not yet offered to users.
      Returns:
      the list of active schools
    • getCourseById

      @PreAuthorize("hasRole('ROLE_ADMIN')") @GetMapping("/{id}") public Course getCourseById(@PathVariable Long id)
    • postCourse

      @PreAuthorize("hasRole('ROLE_ADMIN')") @PostMapping("") public Course postCourse(@RequestBody CourseDTO courseDTO)
    • updateCourse

      @PreAuthorize("hasRole('ROLE_ADMIN')") @PutMapping("/{id}") public Course updateCourse(@PathVariable Long id, @RequestBody CourseDTO courseDTO)
    • deleteCourse

      @PreAuthorize("hasRole('ROLE_ADMIN')") @DeleteMapping("/{id}") public Object deleteCourse(@PathVariable Long id)