Class AssignmentsController

java.lang.Object
edu.ucsb.cs156.frontiers.controllers.ApiController
edu.ucsb.cs156.frontiers.controllers.AssignmentsController

@RequestMapping("/api/assignments") @RestController public class AssignmentsController extends ApiController
  • Constructor Details

    • AssignmentsController

      public AssignmentsController()
  • Method Details

    • postAssignment

      @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @PostMapping("/post") public Assignment postAssignment(@RequestParam Long courseId, @RequestParam String name, @RequestParam AssignmentType asnType, @RequestParam Visibility visibility, @RequestParam Permission permission) throws EntityNotFoundException
      This method creates a new Assignment.
      Parameters:
      courseId - the ID of the course the assignment is associated with
      name - the name of the assignment
      asnType - the assignment type (individual vs team)
      visibility - the visbility of the assignment (public vs private)
      permission - the permissions for the assignment (read, write, maintain, admin)
      Returns:
      the created Assignment
      Throws:
      EntityNotFoundException
    • updateAssignment

      @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #assignmentId)") @PutMapping("/put") public Assignment updateAssignment(@RequestParam Long assignmentId, @RequestParam String name, @RequestParam AssignmentType asnType, @RequestParam Visibility visibility, @RequestParam Permission permission) throws EntityNotFoundException
      This method updates an Assignment.
      Parameters:
      assignmentId - the ID of the course the assignment is associated with
      name - the name of the assignment
      asnType - the assignment type (individual vs team)
      visibility - the visbility of the assignment (public vs private)
      permission - the permissions for the assignment (read, write, maintain, admin)
      Returns:
      the created Assignment
      Throws:
      EntityNotFoundException
    • deleteAssignment

      @PreAuthorize("@CourseSecurity.hasManagePermissions(#root, #courseId)") @DeleteMapping("/{id}") public Object deleteAssignment(@PathVariable Long id, @RequestParam Long courseId)