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

@@ -1,6 +1,6 @@
{
"name": "harmony-back",
"version": "0.11.8",
"version": "0.11.9",
"private": true,
"description": "A Strapi application",
"scripts": {

View File

@@ -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"
]
}
}
}

View File

@@ -1,7 +0,0 @@
/**
* event-other controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::event-other.event-other');

View File

@@ -1,7 +0,0 @@
/**
* event-other router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::event-other.event-other');

View File

@@ -1,7 +0,0 @@
/**
* event-other service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::event-other.event-other');

View File

@@ -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"
}
}
}

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) {

View File

@@ -918,51 +918,6 @@ export interface ApiDirectMessageDirectMessage
};
}
export interface ApiEventOtherEventOther extends Struct.CollectionTypeSchema {
collectionName: 'event_others';
info: {
displayName: 'EventOther';
pluralName: 'event-others';
singularName: 'event-other';
};
options: {
draftAndPublish: false;
};
attributes: {
createdAt: Schema.Attribute.DateTime;
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
fromDate: Schema.Attribute.DateTime;
locale: Schema.Attribute.String & Schema.Attribute.Private;
localizations: Schema.Attribute.Relation<
'oneToMany',
'api::event-other.event-other'
> &
Schema.Attribute.Private;
public: Schema.Attribute.Boolean;
publishedAt: Schema.Attribute.DateTime;
title: Schema.Attribute.String;
toDate: Schema.Attribute.DateTime;
type: Schema.Attribute.Enumeration<
[
'concert',
'festival',
'trade show',
'symposium',
'competition',
'masterclass',
'vocal_workshop',
'conference',
'rehearsal',
'outings',
]
>;
updatedAt: Schema.Attribute.DateTime;
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
};
}
export interface ApiEventRelationshipEventRelationship
extends Struct.CollectionTypeSchema {
collectionName: 'event_relationships';
@@ -1031,8 +986,21 @@ export interface ApiEventEvent extends Struct.CollectionTypeSchema {
Schema.Attribute.Private;
location: Schema.Attribute.String;
publishedAt: Schema.Attribute.DateTime;
repertory: Schema.Attribute.Enumeration<
[
'sacred',
'classical',
'pop',
'gospel',
'traditional',
'jazz',
'world_music',
'not_specified',
]
>;
size: Schema.Attribute.Integer;
start: Schema.Attribute.DateTime;
tags: Schema.Attribute.Component<'social.tags', true>;
title: Schema.Attribute.String;
type: Schema.Attribute.Enumeration<
[
@@ -1051,9 +1019,6 @@ export interface ApiEventEvent extends Struct.CollectionTypeSchema {
updatedAt: Schema.Attribute.DateTime;
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
voice: Schema.Attribute.Enumeration<
['soprano', 'alto', 'tenor', 'bass', 'mixed']
>;
};
}
@@ -1947,7 +1912,6 @@ declare module '@strapi/strapi' {
'api::contact.contact': ApiContactContact;
'api::conversation.conversation': ApiConversationConversation;
'api::direct-message.direct-message': ApiDirectMessageDirectMessage;
'api::event-other.event-other': ApiEventOtherEventOther;
'api::event-relationship.event-relationship': ApiEventRelationshipEventRelationship;
'api::event.event': ApiEventEvent;
'api::group-membership.group-membership': ApiGroupMembershipGroupMembership;