@docbrasil/api-systemmanager 1.1.9 → 1.1.11
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/.vscode/settings.json +1 -0
- package/api/user/my_tasks.js +80 -0
- package/api/user/settings.js +2 -4
- package/dist/bundle.cjs +82 -4
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +567 -1271
- package/docs/Settings.html +3 -3
- package/docs/user_settings.js.html +2 -4
- package/package.json +1 -1
- package/tests/documents_002.spec.js +0 -107
package/docs/Settings.html
CHANGED
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
|
|
243
243
|
|
|
244
244
|
<div class="description">
|
|
245
|
-
Gets the user settings
|
|
245
|
+
Gets the user settings. Returns an array of settings.
|
|
246
246
|
</div>
|
|
247
247
|
|
|
248
248
|
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
<pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
|
|
407
407
|
const api = new API();
|
|
408
408
|
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
409
|
-
await api.user.settings.get(session);</code></pre>
|
|
409
|
+
ret settings = await api.user.settings.get(session);</code></pre>
|
|
410
410
|
|
|
411
411
|
|
|
412
412
|
|
|
@@ -543,7 +543,7 @@ await api.user.settings.get(session);</code></pre>
|
|
|
543
543
|
<p class="tag-source">
|
|
544
544
|
<a href="user_settings.js.html" class="button">View Source</a>
|
|
545
545
|
<span>
|
|
546
|
-
<a href="user_settings.js.html">user/settings.js</a>, <a href="user_settings.js.html#
|
|
546
|
+
<a href="user_settings.js.html">user/settings.js</a>, <a href="user_settings.js.html#line128">line 128</a>
|
|
547
547
|
</span>
|
|
548
548
|
</p>
|
|
549
549
|
|
|
@@ -173,7 +173,7 @@ class Settings {
|
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
175
|
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
176
|
-
* @description Gets the user settings
|
|
176
|
+
* @description Gets the user settings. Returns an array of settings.
|
|
177
177
|
* @param {string} session Is token JWT of user NOT allow SU
|
|
178
178
|
* @return {Promise}
|
|
179
179
|
* @public
|
|
@@ -183,13 +183,12 @@ class Settings {
|
|
|
183
183
|
* const API = require('@docbrasil/api-systemmanager');
|
|
184
184
|
* const api = new API();
|
|
185
185
|
* const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
186
|
-
* await api.user.settings.get(session);
|
|
186
|
+
* ret settings = await api.user.settings.get(session);
|
|
187
187
|
*/
|
|
188
188
|
async get(session) {
|
|
189
189
|
const self = this;
|
|
190
190
|
|
|
191
191
|
try {
|
|
192
|
-
Joi.assert(settings, Joi.object().required());
|
|
193
192
|
Joi.assert(session, Joi.string().required());
|
|
194
193
|
|
|
195
194
|
const apiCall = self._client.get(`/users/settings`, self._setHeader(session));
|
|
@@ -217,7 +216,6 @@ class Settings {
|
|
|
217
216
|
const self = this;
|
|
218
217
|
|
|
219
218
|
try {
|
|
220
|
-
Joi.assert(settings, Joi.object().required());
|
|
221
219
|
Joi.assert(session, Joi.string().required());
|
|
222
220
|
|
|
223
221
|
const apiCall = self._client.del(`/users/settings`, self._setHeader(session));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docbrasil/api-systemmanager",
|
|
3
3
|
"description": "Module API System Manager",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.11",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"htmldoc": "rm -rf docs && jsdoc api/** -d docs -t ./node_modules/better-docs",
|
|
7
7
|
"doc": "rm -rf doc && mkdir doc && jsdoc2md api/**/* api/* > doc/api.md",
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
const _ = require('lodash');
|
|
2
|
-
const expect = require('chai').expect;
|
|
3
|
-
|
|
4
|
-
const API = require('../index');
|
|
5
|
-
const login = require('./payload/payload_login');
|
|
6
|
-
|
|
7
|
-
let sm;
|
|
8
|
-
let user;
|
|
9
|
-
let doc = {
|
|
10
|
-
orgId: '',
|
|
11
|
-
orgname: '',
|
|
12
|
-
areaId: '5db06b51f833e1047a27fd8b',
|
|
13
|
-
docTypeId: '5e5945f650b526150f651717',
|
|
14
|
-
docTypeFields: [],
|
|
15
|
-
docTypeFieldsData: {
|
|
16
|
-
extraUser: 'hello'
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
let foundDoc;
|
|
20
|
-
let retDoc;
|
|
21
|
-
let session;
|
|
22
|
-
|
|
23
|
-
describe('Start API documents', function () {
|
|
24
|
-
before(function (done) {
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
sm = new API();
|
|
28
|
-
done();
|
|
29
|
-
} catch (ex) {
|
|
30
|
-
expect(ex).to.be.empty;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('Login', async function () {
|
|
35
|
-
try {
|
|
36
|
-
const retData = await sm.access.loginSU();
|
|
37
|
-
|
|
38
|
-
expect(retData).to.not.be.empty;
|
|
39
|
-
expect(retData.auth).to.be.true;
|
|
40
|
-
expect(retData.user).to.be.an('object');
|
|
41
|
-
expect(retData.user).to.be.an('object');
|
|
42
|
-
expect(retData.user).to.not.be.empty;
|
|
43
|
-
expect(retData.user.sessionId).to.not.be.empty;
|
|
44
|
-
expect(retData.user.sessionId.split('.').length).equal(3);
|
|
45
|
-
expect(retData.user.orgId.length).equal(24);
|
|
46
|
-
user = retData.user;
|
|
47
|
-
} catch (ex) {
|
|
48
|
-
expect(ex).to.be.empty;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('Add document', async function () {
|
|
53
|
-
try {
|
|
54
|
-
session = user.sessionId;
|
|
55
|
-
doc.orgId = user.orgId;
|
|
56
|
-
doc.orgname = user.organization.orgname;
|
|
57
|
-
retDoc = await sm.documents.add(doc, session);
|
|
58
|
-
expect(retDoc).to.not.be.empty;
|
|
59
|
-
expect(retDoc).to.be.an('object');
|
|
60
|
-
expect(retDoc._id).to.not.be.empty;
|
|
61
|
-
expect(retDoc._id).to.be.an('string');
|
|
62
|
-
expect(retDoc.orgname).equal(user.organization.orgname);
|
|
63
|
-
expect(retData.docTypeId).equal(doc.docTypeId);
|
|
64
|
-
} catch (ex) {
|
|
65
|
-
expect(ex).to.be.empty;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('find', async function () {
|
|
70
|
-
try {
|
|
71
|
-
foundDoc = await sm.documents.findById(doc._id.toString(), session);
|
|
72
|
-
|
|
73
|
-
expect(foundDoc).to.not.be.empty;
|
|
74
|
-
expect(foundDoc).to.be.an('object');
|
|
75
|
-
expect(foundDoc._id.toString()).equal(doc._id.toString());
|
|
76
|
-
expect(foundDoc.docTypeFieldsData.extraName).equal('hello');
|
|
77
|
-
} catch (ex) {
|
|
78
|
-
expect(ex).to.be.empty;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('update', async function () {
|
|
83
|
-
try {
|
|
84
|
-
foundDoc.docTypeFieldsData.extraName = 'hello 2';
|
|
85
|
-
const updatedDoc = await sm.documents.findByIdAndUpdate(doc._id.toString(), foundDoc, session);
|
|
86
|
-
expect(updatedDoc).to.not.be.empty;
|
|
87
|
-
expect(updatedDoc).to.be.an('object');
|
|
88
|
-
expect(updatedDoc._id.toString()).equal(doc._id.toString());
|
|
89
|
-
expect(updatedDoc.docTypeFieldsData.extraName).equal('hello 2');
|
|
90
|
-
} catch (ex) {
|
|
91
|
-
expect(ex).to.be.empty;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('find update', async function () {
|
|
96
|
-
try {
|
|
97
|
-
const oundDocTwo = await sm.documents.findById(doc._id.toString(), session);
|
|
98
|
-
|
|
99
|
-
expect(oundDocTwo).to.not.be.empty;
|
|
100
|
-
expect(oundDocTwo).to.be.an('object');
|
|
101
|
-
expect(oundDocTwo._id.toString()).equal(doc._id.toString());
|
|
102
|
-
expect(oundDocTwo.docTypeFieldsData.extraName).equal('hello 2');
|
|
103
|
-
} catch (ex) {
|
|
104
|
-
expect(ex).to.be.empty;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
});
|