This is the route/oanisations.js :
const express = require('express');
const { PermissionMiddlewareCreator } = require('forest-express-sequelize');
const { organisations } = require('../models');
const router = express.Router();
const permissionMiddlewareCreator = new PermissionMiddlewareCreator('organisations');
// This file contains the logic of every route in Forest Admin for the collection organisations:
// - Native routes are already generated but can be extended/overriden - Learn how to extend a route here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/extend-a-route
// - Smart action routes will need to be added as you create new Smart Actions - Learn how to create a Smart Action here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/actions/create-and-manage-smart-actions
// Create a Organisation
router.post('/organisations', permissionMiddlewareCreator.create(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#create-a-record
next();
});
// Update a Organisation
router.put('/organisations/:recordId', permissionMiddlewareCreator.update(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#update-a-record
next();
});
// Delete a Organisation
router.delete('/organisations/:recordId', permissionMiddlewareCreator.delete(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#delete-a-record
next();
});
// Get a list of Organisations
router.get('/organisations', permissionMiddlewareCreator.list(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#get-a-list-of-records
next();
});
// Get a number of Organisations
router.get('/organisations/count', permissionMiddlewareCreator.list(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#get-a-number-of-records
next();
});
// Get a Organisation
router.get('/organisations/:recordId(?!count)', permissionMiddlewareCreator.details(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#get-a-record
next();
});
// Export a list of Organisations
router.get('/organisations.csv', permissionMiddlewareCreator.export(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#export-a-list-of-records
next();
});
// Delete a list of Organisations
router.delete('/organisations', permissionMiddlewareCreator.delete(), (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#delete-a-list-of-records
next();
});
module.exports = router;
I’m going to try it and keep you updated if it’s wok
Kind regards,
Gauthier