@gls_spain/gps-common 28.0.1 → 29.0.0
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/.idea/workspace.xml +21 -42
- package/CHANGELOG.md +13 -0
- package/package.json +1 -1
- package/schemas/definitions/common.js +0 -7
- package/schemas/definitions/expeditions.js +3 -5
- package/schemas/definitions/historic-records.js +2 -1
- package/schemas/definitions/integrations.js +1 -0
- package/schemas/definitions/networks.js +3 -14
- package/schemas/definitions/representatives.js +1 -2
- package/schemas/definitions/shops.js +2 -4
- package/schemas/definitions/users.js +10 -46
package/.idea/workspace.xml
CHANGED
|
@@ -2,36 +2,12 @@
|
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="ChangeListManager">
|
|
4
4
|
<list default="true" id="c2833e40-3178-44f3-9bc5-203849985c7f" name="Default Changelist" comment="">
|
|
5
|
-
<change beforePath="$PROJECT_DIR$/
|
|
6
|
-
<change beforePath="$PROJECT_DIR$/
|
|
7
|
-
<change beforePath="$PROJECT_DIR$/
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/
|
|
9
|
-
<change beforePath="$PROJECT_DIR$/
|
|
10
|
-
<change beforePath="$PROJECT_DIR$/
|
|
11
|
-
<change beforePath="$PROJECT_DIR$/errors/JobDoesNotExistError.js" beforeDir="false" />
|
|
12
|
-
<change beforePath="$PROJECT_DIR$/errors/NetworkAlreadyExistsError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/NetworkAlreadyExistsError.js" afterDir="false" />
|
|
13
|
-
<change beforePath="$PROJECT_DIR$/errors/NetworkCannotBeDeletedError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/NetworkCannotBeDeletedError.js" afterDir="false" />
|
|
14
|
-
<change beforePath="$PROJECT_DIR$/errors/NetworkDoesNotExistError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/NetworkDoesNotExistError.js" afterDir="false" />
|
|
15
|
-
<change beforePath="$PROJECT_DIR$/errors/RepresentativeAlreadyExistsError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/RepresentativeAlreadyExistsError.js" afterDir="false" />
|
|
16
|
-
<change beforePath="$PROJECT_DIR$/errors/RepresentativeCannotBeDeletedError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/RepresentativeCannotBeDeletedError.js" afterDir="false" />
|
|
17
|
-
<change beforePath="$PROJECT_DIR$/errors/RepresentativeDoesNotExistError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/RepresentativeDoesNotExistError.js" afterDir="false" />
|
|
18
|
-
<change beforePath="$PROJECT_DIR$/errors/ShopAlreadyExistsError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/ShopAlreadyExistsError.js" afterDir="false" />
|
|
19
|
-
<change beforePath="$PROJECT_DIR$/errors/ShopCannotBeDeletedError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/ShopCannotBeDeletedError.js" afterDir="false" />
|
|
20
|
-
<change beforePath="$PROJECT_DIR$/errors/ShopDoesNotExistError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/ShopDoesNotExistError.js" afterDir="false" />
|
|
21
|
-
<change beforePath="$PROJECT_DIR$/errors/ShopNotEnabledError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/ShopNotEnabledError.js" afterDir="false" />
|
|
22
|
-
<change beforePath="$PROJECT_DIR$/errors/UserAlreadyExistsError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/UserAlreadyExistsError.js" afterDir="false" />
|
|
23
|
-
<change beforePath="$PROJECT_DIR$/errors/UserCannotBeDeletedError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/UserCannotBeDeletedError.js" afterDir="false" />
|
|
24
|
-
<change beforePath="$PROJECT_DIR$/errors/UserCannotBeUpdatedError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/UserCannotBeUpdatedError.js" afterDir="false" />
|
|
25
|
-
<change beforePath="$PROJECT_DIR$/errors/UserDoesNotExistError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/UserDoesNotExistError.js" afterDir="false" />
|
|
26
|
-
<change beforePath="$PROJECT_DIR$/errors/WrongNetworkError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/WrongNetworkError.js" afterDir="false" />
|
|
27
|
-
<change beforePath="$PROJECT_DIR$/errors/WrongPasswordError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/WrongPasswordError.js" afterDir="false" />
|
|
28
|
-
<change beforePath="$PROJECT_DIR$/errors/WrongShopError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/WrongShopError.js" afterDir="false" />
|
|
29
|
-
<change beforePath="$PROJECT_DIR$/errors/ZoneAlreadyExistsError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/ZoneAlreadyExistsError.js" afterDir="false" />
|
|
30
|
-
<change beforePath="$PROJECT_DIR$/errors/ZoneCannotBeDeletedError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/ZoneCannotBeDeletedError.js" afterDir="false" />
|
|
31
|
-
<change beforePath="$PROJECT_DIR$/errors/ZoneDoesNotExistError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/ZoneDoesNotExistError.js" afterDir="false" />
|
|
32
|
-
<change beforePath="$PROJECT_DIR$/errors/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/index.js" afterDir="false" />
|
|
33
|
-
<change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
|
|
34
|
-
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
5
|
+
<change beforePath="$PROJECT_DIR$/schemas/definitions/common.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/common.js" afterDir="false" />
|
|
6
|
+
<change beforePath="$PROJECT_DIR$/schemas/definitions/expeditions.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/expeditions.js" afterDir="false" />
|
|
7
|
+
<change beforePath="$PROJECT_DIR$/schemas/definitions/networks.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/networks.js" afterDir="false" />
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/schemas/definitions/representatives.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/representatives.js" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/schemas/definitions/shops.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/shops.js" afterDir="false" />
|
|
10
|
+
<change beforePath="$PROJECT_DIR$/schemas/definitions/users.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/users.js" afterDir="false" />
|
|
35
11
|
</list>
|
|
36
12
|
<option name="SHOW_DIALOG" value="false" />
|
|
37
13
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -154,9 +130,9 @@
|
|
|
154
130
|
</configuration>
|
|
155
131
|
<recent_temporary>
|
|
156
132
|
<list>
|
|
157
|
-
<item itemvalue="npm.test" />
|
|
158
133
|
<item itemvalue="JavaScript Debug.documentation.html (1)" />
|
|
159
134
|
<item itemvalue="npm.build-documentation" />
|
|
135
|
+
<item itemvalue="npm.test" />
|
|
160
136
|
<item itemvalue="Jest.index.test.js" />
|
|
161
137
|
<item itemvalue="Jest.#errors" />
|
|
162
138
|
</list>
|
|
@@ -527,7 +503,10 @@
|
|
|
527
503
|
<workItem from="1584264807456" duration="5446000" />
|
|
528
504
|
<workItem from="1584276339691" duration="500000" />
|
|
529
505
|
<workItem from="1584279223548" duration="443000" />
|
|
530
|
-
<workItem from="1584283992678" duration="
|
|
506
|
+
<workItem from="1584283992678" duration="388000" />
|
|
507
|
+
<workItem from="1584288029270" duration="191000" />
|
|
508
|
+
<workItem from="1584291295326" duration="639000" />
|
|
509
|
+
<workItem from="1584346563581" duration="3239000" />
|
|
531
510
|
</task>
|
|
532
511
|
<servers />
|
|
533
512
|
</component>
|
|
@@ -579,30 +558,30 @@
|
|
|
579
558
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
580
559
|
</state>
|
|
581
560
|
<state x="606" y="280" key="EditFileWatcherDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1580283934403" />
|
|
582
|
-
<state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="
|
|
561
|
+
<state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1584346574395">
|
|
583
562
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
584
563
|
</state>
|
|
585
|
-
<state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
586
|
-
<state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="
|
|
564
|
+
<state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1584346574395" />
|
|
565
|
+
<state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1584346574395">
|
|
587
566
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
588
567
|
</state>
|
|
589
|
-
<state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
590
|
-
<state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="
|
|
568
|
+
<state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1584346574395" />
|
|
569
|
+
<state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1584346574395">
|
|
591
570
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
592
571
|
</state>
|
|
593
|
-
<state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
594
|
-
<state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="
|
|
572
|
+
<state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1584346574395" />
|
|
573
|
+
<state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1584346574395">
|
|
595
574
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
596
575
|
</state>
|
|
597
|
-
<state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
576
|
+
<state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1584346574395" />
|
|
598
577
|
<state x="0" y="23" width="2048" height="1129" key="SettingsEditor" timestamp="1580283935326">
|
|
599
578
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
600
579
|
</state>
|
|
601
580
|
<state x="0" y="23" width="2048" height="1129" key="SettingsEditor/0.23.2048.1129@0.23.2048.1129" timestamp="1580283935326" />
|
|
602
|
-
<state x="1351" y="124" width="697" height="951" key="find.popup" timestamp="
|
|
581
|
+
<state x="1351" y="124" width="697" height="951" key="find.popup" timestamp="1584363161427">
|
|
603
582
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
604
583
|
</state>
|
|
605
|
-
<state x="1351" y="124" width="697" height="951" key="find.popup/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
584
|
+
<state x="1351" y="124" width="697" height="951" key="find.popup/0.23.2048.1129@0.23.2048.1129" timestamp="1584363161427" />
|
|
606
585
|
<state x="689" y="276" width="670" height="676" key="search.everywhere.popup" timestamp="1584284016106">
|
|
607
586
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
608
587
|
</state>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [29.0.0](https://github.com/GLS-Spain/gps-common/compare/v28.0.1...v29.0.0) (2020-03-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add deletable to historic records and integrations ([b81042d](https://github.com/GLS-Spain/gps-common/commit/b81042d4a25e9d3895a1b2907feba19a5121e016))
|
|
7
|
+
* remove tags and integrations, add users permissions ([9caf2bf](https://github.com/GLS-Spain/gps-common/commit/9caf2bfa1387d515da7198e751b6363731b099e2))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* changed networks, shops, expeditions, users and representatives schemas
|
|
13
|
+
|
|
1
14
|
## [28.0.1](https://github.com/GLS-Spain/gps-common/compare/v28.0.0...v28.0.1) (2020-03-15)
|
|
2
15
|
|
|
3
16
|
|
package/package.json
CHANGED
|
@@ -104,12 +104,6 @@ const objectWithUuidAndName = () => ({
|
|
|
104
104
|
additionalProperties: false,
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
-
const tags = () => ({
|
|
108
|
-
type: 'array',
|
|
109
|
-
items: { type: 'string', trim: true },
|
|
110
|
-
uniqueItems: true,
|
|
111
|
-
});
|
|
112
|
-
|
|
113
107
|
const contact = () => ({
|
|
114
108
|
title: 'contact',
|
|
115
109
|
type: 'object',
|
|
@@ -167,7 +161,6 @@ module.exports = {
|
|
|
167
161
|
timezone,
|
|
168
162
|
timezoneNames,
|
|
169
163
|
objectWithUuidAndName,
|
|
170
|
-
tags,
|
|
171
164
|
contact,
|
|
172
165
|
fiscal,
|
|
173
166
|
findByFiscal,
|
|
@@ -17,7 +17,7 @@ const {
|
|
|
17
17
|
mergeSchemas,
|
|
18
18
|
pickProperties,
|
|
19
19
|
} = require('@gls_spain/common-json-schemas');
|
|
20
|
-
const { date, findById, findByIds
|
|
20
|
+
const { date, findById, findByIds } = require('./common');
|
|
21
21
|
const { address } = require('./common');
|
|
22
22
|
const { network, objectWithNetworkId } = require('./networks');
|
|
23
23
|
const { shop, objectWithShopId } = require('./shops');
|
|
@@ -125,8 +125,8 @@ const expedition = () => ({
|
|
|
125
125
|
deletable: { type: 'boolean' },
|
|
126
126
|
network: {
|
|
127
127
|
type: 'object',
|
|
128
|
-
properties: { ...pickProperties(network(), ['_id', 'name'
|
|
129
|
-
required: ['_id', 'name'
|
|
128
|
+
properties: { ...pickProperties(network(), ['_id', 'name']) },
|
|
129
|
+
required: ['_id', 'name'],
|
|
130
130
|
additionalProperties: false,
|
|
131
131
|
},
|
|
132
132
|
shop: {
|
|
@@ -325,7 +325,6 @@ const createExpeditionWithShop = () => ({
|
|
|
325
325
|
'packages',
|
|
326
326
|
'notes',
|
|
327
327
|
]),
|
|
328
|
-
tags: tags(),
|
|
329
328
|
},
|
|
330
329
|
required: [
|
|
331
330
|
'shop',
|
|
@@ -372,7 +371,6 @@ const createExpeditionWithNetwork = () => ({
|
|
|
372
371
|
'packages',
|
|
373
372
|
'notes',
|
|
374
373
|
]),
|
|
375
|
-
tags: tags(),
|
|
376
374
|
},
|
|
377
375
|
required: [
|
|
378
376
|
'network',
|
|
@@ -10,6 +10,7 @@ const baseHistoricRecord = () => ({
|
|
|
10
10
|
_id: uuid(),
|
|
11
11
|
createdAt: datetime(),
|
|
12
12
|
updatedAt: datetime(),
|
|
13
|
+
deletable: { type: 'boolean' },
|
|
13
14
|
action: { type: 'string', enum: ['create', 'update', 'delete'] },
|
|
14
15
|
actionExtras: { type: 'array', items: { type: 'string' }, description: 'additional details about the action, e.g. what was updated' },
|
|
15
16
|
actor: { type: 'string', description: 'the username of the user who made the action' },
|
|
@@ -19,7 +20,7 @@ const baseHistoricRecord = () => ({
|
|
|
19
20
|
type: 'object',
|
|
20
21
|
properties: {
|
|
21
22
|
at: datetime(),
|
|
22
|
-
result: { type: 'string', enum: ['completed', 'failed', 'ignored', 'blocked', 'needsReview'] },
|
|
23
|
+
result: { type: 'string', enum: ['inProgress', 'completed', 'failed', 'ignored', 'blocked', 'needsReview'] },
|
|
23
24
|
message: { type: 'string' },
|
|
24
25
|
},
|
|
25
26
|
required: ['at', 'result', 'message'],
|
|
@@ -9,6 +9,7 @@ const integration = () => ({
|
|
|
9
9
|
_id: uuid(),
|
|
10
10
|
createdAt: datetime(),
|
|
11
11
|
updatedAt: datetime(),
|
|
12
|
+
deletable: { type: 'boolean' },
|
|
12
13
|
name: { type: 'string' },
|
|
13
14
|
enabled: { type: 'boolean' },
|
|
14
15
|
networks: mergeSchemas(omit(findByIds(), 'title'), { description: 'the integration only applies to these networks' }),
|
|
@@ -12,7 +12,7 @@ const {
|
|
|
12
12
|
deleteResponse,
|
|
13
13
|
pickProperties,
|
|
14
14
|
} = require('@gls_spain/common-json-schemas');
|
|
15
|
-
const { findAll, findById, findByName, objectWithUuidAndName,
|
|
15
|
+
const { findAll, findById, findByName, objectWithUuidAndName, contact, fiscal } = require('./common');
|
|
16
16
|
const { defaults, derivationSettings, expirationSettings } = require('./defaults');
|
|
17
17
|
|
|
18
18
|
const network = () => ({
|
|
@@ -25,7 +25,6 @@ const network = () => ({
|
|
|
25
25
|
deletable: { type: 'boolean' },
|
|
26
26
|
defaults: defaults(),
|
|
27
27
|
name: { type: 'string', trim: true },
|
|
28
|
-
integrations: { type: 'array', items: { type: 'string', enum: ['gls'] }, uniqueItems: true },
|
|
29
28
|
contacts: {
|
|
30
29
|
type: 'array',
|
|
31
30
|
items: contact(),
|
|
@@ -34,7 +33,7 @@ const network = () => ({
|
|
|
34
33
|
derivationSettings: derivationSettings(),
|
|
35
34
|
expirationSettings: expirationSettings(),
|
|
36
35
|
},
|
|
37
|
-
required: ['_id', 'createdAt', 'updatedAt', 'deletable', 'defaults', 'name', '
|
|
36
|
+
required: ['_id', 'createdAt', 'updatedAt', 'deletable', 'defaults', 'name', 'contacts'],
|
|
38
37
|
additionalProperties: false,
|
|
39
38
|
});
|
|
40
39
|
|
|
@@ -49,17 +48,7 @@ const createNetworkRequest = () =>
|
|
|
49
48
|
createRequest({
|
|
50
49
|
type: 'object',
|
|
51
50
|
properties: {
|
|
52
|
-
...pickProperties(network(), [
|
|
53
|
-
'_id',
|
|
54
|
-
'createdAt',
|
|
55
|
-
'name',
|
|
56
|
-
'integrations',
|
|
57
|
-
'contacts',
|
|
58
|
-
'fiscal',
|
|
59
|
-
'derivationSettings',
|
|
60
|
-
'expirationSettings',
|
|
61
|
-
]),
|
|
62
|
-
tags: tags(),
|
|
51
|
+
...pickProperties(network(), ['_id', 'createdAt', 'name', 'contacts', 'fiscal', 'derivationSettings', 'expirationSettings']),
|
|
63
52
|
},
|
|
64
53
|
required: ['name'],
|
|
65
54
|
additionalProperties: false,
|
|
@@ -16,7 +16,7 @@ const {
|
|
|
16
16
|
deleteResponse,
|
|
17
17
|
pickProperties,
|
|
18
18
|
} = require('@gls_spain/common-json-schemas');
|
|
19
|
-
const { findAll, findById, findByName, objectWithUuidAndName
|
|
19
|
+
const { findAll, findById, findByName, objectWithUuidAndName } = require('./common');
|
|
20
20
|
const { zone } = require('./zones');
|
|
21
21
|
|
|
22
22
|
const representative = () => ({
|
|
@@ -58,7 +58,6 @@ const createRepresentativeRequest = () =>
|
|
|
58
58
|
properties: {
|
|
59
59
|
...pickProperties(representative(), ['_id', 'createdAt', 'name', 'emails', 'phones', 'nif']),
|
|
60
60
|
zones: setRepresentativesZones(),
|
|
61
|
-
tags: tags(),
|
|
62
61
|
},
|
|
63
62
|
required: ['name', 'nif'],
|
|
64
63
|
additionalProperties: false,
|
|
@@ -24,7 +24,6 @@ const {
|
|
|
24
24
|
findByCircularArea,
|
|
25
25
|
findByPolygonalArea,
|
|
26
26
|
timezone,
|
|
27
|
-
tags,
|
|
28
27
|
contact,
|
|
29
28
|
fiscal,
|
|
30
29
|
findByFiscal,
|
|
@@ -96,8 +95,8 @@ const shop = () => ({
|
|
|
96
95
|
defaults: defaults(),
|
|
97
96
|
network: {
|
|
98
97
|
type: 'object',
|
|
99
|
-
properties: { ...pickProperties(network(), ['_id', 'name', '
|
|
100
|
-
required: ['_id', 'name'
|
|
98
|
+
properties: { ...pickProperties(network(), ['_id', 'name', 'derivationSettings', 'expirationSettings']) },
|
|
99
|
+
required: ['_id', 'name'],
|
|
101
100
|
additionalProperties: false,
|
|
102
101
|
},
|
|
103
102
|
zone: {
|
|
@@ -215,7 +214,6 @@ const createShopRequest = () =>
|
|
|
215
214
|
'derivationSettings',
|
|
216
215
|
'expirationSettings',
|
|
217
216
|
]),
|
|
218
|
-
tags: tags(),
|
|
219
217
|
},
|
|
220
218
|
required: ['network', 'status', 'name', 'address', 'openingSchedule', 'timezone'],
|
|
221
219
|
additionalProperties: false,
|
|
@@ -16,7 +16,7 @@ const {
|
|
|
16
16
|
mergeSchemas,
|
|
17
17
|
pickProperties,
|
|
18
18
|
} = require('@gls_spain/common-json-schemas');
|
|
19
|
-
const { address, findAll, findById, findByName
|
|
19
|
+
const { address, findAll, findById, findByName } = require('./common');
|
|
20
20
|
const { network, objectWithNetworkId } = require('./networks');
|
|
21
21
|
const { shop, objectWithShopId } = require('./shops');
|
|
22
22
|
|
|
@@ -34,7 +34,7 @@ const baseUser = () => ({
|
|
|
34
34
|
description: 'a unique username that cannot be changed later',
|
|
35
35
|
},
|
|
36
36
|
loginEnabled: { type: 'boolean' },
|
|
37
|
-
|
|
37
|
+
permissions: { type: 'array', items: { type: 'string', enum: ['canReceiveAllFromDriver'] }, uniqueItems: true },
|
|
38
38
|
role: { type: 'string' },
|
|
39
39
|
name: { type: 'string', trim: true },
|
|
40
40
|
emails: { type: 'array', items: email(), uniqueItems: true },
|
|
@@ -42,7 +42,7 @@ const baseUser = () => ({
|
|
|
42
42
|
nif: { type: 'string', trim: true },
|
|
43
43
|
address: address(),
|
|
44
44
|
},
|
|
45
|
-
required: ['_id', 'createdAt', 'updatedAt', 'username', 'deletable', 'loginEnabled', '
|
|
45
|
+
required: ['_id', 'createdAt', 'updatedAt', 'username', 'deletable', 'loginEnabled', 'permissions', 'role', 'name', 'emails', 'phones'],
|
|
46
46
|
additionalProperties: false,
|
|
47
47
|
});
|
|
48
48
|
|
|
@@ -55,8 +55,8 @@ const networkAdmin = () =>
|
|
|
55
55
|
role: { enum: ['networkAdmin'] },
|
|
56
56
|
network: {
|
|
57
57
|
type: 'object',
|
|
58
|
-
properties: { ...pickProperties(network(), ['_id', 'name'
|
|
59
|
-
required: ['_id', 'name'
|
|
58
|
+
properties: { ...pickProperties(network(), ['_id', 'name']) },
|
|
59
|
+
required: ['_id', 'name'],
|
|
60
60
|
additionalProperties: false,
|
|
61
61
|
},
|
|
62
62
|
},
|
|
@@ -70,8 +70,8 @@ const shopUser = () =>
|
|
|
70
70
|
role: { enum: ['shopUser'] },
|
|
71
71
|
network: {
|
|
72
72
|
type: 'object',
|
|
73
|
-
properties: { ...pickProperties(network(), ['_id', 'name'
|
|
74
|
-
required: ['_id', 'name'
|
|
73
|
+
properties: { ...pickProperties(network(), ['_id', 'name']) },
|
|
74
|
+
required: ['_id', 'name'],
|
|
75
75
|
additionalProperties: false,
|
|
76
76
|
},
|
|
77
77
|
shop: {
|
|
@@ -88,19 +88,7 @@ const createSuperAdminRequest = () =>
|
|
|
88
88
|
createRequest({
|
|
89
89
|
type: 'object',
|
|
90
90
|
properties: {
|
|
91
|
-
...pickProperties(superAdmin(), [
|
|
92
|
-
'_id',
|
|
93
|
-
'createdAt',
|
|
94
|
-
'username',
|
|
95
|
-
'loginEnabled',
|
|
96
|
-
'integrations',
|
|
97
|
-
'name',
|
|
98
|
-
'emails',
|
|
99
|
-
'phones',
|
|
100
|
-
'nif',
|
|
101
|
-
'address',
|
|
102
|
-
]),
|
|
103
|
-
tags: tags(),
|
|
91
|
+
...pickProperties(superAdmin(), ['_id', 'createdAt', 'username', 'loginEnabled', 'name', 'emails', 'phones', 'nif', 'address']),
|
|
104
92
|
password: password(),
|
|
105
93
|
},
|
|
106
94
|
required: ['username', 'loginEnabled', 'name', 'password'],
|
|
@@ -145,19 +133,7 @@ const createNetworkAdminRequest = () =>
|
|
|
145
133
|
{
|
|
146
134
|
type: 'object',
|
|
147
135
|
properties: {
|
|
148
|
-
...pickProperties(networkAdmin(), [
|
|
149
|
-
'_id',
|
|
150
|
-
'createdAt',
|
|
151
|
-
'username',
|
|
152
|
-
'loginEnabled',
|
|
153
|
-
'integrations',
|
|
154
|
-
'name',
|
|
155
|
-
'emails',
|
|
156
|
-
'phones',
|
|
157
|
-
'nif',
|
|
158
|
-
'address',
|
|
159
|
-
]),
|
|
160
|
-
tags: tags(),
|
|
136
|
+
...pickProperties(networkAdmin(), ['_id', 'createdAt', 'username', 'loginEnabled', 'name', 'emails', 'phones', 'nif', 'address']),
|
|
161
137
|
password: password(),
|
|
162
138
|
},
|
|
163
139
|
required: ['username', 'loginEnabled', 'name', 'password'],
|
|
@@ -236,19 +212,7 @@ const createShopUserRequest = () =>
|
|
|
236
212
|
{
|
|
237
213
|
type: 'object',
|
|
238
214
|
properties: {
|
|
239
|
-
...pickProperties(shopUser(), [
|
|
240
|
-
'_id',
|
|
241
|
-
'createdAt',
|
|
242
|
-
'username',
|
|
243
|
-
'loginEnabled',
|
|
244
|
-
'integrations',
|
|
245
|
-
'name',
|
|
246
|
-
'emails',
|
|
247
|
-
'phones',
|
|
248
|
-
'nif',
|
|
249
|
-
'address',
|
|
250
|
-
]),
|
|
251
|
-
tags: tags(),
|
|
215
|
+
...pickProperties(shopUser(), ['_id', 'createdAt', 'username', 'loginEnabled', 'name', 'emails', 'phones', 'nif', 'address']),
|
|
252
216
|
password: password(),
|
|
253
217
|
},
|
|
254
218
|
required: ['username', 'loginEnabled', 'name', 'password'],
|