Hi
It was for my category table.
Here is what I’am trying to do.
routes/category.js
// Create a Category
router.post(
"/category",
permissionMiddlewareCreator.create(),
async (request, response, next) => {
// Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#create-a-record
console.log("create category");
const categoryData = request.body.data;
let departementId;
try {
departementId = categoryData.relationships.department.data.id;
} catch (err) {}
console.log(departementId, "dep id");
let categoryToCreate = {
departmentId: departementId,
};
try {
//creating the category using my backend api
let res = await network.createCategory(categoryTocreate);
console.log(res);
} catch (err) {
//error during the creation
response.status(500).send("can't create category");
return null;
}
//telling forest that the creation was successful
response.status(200).send("category created");
return null;
next();
}
);
Tell me if it’s not clear or if you need more infos
Thank you for your help and fast reply
Ilias