Skip to content

Commit

Permalink
Set up PUT route for indexing single records (RPB-223)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Nov 5, 2024
1 parent 2917e9b commit 6dc147c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/controllers/nwbib/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -943,4 +943,12 @@ private static List<String> starredIds() {
return new ArrayList<>(Arrays.asList(currentlyStarred().split(" ")).stream()
.filter(s -> !s.trim().isEmpty()).collect(Collectors.toList()));
}

public static Result put(String id, String secret) {
JsonNode inputData = request().body().asJson();
System.out.println(id + ", will transform: " + inputData); // TODO run flux transformation
boolean willIndex = !secret.trim().isEmpty() && secret.equals(CONFIG.getString("secret"));
System.out.printf("Secret '%s', will index: %b\n", secret, willIndex);
return ok(Json.toJson("TODO: not implemented"));
}
}
1 change: 1 addition & 0 deletions conf/nwbib.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ item.api="http://lobid.org/items"
hbz01.api="http://lobid.org/hbz01"
orgs.api="http://lobid.org/organisations"
nwbib.filter="inCollection.id:\"http://lobid.org/resources/HT013494180#!\""
secret=""

# Embedded Elasticsearch index for classification data
index {
Expand Down
3 changes: 2 additions & 1 deletion conf/nwbib.routes
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ GET /robots.txt controllers.Assets.at(path="/public",file="robots.
GET /cgi-bin/wwwalleg/:name.pl controllers.nwbib.Application.showPl(name, db ?= "rnam", index: Int ?= 1, zeilen: Int ?= 1, s1)
GET /sw/:rpbId controllers.nwbib.Application.showSw(rpbId)
GET /o:id controllers.nwbib.Application.searchSpatial(id, from:Int?=0, size:Int?=25, format?="html")
GET /:id controllers.nwbib.Application.show(id, format ?= "")
GET /:id controllers.nwbib.Application.show(id, format ?= "")
PUT /:id controllers.nwbib.Application.put(id, secret ?= "")

0 comments on commit 6dc147c

Please sign in to comment.