Skip to content

Commit

Permalink
Add docs and testing guide to the README (#7)
Browse files Browse the repository at this point in the history
* Add docs and testing guide to the README

* Apply suggestions from code review

Co-authored-by: Marion Baumgartner <[email protected]>

---------

Co-authored-by: Andrey Rusakov <[email protected]>
Co-authored-by: Marion Baumgartner <[email protected]>
  • Loading branch information
3 people authored Jul 19, 2024
1 parent f129bdf commit 53b4b80
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ This repository contains a working example of the
* [Geoshop Extract connector](https://github.com/sitn/sitn_geoshop_connector)
* [Geoshop backend](https://github.com/camptocamp/geoshop-back/)

### How to run
## How to run
It should be enough to run ```docker compose up```, docker will build all the images and start the containers.

### How to test
Extract fetches orders by sending a ```GET http://geoshop_host:8000/extract/order/``` request periodically. Geoshop returns all requests that are eligible for extracting, marks them as ```in_extract``` and will not return it again.

[ExtractOrderView](https://github.com/camptocamp/geoshop-back/blob/master/api/views.py#L349) handles the request, it will return OrderItems which are:

* Order status is either READY or PARTIALLY_DELIVERED
* Order provider is the user that makes request (extract in our case)
* OrderItem status is PENDING

### Utility scripts

To create an order to be picked by Extract, send this script to the ```Geoshop's``` postgres database.

```sql

--- Create an Order (A rectangle)
INSERT INTO "order" (title, description, processing_fee_currency, processing_fee, total_without_vat_currency, total_without_vat, part_vat_currency, part_vat, total_with_vat_currency, total_with_vat, geom, invoice_reference, date_ordered, date_downloaded, date_processed, client_id, invoice_contact_id, order_type_id, extract_result, download_guid, email_deliver, order_status) VALUES ('New demo order', '', 'CHF', NULL, 'CHF', NULL, 'CHF', NULL, 'CHF', NULL, '0103000020080800000100000005000000E0609D479AAF1141DCE4284375FD4BC1009C5A7EEBDDCEC066574A1D448B52C111DEA19A8E293A41E8A550A937FF53C1EC647D947B943B41523BEBFDA75E4EC1E0609D479AAF1141DCE4284375FD4BC1', '', NOW(), NULL, NULL, 3, NULL, 1, '', '4c1391f3-53b5-4130-b0d7-bbbdfc26fb81', '', 'READY');

-- Create a relevant OrderItem order_id=CURRVAL('order_id_seq')
INSERT INTO order_item (last_download, price_status, _price_currency, _price, _base_fee_currency, _base_fee, data_format_id, order_id, product_id, extract_result, srid, status, comment, token, validation_date) VALUES (NULL, 'CALCULATED', 'CHF', 0.00, 'CHF', NULL, 1, CURRVAL('order_id_seq'), 1, '', 2056, 'PENDING', NULL, NULL, NULL);
```
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ services:
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U extract"]
test: ["CMD-SHELL", "pg_isready -U extractuser" -d postgres]
interval: 5s
timeout: 5s
retries: 5
Expand Down

0 comments on commit 53b4b80

Please sign in to comment.