0.11.9 : add create event and field changes
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"kind": "collectionType",
|
||||
"collectionName": "event_others",
|
||||
"info": {
|
||||
"singularName": "event-other",
|
||||
"pluralName": "event-others",
|
||||
"displayName": "EventOther"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false
|
||||
},
|
||||
"pluginOptions": {},
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"public": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"fromDate": {
|
||||
"type": "datetime"
|
||||
},
|
||||
"toDate": {
|
||||
"type": "datetime"
|
||||
},
|
||||
"type": {
|
||||
"type": "enumeration",
|
||||
"enum": [
|
||||
"concert",
|
||||
"festival",
|
||||
"trade show",
|
||||
"symposium",
|
||||
"competition",
|
||||
"masterclass",
|
||||
"vocal_workshop",
|
||||
"conference",
|
||||
"rehearsal",
|
||||
"outings"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* event-other controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi'
|
||||
|
||||
export default factories.createCoreController('api::event-other.event-other');
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* event-other router
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreRouter('api::event-other.event-other');
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* event-other service
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreService('api::event-other.event-other');
|
||||
@@ -51,14 +51,17 @@
|
||||
"outings"
|
||||
]
|
||||
},
|
||||
"voice": {
|
||||
"repertory": {
|
||||
"type": "enumeration",
|
||||
"enum": [
|
||||
"soprano",
|
||||
"alto",
|
||||
"tenor",
|
||||
"bass",
|
||||
"mixed"
|
||||
"sacred",
|
||||
"classical",
|
||||
"pop",
|
||||
"gospel",
|
||||
"traditional",
|
||||
"jazz",
|
||||
"world_music",
|
||||
"not_specified"
|
||||
]
|
||||
},
|
||||
"description": {
|
||||
@@ -69,6 +72,11 @@
|
||||
},
|
||||
"isPublic": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"tags": {
|
||||
"type": "component",
|
||||
"repeatable": true,
|
||||
"component": "social.tags"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user