@docbrasil/api-systemmanager 1.0.79 → 1.0.81

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/doc/api.md CHANGED
@@ -1204,6 +1204,7 @@ Class for documents, permission user
1204
1204
  * [.signedUrl(params, session)](#Documents+signedUrl) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
1205
1205
  * [.signedUrls(params, session)](#Documents+signedUrls) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code> \| <code>string</code>
1206
1206
  * [.uploadSignedDocument(params)](#Documents+uploadSignedDocument) ⇒ <code>Promise.&lt;boolean&gt;</code>
1207
+ * [.checkPrimaryKeys(params, session)](#Documents+checkPrimaryKeys) ⇒ <code>Promise.&lt;array&gt;</code> \| <code>array.&lt;string&gt;</code>
1207
1208
 
1208
1209
  <a name="Documents+add"></a>
1209
1210
 
@@ -1354,7 +1355,7 @@ const API = require('@docbrasil/api-systemmanager');
1354
1355
  const api = new API();
1355
1356
  const params - {
1356
1357
  documents: [{ _id: '5dadd01dc4af3941d42f8c5c' }],
1357
- orgIdId: '5df7f19618430c89a41a19d2',
1358
+ orgId: '5df7f19618430c89a41a19d2',
1358
1359
  };
1359
1360
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1360
1361
  await api.user.document.findByIdsAndRemove(params, session);
@@ -1499,6 +1500,40 @@ onUploadProgress return the progressEvent
1499
1500
  - loaded: The number of bytes of the file that have been uploaded.
1500
1501
  - total: The total number of bytes in the file.
1501
1502
  ```
1503
+ <a name="Documents+checkPrimaryKeys"></a>
1504
+
1505
+ ### documents.checkPrimaryKeys(params, session) ⇒ <code>Promise.&lt;array&gt;</code> \| <code>array.&lt;string&gt;</code>
1506
+ **Kind**: instance method of [<code>Documents</code>](#Documents)
1507
+ **Returns**: <code>Promise.&lt;array&gt;</code> - Return the array of the documents that are repeated. If not document is repeaded, then if returns an empty array.<code>array.&lt;string&gt;</code> - id the id of the repeated document
1508
+ **Access**: public
1509
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1510
+ Checks if a document can be added and it does not repeat its primary key
1511
+
1512
+ | Param | Type | Description |
1513
+ | --- | --- | --- |
1514
+ | params | | |
1515
+ | params.orgId | <code>string</code> | the organization id |
1516
+ | params.docTypeId | <code>string</code> | the id of the doc type |
1517
+ | params.docs | <code>array.&lt;object&gt;</code> | an array of documents |
1518
+ | params.docs.id | <code>string</code> | an unique id representing the document |
1519
+ | params.docs.docTypeFields | <code>object</code> | thje docTypeFields of the document |
1520
+ | params.docs.docTypeFieldsData | <code>object</code> | thje docTypeFieldsData of the document |
1521
+ | session | | |
1522
+
1523
+ **Example**
1524
+ ```js
1525
+ const API = require('@docbrasil/api-systemmanager');
1526
+ const api = new API();
1527
+ const docTypeFields = [...]; // the doc type fields array
1528
+ const docTypeFieldsData = {...}; // the data of this fields
1529
+ const params - {
1530
+ docs: [{ id: '5dadd01dc4af3941d42f8c5c', docTypeFields, docTypeFieldsData }],
1531
+ orgId: '5df7f19618430c89a41a19d2',
1532
+ docTypeId: '5df7f19618430c89a41a19d5',
1533
+ };
1534
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1535
+ const retDocs = await api.user.document.checkPrimaryKeys(params, session);
1536
+ ```
1502
1537
  <a name="Users"></a>
1503
1538
 
1504
1539
  ## Users
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.0.79",
4
+ "version": "1.0.81",
5
5
  "scripts": {
6
6
  "doc": "rm -f doc/api.md && jsdoc2md api/**/** > doc/api.md",
7
7
  "build": "node bundleRollup.js"