Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Storing Nested Unified Objects in Database #660

Open
mit-27 opened this issue Aug 14, 2024 · 1 comment
Open

Fix for Storing Nested Unified Objects in Database #660

mit-27 opened this issue Aug 14, 2024 · 1 comment

Comments

@mit-27
Copy link
Contributor

mit-27 commented Aug 14, 2024

  • 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.unify method. In contrast, others use ingestService.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.
  • 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, then ticketResponse.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.
@naelob
Copy link
Contributor

naelob commented Aug 16, 2024

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 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants