0.12.3 : change updateMe to handle components
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "harmony-back",
|
||||
"version": "0.12.2",
|
||||
"version": "0.12.3",
|
||||
"private": true,
|
||||
"description": "A Strapi application",
|
||||
"scripts": {
|
||||
|
||||
22
src/components/configuration/parameter.json
Normal file
22
src/components/configuration/parameter.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"collectionName": "components_configuration_parameters",
|
||||
"info": {
|
||||
"displayName": "parameter",
|
||||
"icon": "cog"
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"emailNotification": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"pushNotification": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"sendNewsgroup": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/components/configuration/privacy.json
Normal file
35
src/components/configuration/privacy.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"collectionName": "components_configuration_privacies",
|
||||
"info": {
|
||||
"displayName": "privacy",
|
||||
"icon": "key",
|
||||
"description": ""
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"profileVisibility": {
|
||||
"type": "enumeration",
|
||||
"enum": [
|
||||
"public",
|
||||
"contacts",
|
||||
"private"
|
||||
]
|
||||
},
|
||||
"allowMessage": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"allowInvite": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"allowTag": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"showOnline": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
"name": "Apache 2.0",
|
||||
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
|
||||
},
|
||||
"x-generation-date": "2025-11-12T20:11:53.117Z"
|
||||
"x-generation-date": "2025-11-13T22:01:13.582Z"
|
||||
},
|
||||
"x-strapi-config": {
|
||||
"plugins": [
|
||||
@@ -17867,6 +17867,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -18335,6 +18341,51 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"ConfigurationParameterComponent": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"emailNotification": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"pushNotification": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sendNewsgroup": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ConfigurationPrivacyComponent": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"profileVisibility": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"public",
|
||||
"contacts",
|
||||
"private"
|
||||
]
|
||||
},
|
||||
"allowMessage": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"allowInvite": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"allowTag": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"showOnline": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AnnouncementRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -21473,6 +21524,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -25406,6 +25463,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -28898,6 +28961,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -32838,6 +32907,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -37029,6 +37104,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -41669,6 +41750,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -45599,6 +45686,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -49431,6 +49524,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -53250,6 +53349,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -57105,6 +57210,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -60852,6 +60963,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -64776,6 +64893,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -68773,6 +68896,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -72259,6 +72388,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -76674,6 +76809,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -80478,6 +80619,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -84603,6 +84750,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -88440,6 +88593,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -92381,6 +92540,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -96223,6 +96388,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -99570,6 +99741,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -104126,6 +104303,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -108011,6 +108194,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -111856,6 +112045,12 @@
|
||||
},
|
||||
"tags": {},
|
||||
"languages": {},
|
||||
"parameter": {
|
||||
"$ref": "#/components/schemas/ConfigurationParameterComponent"
|
||||
},
|
||||
"privacy": {
|
||||
"$ref": "#/components/schemas/ConfigurationPrivacyComponent"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
|
||||
@@ -225,6 +225,16 @@
|
||||
},
|
||||
"languages": {
|
||||
"type": "json"
|
||||
},
|
||||
"parameter": {
|
||||
"type": "component",
|
||||
"repeatable": false,
|
||||
"component": "configuration.parameter"
|
||||
},
|
||||
"privacy": {
|
||||
"type": "component",
|
||||
"repeatable": false,
|
||||
"component": "configuration.privacy"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,6 +206,8 @@ module.exports = (plugin) => {
|
||||
"experience",
|
||||
"tags",
|
||||
"languages",
|
||||
"parameter",
|
||||
"privacy",
|
||||
]);
|
||||
|
||||
/*
|
||||
@@ -248,9 +250,26 @@ module.exports = (plugin) => {
|
||||
ctx.request.body = newData;
|
||||
ctx.params = { id: user.id };
|
||||
|
||||
const avatarId = await uploadImage(ctx, "avatar", newData.username);
|
||||
if (avatarId != 0) ctx.request.body.avatar = avatarId;
|
||||
return plugin.controllers.user.update(ctx);
|
||||
const keysExcludingParameterAndPrivacy = Object.keys(newData).filter(
|
||||
(key) => key !== "parameter" && key !== "privacy"
|
||||
);
|
||||
|
||||
if (keysExcludingParameterAndPrivacy.length === 0) {
|
||||
await strapi.entityService
|
||||
.update("plugin::users-permissions.user", user.id, {
|
||||
data: newData,
|
||||
})
|
||||
.then((res) => {
|
||||
ctx.response.status = 200;
|
||||
ctx.response.body = res;
|
||||
return ctx;
|
||||
});
|
||||
} else {
|
||||
const avatarId = await uploadImage(ctx, "avatar", newData.username);
|
||||
if (avatarId != 0) ctx.request.body.avatar = avatarId;
|
||||
|
||||
return plugin.controllers.user.update(ctx);
|
||||
}
|
||||
};
|
||||
|
||||
plugin.routes["content-api"].routes.push({
|
||||
|
||||
35
types/generated/components.d.ts
vendored
35
types/generated/components.d.ts
vendored
@@ -19,6 +19,39 @@ export interface AddressFullAddress extends Struct.ComponentSchema {
|
||||
};
|
||||
}
|
||||
|
||||
export interface ConfigurationParameter extends Struct.ComponentSchema {
|
||||
collectionName: 'components_configuration_parameters';
|
||||
info: {
|
||||
displayName: 'parameter';
|
||||
icon: 'cog';
|
||||
};
|
||||
attributes: {
|
||||
emailNotification: Schema.Attribute.Boolean &
|
||||
Schema.Attribute.DefaultTo<false>;
|
||||
pushNotification: Schema.Attribute.Boolean &
|
||||
Schema.Attribute.DefaultTo<false>;
|
||||
sendNewsgroup: Schema.Attribute.Boolean & Schema.Attribute.DefaultTo<false>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ConfigurationPrivacy extends Struct.ComponentSchema {
|
||||
collectionName: 'components_configuration_privacies';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'privacy';
|
||||
icon: 'key';
|
||||
};
|
||||
attributes: {
|
||||
allowInvite: Schema.Attribute.Boolean & Schema.Attribute.DefaultTo<true>;
|
||||
allowMessage: Schema.Attribute.Boolean & Schema.Attribute.DefaultTo<true>;
|
||||
allowTag: Schema.Attribute.Boolean & Schema.Attribute.DefaultTo<true>;
|
||||
profileVisibility: Schema.Attribute.Enumeration<
|
||||
['public', 'contacts', 'private']
|
||||
>;
|
||||
showOnline: Schema.Attribute.Boolean & Schema.Attribute.DefaultTo<true>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface GroupActivity extends Struct.ComponentSchema {
|
||||
collectionName: 'components_group_activities';
|
||||
info: {
|
||||
@@ -82,6 +115,8 @@ declare module '@strapi/strapi' {
|
||||
export module Public {
|
||||
export interface ComponentSchemas {
|
||||
'address.full-address': AddressFullAddress;
|
||||
'configuration.parameter': ConfigurationParameter;
|
||||
'configuration.privacy': ConfigurationPrivacy;
|
||||
'group.activity': GroupActivity;
|
||||
'social.tags': SocialTags;
|
||||
'user.language': UserLanguage;
|
||||
|
||||
2
types/generated/contentTypes.d.ts
vendored
2
types/generated/contentTypes.d.ts
vendored
@@ -1889,6 +1889,7 @@ export interface PluginUsersPermissionsUser
|
||||
> &
|
||||
Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String;
|
||||
parameter: Schema.Attribute.Component<'configuration.parameter', false>;
|
||||
password: Schema.Attribute.Password &
|
||||
Schema.Attribute.Private &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
@@ -1899,6 +1900,7 @@ export interface PluginUsersPermissionsUser
|
||||
'oneToMany',
|
||||
'api::post-ownership.post-ownership'
|
||||
>;
|
||||
privacy: Schema.Attribute.Component<'configuration.privacy', false>;
|
||||
provider: Schema.Attribute.String;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
related_contacts: Schema.Attribute.Relation<
|
||||
|
||||
Reference in New Issue
Block a user