2025-04-14 - Frontend LinkPath structure for tableOutput

From Izara Wiki
Jump to navigation Jump to search

Service - Search Results

Overview

Structure frontend TableConfig and Output prepare for shared library that creates complexFilter and requestProperties


Service - Search Results

Overview

Structure frontend TableConfig and Output prepare for shared library that creates complexFilter and requestProperties

Example params in tableConfig

let paramFromTableOutput = {

	// .. other properties same as sent to backend
	// requiredDataFields not needed in tableConfig as referenced in elements and sortFields

	elements: {
        // add example of pageOutput element that references requiredDataLinkStepObjects
    },
	values: {
		// values are shared between requestProperties and filter values. This set can be iterated to overwrite values using userTag to identify
		userTag_1:{
			defaultValue: "xx",
		},
		userTag_2:{
			defaultValue: "xx",
		},
		userTag_3:{
			defaultValue: "xx",
		},
		userTag_4:{
			defaultValue: "xx",
		},
		userTag_5:{
			defaultValue: "xx",
		},
		userTag_6:{
			valueSource: "complexFilterCombination",
            complexFilterCombinationId: "hash_complexFilterCombinationA",
		},
		userTag_7:{
			valueSource: "perParentCombination",
            perParentCombinationId: "hash_perParentCombinationA",
		},
        userTag_8: {
            valueSource: 'perParentIdentifier',
            perParentIdentifierFieldname: 'sellOfferId'
        },,
		userTag_9:{
			defaultValue: "xx",
		},
		userTag_10:{
			defaultValue: "xx",
		},
		userTag_11:{
			defaultValue: "xx",
		},
	}
}

Example params sent to backend

let paramFromTableOutput = {
	objType: { //* main objType
		serviceTag: "ProductManager",
		objectType: "Product"
	},
    initialLogicalElementId: "uuid_logical_1",
    logicalElements: {
       uuid_logical_1: {
         logicalElementType: "logical",
         previousLogicalElementId: null,
         nextLogicalElementId: null,

         objType: {
           serviceTag: "ProductManager",
           objectType: "product"
         },
         fieldName: "productId",
         comparison: "equals",
         value: "userTag_1"
       }
    },
	requiredDataFields: [ //* linkStepObjects to create main sort result's requiredData and sortFields
        // not needed at tableConfig level because can be built from table's elements and sortFields before sending to lib that converts to backend structure
        "userTag_LinkStepObjectA", // no link, field in main objType (structure same linkPath but only one step)
        "userTag_LinkStepObjectB", // has link
	],
	complexFilterCombinations:{
		hash_complexFilterCombinationA: {
          objType: {
            serviceTag: "Locations",
            objectType: "locationNode"
          },
          initialLogicalElementId: "child_complexFilter_localtionNode",
          logicalElements: {
            child_complexFilter_localtionNode: {
              logicalElementType: "childComplexFilter",
              previousLogicalElementId: null,
              nextLogicalElementId: null,

              childLogicalElementId: "logical_locationNode",
              objType: {
                serviceTag: "Locations",
                objectType: "locationNode"
              },
              pathLinkType: {
                objType: {
                  serviceTag: "Locations",
                  objectType: "locationNode"
                },
                relType: {
                  serviceTag: "Locations",
                  relationshipTag: "hasParentLocationNode"
                },
                direction: "to"
              },
            },
            logical_locationNode: {
               logicalElementType: "logical",
               previousLogicalElementId: "child_complexFilter_localtionNode",
               nextLogicalElementId: null,

               objType: {
                serviceTag: "Locations",
                objectType: "locationNode"
               },
               fieldName: "locationNodeId",
               comparison: "equals",
               value: "userTag_7"
            }
         }
       },
	},
	perParentCombinations:{
		hash_perParentCombinationA: {
          objType: {
            serviceTag: "SellOfferPlan",
            objectType: "sellOfferPlan"
          },
          initialLogicalElementId: "child_complexFilter_1",
          logicalElements: {
            child_complexFilter_1: {
              logicalElementType: "childComplexFilter",
              previousLogicalElementId: null,
              nextLogicalElementId: null,

              childLogicalElementId: "logical_sellOffer",
              objType: {
                serviceTag: "SellOfferPlan",
                objectType: "sellOfferPlan"
              },
              pathLinkType: {
                objType: {
                  serviceTag: "SellOfferManager",
                  objectType: "sellOffer"
                }, 
                relType: {
                  serviceTag: "SellOfferManager",
                  relationshipTag: "usesSellOfferPlan"
                },
                direction: "to"
              },
              requestProperties: {
                tag_orderQuantity: "userTag_9"
              }
           },
           logical_sellOffer: {
              logicalElementType: "logical",
              previousLogicalElementId: "child_complexFilter_1",
              nextLogicalElementId: null,

              objType: {
                serviceTag: "SellOfferManager",
                objectType: "sellOffer"
              },
              fieldName: "sellOfferId",
              comparison: "equals",
              value: "userTag_8"
           }
        }
      },
	},
	requiredDataLinkStepObjects: {
		userTag_LinkStepObjectA: { //* requiredData no linkPath
			initialObjType: { //* main objType
				serviceTag: "ProductManager",
				objectType: "Product"
			},
			linkSteps: ["hash_linkStepA_1"],
		},
        userTag_LinkStepObjectB: { // requiredDataFields for finding max orderTotal
            initialObjType: { //* main objType
				serviceTag: "ProductManager",
				objectType: "Product"
			},
			linkSteps: ["hash_linkStepB_1", "hash_linkStepB_2", "hash_linkStepB_3"],
        }
        // userTag_LinkStepObjectC
        // userTag_LinkStepObjectD
	},
	requiredDataLinkSteps: {
		hash_linkStepA_1:{
          fieldName: "xxx" 
        },
        hash_linkStepB_1:{
          pathLinkType: {
             objType: {
               serviceTag: "SellOfferManager",
               objectType: "SellOffer"
             },
             relType: {
               serviceTag: "ProductManager",
               relationshipTag: "hasSellOffer"
             },
             direction: "to",
          },
           addFilterMain: true, //default: false => need to add filterMain set = true
           filterElements: { //* filter in linkPath
             objType: {
               serviceTag: "SellOfferManager",
               objectType: "SellOffer"
             },
             initialLogicalElementId: "logical_sellOffer_in_link",
             logicalElements: {
               logical_sellOffer_in_link: {
                  logicalElementType: "logical",
                  previousLogicalElementId: null,
                  nextLogicalElementId: null,

                  objType: {
                    serviceTag: "SellOfferManager",
                    objectType: "SellOffer"
                  },
                  fieldName: "userId",
                  comparison: "equals",
                  value: "userTag_2"
               }
            }
          },

        }, 
        hash_linkStepB_2: {
           pathLinkType: {
             objType: {
               serviceTag: "OrderPrice",
               objectType: "OrderPrice"
             },
             relType: {
               serviceTag: "sellOfferStandard",
               relationshipTag: "hasOrderPrice"
             },
             direction: "to",
           },
          requestProperties: {
            tag_deliverTo: "userTag_3",
            tag_sellOfferPlan: "userTag_4",
            // tag_sellOfferPlanDeliveryMethodLink: "userTag_5",
            // tag_sellOfferPlanUserPaymentMethodLink: "userTag_6"
          }
          aggregate: "max",
          sortFields: [
       			{
            		requiredDataLinkStepObjectId: "userTag_LinkStepObjectC",
		            dataType: "number"
        		},
				{
        		     requiredDataLinkStepObjectId: "userTag_LinkStepObjectD",
		             dataType: "string"
		         }
            ],
        }, 
        hash_linkStepB_3: {
           fieldName: "zzz",
        }
	},
	sortFields: [
        {
             requiredDataLinkStepObjectId: "userTag_LinkStepObjectB",
             dataType: "number"
        },
		{
             requiredDataLinkStepObjectId: "userTag_LinkStepObjectA",
             dataType: "string"
         }
    ],
	values: {
		userTag_1:{
			value: "xx",
		},
		userTag_2:{
			value: "yy",
		},
		userTag_3:{
			valueSource: "complexFilterCombination",
            complexFilterCombinationId: "hash_complexFilterCombinationA",
		},
		userTag_4:{
			valueSource: "perParentCombination",
            perParentCombinationId: "hash_perParentCombinationA",
		},
		userTag_7: {
          value: "zz",
        },
        userTag_8: {
          valueSource: 'perParentIdentifier',
          perParentIdentifierFieldname: 'sellOfferId'
        },
        userTag_9: {
          value: 2,
        },
	 }
  }