Skip to content

Commit

Permalink
fix: up data for proto changes and added object importer
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun-KumarH committed Jul 28, 2023
1 parent a93bb60 commit 2d47bc9
Show file tree
Hide file tree
Showing 33 changed files with 1,204 additions and 564 deletions.
15 changes: 14 additions & 1 deletion demo-shop/.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,18 @@
"endpoint": "/graphql",
"job_prefix": "job_",
"data_directory": "data",
"job_directory": "jobs"
"job_directory": "jobs",
"objectImport": {
"endpoint": {
"local": "http://127.0.0.1:5000/graphql/",
"production": "https://api.restorecommerce.io/graphql"
},
"baseDir": "objects/content",
"content": [
{
"dir": "internal",
"bucketName": "internal"
}
]
}
}
3 changes: 3 additions & 0 deletions demo-shop/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules/
.env
data/catalog/
objects/*.js
objects/*.js.map
objects/*.d.ts
21 changes: 20 additions & 1 deletion demo-shop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,26 @@ to import the data locally or into the production environment.

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 should be: `dbcccf4037d64a6194db7dd3237ce6d3`.
The API key is generated during system startup from the `facade-srv` (Check the log message of facade-srv `Bootstrap API Key is`).

By default, the GraphQL importer uses the configuration file `config.json` to read data regarding endpoints for retrieving the API key
and executing mutations/ queries.

## Object Importer

To import the files, following settings needs to be configured in [config.json](cfg/config.json):
* The base directory for import,
* GraphQL endpoint
* Bucket name for the storage-server

Prerequisite: object importer should be build using `npm run build` command before importing objects.

```sh
# Run import in production-mode:
npm run import-objects -- --apiKey=<access_token> -- --NODE_ENV=local

# Run import in production-mode:
npm run import-objects -- --apiKey=<access_token> -- --NODE_ENV=production
# or:
npm run import-objects -- --apiKey=<access_token> # default is development
```
21 changes: 9 additions & 12 deletions demo-shop/data/seed_data/addresses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
longitude: 48.8
latitude: 9.2
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: 3275fcd9c84f4831aeba986e328b43ce
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: 3275fcd9c84f4831aeba986e328b43ce
---
id: 210eff6fc2f044dea7701e24a6b4ce0d
postcode: '23456'
Expand All @@ -38,14 +37,13 @@
longitude: 48.8
latitude: 9.2
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-1
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-1
---
id: 310eff6fc2f044dea7701e24a6b4ce0d
postcode: '34567'
Expand All @@ -62,11 +60,10 @@
longitude: 48.8
latitude: 9.2
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-2
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-2
28 changes: 12 additions & 16 deletions demo-shop/data/seed_data/commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
type: string_value
properties: ""
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
---
id: restore
name: restore
Expand All @@ -36,39 +35,36 @@
# description: List of topic offsets to be ignored while processing Kafka message
# type: array_value
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
---
id: reset
name: reset
description: Reset system data and state (no parameters)
parameters: []
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
---
id: version
name: version
description: "Returns the NPM package and Node.js version of the implementing service"
parameters: []
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
21 changes: 9 additions & 12 deletions demo-shop/data/seed_data/contact_point_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,32 @@
id: billing
type: billing
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
---
id: shipping
type: shipping
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
---
id: legal-address
type: legal-address
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
60 changes: 30 additions & 30 deletions demo-shop/data/seed_data/contact_points.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
telephone: "+4971146051909"
localeId: de-de
timezoneId: europe-berlin
contactPointTypeId: billing
contactPointTypeIds:
- billing
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
---
id: c0cd56ffc29f4a1189720a6db6f5abb0
physicalAddressId: eb228fb0d80d4f4fa51e1a10d8668c1c
Expand All @@ -24,16 +24,16 @@
telephone: "+491630000005"
localeId: de-de
timezoneId: europe-berlin
contactPointTypeId: shipping
contactPointTypeIds:
- shipping
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: r-ug
---
id: 30db337d800f4b009c043e2d70d8f6f4
physicalAddressId: 210eff6fc2f044dea7701e24a6b4ce0d
Expand All @@ -42,16 +42,16 @@
telephone: "+491630000002"
localeId: de-de
timezoneId: europe-berlin
contactPointTypeId: billing
contactPointTypeIds:
- billing
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-1
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-1
---
id: 40db337d800f4b009c043e2d70d8f6f4
physicalAddressId: 210eff6fc2f044dea7701e24a6b4ce0d
Expand All @@ -60,16 +60,16 @@
telephone: "+491630000005"
localeId: de-de
timezoneId: europe-berlin
contactPointTypeId: shipping
contactPointTypeIds:
- shipping
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-1
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-1
---
id: 50db337d800f4b009c043e2d70d8f6f4
physicalAddressId: 310eff6fc2f044dea7701e24a6b4ce0d
Expand All @@ -78,16 +78,16 @@
telephone: "+491630000002"
localeId: de-de
timezoneId: europe-berlin
contactPointTypeId: billing
contactPointTypeIds:
- billing
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-2
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-2
---
id: 60db337d800f4b009c043e2d70d8f6f4
physicalAddressId: 310eff6fc2f044dea7701e24a6b4ce0d
Expand All @@ -96,13 +96,13 @@
telephone: "+491630000005"
localeId: de-de
timezoneId: europe-berlin
contactPointTypeId: shipping
contactPointTypeIds:
- shipping
meta:
created: 0
modified: 0
modifiedBy: ""
owners:
- id: urn:restorecommerce:acs:names:ownerIndicatoryEntity
value: urn:restorecommerce:acs:model:organization.Organization
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-2
attributes:
- id: urn:restorecommerce:acs:names:ownerInstance
value: test-organization-2
Loading

0 comments on commit 2d47bc9

Please sign in to comment.