Skip to content

Instantly share code, notes, and snippets.

@olivier5741
Created September 12, 2022 17:15
Show Gist options
  • Save olivier5741/3191f8372afb22e3626428b0d785da40 to your computer and use it in GitHub Desktop.
Save olivier5741/3191f8372afb22e3626428b0d785da40 to your computer and use it in GitHub Desktop.
Consolidation logCiCa
{
"codes": [
{
"ids": ["ofn_be/country/29"],
"name": "Belgium",
"list": {
"ids": ["iso/country"]
}
}
],
"places": [
{
"ids": ["ofn_be/address/66738"],
"services": ["shipping"],
"private": true,
"address": {
"street": "Grand rue",
"postalCode": "6850",
"locality": "Carlsbourg",
"country": {
"ids": ["ofn_be/country/29"]
}
}
},
{
"ids": ["ofn_be/address/66737"],
"services": ["billing"],
"private": true,
"address": {
"street": "Grand rue",
"postalCode": "6850",
"locality": "Carlsbourg",
"country": {
"ids": ["ofn_be/country/29"]
}
}
}
],
"workspaces": [
{
"ids": ["ofn_be/user/3497"]
},
{
"ids": ["ofn_be/enterprise/591"],
"name": "Comptoir Demo OFN"
},
{
"ids": ["logcica/workspace/ofn_be"]
}
],
"customers": [
{
"ids": ["ofn_be/customer/2997"],
"owner": {
"workspace": {
"ids": ["ofn_be/enterprise/591"]
}
},
"places": [
{
"ids": ["ofn_be/address/66738"]
},
{
"ids": ["ofn_be/address/66737"]
}
]
}
],
"suppliers": [
{
"ids": ["ofn_be/user/3497/enterprise/591"],
"name": "Comptoir Demo OFN",
"owner": {
"workspace": {
"ids": ["ofn_be/user/3497"]
}
}
}
],
"shippingMethods": [
{
"ids": [
"ofn_be/shipping_method/112",
"https://openfoodnetwork.be/shippingmethods/112"
],
"name": "Livraison par Bpost",
"owner": {
"workspace": {
"ids": ["ofn_be/enterprise/591"]
}
}
}
],
"catalogs": [
{
"ids": ["ofn_be/order_cycle/2545"],
"owner": {
"workspace": {
"ids": ["ofn_be/enterprise/591"]
}
}
}
],
"productClassifications": [
{
"ids": ["logcica/product_classification/ofn_be"],
"owner": {
"workspace": {
"ids": ["logcica/workspace/ofn_be"]
}
}
}
],
"productCategories": [
{
"ids": ["ofn_be/taxon/2"],
"classification": {
"ids": ["logcica/product_classification/ofn_be"]
}
}
],
"productGroups": [
{
"ids": ["ofn_be/product/9737"],
"name": "Chocolat noir sans sucre",
"producer": {
"workspace": {
"ids": ["ofn_be/enterprise/591"]
}
}
}
],
"products": [
{
"ids": ["ofn_be/variant/23800", "ofn_be/variant/id/23800"],
"name": "Chocolat noir sans sucre",
"group": {
"ids": ["ofn_be/product/9737"]
},
"categories": [
{
"ids": ["ofn_be/taxon/2"]
}
],
"producer": {
"workspace": {
"ids": ["ofn_be/enterprise/591"]
}
}
}
],
"catalogItems": [
{
"ids": ["ofn_be/order_cycle/2545/variant/23800"],
"name": "Chocolat noir sans sucre",
"product": {
"ids": ["ofn_be/variant/23800"]
},
"catalog": {
"ids": ["ofn_be/order_cycle/2545"]
}
}
],
"orders": [
{
"number": "R656564155",
"link": "https://openfoodnetwork.be/admin/orders/R656564155/edit",
"ids": ["ofn_be/orders/R656564155"],
"createdAt": "2022-09-12T00:00:00.000Z",
"status": "complete",
"shipmentStatus": "shipped",
"paymentStatus": "paid",
"buyer": {
"customer": {
"ids": ["ofn_be/customer/2997"]
},
"workspace": {
"ids": ["ofn_be/user/3497"]
}
},
"seller": {
"supplier": {
"ids": ["ofn_be/user/3497/enterprise/591"]
},
"workspace": {
"ids": ["ofn_be/enterprise/591"]
}
},
"broker": {
"workspace": {
"ids": ["logcica/workspace/ofn_be"]
}
},
"channel": {
"ids": ["logcica/transaction_channel/ofn_be"],
"name": "Open Food Network Belgium"
},
"shippingAddress": {
"place": {
"ids": ["ofn_be/address/66738"]
}
},
"shippingMethod": {
"ids": ["ofn_be/shipping_method/112"]
},
"lines": [
{
"name": "Chocolat noir sans sucre",
"item": {
"ids": ["ofn_be/order_cycle/2545/variant/23800"]
},
"product": {
"ids": ["ofn_be/variant/23800"]
},
"quantity": {
"value": 1
}
}
]
}
]
}
{
"profiles": [
{ "key": "aggressive", "action": "setUnlessSourceEmpty" },
{
"key": "aggressiveJoinRootPlaces",
"action": "setUnlessSourceEmpty",
"unless": [
{ "filter": { "regex": "^places$", "isRoot": true }, "action": "join" }
]
},
{
"key": "protective",
"action": "setUnlessSourceEmpty",
"unless": [
{
"filter": { "regex": "status$", "isRoot": true },
"action": "setUnlessSourceEmpty"
}
]
},
{
"key": "defensive",
"action": "setUnlessSourceEmpty",
"unless": [
{
"filter": { "regex": "status$", "isRoot": true },
"action": "setUnlessSourceEmpty"
},
{
"filter": { "regex": "^name$", "isRoot": true },
"action": "setUnlessSourceEmpty"
},
{
"filter": { "regex": "^description$", "isRoot": true },
"action": "setUnlessSourceEmpty"
}
]
},
{
"key": "defensiveJoinServices",
"action": "setUnlessSourceEmpty",
"unless": [
{
"filter": { "regex": "status$", "isRoot": true },
"action": "setUnlessSourceEmpty"
},
{
"filter": { "regex": "^name$", "isRoot": true },
"action": "setUnlessSourceEmpty"
},
{
"filter": { "regex": "^description$", "isRoot": true },
"action": "setUnlessSourceEmpty"
},
{
"filter": { "regex": "^services$", "isRoot": true },
"action": "join"
}
]
}
],
"rules": [
{ "collection": "workspaces", "profileKey": "defensive" },
{ "collection": "places", "profileKey": "defensiveJoinServices" },
{ "collection": "suppliers", "profileKey": "aggressive" },
{ "collection": "shippingMethods", "profileKey": "aggressive" },
{ "collection": "productClassifications", "profileKey": "protective" },
{ "collection": "productGroups", "profileKey": "aggressive" },
{ "collection": "catalogs", "profileKey": "aggressive" },
{ "collection": "customers", "profileKey": "aggressiveJoinRootPlaces" },
{ "collection": "productCategories", "profileKey": "protective" },
{ "collection": "products", "profileKey": "protective" },
{ "collection": "catalogItems", "profileKey": "aggressive" },
{ "collection": "orders", "profileKey": "aggressive" }
],
"key": "ofn_order_event"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment