Merge remote-tracking branch 'origin/feature/SUPPORT-9345' into develop
This commit is contained in:
commit
a1451c96d2
2 changed files with 12 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package ru.micord.ervu.controller;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
import com.google.protobuf.InvalidProtocolBufferException;
|
||||||
|
|
@ -39,6 +40,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class ExtractController {
|
public class ExtractController {
|
||||||
|
private static final List<String> ALLOWED_FORMATS = List.of("1", "2");
|
||||||
|
|
||||||
private final PersonalDataService personalDataService;
|
private final PersonalDataService personalDataService;
|
||||||
private final ReplyingKafkaService<Object, Bytes> replyingKafkaService;
|
private final ReplyingKafkaService<Object, Bytes> replyingKafkaService;
|
||||||
private final AuditService auditService;
|
private final AuditService auditService;
|
||||||
|
|
@ -64,6 +67,10 @@ public class ExtractController {
|
||||||
|
|
||||||
@GetMapping(value = "/extract/{formatRegistry}")
|
@GetMapping(value = "/extract/{formatRegistry}")
|
||||||
public ResponseEntity<Resource> getExtract(HttpServletRequest servletRequest, @PathVariable String formatRegistry) {
|
public ResponseEntity<Resource> getExtract(HttpServletRequest servletRequest, @PathVariable String formatRegistry) {
|
||||||
|
if (!ALLOWED_FORMATS.contains(formatRegistry)) {
|
||||||
|
return ResponseEntity.badRequest().build();
|
||||||
|
}
|
||||||
|
|
||||||
UserIdsPair userIdsPair = SecurityUtil.getUserIdsPair();
|
UserIdsPair userIdsPair = SecurityUtil.getUserIdsPair();
|
||||||
String ervuId = userIdsPair.getErvuId();
|
String ervuId = userIdsPair.getErvuId();
|
||||||
ConsumerRecord<String, Bytes> record;
|
ConsumerRecord<String, Bytes> record;
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,11 @@ export class ExtractLoadService extends Behavior {
|
||||||
observe: 'response'
|
observe: 'response'
|
||||||
}).toPromise()
|
}).toPromise()
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
if (!response.ok) {
|
||||||
|
this.errorEvent.trigger();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const data = window.URL.createObjectURL(response.body);
|
const data = window.URL.createObjectURL(response.body);
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.href = data;
|
link.href = data;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue