@gls_spain/gps-common 34.0.1 → 34.1.1

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,6 @@
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" />
7
6
  </list>
8
7
  <option name="SHOW_DIALOG" value="false" />
9
8
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -59,6 +58,7 @@
59
58
  <property name="prettierjs.PrettierConfiguration.Package" value="$PROJECT_DIR$/node_modules/prettier" />
60
59
  <property name="settings.editor.selected.configurable" value="watcher.settings" />
61
60
  <property name="ts.external.directory.path" value="$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external" />
61
+ <property name="vue.rearranger.settings.migration" value="true" />
62
62
  </component>
63
63
  <component name="RecentsManager">
64
64
  <key name="CopyFile.RECENT_KEYS">
@@ -122,11 +122,11 @@
122
122
  </configuration>
123
123
  <recent_temporary>
124
124
  <list>
125
- <item itemvalue="npm.build-documentation" />
126
125
  <item itemvalue="JavaScript Debug.documentation.html (1)" />
126
+ <item itemvalue="npm.build-documentation" />
127
+ <item itemvalue="npm.test" />
127
128
  <item itemvalue="npm.semantic-release" />
128
129
  <item itemvalue="npm.commit" />
129
- <item itemvalue="npm.test" />
130
130
  </list>
131
131
  </recent_temporary>
132
132
  </component>
@@ -592,7 +592,33 @@
592
592
  <workItem from="1595999862116" duration="11371000" />
593
593
  <workItem from="1596052438845" duration="2941000" />
594
594
  <workItem from="1596088002152" duration="1276000" />
595
- <workItem from="1596102863465" duration="1301000" />
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="2424000" />
600
+ <workItem from="1597934144169" duration="17000" />
601
+ <workItem from="1597934193331" duration="599000" />
602
+ <workItem from="1597950028741" duration="597000" />
603
+ <workItem from="1597991649203" duration="430000" />
604
+ <workItem from="1598004754259" duration="120000" />
605
+ <workItem from="1598090981738" duration="198000" />
606
+ <workItem from="1598093576151" duration="588000" />
607
+ <workItem from="1598100802076" duration="735000" />
608
+ <workItem from="1598120049591" duration="1499000" />
609
+ <workItem from="1598180744185" duration="16000" />
610
+ <workItem from="1598188015173" duration="314000" />
611
+ <workItem from="1598206900895" duration="111000" />
612
+ <workItem from="1598217043205" duration="91000" />
613
+ <workItem from="1598217927166" duration="574000" />
614
+ <workItem from="1598222406189" duration="9000" />
615
+ <workItem from="1598271224732" duration="4000" />
616
+ <workItem from="1598272437975" duration="6000" />
617
+ <workItem from="1598287527969" duration="5000" />
618
+ <workItem from="1598357442597" duration="26000" />
619
+ <workItem from="1599218272722" duration="619000" />
620
+ <workItem from="1599296807455" duration="54000" />
621
+ <workItem from="1599574256014" duration="232000" />
596
622
  </task>
597
623
  <servers />
598
624
  </component>
@@ -635,22 +661,26 @@
635
661
  <screen x="0" y="23" width="2048" height="1129" />
636
662
  </state>
637
663
  <state x="762" y="341" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1595577705727" />
638
- <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1596110081129">
664
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1598188195051">
665
+ <screen x="0" y="23" width="2048" height="1129" />
666
+ </state>
667
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1598188195051" />
668
+ <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1598188195050">
639
669
  <screen x="0" y="23" width="2048" height="1129" />
640
670
  </state>
641
- <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1596110081129" />
642
- <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1596110081129">
671
+ <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1598188195050" />
672
+ <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1598188195050">
643
673
  <screen x="0" y="23" width="2048" height="1129" />
644
674
  </state>
645
- <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1596110081129" />
646
- <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1596110081128">
675
+ <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1598188195050" />
676
+ <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1598188195051">
647
677
  <screen x="0" y="23" width="2048" height="1129" />
648
678
  </state>
649
- <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1596110081128" />
650
- <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1596110081129">
679
+ <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1598188195051" />
680
+ <state x="725" y="342" width="736" height="612" key="find.popup" timestamp="1598206991663">
651
681
  <screen x="0" y="23" width="2048" height="1129" />
652
682
  </state>
653
- <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1596110081129" />
683
+ <state x="725" y="342" width="736" height="612" key="find.popup/0.23.2048.1129@0.23.2048.1129" timestamp="1598206991663" />
654
684
  <state x="689" y="276" width="670" height="676" key="search.everywhere.popup" timestamp="1595579270021">
655
685
  <screen x="0" y="23" width="2048" height="1129" />
656
686
  </state>
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [34.1.1](https://github.com/GLS-Spain/gps-common/compare/v34.1.0...v34.1.1) (2020-09-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add missing invalid destination error to create sale ([b9ef5c0](https://github.com/GLS-Spain/gps-common/commit/b9ef5c06e11e01c9418278cead6dde96153179f3))
7
+
8
+ # [34.1.0](https://github.com/GLS-Spain/gps-common/compare/v34.0.1...v34.1.0) (2020-08-20)
9
+
10
+
11
+ ### Features
12
+
13
+ * can create expeditions that can be received on any shop of multiple networks ([f2fb145](https://github.com/GLS-Spain/gps-common/commit/f2fb14536fe21115a73f9d3edd3596596164d67e))
14
+
1
15
  ## [34.0.1](https://github.com/GLS-Spain/gps-common/compare/v34.0.0...v34.0.1) (2020-07-30)
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}`,
@@ -3125,6 +3126,8 @@ The \`price\` field will be calculated from the \`size\` and \`settings\` fields
3125
3126
  If the shop the user belongs to is not enabled the API will return a \`500 ShopNotEnabledError\` and if the shop is readonly it will
3126
3127
  return a \`500 ShopCannotBeUpdatedError\`.
3127
3128
 
3129
+ If the destination is invalid the API will return a \`500 InvalidSaleDestinationError\`.
3130
+
3128
3131
  ${securitySchemes.tokens}
3129
3132
  ${securitySchemes.shopUserRole}`,
3130
3133
  requestBody: {
@@ -3147,6 +3150,7 @@ ${securitySchemes.shopUserRole}`,
3147
3150
  ' 500 ': responses.saleAlreadyExists,
3148
3151
  ' 500 ': responses.shopNotEnabled,
3149
3152
  ' 500 ': responses.shopCannotBeUpdated,
3153
+ ' 500 ': responses.invalidSaleDestination,
3150
3154
  },
3151
3155
  },
3152
3156
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "34.0.1",
3
+ "version": "34.1.1",
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',