Class CourseController
java.lang.Object
edu.ucsb.cs156.happiercows.controllers.ApiController
edu.ucsb.cs156.happiercows.controllers.CourseController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method returns a list of all courses.getCourseById(Long id) postCourse(CourseDTO courseDTO) updateCourse(Long id, @Valid Course incoming) Update a single course.Methods inherited from class edu.ucsb.cs156.happiercows.controllers.ApiController
genericMessage, getCurrentUser, handleBadRequest, handleGenericException
-
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
-
getCourseById
-
postCourse
-
updateCourse
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public Course updateCourse(@RequestParam Long id, @RequestBody @Valid @Valid Course incoming) Update a single course.- Parameters:
id- id of the course to updateincoming- the new course information- Returns:
- the updated course object
-