0.11.18 : new group structure
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "harmony-back",
|
"name": "harmony-back",
|
||||||
"version": "0.11.17",
|
"version": "0.11.18",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "A Strapi application",
|
"description": "A Strapi application",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -35,15 +35,6 @@
|
|||||||
"repeatable": true,
|
"repeatable": true,
|
||||||
"component": "social.tags"
|
"component": "social.tags"
|
||||||
},
|
},
|
||||||
"category": {
|
|
||||||
"type": "enumeration",
|
|
||||||
"enum": [
|
|
||||||
"mixedChoir",
|
|
||||||
"womensChoir",
|
|
||||||
"mensChoir",
|
|
||||||
"childrensChoir"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"access": {
|
"access": {
|
||||||
"type": "enumeration",
|
"type": "enumeration",
|
||||||
"enum": [
|
"enum": [
|
||||||
@@ -58,12 +49,6 @@
|
|||||||
"target": "api::group-membership.group-membership",
|
"target": "api::group-membership.group-membership",
|
||||||
"mappedBy": "group"
|
"mappedBy": "group"
|
||||||
},
|
},
|
||||||
"lastActivity": {
|
|
||||||
"type": "datetime"
|
|
||||||
},
|
|
||||||
"activityType": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"state": {
|
"state": {
|
||||||
"type": "enumeration",
|
"type": "enumeration",
|
||||||
"enum": [
|
"enum": [
|
||||||
@@ -71,6 +56,11 @@
|
|||||||
"recruiting",
|
"recruiting",
|
||||||
"audition"
|
"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
|
// 2) Crée le group via core controller
|
||||||
ctx.request.body = { data };
|
ctx.request.body = { data };
|
||||||
const response = await super.create(ctx); // { data: { id, attributes }, meta: {} }
|
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 {
|
export interface SocialTags extends Struct.ComponentSchema {
|
||||||
collectionName: 'components_social_tags';
|
collectionName: 'components_social_tags';
|
||||||
info: {
|
info: {
|
||||||
@@ -50,6 +63,7 @@ declare module '@strapi/strapi' {
|
|||||||
export module Public {
|
export module Public {
|
||||||
export interface ComponentSchemas {
|
export interface ComponentSchemas {
|
||||||
'address.full-address': AddressFullAddress;
|
'address.full-address': AddressFullAddress;
|
||||||
|
'group.activity': GroupActivity;
|
||||||
'social.tags': SocialTags;
|
'social.tags': SocialTags;
|
||||||
'user.permissions': UserPermissions;
|
'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: {
|
attributes: {
|
||||||
access: Schema.Attribute.Enumeration<['private', 'public', 'closed']>;
|
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'>;
|
banner: Schema.Attribute.Media<'images' | 'files' | 'videos' | 'audios'>;
|
||||||
category: Schema.Attribute.Enumeration<
|
|
||||||
['mixedChoir', 'womensChoir', 'mensChoir', 'childrensChoir']
|
|
||||||
>;
|
|
||||||
createdAt: Schema.Attribute.DateTime;
|
createdAt: Schema.Attribute.DateTime;
|
||||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
description: Schema.Attribute.Text;
|
description: Schema.Attribute.Text;
|
||||||
lastActivity: Schema.Attribute.DateTime;
|
|
||||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||||
localizations: Schema.Attribute.Relation<'oneToMany', 'api::group.group'> &
|
localizations: Schema.Attribute.Relation<'oneToMany', 'api::group.group'> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
|
|||||||
Reference in New Issue
Block a user