diff --git a/Docker_Project/README.md b/Docker_Project/README.md index aeba036..24e6769 100644 --- a/Docker_Project/README.md +++ b/Docker_Project/README.md @@ -38,3 +38,10 @@ Add [Ruuter DSL File](Ruuter/DSL/GET/regex.yml) and [Resql Query](Resql/template https://github.com/buerokratt/Data-Anonymizer/issues/63 Add [Ruuter DSL File](Ruuter/DSL/GET/delete_regex.yml) and [Resql Query](Resql/templates/production/delete_regex.sql) to delete a regex pattern. + +### Add new Regex pattern to the database + +https://github.com/buerokratt/Data-Anonymizer/issues/59 + +- Add [Ruuter DSL File](Ruuter/DSL/POST/regex.yml) and [Resql Query](Resql/templates/production/insert_regex.sql) to add a regex pattern. +- Add [Ruuter DSL File](Ruuter/DSL/GET/entity.yml) and [Resql Query](Resql/templates/production/list_entity.sql) to list entities. diff --git a/Docker_Project/Resql/templates/production/insert_regex.sql b/Docker_Project/Resql/templates/production/insert_regex.sql new file mode 100644 index 0000000..e97143f --- /dev/null +++ b/Docker_Project/Resql/templates/production/insert_regex.sql @@ -0,0 +1 @@ +insert into Regex_Entity (entity, regex) VALUES (:entity, :regex) RETURNING id; \ No newline at end of file diff --git a/Docker_Project/Resql/templates/production/list_entity.sql b/Docker_Project/Resql/templates/production/list_entity.sql new file mode 100644 index 0000000..f30b881 --- /dev/null +++ b/Docker_Project/Resql/templates/production/list_entity.sql @@ -0,0 +1 @@ +select name, description from Entity; \ No newline at end of file diff --git a/Docker_Project/Ruuter/DSL/GET/entity.yml b/Docker_Project/Ruuter/DSL/GET/entity.yml new file mode 100644 index 0000000..fef4004 --- /dev/null +++ b/Docker_Project/Ruuter/DSL/GET/entity.yml @@ -0,0 +1,8 @@ +list_entity: + call: http.post + args: + url: http://resql:8082/list_entity + result: request_response + +return_value: + return: ${request_response.response.body} diff --git a/Docker_Project/Ruuter/DSL/POST/regex.yml b/Docker_Project/Ruuter/DSL/POST/regex.yml new file mode 100644 index 0000000..d61e503 --- /dev/null +++ b/Docker_Project/Ruuter/DSL/POST/regex.yml @@ -0,0 +1,11 @@ +insert_regex: + call: http.post + args: + url: http://resql:8082/insert_regex + body: + regex: ${incoming.body.regex} + entity: ${incoming.body.entity} + result: request_response + +return_value: + return: ${request_response.response.body}