Skip to content
Snippets Groups Projects

Update importing participants to support errors

6 files
+ 79
30
Compare changes
  • Side-by-side
  • Inline

Files

@@ -27,6 +27,7 @@ import javax.transaction.Transactional;
import javax.validation.Valid;
import nl.tudelft.labracore.dto.create.EditionCreateDTO;
import nl.tudelft.labracore.dto.helper.ParticipantsImportDTO;
import nl.tudelft.labracore.dto.helper.Period;
import nl.tudelft.labracore.dto.patch.EditionPatchDTO;
import nl.tudelft.labracore.dto.view.structured.details.EditionRolesDetailsDTO;
@@ -34,7 +35,6 @@ import nl.tudelft.labracore.dto.view.structured.details.RolePersonDetailsDTO;
import nl.tudelft.labracore.dto.view.structured.summary.EditionSummaryDTO;
import nl.tudelft.labracore.dto.view.structured.summary.ModuleSummaryDTO;
import nl.tudelft.labracore.enums.ParticipantsImportError;
import nl.tudelft.labracore.enums.RoleType;
import nl.tudelft.labracore.model.Role;
import nl.tudelft.labracore.repository.EditionRepository;
import nl.tudelft.labracore.repository.RoleRepository;
@@ -192,15 +192,15 @@ public class EditionController {
* Adds participants into an edition with a pre-specified role. If the person already has a role in this
* edition, it does not overwrite it.
*
* @param id the id of the edition
* @param participants the map which contains the data about the roles which need to be added
* @return the map with errors
* @param id the id of the edition
* @param dto the dto which holds the map which contains the data about the roles which need to be added
* @return the map with errors
*/
@PostMapping("{id}/add-participants")
@PreAuthorize("hasAuthority('ROLE_CREATE')")
public Map<String, ParticipantsImportError> addParticipantsToEdition(@PathVariable Long id,
@RequestBody Map<String, RoleType> participants) {
return es.addParticipantsToEdition(id, participants);
public Map<ParticipantsImportError, List<String>> addParticipantsToEdition(@PathVariable Long id,
@RequestBody ParticipantsImportDTO dto) {
return es.addParticipantsToEdition(id, dto.getParticipants());
}
/**
Loading