bcgov / invasivesbc

Inventory and database repository for the creation, treatment, and report on BC Invasive plants and animals.
Apache License 2.0
13 stars 4 forks source link

[INV-3497] Get bounding box given a filter parameter #3514

Closed LocalNewsTV closed 1 month ago

LocalNewsTV commented 1 month ago

Overview

One step towards offline map caching

This PR includes the following proposed change(s):

New API endpoint /v2/activities/bbox:

Testing

Copied Filter payloads from recordset network requests and used them against this new endpoint, Rendered the response objects in an external tool. Results came out as expected, given how bounding boxes function

[!NOTE] This Endpoint is not wired up to anything, I tested manually using the ThunderClient extension in VSC

Example Details

Payload example (Every record made by me):

{
    "filterObjects": [
        {
            "limit": 200000,
            "recordSetType": "Activity",
            "selectColumns": [
                "activity_id"
            ],
            "tableFilters": [
                {
                    "field": "created_by",
                    "filter": "EXAMPLE_ID",
                    "filterType": "tableFilter",
                    "id": "FILTER_ID_EXAMPLE",
                    "operator": "CONTAINS",
                    "operator2": "AND"
                }
            ]
        }
    ]
}

API Response:

{
  "bbox": "POLYGON((-127.03320312500054 48.42276700740098,-127.03320312500054 55.69957876911636,-118.78194475016757 55.69957876911636,-118.78194475016757 48.42276700740098,-127.03320312500054 48.42276700740098))"
}

Response displayed using a MapViewer:

image

sonarcloud[bot] commented 1 month ago

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
17.7% Duplication on New Code (required ≤ 3%)
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint