Hello,
I migrat my project from
forest-express-mongoose": “7.6.0”,
to : "@forestadmin/agent": “^1.8.13”,
“@forestadmin/datasource-mongoose”: “^1.4.0”,
“express”: “^4.18.2”,
“mongoose”: “^7.2.0”,
its working but i cannot able to activate my smart actions
the old version
before i init the forest and give him de configDir :
app.use(
await forest.init({
configDir: path.join(__dirname, '../../services/' + serviceName + '/forest'),
envSecret: CONFIG.credentials.forest.env_secret,
authSecret: CONFIG.credentials.forest.auth_secret,
objectMapping: mongoose,
connections: { default: mongoose.connections[0] },
}),
);
the actions i declared in tasks file and i export the collection like this
module.exports = () => {
forest.collection('Area', {
actions: [createAction],
fields: [],
segments: [],
});
};
in the new documentation i see we need to creat our collection in collections/*.js
file.
i use the agent from global variable agent its ok ??
SERVICE.agent = agent;
or how we callled from another file ??
const { agent } = SERVICE;
module.exports = () => {
agent.customizeCollection('Area', (Area) => {
Area.addAction('Mark as Live', {
scope: 'Global',
form: [ ------- ],
});
});
};
and i changed my route to :
const { PermissionMiddlewareCreator } = require('forest-express-mongoose');
const controller = require('../../controllers/actions/areasActionsController');
module.exports = (router) => {
const permissionMiddlewareCreator = new PermissionMiddlewareCreator('Area');
router.route('/').post(permissionMiddlewareCreator.list(), controller.create);
};
- Project name: Mobion_freefloating
- Environment name: local
- Agent (forest package) name & version: …
- Database type: mongoDb mongoose
- Recent changes made on your end if any: today