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 Details

    • SectionsController

      public SectionsController()
  • Method Details

    • getSections

      @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @GetMapping("") public List<Section> getSections(@PathVariable Long courseId)
      List all sections for a course, ordered by section.
      Parameters:
      courseId - the id of the course
      Returns:
      the sections for the course
    • 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 course
      section - the section identifier (must be unique within the course)
      label - the human readable label for the section
      slackChannelName - 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 course
      id - the id of the section to update
      section - the new section identifier (must be unique within the course)
      label - the new human readable label for the section
      slackChannelName - 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 course
      id - the id of the section to delete
      Returns:
      a message indicating the section was deleted