@gls_spain/gps-common 34.8.1 → 34.9.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 +4 -2
- package/CHANGELOG.md +7 -0
- package/open-api-spec/index.js +105 -0
- package/package.json +1 -1
- package/schemas/definitions/common.js +7 -0
- package/schemas/definitions/expeditions.js +66 -13
- package/schemas/definitions/sales.js +10 -4
- package/schemas/index.js +9 -0
package/.idea/workspace.xml
CHANGED
|
@@ -3,6 +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/common.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/common.js" afterDir="false" />
|
|
6
7
|
<change beforePath="$PROJECT_DIR$/schemas/definitions/expeditions.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/expeditions.js" afterDir="false" />
|
|
7
8
|
<change beforePath="$PROJECT_DIR$/schemas/definitions/sales.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/sales.js" afterDir="false" />
|
|
8
9
|
<change beforePath="$PROJECT_DIR$/schemas/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/index.js" afterDir="false" />
|
|
@@ -125,9 +126,9 @@
|
|
|
125
126
|
</configuration>
|
|
126
127
|
<recent_temporary>
|
|
127
128
|
<list>
|
|
129
|
+
<item itemvalue="npm.test" />
|
|
128
130
|
<item itemvalue="npm.build-documentation" />
|
|
129
131
|
<item itemvalue="JavaScript Debug.documentation.html (1)" />
|
|
130
|
-
<item itemvalue="npm.test" />
|
|
131
132
|
<item itemvalue="npm.semantic-release" />
|
|
132
133
|
<item itemvalue="npm.commit" />
|
|
133
134
|
</list>
|
|
@@ -648,7 +649,8 @@
|
|
|
648
649
|
<workItem from="1607951320583" duration="589000" />
|
|
649
650
|
<workItem from="1610108917407" duration="2502000" />
|
|
650
651
|
<workItem from="1610134729440" duration="18000" />
|
|
651
|
-
<workItem from="1610542075615" duration="
|
|
652
|
+
<workItem from="1610542075615" duration="660000" />
|
|
653
|
+
<workItem from="1610988300441" duration="4154000" />
|
|
652
654
|
</task>
|
|
653
655
|
<servers />
|
|
654
656
|
</component>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [34.9.0](https://github.com/GLS-Spain/gps-common/compare/v34.8.1...v34.9.0) (2021-01-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add expire, unexpire, update derivation, add date range to find expeditions and sales ([8290523](https://github.com/GLS-Spain/gps-common/commit/8290523fe0fc0f366cf0a1299a3a2b3484f20d16))
|
|
7
|
+
|
|
1
8
|
## [34.8.1](https://github.com/GLS-Spain/gps-common/compare/v34.8.0...v34.8.1) (2021-01-13)
|
|
2
9
|
|
|
3
10
|
|
package/open-api-spec/index.js
CHANGED
|
@@ -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
|
@@ -346,6 +346,12 @@ const findByDateRange = () => ({
|
|
|
346
346
|
additionalProperties: false,
|
|
347
347
|
});
|
|
348
348
|
|
|
349
|
+
const findByOptionalDateRange = () => ({
|
|
350
|
+
type: 'object',
|
|
351
|
+
properties: { dateRange: dateRange() },
|
|
352
|
+
additionalProperties: false,
|
|
353
|
+
});
|
|
354
|
+
|
|
349
355
|
const timezone = () => ({ type: 'string', format: 'timezone' });
|
|
350
356
|
|
|
351
357
|
const timezoneNames = () => ({ type: 'string', enum: timezones });
|
|
@@ -416,6 +422,7 @@ module.exports = {
|
|
|
416
422
|
findByPolygonalArea,
|
|
417
423
|
findByDate,
|
|
418
424
|
findByDateRange,
|
|
425
|
+
findByOptionalDateRange,
|
|
419
426
|
timezone,
|
|
420
427
|
timezoneNames,
|
|
421
428
|
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: [
|
|
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, findByOptionalDateRange } = 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,17 @@ const findByNetwork = () => mergeSchemas(objectWithNetworkId(), { title: 'find b
|
|
|
154
154
|
|
|
155
155
|
const findByShop = () => mergeSchemas(objectWithShopId(), { title: 'find by shop' });
|
|
156
156
|
|
|
157
|
-
const findSalesSuperAdminRequest = () =>
|
|
157
|
+
const findSalesSuperAdminRequest = () =>
|
|
158
|
+
findRequest({
|
|
159
|
+
oneOf: [mergeSchemas(findByNetwork(), findByOptionalDateRange()), mergeSchemas(findByShop(), findByOptionalDateRange()), findById()],
|
|
160
|
+
});
|
|
158
161
|
|
|
159
|
-
const findSalesNetworkAdminRequest = () =>
|
|
162
|
+
const findSalesNetworkAdminRequest = () =>
|
|
163
|
+
findRequest({
|
|
164
|
+
oneOf: [mergeSchemas(findAll(), findByOptionalDateRange()), mergeSchemas(findByShop(), findByOptionalDateRange()), findById()],
|
|
165
|
+
});
|
|
160
166
|
|
|
161
|
-
const findSalesShopUserRequest = () => findRequest({ oneOf: [findAll(), findById()] });
|
|
167
|
+
const findSalesShopUserRequest = () => findRequest({ oneOf: [mergeSchemas(findAll(), findByOptionalDateRange()), findById()] });
|
|
162
168
|
|
|
163
169
|
const findSalesResponse = () => findResponse(sale());
|
|
164
170
|
|
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,
|