0.11.18 : new group structure
This commit is contained in:
@@ -35,15 +35,6 @@
|
||||
"repeatable": true,
|
||||
"component": "social.tags"
|
||||
},
|
||||
"category": {
|
||||
"type": "enumeration",
|
||||
"enum": [
|
||||
"mixedChoir",
|
||||
"womensChoir",
|
||||
"mensChoir",
|
||||
"childrensChoir"
|
||||
]
|
||||
},
|
||||
"access": {
|
||||
"type": "enumeration",
|
||||
"enum": [
|
||||
@@ -58,12 +49,6 @@
|
||||
"target": "api::group-membership.group-membership",
|
||||
"mappedBy": "group"
|
||||
},
|
||||
"lastActivity": {
|
||||
"type": "datetime"
|
||||
},
|
||||
"activityType": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "enumeration",
|
||||
"enum": [
|
||||
@@ -71,6 +56,11 @@
|
||||
"recruiting",
|
||||
"audition"
|
||||
]
|
||||
},
|
||||
"activities": {
|
||||
"type": "component",
|
||||
"repeatable": true,
|
||||
"component": "group.activity"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,23 @@ export default factories.createCoreController(
|
||||
}
|
||||
}
|
||||
|
||||
const userId = ctx.state.user?.id;
|
||||
if (userId) {
|
||||
const user = ctx.state.user;
|
||||
const userName =
|
||||
user?.surname && user?.name
|
||||
? `${user.surname} ${user.name}`
|
||||
: user?.username || "Utilisateur";
|
||||
|
||||
const newActivity = {
|
||||
activityMessage: "Création du groupe",
|
||||
activityDate: new Date().toISOString(),
|
||||
activityUser: userName,
|
||||
};
|
||||
|
||||
data.activities = [newActivity];
|
||||
}
|
||||
|
||||
// 2) Crée le group via core controller
|
||||
ctx.request.body = { data };
|
||||
const response = await super.create(ctx); // { data: { id, attributes }, meta: {} }
|
||||
|
||||
19
src/components/group/activity.json
Normal file
19
src/components/group/activity.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"collectionName": "components_group_activities",
|
||||
"info": {
|
||||
"displayName": "Activity",
|
||||
"description": ""
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"activityMessage": {
|
||||
"type": "string"
|
||||
},
|
||||
"activityUser": {
|
||||
"type": "string"
|
||||
},
|
||||
"activityDate": {
|
||||
"type": "datetime"
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user