Hello,
I’m trying to know if it’s possible to override the default route, as exemple update of a collection.
agent-version: node-v2 => Forest Admin - [Beta] Developer guide (agents v2)
Hello,
I’m trying to know if it’s possible to override the default route, as exemple update of a collection.
agent-version: node-v2 => Forest Admin - [Beta] Developer guide (agents v2)
The new NodeJS implementation won’t support route overrides.
There are many reasons for that, the main one being that letting customers interact with low-level requests caused changes on our end to break customer code more often than we would like.
Instead multiple features are planned to fill the same need.
We’re working hard to release and document them as fast as possible, now that the new agent is publicly announced and a Beta is available.
collection.addHook('List', (context, flow) => {
return flow.continue()
});
Hooks is the lowest level feature that the new agents will have.
They allow to change behaviors in a controlled way.
collection.replaceWrite('aFieldName', value => {
return { aFieldName: btoa(value) };
})
Write overrides allow to override the action that is performed when a given field is modified.
collection.addFieldValidation('aFieldName', 'GreaterThan', 4)
collection.addRelationValidation('someRelation', async (context) => {
return {
field: 'author:country:name',
operator: 'Equal',
value: 'France'
}
});
This feature allows to add validation both in the frontend and agent for a list of preset conditions on specific fields.
so with you’re exemple we going to have something like :
collection.addHook('Update', (context, flow) => {
return flow.continue()
});
Is the field validation is are already check or only if the field changed ?
It is difficult to reply to that last question: hooks are being designed/developed as we speak, so I can’t know for sure.
What I can tell is that