0.11.9 : add create event and field changes

This commit is contained in:
2025-10-24 12:40:15 +02:00
parent 4c5b72d0d9
commit 337293182b
9 changed files with 449 additions and 1322 deletions

View File

@@ -23,9 +23,27 @@ export default ({ strapi }: { strapi: Core.Strapi }) =>
}
try {
// Format tags from array of strings to array of component objects
const data = ctx.request.body.data;
if (data.tags && Array.isArray(data.tags)) {
data.tags = data.tags
.filter((tag: any) => {
// Skip if already formatted as object, or if it's null/empty
if (typeof tag === "object") return true;
return tag && String(tag).trim().length > 0;
})
.map((tag: any) => {
// Convert string tags to component format
if (typeof tag === "string") {
return { tag: tag.trim() };
}
return tag;
});
}
// 1. Call the default Strapi create method
const event = await strapi.entityService.create("api::event.event", {
data: ctx.request.body.data,
data,
});
if (!event) {