csv proof of concept
This commit is contained in:
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user