@metarisc/metarisc-js 0.0.1-alpha.71 → 0.0.1-alpha.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/OrganisationsAPI.d.ts +8 -0
- package/lib/api/OrganisationsAPI.js +12 -0
- package/lib/utils.js +2 -6
- package/package.json +1 -1
- package/src/api/OrganisationsAPI.ts +14 -0
- package/src/utils.ts +7 -6
|
@@ -53,6 +53,14 @@ export declare class OrganisationsAPI extends Core {
|
|
|
53
53
|
utilisateur_id: string;
|
|
54
54
|
role: string;
|
|
55
55
|
}): Promise<AxiosResponse<OrganisationMembre>>;
|
|
56
|
+
/**
|
|
57
|
+
* Mise à jour des préférences de l'organisation.
|
|
58
|
+
*/
|
|
59
|
+
updateOrganisationPreferences(orgId: string, params: {
|
|
60
|
+
platau_id_acteur?: string;
|
|
61
|
+
platau_active?: boolean;
|
|
62
|
+
s3_global_endpoint?: string;
|
|
63
|
+
}): Promise<AxiosResponse<OrganisationPreferences>>;
|
|
56
64
|
/**
|
|
57
65
|
* Mise à jour de l'ensemble des règles utilisées pour le calcul de la conformité et de la performance DECI.
|
|
58
66
|
*/
|
|
@@ -111,6 +111,18 @@ class OrganisationsAPI extends core_1.Core {
|
|
|
111
111
|
body: utils_1.Utils.payloadFilter(params)
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Mise à jour des préférences de l'organisation.
|
|
116
|
+
*/
|
|
117
|
+
async updateOrganisationPreferences(orgId, params) {
|
|
118
|
+
const pathVariable = { 'org_id': (new String(orgId)).toString() };
|
|
119
|
+
return this.request({
|
|
120
|
+
method: 'POST',
|
|
121
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/organisations/{org_id}/preferences'),
|
|
122
|
+
params: {},
|
|
123
|
+
body: utils_1.Utils.payloadFilter(params)
|
|
124
|
+
});
|
|
125
|
+
}
|
|
114
126
|
/**
|
|
115
127
|
* Mise à jour de l'ensemble des règles utilisées pour le calcul de la conformité et de la performance DECI.
|
|
116
128
|
*/
|
package/lib/utils.js
CHANGED
|
@@ -49,18 +49,14 @@ class Utils {
|
|
|
49
49
|
*/
|
|
50
50
|
static payloadFilter(payload) {
|
|
51
51
|
const filtered = {};
|
|
52
|
-
// Filtre sur tous les champs "undefined"
|
|
53
52
|
Object.keys(payload).forEach((key) => {
|
|
54
53
|
if (payload[key] === Object(payload[key])) {
|
|
55
54
|
filtered[key] = Utils.payloadFilter(payload[key]);
|
|
56
55
|
}
|
|
57
|
-
|
|
56
|
+
if (payload[key] !== undefined) {
|
|
58
57
|
filtered[key] = payload[key];
|
|
59
58
|
}
|
|
60
|
-
|
|
61
|
-
// Filtre sur la date
|
|
62
|
-
Object.keys(filtered).forEach((key) => {
|
|
63
|
-
if (filtered[key] instanceof Date) {
|
|
59
|
+
if (payload[key] instanceof Date) {
|
|
64
60
|
filtered[key] = this.formatDate(payload[key]);
|
|
65
61
|
}
|
|
66
62
|
});
|
package/package.json
CHANGED
|
@@ -137,6 +137,20 @@ export class OrganisationsAPI extends Core {
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Mise à jour des préférences de l'organisation.
|
|
142
|
+
*/
|
|
143
|
+
async updateOrganisationPreferences(orgId: string, params : { platau_id_acteur ? : string, platau_active ? : boolean, s3_global_endpoint ? : string }): Promise<AxiosResponse<OrganisationPreferences>>
|
|
144
|
+
{
|
|
145
|
+
const pathVariable = { 'org_id': (new String(orgId)).toString() };
|
|
146
|
+
return this.request({
|
|
147
|
+
method: 'POST',
|
|
148
|
+
endpoint: Utils.constructPath(pathVariable, '/organisations/{org_id}/preferences'),
|
|
149
|
+
params: { },
|
|
150
|
+
body: Utils.payloadFilter(params)
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
140
154
|
/**
|
|
141
155
|
* Mise à jour de l'ensemble des règles utilisées pour le calcul de la conformité et de la performance DECI.
|
|
142
156
|
*/
|
package/src/utils.ts
CHANGED
|
@@ -54,21 +54,22 @@ export class Utils {
|
|
|
54
54
|
*/
|
|
55
55
|
static payloadFilter(payload : any) : object {
|
|
56
56
|
const filtered : any = {};
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
Object.keys(payload).forEach((key) => {
|
|
59
|
+
|
|
59
60
|
if (payload[key] === Object(payload[key])) {
|
|
60
61
|
filtered[key] = Utils.payloadFilter(payload[key]);
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
|
|
64
|
+
if (payload[key] !== undefined) {
|
|
63
65
|
filtered[key] = payload[key];
|
|
64
66
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Object.keys(filtered).forEach((key) => {
|
|
68
|
-
if(filtered[key] instanceof Date) {
|
|
67
|
+
|
|
68
|
+
if(payload[key] instanceof Date) {
|
|
69
69
|
filtered[key] = this.formatDate(payload[key]);
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
+
|
|
72
73
|
return filtered;
|
|
73
74
|
}
|
|
74
75
|
}
|