Add the "addWorkerReport" endpoint.

springify_project
Lampros Smyrnaios 3 years ago
parent 40763ec146
commit 5e7ccbd8c6

@ -4,16 +4,15 @@ import com.google.common.collect.HashMultimap;
import eu.openaire.urls_controller.models.Assignment;
import eu.openaire.urls_controller.models.Datasource;
import eu.openaire.urls_controller.models.Task;
import eu.openaire.urls_controller.payloads.requests.WorkerReport;
import eu.openaire.urls_controller.payloads.responces.AssignmentResponse;
import eu.openaire.urls_controller.util.FileUtils;
import eu.openaire.urls_controller.util.GenericUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@ -46,6 +45,19 @@ public class UrlController {
return ResponseEntity.status(200).header("Content-Type", "application/json").body(new AssignmentResponse(assignment));
}
@PostMapping("addWorkerReport")
public ResponseEntity<?> addWorkerReport(@RequestBody WorkerReport workerReport) {
if ( workerReport == null )
return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
logger.debug("Received the WorkerReport:\n" + workerReport.toString());
// TODO - Store the workerReport into the database.
return ResponseEntity.status(HttpStatus.OK).build();
}
private static int assignmentId = -1; // Just for the "getTestUrls"-endpoint.

@ -41,7 +41,7 @@ public class Payload {
private Long size; // In bytes.
@JsonProperty("more_info")
private String more_info;
private String more_info;
@JsonProperty("md5")
private String md5;

Loading…
Cancel
Save