Class AssignmentController

java.lang.Object
com.nicholasalfonso.lato.controller.AssignmentController

@RestController @RequestMapping("/api/assignments") public class AssignmentController extends Object
REST controller for user assignment management. Provides endpoints for CRUD operations and state management of assignments.
  • Constructor Details

    • AssignmentController

      public AssignmentController(AssignmentService assignmentService, CurrentUserService currentUserService)
      Creates the assignment controller with required services.
      Parameters:
      assignmentService - service for assignment operations
      currentUserService - service to resolve the current authenticated user
  • Method Details

    • handleGetAssignmentDetailsRequest

      @GetMapping("/{id}") public AssignmentDetailResponse handleGetAssignmentDetailsRequest(@PathVariable Long id)
      Retrieves detailed information for a specific assignment.
      Parameters:
      id - the assignment ID
      Returns:
      detailed assignment response
    • handleGetArchivedAssignmentsRequest

      @GetMapping("/archived") public List<AssignmentDetailResponse> handleGetArchivedAssignmentsRequest()
      Retrieves all archived assignments for the authenticated user.
      Returns:
      list of archived assignment responses
    • handleAssignmentCreationRequest

      @PostMapping public AssignmentResponse handleAssignmentCreationRequest(@Valid @RequestBody @Valid CreateAssignmentRequest request)
      Creates a new assignment.
      Parameters:
      request - creation details including title, course, and due date
      Returns:
      created assignment response
    • handleAssignmentUpdateRequest

      @PutMapping("/{id}") public AssignmentDetailResponse handleAssignmentUpdateRequest(@PathVariable Long id, @Valid @RequestBody @Valid UpdateAssignmentRequest request)
      Updates details for an existing assignment.
      Parameters:
      id - the assignment ID
      request - update details
      Returns:
      updated assignment response
    • handleAssignmentCompletionRequest

      @PutMapping("/{id}/completion") public AssignmentResponse handleAssignmentCompletionRequest(@PathVariable Long id, @RequestParam(defaultValue="true") boolean complete)
      Marks an assignment as complete or incomplete.
      Parameters:
      id - the assignment ID
      complete - true to mark as complete, false for incomplete
      Returns:
      updated assignment response
    • handleAssignmentArchivalRequest

      @PutMapping("/{id}/archival") public AssignmentResponse handleAssignmentArchivalRequest(@PathVariable Long id, @RequestParam(defaultValue="true") boolean archive)
      Archives or unarchives an assignment.
      Parameters:
      id - the assignment ID
      archive - true to archive, false to unarchive
      Returns:
      updated assignment response
    • handleAssignmentDeletionRequest

      @DeleteMapping("/{id}") public MessageResponse handleAssignmentDeletionRequest(@PathVariable Long id)
      Permanently deletes an assignment.
      Parameters:
      id - the assignment ID
      Returns:
      success message