Panora
Panora copied to clipboard
Fix for Storing Nested Unified Objects in Database
-
Case 1:
- When we pull data (using the syncService) from third parties that consist of nested objects, some connector’s mappers only convert it into a unified object using the
coreUnificationService.unifymethod. In contrast, others useingestService.ingestData. -
Possible Solution: It should use
ingestService.ingestData, which ensures that the nested object will be stored in the database and will return a unified object that will be stored in the main object’s unified format.
- When we pull data (using the syncService) from third parties that consist of nested objects, some connector’s mappers only convert it into a unified object using the
-
Case 2:
- When calling the unified API endpoint to add an object, the nested object is not added to the database when we pass a nested object as part of the unified object. (For example, if we pass a comment object as part of a ticket, the comment will not be added to
tcg_comments). -
Possible Solution: As a first step, we desunify the passed object, ensuring that the nested object also converts into its original form. Then, when we call the
add<object>method, which calls the respective third party’s method to add the object, we also call third-party endpoints for both the original object and its nested object. Instead of returning the response data of the original object, we assign the nested object’s response data inside the original object’s response data (for example, if we receive comment response data and ticket response data, thenticketResponse.data.comment = commentResponse.data). After this, the response data is passed to the unify method. Here, as mentioned in Case 1, we check for nested objects and utilize ingestData to store the nested object inside its respective database table.
- When calling the unified API endpoint to add an object, the nested object is not added to the database when we pass a nested object as part of the unified object. (For example, if we pass a comment object as part of a ticket, the comment will not be added to
For case 2 you're right ! Thats something we must do ! For case 1, actually if im not ingesting its because its not needed but if you've came across a bug where inges must be done and not only unification let me know !