Skip to content

Commit

Permalink
Merge branch 'refactor-dataset'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed Dec 12, 2023
1 parent 4477674 commit 0aacead
Show file tree
Hide file tree
Showing 64 changed files with 3,454 additions and 2,983 deletions.
8 changes: 3 additions & 5 deletions demo-shop/.config.json → .config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"host": "localhost",
"port": 5000,
"endpoint": "/graphql",
"entry": "http://localhost:5000/graphql",
"job_prefix": "job_",
"data_directory": "data",
"job_directory": "jobs",
"data_directory": "./datasets/",
"job_directory": "jobs/",
"objectImport": {
"endpoint": {
"local": "http://127.0.0.1:5000/graphql/",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ id_rsa
id_rsa.pub
known_hosts
config

*.env
File renamed without changes.
3 changes: 2 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ The data sets serve several purposes:
== Available Data Sets

- link:demo-shop[Demo Shop]
- link:datasets/system[System]
- link:datasets/demo-shop[Demo Shop]

4 changes: 4 additions & 0 deletions datasets/demo-shop/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data/generated/
objects/*.js
objects/*.js.map
objects/*.d.ts
32 changes: 17 additions & 15 deletions demo-shop/README.md → datasets/demo-shop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ to import the data locally or into the production environment.

### Current supported jobs are

- identity (imports `users`, `roles`, `rules`, `policies` and `policy_sets`)
- master (imports master data resources `country`, `time_zone`, `locale`,
`tax_types` and `commands`)
- extra (import resources `organizations`, `addresses`, `contact_point_types`,
`contact_points`)
- catalog (import resources `price_group`, `manufacturer`, `product_category`,
`product_prototype`, `product`)
- master (imports resources `organizations`, `addresses`, `contact_points`, `shops`, `customers`)
- identity (imports `users`)
- extra (import resources )
- catalog (imports resources `price_group`, `manufacturer`, `product_category`, `product_prototype`, `product`)

> NOTE: Resources must be imported in a specific order!
> Master > Identity > Extra > Catalog.
Expand All @@ -39,22 +36,27 @@ to import the data locally or into the production environment.
### Script usage

1. Generate catalog datasets using [`transform.js script`](./generator/catalog/transform.js):
1. Extract the API-KEY from the logs of `facade-srv`.

- `node transform.js`
2. Either export the API-KEY, paste it to an `.env` file or paste as command argument.

2. Import datasets using [`import.js script`](./import.js):
2. Generate catalog datasets using [`transform.js script`](./generator/catalog/transform.js):

- `node import.js import -t <access_token> -j <job>`
- `node ./transform.js`

3. Import catalog data. When importing catalog data, the source must be specified
as-well, as this data is generated in a different path:
3. Import datasets using [`import.js script`](./import.js):

- `node import.js import -t <access_token> -j catalog -s catalog`
- `node ./import.js import -t <access_token> -d demo-shop -j <job>`

4. Examples:

- `node ./import.js import -t <access_token> -d demo-shop -j master`
- `node ./import.js import -t <access_token> -d demo-shop -j identity`
- `node ./import.js import -t <access_token> -d demo-shop -j catalog`

### Supported environment variables: `GQL_ENDPOINT`.

All flags are optional, and they can be listed by typing `node import.js -h`.
All flags are optional, and they can be listed by typing `node ./import.js -h`.
The API key can be obtained from the [`facade-srv`](https://github.com/restorecommerce/facade-srv/blob/master/cfg/config.json#L21) configuration.
The API key is generated during system startup from the `facade-srv` (Check the log message of facade-srv `Bootstrap API Key is`).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
id: eb228fb0d80d4f4fa51e1a10d8668c1c
id: restorecommecre-demo-shop-000-address-000
postcode: '70174'
locality: Stuttgart
street: Ossietzkystraße
buildingNumber: '4'
region: Stuttgart
countryId: germany
countryId: restorecommecre-demo-country-germany
altitude: 0
addressAddition:
field1: ""
Expand All @@ -20,15 +20,15 @@
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: 3275fcd9c84f4831aeba986e328b43ce
value: restorecommecre-demo-shop-organization-000
---
id: 210eff6fc2f044dea7701e24a6b4ce0d
id: restorecommecre-demo-customer-000-address-000
postcode: '23456'
locality: Teststadt
street: Erste Teststraße
buildingNumber: '1'
region: Testregion
countryId: germany
countryId: restorecommecre-demo-country-germany
altitude: 0
addressAddition:
field1: ""
Expand All @@ -43,15 +43,15 @@
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-1
value: restorecommecre-demo-customer-000-organization
---
id: 310eff6fc2f044dea7701e24a6b4ce0d
id: restorecommecre-demo-customer-001-address-000
postcode: '34567'
locality: Beispielstadt
street: Zweite Teststraße
buildingNumber: '1'
region: Beispielregion
countryId: germany
countryId: restorecommecre-demo-country-germany
altitude: 0
addressAddition:
field1: ""
Expand All @@ -66,4 +66,27 @@
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-2
value: restorecommecre-demo-customer-001-organization
---
id: restorecommecre-demo-customer-002-address-000
postcode: '34567'
locality: Beispielstadt
street: Zweite Teststraße
buildingNumber: '1'
region: Beispielregion
countryId: restorecommecre-demo-country-germany
altitude: 0
addressAddition:
field1: ""
field2: ""
geoCoordinates:
longitude: 48.8
latitude: 9.2
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-customer-002-organization
81 changes: 81 additions & 0 deletions datasets/demo-shop/data/seed-data/contact_points.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
id: restorecommecre-demo-shop-000-contact-point
physicalAddressId: restorecommecre-demo-shop-000-address-000
website: https://about.restorecommerce.io/
email: [email protected]
telephone: "+4971146051909"
localeId: de-de
timezoneId: europe-berlin
contactPointTypeIds:
- billing
- shipping
- legal
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-shop-organization-000
---
id: restorecommecre-demo-customer-000-contact-point
physicalAddressId: restorecommecre-demo-customer-000-address-000
website: https://about.restorecommerce.io/
email: [email protected]
telephone: "+491630000005"
localeId: de-de
timezoneId: europe-berlin
contactPointTypeIds:
- billing
- shipping
- legal
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-customer-000-organization
---
id: restorecommecre-demo-customer-001-contact-point
physicalAddressId: restorecommecre-demo-customer-001-address-000
website: https://about.restorecommerce.io/
email: [email protected]
telephone: "+491630000005"
localeId: de-de
timezoneId: europe-berlin
contactPointTypeIds:
- billing
- shipping
- legal
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-customer-organization-002
---
id: restorecommecre-demo-customer-002-contact-point
physicalAddressId: restorecommecre-demo-customer-002-address-000
website: https://about.restorecommerce.io/
email: [email protected]
telephone: "+491630000005"
localeId: de-de
timezoneId: europe-berlin
contactPointTypeIds:
- billing
- shipping
- legal
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-customer-002-organization
---
59 changes: 59 additions & 0 deletions datasets/demo-shop/data/seed-data/countries.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
id: restorecommecre-demo-country-germany
name: Germany
countryCode: DE
geographicalName: Germany
economicAreas:
- EEA
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-root-organization
---
id: restorecommecre-demo-country-switzerland
name: Switzerland
countryCode: CH
geographicalName: Switzerland
economicAreas: []
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-root-organization
---
id: restorecommecre-demo-country-belgium
name: Belgium
countryCode: BE
geographicalName: Belgium
economicAreas:
- EEA
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-root-organization
---
id: restorecommecre-demo-country-france
name: France
countryCode: FR
geographicalName: France
economicAreas:
- EEA
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-root-organization
39 changes: 39 additions & 0 deletions datasets/demo-shop/data/seed-data/customers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
id: restorecommecre-demo-customer-000
commercial:
organization_id: restorecommecre-demo-customer-000-organization
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-customer-000-organization
---
id: restorecommecre-demo-customer-001
public_sector:
organization_id: restorecommecre-demo-customer-organization-001
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-customer-001-organization
---
id: restorecommecre-demo-customer-002
private:
user_id: restorecommecre-demo-customer-002-user
contact_point_ids: [
restorecommecre-demo-customer-002-contact-point
]
meta:
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: restorecommecre-demo-customer-002-user-000
Loading

0 comments on commit 0aacead

Please sign in to comment.