Skip to content

Beta Version of API - #184

Merged
SonkeHoffmann merged 16 commits into
devfrom
dev-api
Dec 10, 2025
Merged

Beta Version of API#184
SonkeHoffmann merged 16 commits into
devfrom
dev-api

Conversation

@RobinGummels

Copy link
Copy Markdown
Contributor

Current state of API:

  • Currently the returned values of GET /collections aren't STAC-Conform - some attributes are still missing, wrongly displayed or are using the wrong keyword. But you can already test with this version to see how everything is working.
  • CQL2 isn't implemented, but you can use default query-parameters as GET /collections?bbox=7,51,8,52&q=Forest
  • GET /collections/{id} is also not available yet, but will come very soon.

How-to-use:

  • Have a look into the ./api/README.md
  • Rename .env.example to .env and use prober values for given parameters (only the DB-Logins)
    • If you encouter any problems -> write me
  • Navigate to right directory cd ./api
  • Install all dependencies npm install
  • Start API npm start
  • Now you can access the API via http://localhost:3000/ and start querying via http://localhost:3000/collections&your=parameters

About this Pull-Request:

  • It's obviously not necessary to read every line.
  • Just have a look into the README.md and make sure everything is running as you aspected. Maybe also run the test's with npm test.

RobinGummels and others added 14 commits November 11, 2025 18:43
…nd queryables routes

- Added package.json for project dependencies and scripts.
- Implemented GET endpoint for collections.
- Created conformance endpoint to list supported conformance classes.
- Developed landing page for the API with links to collections and documentation.
- Added queryables endpoint to return queryable properties for collections. (If i'm correct this can be removed)
* changed Texts 1,2 and 8 according to the remarks of the customer

* Did my fixes to 4. and 10.3

* added remark why we want to save every catalog

* deleted keywords for catalog

* changed everything related to the database component

* Updated 3.1, 3.3, 3,4 (References to Lastenheft/small other changes)

* Added small Graph to 3. Produktumgebung

* Update bid.md 7.3STAC-Validator

added the handling of collections that cannot be validated automatically.

* Update bid.md 7.3STAC-API-Validator

changed the way we validate the collection search extension.

* Update bid.md 9.3.2Endpunkte

small fix collection search extension.

* added Skizze for 3, and updated 6.1, 10.1

* Updated 3. Produktumgebung

* Update bid.md 7.Qualitätsanforderungen

minor fixes

* Update 6.4.2 added remark about loading feedback

* Minor change to Table in "11 Zeitplan". A collum was missing in the head, therefore the table wasn't rendering correctly..

---------

Co-authored-by: Jakob <vertrox78@gmail.com>
Co-authored-by: Sönke Hoffmann <shoffma5@uni.muenster.de>
Co-authored-by: jklaer <jklaer@uni-muenster.de>
Co-authored-by: VincentKuehn <vkuehn@uni-muenster.de>
Co-authored-by: mammutor <mammutor@gmail.com>
Co-authored-by: Humam <44206081+Mammutor@users.noreply.github.com>
Co-authored-by: Justin K <justinkrumbhmer@yahoo.com>
- Overhaul of first idea landing page
- Added some more tests for the required elements in the landingpage-Catalog
…he `GET /` landing page

fix(api): enhance STAC API landing page and conformance links

- Overhaul of first idea landing page
- Added missing conformance links
- Added some more tests for the required elements in the landingpage-Catalog
…mance endpoint

- implemented condormance endpoint
Implemented GET /confomance
- Implemented the GET /conformance Endpoint and extracted the conformance-classes into an array that is now stored in /config/conformanceURIS.js and can be used (and is now used by the Landing Page, i edited the index.js accordingly) by both GET / and GET /conformance. Also added a Test that checks whether the Landing Page presents the same conformance URIS as the conformance Endpoint or not.
* Temporary mock data for testing and frontend development

* Added API middleware layer for error handling and validation

* TODOs ready? pls review

* Added API utilities for query parsing, validation, and response formatting

* Added swagger and openapi.yaml

* Update queryables.js

Refactor queryables endpoint into /collections/queryables

* Renamed the collections.js file to mocks-collections.js to better reflect its purpose and improve project clarity

* changed README "Projektstruktur"

* restart from dev-api 22.11..2025

* API: 2.3 Implement Collections List Endpoint done (added explanations as comments in the code)

* API: 2.4 Implement Single Collection Endpoint (added explanations as comments in the code)

* Update api/routes/collections.js

Co-authored-by: Robin Tammo Gummels <github@gummels.eu>

* Changed some of the code with the comments on Github (i will finish  it tomorrow morning)

* Implement most of the feedback and comments (need to talk about some other changes)

* Update api/routes/index.js

Changed wording from `/collections/queryables` to `/collections-queryables`

* Update api/README.md

Changed wording from `/collections/queryables` to `/collections-queryables`

* Update api/README.md

Removed missing folder

* Update api/routes/collections.js

Removed TODOs from wrong lines

* Update api/routes/collections.js

Added TODOs

* Update api/routes/queryables.js

Changed wording from `/collections/queryables` to `/collections-queryables`

* Update api/routes/queryables.js

Changed wording from `/collections/queryables` to `/collections-queryables`

---------

Co-authored-by: VincentKuehn <vkuehn@uni-muenster.de>
Co-authored-by: Robin Tammo Gummels <github@gummels.eu>
…#159)

* feat(api): add collection search parameters and validation middleware

* Added unit-test for validator-functions and integration-tests for `GET /collections`-Querys.
- Also minor bugfix, because the validator accepted deecimals as tokens.
* database connection in implementated. The parameters for the connection have to added in the .env-file.
Also there is test-file for testing and console messages

(installed `pg`)

* support for spatial queries via postgis + error handling for datatbase operations

changed language to english

* error handling

* added DATABASE_URL

There is an issue with the distance query. Changed the error handling and testing, the console messages are now way better structured

* found the Problem with the distance query. The layer are so big, that they reach over the 180° long (PostgGIS can't handel that). Now the calc is done by degree and not meters.

* The two files `test-data-retrieval.js` and `verify-schema.js` have been added.

`test-data-retrieval` (theoretical, checks against the spezification):
```
Discovers all tables and columns and validates against expected schema.
```

The second files `verify-schema.js` (practical, checks against the real data):
```
Discovers all tables and columns, validates against expected schema
```

* pooling error hanling and log imporoved.
renamed tests files to actual test-files

* standalone node tests were convertad into JEST

* write file `validateRequest.js`. Validates every incoming API request, whether the request is valid and logical.

* commented `stac_id` from the tests, it is not in both databases, so the tests for `stac_id` will always fail
Added explanation to the `.env.example`, which port is which database

* added example pattern for API - database connection.

* deleted `validateRequest` cause it's already implemented by @RobinGummels

---------

Co-authored-by: Sönke Hoffmann <shoffma5@uni.muenster.de>
- Some lines used tab and spaces...
* added SQLQuery-builder with these parameters: q,bbox,datetime,sortby,limit and token

* finalised bbox and datetime

* adapted to DB, QueryBuilder and added helperfunction runQuery

* added question-TODOs

* added bbox+datetime to the Query-Builder from Jonas

* added tests for Query-Builder from Jonas

* added tests from George

* added falsely deleted TODOs again

* fixed collumn names to match our DB and adjusted full text search to match 05_indexes.sql correctly

* Used a formatter and linter on `buildCollectionSearchQuery.js

* Did some major and minor fixes to the collection search.

- Updated `buildCollectionSearchQuery` to support pagination and improved text search with English language settings.
- Modified tests in `buildCollectionsSearchQuery.basic.test.js`, `collections-pagination.test.js`, and `collections-sort.test.js` to reflect new query behavior and validation logic.
- Enhanced sort validation in `validators.test.js` and `collectionSearchParams.js` to map API fields to database column names.
- Implemented total count retrieval for matched results in `collections.js`.

* Added a internal .env creation in the CI/CD Pipeline. It utilzes GitHub Repository Secrets to not publish any private Logins and stuff.

* Forgot that the second Job of the CI/CD pipeline runs seperatly and needs a internal .env file too.

* Enhance documentation for buildCollectionSearchQuery

Updated the documentation for:
- the buildCollectionSearchQuery function
- the fulltextsearch

* Refactor buildCollectionSearchQuery and updated SELECT part

Changed the SELECT part to match our bid and the database shema. Updated comments and for clarity. Changed full-text search to use 'simple' configuration instead of 'english'.

* Update api/routes/collections.js

small typo

Co-authored-by: Robin Tammo Gummels <github@gummels.eu>

* Remove sorting TODO from collections route

Removed TODO comment about sorting based on sortby parameter.

* Explicitly return undefined for normalized in validateSortby

Update validateSortby function to explicitly return undefined for normalized when sortby is not provided.

* small fix in buildCollectionSearch.fulltext.test.js

Change plainto_tsquery language from 'english' to 'simple'

* Fix duplicate SELECT keyword in query

Remove duplicate 'SELECT' keyword in SQL query.

* Fix missing newline at end of collectionSearchParams.js

* Fixed missing bracket in collectionSearchParams.js

* Refactor validateSortby for optional parameter handling

Refactor validateSortby function to handle optional sortby parameter and improve validation logic.

* Stabilize API test pipeline by running Jest in-band with extended timeout

Run Jest in CI with --runInBand and a higher default --testTimeout to stabilize database-backed integration tests.

Multiple Jest workers were competing for the same PostgreSQL connection pool and some long-running /collections queries exceeded the default 5s timeout, causing failures in existing test suites (e.g. collectionSearch and DBconnection).

* Fixed leaking tests that blocked CI/CD-Pipeline.
- Added a global Teardown for jest and force-exited the tests to prevent leaking.
- Made a change to db_APIconnection to only log the pool-(dis)connection if it isn't run in a test enviroment.

* Did a minimum amount of Formatting to the discription

* Used `npm audit fix --force` to fix all vulnerabilties in our used packages.

* Fixed curious doublechecking for empty Strings for the sortby-Parameter.
- Now we only check once for a empty sortby
- And added a test which distinguish between `sortby=""` and `sortby="+"`

* Update api/routes/collections.js

Removed the TODO about switching from mock-data to the real db

* Removed globalTeardown as i brought up some problems corresponding to long db-queries (for example BBOX). Instead i increased the maximal testTimeout.

---------

Co-authored-by: Robin Tammo Gummels <github@gummels.eu>

@jkrumboe jkrumboe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small suggestion for the documentation of the database port

Comment thread api/.env.example Outdated
Comment thread api/.env.example Outdated

@SonkeHoffmann SonkeHoffmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. All tests passed.

I will now upload the newer version of the database, then a few tests will fail, but that should be a fast fix.

@SonkeHoffmann
SonkeHoffmann merged commit 98498d8 into dev Dec 10, 2025
8 checks passed
@RobinGummels

Copy link
Copy Markdown
Contributor Author

@SonkeHoffmann you will be probably unable to create merge a PR of your new Version into dev as it's a protected branch. You are only allowed to merge, if all tests are passed. But if you did your changes, i will try to adopt it as fast as possible in you Branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants