@docbrasil/api-systemmanager 1.0.54 → 1.0.57

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
@@ -19,6 +19,9 @@
19
19
  <dt><a href="#AdminNotification">AdminNotification</a></dt>
20
20
  <dd><p>Admin Class for notification, permission admin</p>
21
21
  </dd>
22
+ <dt><a href="#Organization">Organization</a></dt>
23
+ <dd><p>Class for organizations, permission user</p>
24
+ </dd>
22
25
  <dt><a href="#AdminPlugin">AdminPlugin</a></dt>
23
26
  <dd><p>Admin Class for plugin, permission admin</p>
24
27
  </dd>
@@ -649,6 +652,191 @@ const params = {
649
652
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
650
653
  await api.admin.notifications.findByIdAndDelete(params, session);
651
654
  ```
655
+ <a name="Organization"></a>
656
+
657
+ ## Organization
658
+ Class for organizations, permission user
659
+
660
+ **Kind**: global class
661
+
662
+ * [Organization](#Organization)
663
+ * [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
664
+ * [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
665
+ * [.findById(orgId, session)](#Organization+findById)
666
+ * [.idCardExist(idcard, session)](#Organization+idCardExist)
667
+ * [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
668
+ * [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
669
+ * [.callFetch(params)](#Organization+callFetch) ⇒ <code>promise</code>
670
+
671
+ <a name="Organization+upsertAvatar"></a>
672
+
673
+ ### organization.upsertAvatar(params, session) ⇒ <code>Promise</code>
674
+ Update avatar of organization by session of user not allow session user SU
675
+
676
+ **Kind**: instance method of [<code>Organization</code>](#Organization)
677
+ **Access**: public
678
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
679
+
680
+ | Param | Type | Description |
681
+ | --- | --- | --- |
682
+ | params | <code>object</code> | Params to update avatar |
683
+ | params.orgId | <code>string</code> | Organization id |
684
+ | params.avatar | <code>string</code> | Image in base64 to update |
685
+ | params.type | <code>string</code> | MimeType (image/png) |
686
+ | session | <code>string</code> | Is token JWT of user SU |
687
+
688
+ **Example**
689
+ ```js
690
+ const API = require('@docbrasil/api-systemmanager');
691
+ const api = new API();
692
+ const params = {
693
+ orgId: '5dadd01dc4af3941d42f8c5c',
694
+ avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
695
+ type: 'image/png',
696
+ };
697
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
698
+ await api.admin.organizations.upsertAvatar(params, session);
699
+ ```
700
+ <a name="Organization+removeAvatar"></a>
701
+
702
+ ### organization.removeAvatar(session) ⇒ <code>Promise</code>
703
+ Remove avatar of user by session of user not allow session user SU
704
+
705
+ **Kind**: instance method of [<code>Organization</code>](#Organization)
706
+ **Access**: public
707
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
708
+
709
+ | Param | Type | Description |
710
+ | --- | --- | --- |
711
+ | params.orgId | <code>string</code> | Organization id |
712
+ | session | <code>string</code> | Is token JWT of user SU |
713
+
714
+ **Example**
715
+ ```js
716
+ const API = require('@docbrasil/api-systemmanager');
717
+ const api = new API();
718
+ const orgId = '5dadd01dc4af3941d42f8c5c';
719
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
720
+ await api.admin.organizations.removeAvatar(orgId, session);
721
+ ```
722
+ <a name="Organization+findById"></a>
723
+
724
+ ### organization.findById(orgId, session)
725
+ Find organization by id
726
+
727
+ **Kind**: instance method of [<code>Organization</code>](#Organization)
728
+ **Access**: public
729
+ **Author**: Augusto Pissarra <abernardo.br@gmail.com>
730
+
731
+ | Param | Type | Description |
732
+ | --- | --- | --- |
733
+ | orgId | <code>string</code> | ID of the organization to find (_id database) |
734
+ | session | <code>string</code> | Is token JWT |
735
+
736
+ **Example**
737
+ ```js
738
+ const API = require('@docbrasil/api-systemmanager');
739
+ const api = new API();
740
+ const orgId = '80443245000122';
741
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
742
+ await api.user.organization.findById(idCard, session);
743
+ ```
744
+ <a name="Organization+idCardExist"></a>
745
+
746
+ ### organization.idCardExist(idcard, session)
747
+ Check if id card exist
748
+
749
+ **Kind**: instance method of [<code>Organization</code>](#Organization)
750
+ **Access**: public
751
+ **Author**: Augusto Pissarra <abernardo.br@gmail.com>
752
+
753
+ | Param | Type | Description |
754
+ | --- | --- | --- |
755
+ | idcard | <code>string</code> | Check if id card exist |
756
+ | session | <code>string</code> | Is token JWT |
757
+
758
+ **Example**
759
+ ```js
760
+ const API = require('@docbrasil/api-systemmanager');
761
+ const api = new API();
762
+ const idCard = '80443245000122';
763
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
764
+ await api.user.organization.idCardExist(idCard, session);
765
+ ```
766
+ <a name="Organization+upsertAvatar"></a>
767
+
768
+ ### organization.upsertAvatar(params, session) ⇒ <code>Promise</code>
769
+ Update avatar of organization by session of user not allow session user SU
770
+
771
+ **Kind**: instance method of [<code>Organization</code>](#Organization)
772
+ **Access**: public
773
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
774
+
775
+ | Param | Type | Description |
776
+ | --- | --- | --- |
777
+ | params | <code>object</code> | Params to update avatar |
778
+ | params.avatar | <code>string</code> | Image in base64 to update |
779
+ | params.type | <code>string</code> | mimeType (image/png) |
780
+ | session | <code>string</code> | Is token JWT of user NOT allow SU |
781
+
782
+ **Example**
783
+ ```js
784
+ const API = require('@docbrasil/api-systemmanager');
785
+ const api = new API();
786
+ const params = {
787
+ avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
788
+ type: 'image/png',
789
+ };
790
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
791
+ await api.user.profile.updateAvatar(params, session);
792
+ ```
793
+ <a name="Organization+removeAvatar"></a>
794
+
795
+ ### organization.removeAvatar(session) ⇒ <code>Promise</code>
796
+ Remove avatar of user by session of user not allow session user SU
797
+
798
+ **Kind**: instance method of [<code>Organization</code>](#Organization)
799
+ **Access**: public
800
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
801
+
802
+ | Param | Type | Description |
803
+ | --- | --- | --- |
804
+ | session | <code>string</code> | Is token JWT of user NOT allow SU |
805
+
806
+ **Example**
807
+ ```js
808
+ const API = require('@docbrasil/api-systemmanager');
809
+ const api = new API();
810
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
811
+ await api.user.profile.removeAvatar(session);
812
+ ```
813
+ <a name="Organization+callFetch"></a>
814
+
815
+ ### organization.callFetch(params) ⇒ <code>promise</code>
816
+ Call URL internal, need auth JWT (session)
817
+
818
+ **Kind**: instance method of [<code>Organization</code>](#Organization)
819
+ **Access**: public
820
+ **Author**: Thiago Anselmo <thiagoo.anselmoo@gmail.com>
821
+
822
+ | Param | Type | Default | Description |
823
+ | --- | --- | --- | --- |
824
+ | params | <code>object</code> | | Params to call fectch (URL internal) |
825
+ | params.url | <code>string</code> | | URL to call |
826
+ | [params.method] | <code>string</code> | <code>&quot;POST&quot;</code> | Fetch Method |
827
+ | params.payload | <code>string</code> | | Payload to send system manager |
828
+
829
+ **Example**
830
+ ```js
831
+ const API = require('@docbrasil/api-systemmanager');
832
+ const api = new API();
833
+
834
+ const params = {
835
+ url: 'http://localhost:8080/organizations/..../process/..../task/candidateAccepted/end/....',
836
+ method: 'POST'
837
+ }
838
+ await api.user.organization.callFetchs(params, session);
839
+ ```
652
840
  <a name="AdminPlugin"></a>
653
841
 
654
842
  ## AdminPlugin
@@ -1505,12 +1693,65 @@ Class for organizations, permission user
1505
1693
  **Kind**: global class
1506
1694
 
1507
1695
  * [Organization](#Organization)
1696
+ * [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
1697
+ * [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
1508
1698
  * [.findById(orgId, session)](#Organization+findById)
1509
1699
  * [.idCardExist(idcard, session)](#Organization+idCardExist)
1510
1700
  * [.upsertAvatar(params, session)](#Organization+upsertAvatar) ⇒ <code>Promise</code>
1511
1701
  * [.removeAvatar(session)](#Organization+removeAvatar) ⇒ <code>Promise</code>
1512
1702
  * [.callFetch(params)](#Organization+callFetch) ⇒ <code>promise</code>
1513
1703
 
1704
+ <a name="Organization+upsertAvatar"></a>
1705
+
1706
+ ### organization.upsertAvatar(params, session) ⇒ <code>Promise</code>
1707
+ Update avatar of organization by session of user not allow session user SU
1708
+
1709
+ **Kind**: instance method of [<code>Organization</code>](#Organization)
1710
+ **Access**: public
1711
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1712
+
1713
+ | Param | Type | Description |
1714
+ | --- | --- | --- |
1715
+ | params | <code>object</code> | Params to update avatar |
1716
+ | params.orgId | <code>string</code> | Organization id |
1717
+ | params.avatar | <code>string</code> | Image in base64 to update |
1718
+ | params.type | <code>string</code> | MimeType (image/png) |
1719
+ | session | <code>string</code> | Is token JWT of user SU |
1720
+
1721
+ **Example**
1722
+ ```js
1723
+ const API = require('@docbrasil/api-systemmanager');
1724
+ const api = new API();
1725
+ const params = {
1726
+ orgId: '5dadd01dc4af3941d42f8c5c',
1727
+ avatar: 'iVBORw0KGgoAAAANSUhEUgAAAasAAAHnCAYAAAAGi3J6AAA9BElEQVR...He3/kk/m7kl35S8AAAAASUVORK5CYII=',
1728
+ type: 'image/png',
1729
+ };
1730
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1731
+ await api.admin.organizations.upsertAvatar(params, session);
1732
+ ```
1733
+ <a name="Organization+removeAvatar"></a>
1734
+
1735
+ ### organization.removeAvatar(session) ⇒ <code>Promise</code>
1736
+ Remove avatar of user by session of user not allow session user SU
1737
+
1738
+ **Kind**: instance method of [<code>Organization</code>](#Organization)
1739
+ **Access**: public
1740
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
1741
+
1742
+ | Param | Type | Description |
1743
+ | --- | --- | --- |
1744
+ | params.orgId | <code>string</code> | Organization id |
1745
+ | session | <code>string</code> | Is token JWT of user SU |
1746
+
1747
+ **Example**
1748
+ ```js
1749
+ const API = require('@docbrasil/api-systemmanager');
1750
+ const api = new API();
1751
+ const orgId = '5dadd01dc4af3941d42f8c5c';
1752
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1753
+ await api.admin.organizations.removeAvatar(orgId, session);
1754
+ ```
1514
1755
  <a name="Organization+findById"></a>
1515
1756
 
1516
1757
  ### organization.findById(orgId, 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.0.54",
4
+ "version": "1.0.57",
5
5
  "scripts": {
6
6
  "doc": "rm -f doc/api.md && jsdoc2md api/**/** > doc/api.md",
7
7
  "build": "node bundleRollup.js"