Skip to content

Commit 53b4b80

Browse files
lansegAndrey Rusakovmarionb
authored
Add docs and testing guide to the README (#7)
* Add docs and testing guide to the README * Apply suggestions from code review Co-authored-by: Marion Baumgartner <marionb@users.noreply.github.com> --------- Co-authored-by: Andrey Rusakov <andrey.rusakov@camptocamp.com> Co-authored-by: Marion Baumgartner <marionb@users.noreply.github.com>
1 parent f129bdf commit 53b4b80

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

README.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,27 @@ This repository contains a working example of the
1111
* [Geoshop Extract connector](https://github.com/sitn/sitn_geoshop_connector)
1212
* [Geoshop backend](https://github.com/camptocamp/geoshop-back/)
1313

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

17+
### How to test
18+
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.
19+
20+
[ExtractOrderView](https://github.com/camptocamp/geoshop-back/blob/master/api/views.py#L349) handles the request, it will return OrderItems which are:
21+
22+
* Order status is either READY or PARTIALLY_DELIVERED
23+
* Order provider is the user that makes request (extract in our case)
24+
* OrderItem status is PENDING
25+
26+
### Utility scripts
27+
28+
To create an order to be picked by Extract, send this script to the ```Geoshop's``` postgres database.
29+
30+
```sql
31+
32+
--- Create an Order (A rectangle)
33+
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');
34+
35+
-- Create a relevant OrderItem order_id=CURRVAL('order_id_seq')
36+
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);
37+
```

docker-compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ services:
6767
ports:
6868
- "5432:5432"
6969
healthcheck:
70-
test: ["CMD-SHELL", "pg_isready -U extract"]
70+
test: ["CMD-SHELL", "pg_isready -U extractuser" -d postgres]
7171
interval: 5s
7272
timeout: 5s
7373
retries: 5

0 commit comments

Comments
 (0)