@veritree/services 2.26.5 → 2.27.1
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/package.json +1 -1
- package/src/endpoints/planting-sites.js +36 -20
- package/src/endpoints/regions.js +14 -2
- package/src/helpers/team.js +10 -10
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import Api from
|
|
1
|
+
import Api from '../helpers/api';
|
|
2
2
|
|
|
3
3
|
class PlantingSitesApi extends Api {
|
|
4
4
|
constructor(resource) {
|
|
5
5
|
super(resource);
|
|
6
|
-
this.resource =
|
|
6
|
+
this.resource = 'planting-sites';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
users(plantingSiteId) {
|
|
10
|
-
let url = `${this.getUrl()}/${plantingSiteId}/users
|
|
10
|
+
let url = `${this.getUrl()}/${plantingSiteId}/users`;
|
|
11
11
|
|
|
12
12
|
const all = async (params) => {
|
|
13
|
-
url = `${url}${this.getUrlParams(params)}
|
|
13
|
+
url = `${url}${this.getUrlParams(params)}`;
|
|
14
14
|
return await this.get(url);
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
|
|
17
|
-
return {
|
|
18
|
-
all
|
|
19
|
-
}
|
|
17
|
+
return {
|
|
18
|
+
all,
|
|
19
|
+
};
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
images(subsiteId) {
|
|
23
|
-
let url = `${this.getUrl()}/${subsiteId}/media/images
|
|
23
|
+
let url = `${this.getUrl()}/${subsiteId}/media/images`;
|
|
24
24
|
|
|
25
25
|
const attach = async (data, params) => {
|
|
26
26
|
url = `${url}${this.getUrlParams(params)}`;
|
|
@@ -29,18 +29,20 @@ class PlantingSitesApi extends Api {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const remove = async (imageId, params) => {
|
|
32
|
-
url = `${this.getUrl()}/${subsiteId}/media/images/${imageId}${this.getUrlParams(
|
|
33
|
-
|
|
32
|
+
url = `${this.getUrl()}/${subsiteId}/media/images/${imageId}${this.getUrlParams(
|
|
33
|
+
params
|
|
34
|
+
)}`;
|
|
35
|
+
return await this.post(url, null, 'delete');
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
return {
|
|
37
|
-
attach,
|
|
38
|
+
return {
|
|
39
|
+
attach,
|
|
38
40
|
delete: remove,
|
|
39
|
-
}
|
|
41
|
+
};
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
attachments(subsiteId) {
|
|
43
|
-
let url = `${this.getUrl()}/${subsiteId}/media/attachments
|
|
45
|
+
let url = `${this.getUrl()}/${subsiteId}/media/attachments`;
|
|
44
46
|
|
|
45
47
|
const attach = async (data, params) => {
|
|
46
48
|
url = `${url}${this.getUrlParams(params)}`;
|
|
@@ -49,16 +51,30 @@ class PlantingSitesApi extends Api {
|
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
const remove = async (attachmentId, params) => {
|
|
52
|
-
url = `${this.getUrl()}/${subsiteId}/media/attachments/${attachmentId}${this.getUrlParams(
|
|
53
|
-
|
|
54
|
+
url = `${this.getUrl()}/${subsiteId}/media/attachments/${attachmentId}${this.getUrlParams(
|
|
55
|
+
params
|
|
56
|
+
)}`;
|
|
57
|
+
return await this.post(url, null, 'delete');
|
|
54
58
|
};
|
|
55
59
|
|
|
56
|
-
return {
|
|
60
|
+
return {
|
|
57
61
|
attach,
|
|
58
62
|
delete: remove,
|
|
59
|
-
}
|
|
63
|
+
};
|
|
60
64
|
}
|
|
61
65
|
|
|
66
|
+
stakeholders(plantingSiteId) {
|
|
67
|
+
const all = async (params) => {
|
|
68
|
+
const url = `${this.getUrl()}/${plantingSiteId}/stakeholders${this.getUrlParams(
|
|
69
|
+
params
|
|
70
|
+
)}`;
|
|
71
|
+
return await this.get(url);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
all,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
62
78
|
}
|
|
63
79
|
|
|
64
|
-
export const PlantingSites = new PlantingSitesApi();
|
|
80
|
+
export const PlantingSites = new PlantingSitesApi();
|
package/src/endpoints/regions.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Api from
|
|
1
|
+
import Api from '../helpers/api';
|
|
2
2
|
|
|
3
3
|
class RegionsApi extends Api {
|
|
4
4
|
constructor(resource) {
|
|
5
5
|
super(resource);
|
|
6
|
-
this.resource =
|
|
6
|
+
this.resource = 'regions';
|
|
7
7
|
}
|
|
8
8
|
stats(region) {
|
|
9
9
|
const all = async () => {
|
|
@@ -11,6 +11,18 @@ class RegionsApi extends Api {
|
|
|
11
11
|
return await this.get(url);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
return {
|
|
15
|
+
all,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
stakeholders(region) {
|
|
19
|
+
const all = async (params) => {
|
|
20
|
+
const url = `${this.getUrl()}/${region}/stakeholders${this.getUrlParams(
|
|
21
|
+
params
|
|
22
|
+
)}`;
|
|
23
|
+
return await this.get(url);
|
|
24
|
+
};
|
|
25
|
+
|
|
14
26
|
return {
|
|
15
27
|
all,
|
|
16
28
|
};
|
package/src/helpers/team.js
CHANGED
|
@@ -9,28 +9,28 @@
|
|
|
9
9
|
const Team = (api, id) => {
|
|
10
10
|
let url = `${api.baseUrl}/${api.resource}/${id}/users`;
|
|
11
11
|
|
|
12
|
-
const all = async (
|
|
13
|
-
url = `${url}${api.getUrlParams(
|
|
12
|
+
const all = async (params) => {
|
|
13
|
+
url = `${url}${api.getUrlParams(params)}`;
|
|
14
14
|
return await api.get(url);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const single = async (userId,
|
|
18
|
-
url = `${url}/${userId}${api.getUrlParams(
|
|
17
|
+
const single = async (userId, params) => {
|
|
18
|
+
url = `${url}/${userId}${api.getUrlParams(params)}`;
|
|
19
19
|
return await api.get(url);
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const create = async (data) => {
|
|
23
|
-
url = `${url}${api.getUrlParams()}`;
|
|
22
|
+
const create = async (data, params) => {
|
|
23
|
+
url = `${url}${api.getUrlParams(params)}`;
|
|
24
24
|
return await api.post(url, data);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const update = async (userId, data) => {
|
|
28
|
-
url = `${url}/${userId}${api.getUrlParams()}`;
|
|
27
|
+
const update = async (userId, data, params) => {
|
|
28
|
+
url = `${url}/${userId}${api.getUrlParams(params)}`;
|
|
29
29
|
return await api.post(url, data, 'patch');
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const remove = async (userId,
|
|
33
|
-
url = `${url}/${userId}${api.getUrlParams(
|
|
32
|
+
const remove = async (userId, params) => {
|
|
33
|
+
url = `${url}/${userId}${api.getUrlParams(params)}`;
|
|
34
34
|
return await api.post(url, null, "delete");
|
|
35
35
|
}
|
|
36
36
|
|