Skip to content
Snippets Groups Projects

Add endpoint for removing people from an edition

Files

+ 19
0
@@ -30,7 +30,10 @@ import nl.tudelft.labracore.dto.patch.EditionPatchDTO;
import nl.tudelft.labracore.dto.view.structured.details.EditionRolesDetailsDTO;
import nl.tudelft.labracore.dto.view.structured.details.RolePersonDetailsDTO;
import nl.tudelft.labracore.dto.view.structured.summary.ModuleSummaryDTO;
import nl.tudelft.labracore.model.Role;
import nl.tudelft.labracore.model.RoleType;
import nl.tudelft.labracore.repository.EditionRepository;
import nl.tudelft.labracore.repository.RoleRepository;
import nl.tudelft.labracore.service.EditionService;
import nl.tudelft.librador.dto.view.View;
@@ -52,6 +55,9 @@ public class EditionController {
@Autowired
private EditionRepository er;
@Autowired
private RoleRepository rr;
@Autowired
private EditionService es;
@@ -166,6 +172,19 @@ public class EditionController {
es.addParticipantsOfCohort(editionId, cohortId);
}
/**
* Removes a person from the given edition with the given person ID.
*
* @param id The id of the edition to remove the person from.
* @param personId The id of the person to remove.
*/
@DeleteMapping("/{id}/remove/person/{personId}")
@PreAuthorize("hasAuthority('ROLE_DELETE')")
+1
public void removePersonFromEdition(@PathVariable Long id, @PathVariable Long personId) {
rr.findById(new Role.Id(personId, id))
.ifPresent(role -> role.setType(RoleType.BLOCKED));
}
/**
* Gets all modules belonging to edition with the given id.
*
Loading