0.11.18 : new group structure
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "harmony-back",
|
||||
"version": "0.11.17",
|
||||
"version": "0.11.18",
|
||||
"private": true,
|
||||
"description": "A Strapi application",
|
||||
"scripts": {
|
||||
|
||||
@@ -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
14
types/generated/components.d.ts
vendored
14
types/generated/components.d.ts
vendored
@@ -19,6 +19,19 @@ export interface AddressFullAddress extends Struct.ComponentSchema {
|
||||
};
|
||||
}
|
||||
|
||||
export interface GroupActivity extends Struct.ComponentSchema {
|
||||
collectionName: 'components_group_activities';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Activity';
|
||||
};
|
||||
attributes: {
|
||||
activityDate: Schema.Attribute.DateTime;
|
||||
activityMessage: Schema.Attribute.String;
|
||||
activityUser: Schema.Attribute.String;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SocialTags extends Struct.ComponentSchema {
|
||||
collectionName: 'components_social_tags';
|
||||
info: {
|
||||
@@ -50,6 +63,7 @@ declare module '@strapi/strapi' {
|
||||
export module Public {
|
||||
export interface ComponentSchemas {
|
||||
'address.full-address': AddressFullAddress;
|
||||
'group.activity': GroupActivity;
|
||||
'social.tags': SocialTags;
|
||||
'user.permissions': UserPermissions;
|
||||
}
|
||||
|
||||
6
types/generated/contentTypes.d.ts
vendored
6
types/generated/contentTypes.d.ts
vendored
@@ -1072,16 +1072,12 @@ export interface ApiGroupGroup extends Struct.CollectionTypeSchema {
|
||||
};
|
||||
attributes: {
|
||||
access: Schema.Attribute.Enumeration<['private', 'public', 'closed']>;
|
||||
activityType: Schema.Attribute.String;
|
||||
activities: Schema.Attribute.Component<'group.activity', true>;
|
||||
banner: Schema.Attribute.Media<'images' | 'files' | 'videos' | 'audios'>;
|
||||
category: Schema.Attribute.Enumeration<
|
||||
['mixedChoir', 'womensChoir', 'mensChoir', 'childrensChoir']
|
||||
>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||
Schema.Attribute.Private;
|
||||
description: Schema.Attribute.Text;
|
||||
lastActivity: Schema.Attribute.DateTime;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'api::group.group'> &
|
||||
Schema.Attribute.Private;
|
||||
|
||||
Reference in New Issue
Block a user