From b6e1458d8af29d3cf0946dff59ebf1d17cb715e9 Mon Sep 17 00:00:00 2001 From: Sam Van Campenhout Date: Tue, 23 Nov 2021 15:45:42 +0100 Subject: [PATCH] Add a new `/request-reasons` endpoint (#70) This can be used to retrieve all the possible options. --- config/dispatcher/dispatcher.ex | 3 +++ .../20211119151700-move-reason-codes.sparql | 14 +++++++++++++ config/resources/domain.lisp | 3 ++- config/resources/privacy-centric-service.json | 20 +++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 config/migrations/20211119151700-move-reason-codes.sparql create mode 100644 config/resources/privacy-centric-service.json diff --git a/config/dispatcher/dispatcher.ex b/config/dispatcher/dispatcher.ex index dc3ac57..985e090 100644 --- a/config/dispatcher/dispatcher.ex +++ b/config/dispatcher/dispatcher.ex @@ -187,6 +187,9 @@ defmodule Dispatcher do Proxy.forward conn, path, "http://cache/site-types/" end + match "/request-reasons/*path", %{ accept: [:json], layer: :api} do + Proxy.forward conn, path, "http://cache/request-reasons/" + end ############### # LOGIN diff --git a/config/migrations/20211119151700-move-reason-codes.sparql b/config/migrations/20211119151700-move-reason-codes.sparql new file mode 100644 index 0000000..1aa262a --- /dev/null +++ b/config/migrations/20211119151700-move-reason-codes.sparql @@ -0,0 +1,14 @@ +DELETE { + GRAPH { + ?s ?p ?o + } +} INSERT { + GRAPH { + ?s ?p ?o + } +} WHERE { + GRAPH { + ?s a ; + ?p ?o. + } +} \ No newline at end of file diff --git a/config/resources/domain.lisp b/config/resources/domain.lisp index a0faba9..ac4d7d6 100644 --- a/config/resources/domain.lisp +++ b/config/resources/domain.lisp @@ -12,4 +12,5 @@ (defparameter *supply-cache-headers-p* t) (read-domain-file "domain.json") -(read-domain-file "auth.json") \ No newline at end of file +(read-domain-file "auth.json") +(read-domain-file "privacy-centric-service.json") \ No newline at end of file diff --git a/config/resources/privacy-centric-service.json b/config/resources/privacy-centric-service.json new file mode 100644 index 0000000..1846fe1 --- /dev/null +++ b/config/resources/privacy-centric-service.json @@ -0,0 +1,20 @@ +{ + "version": "0.1", + "prefixes": { + "skos": "http://www.w3.org/2004/02/skos/core#", + "ext": "http://mu.semte.ch/vocabularies/ext/" + }, + "resources": { + "request-reasons": { + "name": "request-reason", + "class": "ext:ReasonCode", + "attributes": { + "label": { + "type": "string", + "predicate": "skos:prefLabel" + } + }, + "new-resource-base": "http://data.lblod.info/id/information-request-reason/" + } + } +}