Skip to content
Snippets Groups Projects

Resolve "[Queue-2.0] Add possibility to edit capacity per time slot"

9 files
+ 350
33
Compare changes
  • Side-by-side
  • Inline

Files

@@ -42,6 +42,7 @@ import nl.tudelft.queue.dto.create.labs.SlottedLabCreateDTO;
import nl.tudelft.queue.dto.create.requests.LabRequestCreateDTO;
import nl.tudelft.queue.dto.create.requests.SelectionRequestCreateDTO;
import nl.tudelft.queue.dto.patch.RequestPatchDTO;
import nl.tudelft.queue.dto.patch.SlottedLabTimeSlotCapacityPatchDTO;
import nl.tudelft.queue.dto.patch.labs.CapacitySessionPatchDTO;
import nl.tudelft.queue.dto.patch.labs.ExamLabPatchDTO;
import nl.tudelft.queue.dto.patch.labs.RegularLabPatchDTO;
@@ -149,6 +150,26 @@ public class LabController {
return "lab/view/" + qSession.getType().name().toLowerCase();
}
/**
* Applies any changes to the capacities of time slots in the given lab using the Patch DTO in the body of
* the request.
*
* @param lab The lab for which to change the capacities of time slots.
* @param dto The DTO indicating what to change.
* @return A redirect to the lab overview page.
*/
@Transactional
@PostMapping("/lab/{lab}/capacities")
@PreAuthorize("@permissionService.canManageSession(#lab)")
public String editLabCapacities(@PathEntity Lab lab,
SlottedLabTimeSlotCapacityPatchDTO dto) {
if (lab instanceof AbstractSlottedLab<?>) {
dto.apply((AbstractSlottedLab<?>) lab);
}
return "redirect:/lab/" + lab.getId();
}
/**
* Gets the student enqueue view. This page displays the form that needs to be filled out by the student
* to successfully enrol into the given session.
Loading