Example on how to directly update via the DB connection in a beforeUpdate:
async beforeUpdate(data) {
console.dir(data, { depth: null, colors: true });
if (!data?.params?.data?.seo) {
return;
}
const structuredData = await generateProductJsonLd(data);
await strapi.db
.connection("components_shared_seos")
.where("id", data.params.data.seo.id)
.update({
structured_data: structuredData,
});
},
You can get the name of the table by connecting to the DB and search the name of your component there. This example shows a generation an auto generation of JSON-LD for SEO