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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeleteAssignment(Long id, Long courseId) postAssignment(Long courseId, String name, AssignmentType asnType, Visibility visibility, Permission permission) This method creates a new Assignment.updateAssignment(Long assignmentId, String name, AssignmentType asnType, Visibility visibility, Permission permission) This method updates an Assignment.Methods inherited from class edu.ucsb.cs156.frontiers.controllers.ApiController
doesCurrentUserHaveRole, genericMessage, getCurrentUser, handleDuplicateGroupException, handleEntityNotFoundException, handleIllegalArgument, handleNoLinkedOrgException, handleUnsupportedOperation, handleValidationException, isCurrentUserAdmin
-
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 withname- the name of the assignmentasnType- 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 withname- the name of the assignmentasnType- 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
-