-
Notifications
You must be signed in to change notification settings - Fork 8
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
"Non-ID" keys #117
base: main
Are you sure you want to change the base?
"Non-ID" keys #117
Conversation
|
||
for (let idx = 0; idx < paths.length; idx++) { | ||
const entity = getEntityByContextPath(paths.slice(0, idx + 1), txContext.hasComp) | ||
const entityID = entityIDs[idx] | ||
const entityPathVal = `${entity.name}(${entityID})` | ||
const entityPathVal = {target: entity.name, key: entityID}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This illustrates one main change: paths are expressed as JSON arrays like
[{target: "RootEntity", key: {ID: "..."}}, {target: "Level1Entity", key: {ID: "..."}}]
instead of
"RootEntity(...)/Level1Entity(...)"
…cking into feat/non-ID-keys
serviceEntity: target.name || target, | ||
changes: changes.filter(c => c.valueChangedFrom || c.valueChangedTo).map((c) => ({ | ||
...c, | ||
serviceEntityPath: stringifyPath(c.serviceEntityPath), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, if there is a single-key situation, we now serialize paths to the 'old' format before saving to the db.
@Sv7enNowitzki can you please have a look at the tests and give an OK to merge this into the main branch? |
Hi @nkaputnik No, as I mentioned earlier in the email, the current code does not work in a CAP application, such as simple-bookshop. Best Regards, |
In our project, we are dealing with a legacy data model that does not follow the best practices regarding primary keys, and there is nothing we can change about it in the mid term.
This PR aims at introducing the capability to deal with change logs for entities with complex/composite keys.
It does not cover all scenarios, but at least some situations.