Fix many-to-many insert#7
Conversation
|
|
||
| if (Reflect.hasMetadata("__track_changes", event.entity.constructor)) { | ||
| if (event.entity && | ||
| Reflect.hasMetadata("__track_changes", event.entity.constructor)) { |
There was a problem hiding this comment.
Is this a linting error or purposely on a new line?
There was a problem hiding this comment.
It's a new line on purpose - since the second line is kind of long, I think it helps readability.
However, note that the weird, long spacing on that second line is an artifact of how GH renders tabs (this project uses tabs for indentation, not spaces). So, if you open this in VSCode, it actually looks like this:
There was a problem hiding this comment.
Lets keep style based changes out of this PR for now, the next line is even longer, so this change would only make sense if we were to apply this style to the entire project.
The tab's don't really work well, it's usually tab for indentation and spaces for alignment.
mwallert
left a comment
There was a problem hiding this comment.
I don't see any issues here, but I think @DropsOfSerenity has the most context for this repo.
|
|
||
| if (Reflect.hasMetadata("__track_changes", event.entity.constructor)) { | ||
| if (event.entity && | ||
| Reflect.hasMetadata("__track_changes", event.entity.constructor)) { |
There was a problem hiding this comment.
Lets keep style based changes out of this PR for now, the next line is even longer, so this change would only make sense if we were to apply this style to the entire project.
The tab's don't really work well, it's usually tab for indentation and spaces for alignment.
| const related = await relatedFactory.createMany(3); | ||
|
|
||
| // This inserts records into the join table implcitly created for MTM | ||
| // relationships. These should not be tracked, and should not fail either. |
There was a problem hiding this comment.
Should not fail should be expressed in test rather than comment. Probably we should use chai-as-promised here and do something like:
await expect(entity.save()).to.be.fulfilled;
Changes
ChangeSubscriberto check whether an entity is being inserted.Purpose
Closes #6, allowing consumers to save many-to-many relations.