- Update "addResults"-endpoint.
- Add "UrlsRequest.java". - Some minor updates in "build.gradle" and "application.properties".
This commit is contained in:
parent
8a4376da9c
commit
c6e12d3e95
|
@ -44,3 +44,7 @@ dependencies {
|
|||
testImplementation group: 'org.springframework.security', name: 'spring-security-test', version: springSecurityVersion
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
|
@ -1,14 +1,12 @@
|
|||
package eu.openaire.urls_controller.controllers;
|
||||
|
||||
import eu.openaire.urls_controller.models.UrlToCheck;
|
||||
import eu.openaire.urls_controller.payloads.requests.UrlsRequest;
|
||||
import eu.openaire.urls_controller.payloads.responces.UrlsResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -49,22 +47,15 @@ public class UrlController {
|
|||
|
||||
@PostMapping("")
|
||||
// TODO - Add authorization to edit the database.
|
||||
public ResponseEntity<?> addResults() {
|
||||
public ResponseEntity<?> addResults(@RequestBody UrlsRequest urlsRequest) {
|
||||
|
||||
UrlToCheck urlToCheck = new UrlToCheck();
|
||||
|
||||
List<UrlToCheck> urlsToCheck = new ArrayList<>();
|
||||
logger.debug(urlsRequest.toString());
|
||||
|
||||
|
||||
// TODO - Retrieve the ID-URL pairs from the database.
|
||||
|
||||
// For now, we give static data.
|
||||
urlsToCheck.add(new UrlToCheck("ID-1", "URL-1"));
|
||||
// TODO - Add data in the DataBase..
|
||||
|
||||
|
||||
logger.debug("ID-URL pairs to return: " + urlsToCheck);
|
||||
|
||||
return ResponseEntity.ok(new UrlsResponse(urlsToCheck));
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package eu.openaire.urls_controller.payloads.requests;
|
||||
|
||||
import eu.openaire.urls_controller.models.Payload;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UrlsRequest {
|
||||
|
||||
private List<Payload> payloads;
|
||||
|
||||
public void UrlsResponse() {
|
||||
}
|
||||
|
||||
public void UrlsResponse(List<Payload> payloads) {
|
||||
this.payloads = payloads;
|
||||
}
|
||||
|
||||
public UrlsRequest get() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Payload> getUrlsToCheck() {
|
||||
return payloads;
|
||||
}
|
||||
|
||||
public void setUrlsToCheck(List<Payload> payloads) {
|
||||
this.payloads = payloads;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UrlsRequest{" +
|
||||
"payloads=" + payloads +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
#server.ssl.key-store = src/main/resources/keystore.p12
|
||||
#server.ssl.key-store-type = PKCS12
|
||||
#server.ssl.key-alias = tomcat
|
||||
#server.ssl.key-store-password = rent_project
|
||||
#server.ssl.key-store-password = urls_controller_project
|
||||
#server.tomcat.remoteip.remote-ip-header = x-your-remote-ip-header
|
||||
#server.tomcat.remoteip.protocol-header = x-your-protocol-header
|
||||
#server.error.include-stacktrace=never
|
||||
|
|
Loading…
Reference in New Issue