Greenstand / Greenstand/treetracker-functions
Build two openfaas function to test these two SQL
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
We aready setup our openfaas by https://github.com/Greenstand/treetracker-infrastructure/pull/172
To finish this function, we need to setup the db connection with openfaas
We need to create two functions that request our test postgresqlDB and return the result, these two SQLs are here:
SQL 1:
```
select * from trees
where
(
planting_organization_id in (select entity_id from getEntityRelationshipChildren(194))
)
order by id desc
```
SQL 2:
```
WITH RECURSIVE organization_children AS (
SELECT entity.id, entity_relationship.parent_id, 1 as depth, entity_relationship.type, entity_relati
FROM entity
LEFT JOIN entity_relationship ON entity_relationship.child_id = entity.id
WHERE entity.id = 194
UNION
SELECT next_child.id, entity_relationship.parent_id, depth + 1, entity_relationship.type, entity_rel
FROM entity next_child
JOIN entity_relationship ON entity_relationship.child_id = next_child.id
JOIN organization_children c ON entity_relationship.parent_id = c.id
)
,org_tree_id AS (
SELECT id FROM (
SELECT trees.id as id from trees
WHERE
planter_id IN (
SELECT id FROM planter
JOIN (
SELECT id AS entity_id FROM organization_children LIMIT 20
) org ON planter.organization_id = org.entity_id
)
UNION
select id from trees where planting_organization_id = (
194
)
) ids
)
select * from trees
where
(
id in (select id from org_tree_id)
)
order by id desc
limit 2
offset 1000;
```
When this is done, we will use our test tool to do a pressure test against these two and check the result.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.