Class SectionsController
java.lang.Object
edu.ucsb.cs156.frontiers.controllers.ApiController
edu.ucsb.cs156.frontiers.controllers.SectionsController
@RequestMapping("/api/courses/{courseId}/sections")
@RestController
public class SectionsController
extends ApiController
CRUD endpoints for the Sections table, scoped by course. Sections map a raw section identifier
(e.g. the value that appears in a roster CSV) to a human readable label; they are used when the
TRANSLATE_SECTIONS course option is enabled.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeleteSection(Long courseId, Long id) Delete a section from a course.getSections(Long courseId) List all sections for a course, ordered by section.postSection(Long courseId, String section, String label, String slackChannelName) Create a new section for a course.Update an existing section for a course.
-
Constructor Details
-
SectionsController
public SectionsController()
-
-
Method Details
-
getSections
-
postSection
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @PostMapping("") public Section postSection(@PathVariable Long courseId, @RequestParam String section, @RequestParam String label, @RequestParam(required=false) String slackChannelName) Create a new section for a course.- Parameters:
courseId- the id of the coursesection- the section identifier (must be unique within the course)label- the human readable label for the sectionslackChannelName- the Slack channel associated with the section, if any- Returns:
- the created section
-
putSection
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @PutMapping("/{id}") public Section putSection(@PathVariable Long courseId, @PathVariable Long id, @RequestParam String section, @RequestParam String label, @RequestParam(required=false) String slackChannelName) Update an existing section for a course.- Parameters:
courseId- the id of the courseid- the id of the section to updatesection- the new section identifier (must be unique within the course)label- the new human readable label for the sectionslackChannelName- the Slack channel associated with the section, if any- Returns:
- the updated section
-
deleteSection
@PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @DeleteMapping("/{id}") @Transactional public Object deleteSection(@PathVariable Long courseId, @PathVariable Long id) Delete a section from a course.- Parameters:
courseId- the id of the courseid- the id of the section to delete- Returns:
- a message indicating the section was deleted
-