1

csv proof of concept

This commit is contained in:
Christoph
2020-03-16 14:09:30 +01:00
parent 9f464fe859
commit 2c3531657d
3 changed files with 14 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import mops.gruppen2.domain.apiWrapper.UpdatedGroupRequestMapper;
import mops.gruppen2.domain.event.Event;
import mops.gruppen2.service.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
@ -59,4 +60,9 @@ public class APIController {
public void uploadCsv(@RequestBody InputStream body) throws IOException {
System.out.println(CsvService.read(body));
}
@PostMapping(value = "/uploadcsv", consumes = "multipart/form-data")
public void uploadMultipart(@RequestParam("file") MultipartFile file) throws IOException {
System.out.println(CsvService.read(file.getInputStream()));
}
}

View File

@ -3,10 +3,11 @@ package mops.gruppen2.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Value;
import lombok.NoArgsConstructor;
@Value
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(exclude = {"givenname", "familyname", "email"})
public class User {
String user_id;

View File

@ -57,7 +57,11 @@
</div>
</div>
</form>
<form action="/gruppen2/api/uploadcsv" method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
<input type="submit" name="submit" value="Submit" />
</form>
</div>
</main>
</body>
</html>
</html>