Add check for empty csv file
and set required parameter to false Co-Authored-By: Lukas Ettel <lukasettel@users.noreply.github.com>
This commit is contained in:
@ -79,10 +79,13 @@ public class Gruppen2Controller {
|
||||
@RequestParam(value = "title") String title,
|
||||
@RequestParam(value = "beschreibung") String beschreibung,
|
||||
@RequestParam(value = "visibility", required = false) Boolean visibility,
|
||||
@RequestParam("file") MultipartFile file) throws IOException {
|
||||
@RequestParam(value = "file", required = false) MultipartFile file) throws IOException {
|
||||
|
||||
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||
List<User> userList = CsvService.read(file.getInputStream());
|
||||
List<User> userList = new ArrayList<>();
|
||||
if(!file.isEmpty()) {
|
||||
userList = CsvService.read(file.getInputStream());
|
||||
}
|
||||
visibility = visibility == null;
|
||||
controllerService.createLecture(account, title, beschreibung, visibility, userList);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user