@gls_spain/gps-common 34.0.0 → 34.1.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.
@@ -3,7 +3,7 @@
3
3
  <component name="ChangeListManager">
4
4
  <list default="true" id="c2833e40-3178-44f3-9bc5-203849985c7f" name="Default Changelist" comment="">
5
5
  <change beforePath="$PROJECT_DIR$/open-api-spec/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/open-api-spec/index.js" afterDir="false" />
6
- <change beforePath="$PROJECT_DIR$/schemas/definitions/sales.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/sales.js" afterDir="false" />
6
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/expeditions.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/expeditions.js" afterDir="false" />
7
7
  </list>
8
8
  <option name="SHOW_DIALOG" value="false" />
9
9
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -590,7 +590,13 @@
590
590
  <workItem from="1595939490548" duration="3433000" />
591
591
  <workItem from="1595961689372" duration="1814000" />
592
592
  <workItem from="1595999862116" duration="11371000" />
593
- <workItem from="1596052438845" duration="2652000" />
593
+ <workItem from="1596052438845" duration="2941000" />
594
+ <workItem from="1596088002152" duration="1276000" />
595
+ <workItem from="1596102863465" duration="2035000" />
596
+ <workItem from="1596121607720" duration="51000" />
597
+ <workItem from="1596176213722" duration="391000" />
598
+ <workItem from="1596210378560" duration="336000" />
599
+ <workItem from="1597913906065" duration="2109000" />
594
600
  </task>
595
601
  <servers />
596
602
  </component>
@@ -633,22 +639,22 @@
633
639
  <screen x="0" y="23" width="2048" height="1129" />
634
640
  </state>
635
641
  <state x="762" y="341" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1595577705727" />
636
- <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1596055279837">
642
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1597916472340">
637
643
  <screen x="0" y="23" width="2048" height="1129" />
638
644
  </state>
639
- <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1596055279837" />
640
- <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1596055279836">
645
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1597916472340" />
646
+ <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1597916472339">
641
647
  <screen x="0" y="23" width="2048" height="1129" />
642
648
  </state>
643
- <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1596055279836" />
644
- <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1596055279836">
649
+ <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1597916472339" />
650
+ <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1597916472339">
645
651
  <screen x="0" y="23" width="2048" height="1129" />
646
652
  </state>
647
- <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1596055279836" />
648
- <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1596055279837">
653
+ <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1597916472339" />
654
+ <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1597916472339">
649
655
  <screen x="0" y="23" width="2048" height="1129" />
650
656
  </state>
651
- <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1596055279837" />
657
+ <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1597916472339" />
652
658
  <state x="689" y="276" width="670" height="676" key="search.everywhere.popup" timestamp="1595579270021">
653
659
  <screen x="0" y="23" width="2048" height="1129" />
654
660
  </state>
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [34.1.0](https://github.com/GLS-Spain/gps-common/compare/v34.0.1...v34.1.0) (2020-08-20)
2
+
3
+
4
+ ### Features
5
+
6
+ * can create expeditions that can be received on any shop of multiple networks ([f2fb145](https://github.com/GLS-Spain/gps-common/commit/f2fb14536fe21115a73f9d3edd3596596164d67e))
7
+
8
+ ## [34.0.1](https://github.com/GLS-Spain/gps-common/compare/v34.0.0...v34.0.1) (2020-07-30)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * require at least one email and phone for a sale sender ([91ed154](https://github.com/GLS-Spain/gps-common/commit/91ed15423a177882fb12b4241e4fae73ca99e551))
14
+
1
15
  # [34.0.0](https://github.com/GLS-Spain/gps-common/compare/v33.0.9...v34.0.0) (2020-07-29)
2
16
 
3
17
 
@@ -825,7 +825,7 @@ of each record.
825
825
  {
826
826
  name: 'Callbacks',
827
827
  description: `
828
- This section contains endpoints that are not meant to be used by the API users, instead they meant for other systems (integrations, etc)
828
+ This section contains endpoints that are not meant to be used by the API users, instead they are meant for other systems (integrations, etc)
829
829
  to report back information when they have it.
830
830
  `,
831
831
  },
@@ -2586,10 +2586,11 @@ ${descriptions.createIdIsOptional}
2586
2586
 
2587
2587
  ${descriptions.optionalArrayPropertiesEmptyByDefault}
2588
2588
 
2589
- An expedition can be associated on creation to either a shop or a network:
2589
+ An expedition can be associated on creation to either one shop, one network or multiple networks:
2590
2590
 
2591
- - Provide a shop when it is known at which shop it is going to be received. That shop network will be inserted automatically.
2592
- - Provide a network when it can be received at any shop in it. When a shop receives it, that shop will be added to the expedition.
2591
+ - Provide \`shop\` when it can be received only in a specific shop. The network will be inserted automatically.
2592
+ - Provide \`network\` when it can be received at any shop in one network. On reception the shop will be added to the expedition.
2593
+ - Provide \`network\` and \`otherNetworks\` when it can be received in any shop in more than one network. On reception the network and shop will be set and the other networks removed.
2593
2594
 
2594
2595
  If the provided shop does not exist the API will return a \`500 ShopDoesNotExistError\`, if it is not enabled it will return a
2595
2596
  \`500 ShopNotEnabledError\`, and if it is readonly it will return a \`500 ShopCannotBeUpdatedError\`.
@@ -2597,7 +2598,7 @@ If the provided shop does not exist the API will return a \`500 ShopDoesNotExist
2597
2598
  When providing a shop one can also provide a sale if the expedition is created because of it. If the provided sale does not
2598
2599
  exist the API will return a \`500 SaleDoesNotExistError\`.
2599
2600
 
2600
- If the provided network does not exist the API will return a \`500 NetworkDoesNotExistError\`.
2601
+ If a provided network does not exist the API will return a \`500 NetworkDoesNotExistError\`.
2601
2602
 
2602
2603
  The \`status.code\` of a new expedition cannot be specified and it will always be \`incoming\`.
2603
2604
 
@@ -2805,7 +2806,7 @@ Scan a barcode or QR code and find the appropriate expedition.
2805
2806
 
2806
2807
  It can return:
2807
2808
 
2808
- - \`ok\`: when the barcode or QR match a single expedition from the **same shop** or from the same network but **no shop**.
2809
+ - \`ok\`: when the barcode or QR match a single expedition from the **same shop** or the expedition has **no shop** but can be received in this shop network.
2809
2810
  - \`notFound\`: when the expedition does not exist.
2810
2811
  - \`anotherShop\`: when the expedition belongs to another shop.
2811
2812
  - \`multipleResults\`: when the barcode or QR match more than one expedition (e.g. shared reference). Try scanning another barcode.
@@ -2852,7 +2853,7 @@ and some are not. The result for each expedition depends on its situation:
2852
2853
  | not found | - | not found | - | - |
2853
2854
  | server error | - | error | - | - |
2854
2855
 
2855
- (*) If the received expedition is not associated to a shop this operation will associate it to the shop that is receiving it.
2856
+ (*) If the expedition has no shop but it can be received in this network, then on reception its network and shop will be set to the receiving shop.
2856
2857
 
2857
2858
  ${securitySchemes.tokens}
2858
2859
  ${securitySchemes.shopUserRole}`,
@@ -3398,7 +3399,7 @@ the call against a known secret.`,
3398
3399
  responses: {
3399
3400
  ' 200': {
3400
3401
  description: 'The data in the URL query parameters has been verified and accepted.',
3401
- content: { 'text/plain': { schema: { type: 'string', enum: ['ok'] } } },
3402
+ content: { 'text/plain': { schema: { type: 'string', enum: ['transaction feedback processed correctly'] } } },
3402
3403
  },
3403
3404
  ' 400': {
3404
3405
  description: 'There is invalid data in the URL query parameters',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "34.0.0",
3
+ "version": "34.1.0",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -129,12 +129,24 @@ const expedition = () => ({
129
129
  required: ['_id', 'name'],
130
130
  additionalProperties: false,
131
131
  },
132
+ otherNetworks: {
133
+ type: 'array',
134
+ items: {
135
+ type: 'object',
136
+ properties: { ...pickProperties(network(), ['_id', 'name']) },
137
+ required: ['_id', 'name'],
138
+ additionalProperties: false,
139
+ },
140
+ minItems: 1,
141
+ uniqueItems: true,
142
+ description: `only for incoming expeditions created with multiple networks and no shop, on reception this field is removed and \`network\` and \`shop\` set to the receiving shop`,
143
+ },
132
144
  shop: {
133
145
  type: 'object',
134
146
  properties: { ...pickProperties(shop(), ['_id', 'name']) },
135
147
  required: ['_id', 'name'],
136
148
  additionalProperties: false,
137
- description: 'not available for incoming expeditions that are not assigned to a shop until reception',
149
+ description: 'not available for incoming expeditions created with no shop, on reception this will be set to the receiving shop',
138
150
  },
139
151
  type: { type: 'string', enum: ['delivery', 'pickup'] },
140
152
  status: {
@@ -336,11 +348,20 @@ const createExpeditionWithShop = () => ({
336
348
  });
337
349
 
338
350
  const createExpeditionWithNetwork = () => ({
339
- title: 'create with network',
351
+ title: 'create with one or more networks',
340
352
  type: 'object',
341
353
  properties: {
342
354
  ...pickProperties(expedition(), ['_id', 'createdAt']),
343
- network: objectWithUuid(),
355
+ network: mergeSchemas(objectWithUuid(), {
356
+ description: `any shop in the network can receive it, on reception \`shop\` will be set to the receiving shop`,
357
+ }),
358
+ otherNetworks: {
359
+ type: 'array',
360
+ items: objectWithUuid(),
361
+ minItems: 1,
362
+ uniqueItems: true,
363
+ description: `additional networks the expedition can be received in, on reception this will be removed and \`network\` and \`shop\` set to the receiving shop`,
364
+ },
344
365
  ...pickProperties(expedition(), [
345
366
  'type',
346
367
  'code',
@@ -71,8 +71,8 @@ const sale = () => ({
71
71
  name: { type: 'string', trim: true },
72
72
  nif: { type: 'string', trim: true },
73
73
  address: address(),
74
- emails: { type: 'array', items: email(), uniqueItems: true },
75
- phones: { type: 'array', items: phone(), uniqueItems: true },
74
+ emails: { type: 'array', items: email(), uniqueItems: true, minItems: 1 },
75
+ phones: { type: 'array', items: phone(), uniqueItems: true, minItems: 1 },
76
76
  fiscal: {
77
77
  type: 'object',
78
78
  properties: {