Skip to content

Commit

Permalink
fix(custom_queries): add custom queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed May 7, 2024
1 parent 359a017 commit aaa6b76
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ARG APP_HOME=/home/node/srv
WORKDIR $APP_HOME

COPY --chown=node:node ./cfg $APP_HOME/cfg
COPY --chown=node:node ./queries $APP_HOME/queries
COPY --chown=node:node --from=build $APP_HOME/lib $APP_HOME/lib

EXPOSE 50051
Expand Down
15 changes: 7 additions & 8 deletions cfg/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
"fulfillment",
"fulfillmentCourier",
"fulfillmentProduct"
],
"customQueries": [
{
"path": "queries/filter_ownership.aql",
"name": "filterByOwnership",
"type": "filter"
}
]
}
},
Expand Down Expand Up @@ -263,14 +270,6 @@
"enabled": true,
"enforce": true,
"database": "arangoDB",
"client": {
"acs-srv": {
"address": "localhost:50061"
},
"user": {
"address": "localhost:50051"
}
},
"urns": {
"entity": "urn:restorecommerce:acs:names:model:entity",
"user": "urn:restorecommerce:acs:model:user.User",
Expand Down
6 changes: 0 additions & 6 deletions cfg/config_production.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@
}
},
"authorization": {
"acs-srv": {
"address": "access-control-srv:50051"
},
"user": {
"address": "identity-srv:50051"
},
"cache": {
"url": "redis://redis:6379"
}
Expand Down
11 changes: 11 additions & 0 deletions queries/filter_ownership.aql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let found = (
for o in node.meta.owners
filter o.id == "urn:restorecommerce:acs:names:ownerIndicatoryEntity"
for arg in @customArguments
filter o.value == arg.entity
for ownerInst in o.attributes
filter ownerInst.id == "urn:restorecommerce:acs:names:ownerInstance"
filter ownerInst.value in arg.instance
return true
)
filter true in found

0 comments on commit aaa6b76

Please sign in to comment.