@gls_spain/gps-common 34.1.0 → 34.2.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,10 @@
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/expeditions.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/expeditions.js" afterDir="false" />
6
+ <change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
7
+ <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
8
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/sales.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/sales.js" afterDir="false" />
9
+ <change beforePath="$PROJECT_DIR$/schemas/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/index.js" afterDir="false" />
7
10
  </list>
8
11
  <option name="SHOW_DIALOG" value="false" />
9
12
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -59,6 +62,7 @@
59
62
  <property name="prettierjs.PrettierConfiguration.Package" value="$PROJECT_DIR$/node_modules/prettier" />
60
63
  <property name="settings.editor.selected.configurable" value="watcher.settings" />
61
64
  <property name="ts.external.directory.path" value="$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external" />
65
+ <property name="vue.rearranger.settings.migration" value="true" />
62
66
  </component>
63
67
  <component name="RecentsManager">
64
68
  <key name="CopyFile.RECENT_KEYS">
@@ -122,11 +126,11 @@
122
126
  </configuration>
123
127
  <recent_temporary>
124
128
  <list>
125
- <item itemvalue="npm.build-documentation" />
126
129
  <item itemvalue="JavaScript Debug.documentation.html (1)" />
130
+ <item itemvalue="npm.build-documentation" />
131
+ <item itemvalue="npm.test" />
127
132
  <item itemvalue="npm.semantic-release" />
128
133
  <item itemvalue="npm.commit" />
129
- <item itemvalue="npm.test" />
130
134
  </list>
131
135
  </recent_temporary>
132
136
  </component>
@@ -596,7 +600,32 @@
596
600
  <workItem from="1596121607720" duration="51000" />
597
601
  <workItem from="1596176213722" duration="391000" />
598
602
  <workItem from="1596210378560" duration="336000" />
599
- <workItem from="1597913906065" duration="2109000" />
603
+ <workItem from="1597913906065" duration="2424000" />
604
+ <workItem from="1597934144169" duration="17000" />
605
+ <workItem from="1597934193331" duration="599000" />
606
+ <workItem from="1597950028741" duration="597000" />
607
+ <workItem from="1597991649203" duration="430000" />
608
+ <workItem from="1598004754259" duration="120000" />
609
+ <workItem from="1598090981738" duration="198000" />
610
+ <workItem from="1598093576151" duration="588000" />
611
+ <workItem from="1598100802076" duration="735000" />
612
+ <workItem from="1598120049591" duration="1499000" />
613
+ <workItem from="1598180744185" duration="16000" />
614
+ <workItem from="1598188015173" duration="314000" />
615
+ <workItem from="1598206900895" duration="111000" />
616
+ <workItem from="1598217043205" duration="91000" />
617
+ <workItem from="1598217927166" duration="574000" />
618
+ <workItem from="1598222406189" duration="9000" />
619
+ <workItem from="1598271224732" duration="4000" />
620
+ <workItem from="1598272437975" duration="6000" />
621
+ <workItem from="1598287527969" duration="5000" />
622
+ <workItem from="1598357442597" duration="26000" />
623
+ <workItem from="1599218272722" duration="619000" />
624
+ <workItem from="1599296807455" duration="54000" />
625
+ <workItem from="1599574256014" duration="436000" />
626
+ <workItem from="1599675057970" duration="1442000" />
627
+ <workItem from="1599722212402" duration="763000" />
628
+ <workItem from="1600358026541" duration="623000" />
600
629
  </task>
601
630
  <servers />
602
631
  </component>
@@ -639,22 +668,26 @@
639
668
  <screen x="0" y="23" width="2048" height="1129" />
640
669
  </state>
641
670
  <state x="762" y="341" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1595577705727" />
642
- <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1597916472340">
671
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1598188195051">
672
+ <screen x="0" y="23" width="2048" height="1129" />
673
+ </state>
674
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1598188195051" />
675
+ <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1598188195050">
643
676
  <screen x="0" y="23" width="2048" height="1129" />
644
677
  </state>
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">
678
+ <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1598188195050" />
679
+ <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1598188195050">
647
680
  <screen x="0" y="23" width="2048" height="1129" />
648
681
  </state>
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">
682
+ <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1598188195050" />
683
+ <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1598188195051">
651
684
  <screen x="0" y="23" width="2048" height="1129" />
652
685
  </state>
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">
686
+ <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1598188195051" />
687
+ <state x="725" y="342" width="736" height="612" key="find.popup" timestamp="1598206991663">
655
688
  <screen x="0" y="23" width="2048" height="1129" />
656
689
  </state>
657
- <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1597916472339" />
690
+ <state x="725" y="342" width="736" height="612" key="find.popup/0.23.2048.1129@0.23.2048.1129" timestamp="1598206991663" />
658
691
  <state x="689" y="276" width="670" height="676" key="search.everywhere.popup" timestamp="1595579270021">
659
692
  <screen x="0" y="23" width="2048" height="1129" />
660
693
  </state>
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [34.2.0](https://github.com/GLS-Spain/gps-common/compare/v34.1.1...v34.2.0) (2020-09-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * add /sales/update ([61be4c5](https://github.com/GLS-Spain/gps-common/commit/61be4c5f9f91f4e395939ba9db8c2cf3467da171))
7
+
8
+ ## [34.1.1](https://github.com/GLS-Spain/gps-common/compare/v34.1.0...v34.1.1) (2020-09-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add missing invalid destination error to create sale ([b9ef5c0](https://github.com/GLS-Spain/gps-common/commit/b9ef5c06e11e01c9418278cead6dde96153179f3))
14
+
1
15
  # [34.1.0](https://github.com/GLS-Spain/gps-common/compare/v34.0.1...v34.1.0) (2020-08-20)
2
16
 
3
17
 
@@ -178,6 +178,8 @@ const {
178
178
  findSalesResponse,
179
179
  checkSalePriceRequest,
180
180
  checkSalePriceResponse,
181
+ updateSaleRequest,
182
+ updateSaleResponse,
181
183
  } = require('../schemas/definitions/sales');
182
184
 
183
185
  const openApiSpec = { openapi: '3.0.2' };
@@ -3126,6 +3128,8 @@ The \`price\` field will be calculated from the \`size\` and \`settings\` fields
3126
3128
  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
3127
3129
  return a \`500 ShopCannotBeUpdatedError\`.
3128
3130
 
3131
+ If the destination is invalid the API will return a \`500 InvalidSaleDestinationError\`.
3132
+
3129
3133
  ${securitySchemes.tokens}
3130
3134
  ${securitySchemes.shopUserRole}`,
3131
3135
  requestBody: {
@@ -3148,6 +3152,7 @@ ${securitySchemes.shopUserRole}`,
3148
3152
  ' 500 ': responses.saleAlreadyExists,
3149
3153
  ' 500 ': responses.shopNotEnabled,
3150
3154
  ' 500 ': responses.shopCannotBeUpdated,
3155
+ ' 500 ': responses.invalidSaleDestination,
3151
3156
  },
3152
3157
  },
3153
3158
  },
@@ -3282,6 +3287,36 @@ ${securitySchemes.anyRole}`,
3282
3287
  },
3283
3288
  },
3284
3289
  },
3290
+ '/sales/update': {
3291
+ post: {
3292
+ tags: ['Sales'],
3293
+ summary: '[S] Update',
3294
+ description: `
3295
+ Finds a sale and updates the provided properties.
3296
+
3297
+ ${securitySchemes.tokens}
3298
+ ${securitySchemes.superAdminRole}`,
3299
+ requestBody: {
3300
+ content: { 'application/json': { schema: updateSaleRequest() } },
3301
+ required: true,
3302
+ },
3303
+ responses: {
3304
+ ' 200': {
3305
+ description: 'Contains the updated sale.',
3306
+ content: { 'application/json': { schema: updateSaleResponse() } },
3307
+ },
3308
+ ' 400': responses.badRequest,
3309
+ ' 401': responses.invalidUserInCookieOrHeader,
3310
+ ' 401 ': responses.invalidCookieOrHeader,
3311
+ ' 401 ': responses.missingCookieOrHeader,
3312
+ ' 401 ': responses.unauthorized,
3313
+ ' 403': responses.forbidden,
3314
+ ' 415': responses.unsupportedMediaType,
3315
+ ' 500': responses.internalServerError,
3316
+ ' 500 ': responses.saleDoesNotExist,
3317
+ },
3318
+ },
3319
+ },
3285
3320
  '/historicRecords/find': {
3286
3321
  post: {
3287
3322
  tags: ['Historic records'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "34.1.0",
3
+ "version": "34.2.0",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -27,33 +27,33 @@
27
27
  }
28
28
  },
29
29
  "devDependencies": {
30
- "@semantic-release/changelog": "^5.0.0",
30
+ "@semantic-release/changelog": "^5.0.1",
31
31
  "@semantic-release/git": "^9.0.0",
32
- "@semantic-release/npm": "^7.0.5",
32
+ "@semantic-release/npm": "^7.0.6",
33
33
  "@semantic-release/release-notes-generator": "^9.0.1",
34
- "@types/jest": "^25.1.4",
35
- "ajv": "^6.12.0",
36
- "commitizen": "^4.0.3",
37
- "cz-conventional-changelog": "^3.1.0",
34
+ "@types/jest": "^25.2.3",
35
+ "ajv": "^6.12.5",
36
+ "commitizen": "^4.2.1",
37
+ "cz-conventional-changelog": "^3.3.0",
38
38
  "eslint": "^6.8.0",
39
- "eslint-config-airbnb-base": "^14.1.0",
40
- "eslint-config-prettier": "^6.10.1",
41
- "eslint-plugin-import": "^2.20.1",
42
- "husky": "^4.2.3",
43
- "jest": "^25.1.0",
39
+ "eslint-config-airbnb-base": "^14.2.0",
40
+ "eslint-config-prettier": "^6.11.0",
41
+ "eslint-plugin-import": "^2.22.0",
42
+ "husky": "^4.3.0",
43
+ "jest": "^25.5.4",
44
44
  "prettier": "^1.19.1",
45
- "redoc-cli": "^0.9.7",
46
- "semantic-release": "^17.0.4"
45
+ "redoc-cli": "^0.9.12",
46
+ "semantic-release": "^17.1.1"
47
47
  },
48
48
  "dependencies": {
49
- "@gls_spain/ajv-options": "^1.1.0",
50
- "@gls_spain/common-errors": "^1.0.0",
51
- "@gls_spain/common-json-schemas": "^1.1.0",
52
- "@gls_spain/mongodb": "^1.1.0",
53
- "@gls_spain/winston-transports": "^1.0.0",
54
- "lodash": "^4.17.15",
55
- "winston": "^3.2.1",
56
- "yargs": "^15.3.1"
49
+ "@gls_spain/ajv-options": "^1.1.2",
50
+ "@gls_spain/common-errors": "^1.1.0",
51
+ "@gls_spain/common-json-schemas": "^1.2.4",
52
+ "@gls_spain/mongodb": "^1.2.0",
53
+ "@gls_spain/winston-transports": "^1.0.2",
54
+ "lodash": "^4.17.20",
55
+ "winston": "^3.3.3",
56
+ "yargs": "^15.4.1"
57
57
  },
58
58
  "scripts": {
59
59
  "commit": "git-cz",
@@ -8,6 +8,8 @@ const {
8
8
  createResponse,
9
9
  findRequest,
10
10
  findResponse,
11
+ updateRequest,
12
+ updateResponse,
11
13
  mergeSchemas,
12
14
  pickProperties,
13
15
  } = require('@gls_spain/common-json-schemas');
@@ -181,6 +183,16 @@ const checkSalePriceResponse = () => ({
181
183
  additionalProperties: false,
182
184
  });
183
185
 
186
+ const updateSaleRequest = () =>
187
+ updateRequest(findById(), {
188
+ type: 'object',
189
+ properties: { ...pickProperties(sale(), ['status']) },
190
+ minProperties: 1,
191
+ additionalProperties: false,
192
+ });
193
+
194
+ const updateSaleResponse = () => updateResponse(sale());
195
+
184
196
  module.exports = {
185
197
  sale,
186
198
  createSaleRequest,
@@ -191,4 +203,6 @@ module.exports = {
191
203
  findSalesResponse,
192
204
  checkSalePriceRequest,
193
205
  checkSalePriceResponse,
206
+ updateSaleRequest,
207
+ updateSaleResponse,
194
208
  };
package/schemas/index.js CHANGED
@@ -112,6 +112,8 @@ const {
112
112
  findSalesResponse,
113
113
  checkSalePriceRequest,
114
114
  checkSalePriceResponse,
115
+ updateSaleRequest,
116
+ updateSaleResponse,
115
117
  } = require('./definitions/sales');
116
118
 
117
119
  function request(schema, $id) {
@@ -245,6 +247,8 @@ const salesFindShopUserRequest = request(findSalesShopUserRequest(), 'salesFindS
245
247
  const salesFindResponse = response(findSalesResponse(), 'salesFindResponse');
246
248
  const salesCheckPriceRequest = request(checkSalePriceRequest(), 'salesCheckPriceRequest');
247
249
  const salesCheckPriceResponse = response(checkSalePriceResponse(), 'salesCheckPriceResponse');
250
+ const salesUpdateRequest = request(updateSaleRequest(), 'salesUpdateRequest');
251
+ const salesUpdateResponse = response(updateSaleResponse(), 'salesUpdateResponse');
248
252
 
249
253
  module.exports = {
250
254
  errorResponse,
@@ -367,4 +371,6 @@ module.exports = {
367
371
  salesFindResponse,
368
372
  salesCheckPriceRequest,
369
373
  salesCheckPriceResponse,
374
+ salesUpdateRequest,
375
+ salesUpdateResponse,
370
376
  };