We’re migrating from forest-express-sequelize
to @forestadmin/agent
.
We saw that when creating a record with a relationship, an update is called immediately after.
We have this collection BoatContentTranslation
which belongs to a BoatContent
collection. For both collections we have an override on both create and update.
When we create a boat-content-translation record the createOverride
is called, passing the data from the input form (from the context we get this).
this override function returns this object
Anyways, after the create has correctly terminated, the updateOverride
is immediately called (always from the boat-content-translation), passing this data (from the context we get this)
Which looks weird, because it is trying to update the idBoatContent
, which is already present in the record and with the same value.
The problem is that (on our side) we use these overrides to fill in a “relational audit log”, which we need to track all changes to these collections (since it’s really important for us for a number of internal reasons…) and since both the create and the update overrides have been called we get two log entries with almost the same timestamp (difference of just a few milliseconds).
And inspecting the logs we see that they are “grouped” two by two (first create then update) and the only difference between each “couple”'s before and after is the updated_at
.
The same also happens if we try to create a boat-content-translation directly from its list view (not starting from the boat-content).
We’d like to know if there’s something we are missing in the return value of the createOverride
that is causing this issue or if this is due to something else. Because we can’t understand why the updateOverride
gets called after every createOverride
. But in our perspective it shouldn’t.
So please let us know what we’re probably missing
Here is the “meta” section of the forest admin schema file:
{
"liana": "forest-nodejs-agent",
"liana_version": "1.41.7",
"liana_features": null,
"stack": {"engine": "nodejs", "engine_version": "20.11.1"}
}
and from package.json
:
"sequelize": "^6.28.0"
Thank you,
Matteo