Add modification for post logic and add fields on user / contact
This commit is contained in:
@@ -41,7 +41,7 @@ export default {
|
||||
});
|
||||
|
||||
if (!alreadyExists) {
|
||||
await strapi.db.query("api::post.post").create({
|
||||
const post = await strapi.db.query("api::post.post").create({
|
||||
data: {
|
||||
title: article.title,
|
||||
content: article.description,
|
||||
@@ -55,6 +55,15 @@ export default {
|
||||
},
|
||||
});
|
||||
|
||||
// Créer le postOwnership associé
|
||||
await strapi.db.query("api::post-ownership.post-ownership").create({
|
||||
data: {
|
||||
post: post.id,
|
||||
contextType: "system",
|
||||
relation: "owner",
|
||||
},
|
||||
});
|
||||
|
||||
strapi.log.info(`🆕 Article créé : ${article.title}`);
|
||||
} else {
|
||||
strapi.log.info(`🔁 Article déjà existant : ${article.title}`);
|
||||
|
||||
Reference in New Issue
Block a user