Revive EntityUtil.merge() function. - #429
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request refactors entity merge functionality by extracting the merge logic from EntityMergeProvider.ts into a new reusable utility module EntityUtil.ts. The refactoring improves code organization and maintainability by separating business logic validation (provider layer) from core merge operations (utility layer), while preserving all existing functionality.
Key Changes:
- Created new
EntityUtil.tswithmerge(),getMetadata(), and supporting functions for recursive entity merging - Introduced
IMergePropsinterface to generalize merge parameters beyond the specificIRecordMergetype - Updated
EntityMergeProvider.tsto delegate toEntityUtilmethods, reducing code duplication
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/utils/EntityUtil.ts |
New utility module containing metadata retrieval, merge logic, and cascade merge helpers extracted from EntityMergeProvider |
src/providers/common/EntityMergeProvider.ts |
Refactored to use EntityUtil methods, removing redundant implementations and imports |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors and modularizes the entity merge logic by moving it out of
EntityMergeProvider.tsand into a new utility module,EntityUtil.ts. The main purpose is to improve code organization and reusability for metadata handling and record merging, while preserving all existing functionality.Refactoring and Modularization
EntityMergeProvider.tsinto a new utility moduleEntityUtil.ts. This includes thegetMetadatafunction, the mainmergefunction, and related helpers for cascading merges and table name resolution. ([[1]](https://github.com/samchon/backend/pull/429/files#diff-52996d10a31875cefd3808d37f955ef225a6874c92d4b8e97d8f2f62fc283c7dL46-L212),[[2]](https://github.com/samchon/backend/pull/429/files#diff-a3f00de28cf17983ad28ffb850c0d3c356d3ff885b87b83dae60e66cf0013f88R1-R208))EntityMergeProvider.tsto use the newEntityUtil.getMetadata()andEntityUtil.merge()methods, removing the old in-file implementations. ([[1]](https://github.com/samchon/backend/pull/429/files#diff-52996d10a31875cefd3808d37f955ef225a6874c92d4b8e97d8f2f62fc283c7dL23-R18),[[2]](https://github.com/samchon/backend/pull/429/files#diff-52996d10a31875cefd3808d37f955ef225a6874c92d4b8e97d8f2f62fc283c7dL46-L212))Code Cleanup
EntityMergeProvider.tsthat are now handled byEntityUtil.ts. ([[1]](https://github.com/samchon/backend/pull/429/files#diff-52996d10a31875cefd3808d37f955ef225a6874c92d4b8e97d8f2f62fc283c7dL2-R7),[[2]](https://github.com/samchon/backend/pull/429/files#diff-52996d10a31875cefd3808d37f955ef225a6874c92d4b8e97d8f2f62fc283c7dL46-L212))Utility Improvements
IMergePropsinEntityUtil.tsto clarify the merge function’s input parameters. ([src/utils/EntityUtil.tsR1-R208](https://github.com/samchon/backend/pull/429/files#diff-a3f00de28cf17983ad28ffb850c0d3c356d3ff885b87b83dae60e66cf0013f88R1-R208))[src/utils/EntityUtil.tsR1-R208](https://github.com/samchon/backend/pull/429/files#diff-a3f00de28cf17983ad28ffb850c0d3c356d3ff885b87b83dae60e66cf0013f88R1-R208))