@gls_spain/gps-common 34.8.1 → 34.9.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.
@@ -2,10 +2,8 @@
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$/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" />
5
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/common.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/common.js" afterDir="false" />
7
6
  <change beforePath="$PROJECT_DIR$/schemas/definitions/sales.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/sales.js" afterDir="false" />
8
- <change beforePath="$PROJECT_DIR$/schemas/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/index.js" afterDir="false" />
9
7
  </list>
10
8
  <option name="SHOW_DIALOG" value="false" />
11
9
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -59,7 +57,7 @@
59
57
  <property name="nodejs_package_manager_path" value="npm" />
60
58
  <property name="prettier.import.notification.dismissed" value="true" />
61
59
  <property name="prettierjs.PrettierConfiguration.Package" value="$PROJECT_DIR$/node_modules/prettier" />
62
- <property name="settings.editor.selected.configurable" value="settings.javascript.prettier" />
60
+ <property name="settings.editor.selected.configurable" value="watcher.settings" />
63
61
  <property name="ts.external.directory.path" value="$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external" />
64
62
  <property name="vue.rearranger.settings.migration" value="true" />
65
63
  </component>
@@ -648,7 +646,12 @@
648
646
  <workItem from="1607951320583" duration="589000" />
649
647
  <workItem from="1610108917407" duration="2502000" />
650
648
  <workItem from="1610134729440" duration="18000" />
651
- <workItem from="1610542075615" duration="374000" />
649
+ <workItem from="1610542075615" duration="660000" />
650
+ <workItem from="1610988300441" duration="4439000" />
651
+ <workItem from="1610996494321" duration="612000" />
652
+ <workItem from="1611040774303" duration="609000" />
653
+ <workItem from="1611059922357" duration="15000" />
654
+ <workItem from="1611060068624" duration="1331000" />
652
655
  </task>
653
656
  <servers />
654
657
  </component>
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [34.9.1](https://github.com/GLS-Spain/gps-common/compare/v34.9.0...v34.9.1) (2021-01-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fix find sales by createdAt range instead of date range ([c50f662](https://github.com/GLS-Spain/gps-common/commit/c50f662d9aaafca0ebc4345c0d78e0d9f68cdcff))
7
+
8
+ # [34.9.0](https://github.com/GLS-Spain/gps-common/compare/v34.8.1...v34.9.0) (2021-01-18)
9
+
10
+
11
+ ### Features
12
+
13
+ * add expire, unexpire, update derivation, add date range to find expeditions and sales ([8290523](https://github.com/GLS-Spain/gps-common/commit/8290523fe0fc0f366cf0a1299a3a2b3484f20d16))
14
+
1
15
  ## [34.8.1](https://github.com/GLS-Spain/gps-common/compare/v34.8.0...v34.8.1) (2021-01-13)
2
16
 
3
17
 
@@ -129,6 +129,9 @@ const {
129
129
  receiveAllExpeditionsFromDriverResponse,
130
130
  downloadExpeditionLabelRequest,
131
131
  downloadExpeditionLabelResponse,
132
+ expireExpeditionRequest,
133
+ unexpireExpeditionRequest,
134
+ updateExpeditionDerivationRequest,
132
135
  } = require('../schemas/definitions/expeditions');
133
136
  const { defaults, getDefaultsResponse, updateDefaultsRequest, updateDefaultsResponse } = require('../schemas/definitions/defaults');
134
137
  const { counters, getCountersResponse } = require('../schemas/definitions/counters');
@@ -3147,6 +3150,108 @@ ${securitySchemes.anyRole}`,
3147
3150
  },
3148
3151
  },
3149
3152
  },
3153
+ '/expeditions/expire': {
3154
+ post: {
3155
+ tags: ['Expeditions'],
3156
+ summary: '[S] Expire',
3157
+ description: `
3158
+ Changes the status of a delivery expedition from \`inShop\` to \`inShopExpired\`.
3159
+
3160
+ If the expedition is not a delivery or is not in shop, the API will return a \`500 ExpeditionCannotBeUpdatedError\`.
3161
+
3162
+ ${securitySchemes.tokens}
3163
+ ${securitySchemes.superAdminRole}`,
3164
+ requestBody: {
3165
+ content: { 'application/json': { schema: expireExpeditionRequest() } },
3166
+ required: true,
3167
+ },
3168
+ responses: {
3169
+ ' 200': {
3170
+ description: 'Contains the updated expedition.',
3171
+ content: { 'application/json': { schema: updateExpeditionResponse() } },
3172
+ },
3173
+ ' 400': responses.badRequest,
3174
+ ' 401': responses.invalidUserInCookieOrHeader,
3175
+ ' 401 ': responses.invalidCookieOrHeader,
3176
+ ' 401 ': responses.missingCookieOrHeader,
3177
+ ' 401 ': responses.unauthorized,
3178
+ ' 403': responses.forbidden,
3179
+ ' 415': responses.unsupportedMediaType,
3180
+ ' 500': responses.internalServerError,
3181
+ ' 500 ': responses.expeditionDoesNotExist,
3182
+ ' 500 ': responses.expeditionCannotBeUpdated,
3183
+ },
3184
+ },
3185
+ },
3186
+ '/expeditions/unexpire': {
3187
+ post: {
3188
+ tags: ['Expeditions'],
3189
+ summary: '[S] Unexpire',
3190
+ description: `
3191
+ Changes the status of a delivery expedition from \`inShopExpired\` to \`inShop\`.
3192
+
3193
+ The \`status.expiration\` fields will be reset using the shop expiration settings, as if the expedition had been received from the driver
3194
+ at this point.
3195
+
3196
+ If the expedition is not a delivery or is not expired, the API will return a \`500 ExpeditionCannotBeUpdatedError\`.
3197
+
3198
+ ${securitySchemes.tokens}
3199
+ ${securitySchemes.superAdminRole}`,
3200
+ requestBody: {
3201
+ content: { 'application/json': { schema: unexpireExpeditionRequest() } },
3202
+ required: true,
3203
+ },
3204
+ responses: {
3205
+ ' 200': {
3206
+ description: 'Contains the updated expedition.',
3207
+ content: { 'application/json': { schema: updateExpeditionResponse() } },
3208
+ },
3209
+ ' 400': responses.badRequest,
3210
+ ' 401': responses.invalidUserInCookieOrHeader,
3211
+ ' 401 ': responses.invalidCookieOrHeader,
3212
+ ' 401 ': responses.missingCookieOrHeader,
3213
+ ' 401 ': responses.unauthorized,
3214
+ ' 403': responses.forbidden,
3215
+ ' 415': responses.unsupportedMediaType,
3216
+ ' 500': responses.internalServerError,
3217
+ ' 500 ': responses.expeditionDoesNotExist,
3218
+ ' 500 ': responses.expeditionCannotBeUpdated,
3219
+ },
3220
+ },
3221
+ },
3222
+ '/expeditions/updateDerivation': {
3223
+ post: {
3224
+ tags: ['Expeditions'],
3225
+ summary: '[S] Update derivation',
3226
+ description: `
3227
+ Updates the derivation price and settings of an expedition using the provided derivation settings.
3228
+
3229
+ If the expedition has not been received yet, the API will return a \`500 ExpeditionCannotBeUpdatedError\`.
3230
+
3231
+ ${securitySchemes.tokens}
3232
+ ${securitySchemes.superAdminRole}`,
3233
+ requestBody: {
3234
+ content: { 'application/json': { schema: updateExpeditionDerivationRequest() } },
3235
+ required: true,
3236
+ },
3237
+ responses: {
3238
+ ' 200': {
3239
+ description: 'Contains the updated expedition.',
3240
+ content: { 'application/json': { schema: updateExpeditionResponse() } },
3241
+ },
3242
+ ' 400': responses.badRequest,
3243
+ ' 401': responses.invalidUserInCookieOrHeader,
3244
+ ' 401 ': responses.invalidCookieOrHeader,
3245
+ ' 401 ': responses.missingCookieOrHeader,
3246
+ ' 401 ': responses.unauthorized,
3247
+ ' 403': responses.forbidden,
3248
+ ' 415': responses.unsupportedMediaType,
3249
+ ' 500': responses.internalServerError,
3250
+ ' 500 ': responses.expeditionDoesNotExist,
3251
+ ' 500 ': responses.expeditionCannotBeUpdated,
3252
+ },
3253
+ },
3254
+ },
3150
3255
  '/pods/find': {
3151
3256
  post: {
3152
3257
  tags: ['Pods'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "34.8.1",
3
+ "version": "34.9.1",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -1,6 +1,7 @@
1
1
  const {
2
2
  uuid,
3
3
  dateRange,
4
+ datetimeRange,
4
5
  address: genericAddress,
5
6
  objectWithUuid,
6
7
  email,
@@ -346,6 +347,18 @@ const findByDateRange = () => ({
346
347
  additionalProperties: false,
347
348
  });
348
349
 
350
+ const findByOptionalDateRange = () => ({
351
+ type: 'object',
352
+ properties: { dateRange: dateRange() },
353
+ additionalProperties: false,
354
+ });
355
+
356
+ const findByOptionalCreatedAtRange = () => ({
357
+ type: 'object',
358
+ properties: { createdAtRange: datetimeRange() },
359
+ additionalProperties: false,
360
+ });
361
+
349
362
  const timezone = () => ({ type: 'string', format: 'timezone' });
350
363
 
351
364
  const timezoneNames = () => ({ type: 'string', enum: timezones });
@@ -416,6 +429,8 @@ module.exports = {
416
429
  findByPolygonalArea,
417
430
  findByDate,
418
431
  findByDateRange,
432
+ findByOptionalDateRange,
433
+ findByOptionalCreatedAtRange,
419
434
  timezone,
420
435
  timezoneNames,
421
436
  objectWithUuidAndName,
@@ -17,7 +17,7 @@ const {
17
17
  mergeSchemas,
18
18
  pickProperties,
19
19
  } = require('@gls_spain/common-json-schemas');
20
- const { date, findById, findByIds } = require('./common');
20
+ const { date, findById, findByIds, findByOptionalDateRange } = require('./common');
21
21
  const { address } = require('./common');
22
22
  const { network, objectWithNetworkId } = require('./networks');
23
23
  const { shop, objectWithShopId } = require('./shops');
@@ -497,12 +497,12 @@ const findExpeditionsSuperAdminRequest = () =>
497
497
  findRequest({
498
498
  oneOf: [
499
499
  findById(),
500
- findByNetwork(),
501
- findByNetworkAndStatus(),
502
- findByNetworkAndNoShop(),
503
- findByNetworkAndNoShopAndStatus(),
504
- findByShop(),
505
- findByShopAndStatus(),
500
+ mergeSchemas(findByNetwork(), findByOptionalDateRange()),
501
+ mergeSchemas(findByNetworkAndStatus(), findByOptionalDateRange()),
502
+ mergeSchemas(findByNetworkAndNoShop(), findByOptionalDateRange()),
503
+ mergeSchemas(findByNetworkAndNoShopAndStatus(), findByOptionalDateRange()),
504
+ mergeSchemas(findByShop(), findByOptionalDateRange()),
505
+ mergeSchemas(findByShopAndStatus(), findByOptionalDateRange()),
506
506
  findByCode(),
507
507
  findBySale(),
508
508
  ],
@@ -510,18 +510,26 @@ const findExpeditionsSuperAdminRequest = () =>
510
510
 
511
511
  const findExpeditionsNetworkAdminRequest = () =>
512
512
  findRequest({
513
- oneOf: [findById(), findByShop(), findByShopAndStatus(), findByNoShop(), findByNoShopAndStatus(), findByCode(), findBySale()],
513
+ oneOf: [
514
+ findById(),
515
+ mergeSchemas(findByShop(), findByOptionalDateRange()),
516
+ mergeSchemas(findByShopAndStatus(), findByOptionalDateRange()),
517
+ mergeSchemas(findByNoShop(), findByOptionalDateRange()),
518
+ mergeSchemas(findByNoShopAndStatus(), findByOptionalDateRange()),
519
+ findByCode(),
520
+ findBySale(),
521
+ ],
514
522
  });
515
523
 
516
524
  const findExpeditionsShopUserRequest = () =>
517
525
  findRequest({
518
526
  oneOf: [
519
527
  findById(),
520
- findByShop(),
521
- findByShopAndStatus(),
522
- findByShopAndTypesAndStatus(),
523
- findByNoShop(),
524
- findByNoShopAndStatus(),
528
+ mergeSchemas(findByShop(), findByOptionalDateRange()),
529
+ mergeSchemas(findByShopAndStatus(), findByOptionalDateRange()),
530
+ mergeSchemas(findByShopAndTypesAndStatus(), findByOptionalDateRange()),
531
+ mergeSchemas(findByNoShop(), findByOptionalDateRange()),
532
+ mergeSchemas(findByNoShopAndStatus(), findByOptionalDateRange()),
525
533
  findByCode(),
526
534
  findBySale(),
527
535
  ],
@@ -784,6 +792,48 @@ const downloadExpeditionLabelResponse = () => ({
784
792
  additionalProperties: false,
785
793
  });
786
794
 
795
+ const expireExpeditionRequest = () => ({
796
+ type: 'object',
797
+ properties: {
798
+ expire: objectWithUuid(),
799
+ },
800
+ required: ['expire'],
801
+ additionalProperties: false,
802
+ });
803
+
804
+ const unexpireExpeditionRequest = () => ({
805
+ type: 'object',
806
+ properties: {
807
+ unexpire: objectWithUuid(),
808
+ },
809
+ required: ['unexpire'],
810
+ additionalProperties: false,
811
+ });
812
+
813
+ const updateExpeditionDerivationRequest = () => ({
814
+ type: 'object',
815
+ properties: {
816
+ find: objectWithUuid(),
817
+ set: {
818
+ type: 'object',
819
+ properties: {
820
+ derivation: {
821
+ type: 'object',
822
+ properties: {
823
+ settings: derivationSettings(),
824
+ },
825
+ required: ['settings'],
826
+ additionalProperties: false,
827
+ },
828
+ },
829
+ required: ['derivation'],
830
+ additionalProperties: false,
831
+ },
832
+ },
833
+ required: ['find', 'set'],
834
+ additionalProperties: false,
835
+ });
836
+
787
837
  module.exports = {
788
838
  processedWithDriver,
789
839
  processedWithCustomer,
@@ -811,4 +861,7 @@ module.exports = {
811
861
  receiveAllExpeditionsFromDriverResponse,
812
862
  downloadExpeditionLabelRequest,
813
863
  downloadExpeditionLabelResponse,
864
+ expireExpeditionRequest,
865
+ unexpireExpeditionRequest,
866
+ updateExpeditionDerivationRequest,
814
867
  };
@@ -14,7 +14,7 @@ const {
14
14
  pickProperties,
15
15
  objectWithUuid,
16
16
  } = require('@gls_spain/common-json-schemas');
17
- const { country, findAll, findById } = require('./common');
17
+ const { country, findAll, findById, findByOptionalCreatedAtRange } = require('./common');
18
18
  const { address } = require('./common');
19
19
  const { saleSize, salesSettings } = require('./defaults');
20
20
  const { network, objectWithNetworkId } = require('./networks');
@@ -154,11 +154,25 @@ const findByNetwork = () => mergeSchemas(objectWithNetworkId(), { title: 'find b
154
154
 
155
155
  const findByShop = () => mergeSchemas(objectWithShopId(), { title: 'find by shop' });
156
156
 
157
- const findSalesSuperAdminRequest = () => findRequest({ oneOf: [findByNetwork(), findByShop(), findById()] });
157
+ const findSalesSuperAdminRequest = () =>
158
+ findRequest({
159
+ oneOf: [
160
+ mergeSchemas(findByNetwork(), findByOptionalCreatedAtRange()),
161
+ mergeSchemas(findByShop(), findByOptionalCreatedAtRange()),
162
+ findById(),
163
+ ],
164
+ });
158
165
 
159
- const findSalesNetworkAdminRequest = () => findRequest({ oneOf: [findAll(), findByShop(), findById()] });
166
+ const findSalesNetworkAdminRequest = () =>
167
+ findRequest({
168
+ oneOf: [
169
+ mergeSchemas(findAll(), findByOptionalCreatedAtRange()),
170
+ mergeSchemas(findByShop(), findByOptionalCreatedAtRange()),
171
+ findById(),
172
+ ],
173
+ });
160
174
 
161
- const findSalesShopUserRequest = () => findRequest({ oneOf: [findAll(), findById()] });
175
+ const findSalesShopUserRequest = () => findRequest({ oneOf: [mergeSchemas(findAll(), findByOptionalCreatedAtRange()), findById()] });
162
176
 
163
177
  const findSalesResponse = () => findResponse(sale());
164
178
 
package/schemas/index.js CHANGED
@@ -77,6 +77,9 @@ const {
77
77
  receiveAllExpeditionsFromDriverResponse,
78
78
  downloadExpeditionLabelRequest,
79
79
  downloadExpeditionLabelResponse,
80
+ expireExpeditionRequest,
81
+ unexpireExpeditionRequest,
82
+ updateExpeditionDerivationRequest,
80
83
  } = require('./definitions/expeditions');
81
84
  const { findPodsRequest, findPodsResponse } = require('./definitions/pods');
82
85
  const {
@@ -214,6 +217,9 @@ const expeditionsReceiveAllFromDriverResponse = response(
214
217
  );
215
218
  const expeditionsDownloadLabelRequest = request(downloadExpeditionLabelRequest(), 'expeditionsDownloadLabelRequest');
216
219
  const expeditionsDownloadLabelResponse = response(downloadExpeditionLabelResponse(), 'expeditionsDownloadLabelResponse');
220
+ const expeditionsExpireRequest = request(expireExpeditionRequest(), 'expeditionsExpireRequest');
221
+ const expeditionsUnexpireRequest = request(unexpireExpeditionRequest(), 'expeditionsUnexpireRequest');
222
+ const expeditionsUpdateDerivationRequest = request(updateExpeditionDerivationRequest(), 'expeditionsUpdateDerivationRequest');
217
223
 
218
224
  const podsFindRequest = request(findPodsRequest(), 'podsFindRequest');
219
225
  const podsFindResponse = response(findPodsResponse(), 'podsFindResponse');
@@ -343,6 +349,9 @@ module.exports = {
343
349
  expeditionsReceiveAllFromDriverResponse,
344
350
  expeditionsDownloadLabelRequest,
345
351
  expeditionsDownloadLabelResponse,
352
+ expeditionsExpireRequest,
353
+ expeditionsUnexpireRequest,
354
+ expeditionsUpdateDerivationRequest,
346
355
 
347
356
  podsFindRequest,
348
357
  podsFindResponse,