@docbrasil/api-systemmanager 1.1.69 → 1.1.70
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/api/user/document.js +75 -0
- package/dist/bundle.cjs +75 -0
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +60 -0
- package/docs/Documents.html +1057 -16
- package/docs/user_document.js.html +75 -0
- package/package.json +1 -1
package/doc/api.md
CHANGED
|
@@ -1619,6 +1619,7 @@ Class for documents, permission user
|
|
|
1619
1619
|
|
|
1620
1620
|
* [Documents](#Documents)
|
|
1621
1621
|
* [.add(params, session)](#Documents+add) ⇒ <code>Promise</code>
|
|
1622
|
+
* [.addDocuments(params, session)](#Documents+addDocuments) ⇒ <code>Promise.<object></code> \| <code>boolean</code> \| <code>array.<object></code> \| <code>array.<object></code>
|
|
1622
1623
|
* [.findByIdAndUpdate(id, params, session)](#Documents+findByIdAndUpdate) ⇒ <code>Promise</code>
|
|
1623
1624
|
* [.findByIdsAndUpdate(ids, params, session)](#Documents+findByIdsAndUpdate) ⇒ <code>Promise</code>
|
|
1624
1625
|
* [.findById(id, session)](#Documents+findById) ⇒ <code>Promise</code>
|
|
@@ -1694,6 +1695,65 @@ const params = {
|
|
|
1694
1695
|
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1695
1696
|
await api.user.document.add(params, session);
|
|
1696
1697
|
```
|
|
1698
|
+
<a name="Documents+addDocuments"></a>
|
|
1699
|
+
|
|
1700
|
+
### documents.addDocuments(params, session) ⇒ <code>Promise.<object></code> \| <code>boolean</code> \| <code>array.<object></code> \| <code>array.<object></code>
|
|
1701
|
+
Add multiple documents to a doc area under a doc type
|
|
1702
|
+
|
|
1703
|
+
**Kind**: instance method of [<code>Documents</code>](#Documents)
|
|
1704
|
+
**Returns**: <code>Promise.<object></code> - The result of the operation<code>boolean</code> - return.success True if the operation was successful<code>array.<object></code> - return.added Array of added documents<code>array.<object></code> - return.notAdded Array of documents that could not be added
|
|
1705
|
+
**Access**: public
|
|
1706
|
+
**Author**: Myndware <augusto.pissarra@myndware.com>
|
|
1707
|
+
|
|
1708
|
+
| Param | Type | Default | Description |
|
|
1709
|
+
| --- | --- | --- | --- |
|
|
1710
|
+
| params | <code>object</code> | | Object for adding documents |
|
|
1711
|
+
| params.orgId | <code>string</code> | | Organization id (_id database) |
|
|
1712
|
+
| params.userId | <code>string</code> | | User id (_id database) |
|
|
1713
|
+
| params.docAreaName | <code>string</code> | | The name of the doc area |
|
|
1714
|
+
| params.docTypeName | <code>string</code> | | The name of the doc type |
|
|
1715
|
+
| params.docs | <code>array.<object></code> | | Array of documents to add |
|
|
1716
|
+
| [params.docs.document] | <code>string</code> | <code>"''"</code> | The url to the document on S3, an external URL or a base64 representation of the document |
|
|
1717
|
+
| [params.docs.type] | <code>string</code> | <code>"''"</code> | The mime type of the document |
|
|
1718
|
+
| [params.docs.name] | <code>string</code> | <code>"''"</code> | The name of the document |
|
|
1719
|
+
| [params.docs.content] | <code>string</code> | <code>"''"</code> | The content of the document |
|
|
1720
|
+
| [params.docs.bytes] | <code>number</code> | <code>0</code> | The bytes (in kb) of the document |
|
|
1721
|
+
| [params.docs.urlType] | <code>string</code> | <code>"''"</code> | The urlType of the document |
|
|
1722
|
+
| [params.docs.description] | <code>string</code> | <code>"''"</code> | The description of the document |
|
|
1723
|
+
| [params.docs.category] | <code>string</code> | <code>"''"</code> | The category of the document |
|
|
1724
|
+
| [params.docs.tags] | <code>array.<string></code> | <code>[]</code> | The tags of the document |
|
|
1725
|
+
| [params.docs.docTypeFieldsData] | <code>object</code> | <code>{}</code> | The data related to this document |
|
|
1726
|
+
| [params.docs.hasPhisicalStorage] | <code>boolean</code> | <code>false</code> | The flag to define if the document has physical storage or not |
|
|
1727
|
+
| [params.docs.boxId] | <code>string</code> | <code>"''"</code> | The boxId if we define the document has physical storage |
|
|
1728
|
+
| [params.docs.status] | <code>number</code> | | The document status |
|
|
1729
|
+
| [params.docs.storageStatus] | <code>string</code> | <code>"''"</code> | The storageStatus if we define the document has physical storage |
|
|
1730
|
+
| session | <code>string</code> | | Session, token JWT |
|
|
1731
|
+
|
|
1732
|
+
**Example**
|
|
1733
|
+
```js
|
|
1734
|
+
const API = require('@docbrasil/api-systemmanager');
|
|
1735
|
+
const api = new API();
|
|
1736
|
+
const params = {
|
|
1737
|
+
orgId: '5df7f19618430c89a41a19d2',
|
|
1738
|
+
userId: '5df7f19618430c89a41a19d3',
|
|
1739
|
+
docAreaName: 'My Doc Area',
|
|
1740
|
+
docTypeName: 'My Doc Type',
|
|
1741
|
+
docs: [
|
|
1742
|
+
{
|
|
1743
|
+
document: 'https://s3.amazonaws.com/...',
|
|
1744
|
+
type: 'application/pdf',
|
|
1745
|
+
name: 'Document 1',
|
|
1746
|
+
description: 'First document',
|
|
1747
|
+
category: 'Category 1',
|
|
1748
|
+
tags: ['tag1', 'tag2'],
|
|
1749
|
+
docTypeFieldsData: { extraField: 'value' },
|
|
1750
|
+
bytes: 12345
|
|
1751
|
+
}
|
|
1752
|
+
]
|
|
1753
|
+
};
|
|
1754
|
+
const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
1755
|
+
const result = await api.user.document.addDocuments(params, session);
|
|
1756
|
+
```
|
|
1697
1757
|
<a name="Documents+findByIdAndUpdate"></a>
|
|
1698
1758
|
|
|
1699
1759
|
### documents.findByIdAndUpdate(id, params, session) ⇒ <code>Promise</code>
|