@gls_spain/gps-common 34.10.0 → 34.11.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.
package/CHANGELOG.md CHANGED
@@ -1,17 +1,31 @@
1
- # [34.10.0](https://github.com/GLS-Spain/gps-common/compare/v34.9.7...v34.10.0) (2021-04-29)
2
-
3
-
4
- ### Features
5
-
6
- * new property send to Gls Spain ([446980a](https://github.com/GLS-Spain/gps-common/commit/446980a054bb750cc05e76b7b8752b7d21d0d550))
7
-
8
- ## [34.9.7](https://github.com/GLS-Spain/gps-common/compare/v34.9.6...v34.9.7) (2021-03-18)
1
+ ## [34.11.1](https://github.com/GLS-Spain/gps-common/compare/v34.11.0...v34.11.1) (2021-05-17)
9
2
 
10
3
 
11
4
  ### Bug Fixes
12
5
 
13
- * update dependencias and generate documentation ([45ef47c](https://github.com/GLS-Spain/gps-common/commit/45ef47ca8bd0474576fcf6aab2b4ab0704c4dd48))
6
+ * problem to new endPoint ([2e46159](https://github.com/GLS-Spain/gps-common/commit/2e46159d6eeeb62eeaab0b7353dd75598e3295be))
14
7
 
8
+ # [34.11.0](https://github.com/GLS-Spain/gps-common/compare/v34.10.0...v34.11.0) (2021-05-10)
9
+
10
+
11
+ ### Features
12
+
13
+ * add new EndPoint /expeditions/reminder ([dd2bed6](https://github.com/GLS-Spain/gps-common/commit/dd2bed6a4c26a4991227043c5d40a52fa970ee88))
14
+
15
+ # [34.10.0](https://github.com/GLS-Spain/gps-common/compare/v34.9.7...v34.10.0) (2021-04-29)
16
+
17
+
18
+ ### Features
19
+
20
+ * new property send to Gls Spain ([446980a](https://github.com/GLS-Spain/gps-common/commit/446980a054bb750cc05e76b7b8752b7d21d0d550))
21
+
22
+ ## [34.9.7](https://github.com/GLS-Spain/gps-common/compare/v34.9.6...v34.9.7) (2021-03-18)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * update dependencias and generate documentation ([45ef47c](https://github.com/GLS-Spain/gps-common/commit/45ef47ca8bd0474576fcf6aab2b4ab0704c4dd48))
28
+
15
29
  ## [34.9.6](https://github.com/GLS-Spain/gps-common/compare/v34.9.5...v34.9.6) (2021-03-15)
16
30
 
17
31
 
@@ -132,6 +132,7 @@ const {
132
132
  expireExpeditionRequest,
133
133
  unexpireExpeditionRequest,
134
134
  updateExpeditionDerivationRequest,
135
+ reminderResponse
135
136
  } = require('../schemas/definitions/expeditions');
136
137
  const { defaults, getDefaultsResponse, updateDefaultsRequest, updateDefaultsResponse } = require('../schemas/definitions/defaults');
137
138
  const { counters, getCountersResponse } = require('../schemas/definitions/counters');
@@ -193,6 +194,8 @@ const {
193
194
  downloadSaleLabelResponse,
194
195
  } = require('../schemas/definitions/sales');
195
196
 
197
+ const { findParcelShopsRequest, findParcelShopsResponse } = require('../schemas/definitions/findParcelShops');
198
+
196
199
  const pkg = require('../package.json');
197
200
 
198
201
  const openApiSpec = { openapi: '3.0.2' };
@@ -263,6 +266,7 @@ openApiSpec['x-tagGroups'] = [
263
266
  'Integrations',
264
267
  'Callbacks',
265
268
  'Redirects',
269
+ 'ParcelShop'
266
270
  ],
267
271
  },
268
272
  ];
@@ -843,6 +847,12 @@ to report back information when they have it.
843
847
  name: 'Redirects',
844
848
  description: `
845
849
  This section contains endpoints that redirect to other URLs.
850
+ `,
851
+ },
852
+ {
853
+ name: 'ParcelShop',
854
+ description: `
855
+ This section contains endpoints get parcel shop to street.
846
856
  `,
847
857
  },
848
858
  ];
@@ -3254,6 +3264,41 @@ ${securitySchemes.superAdminRole}`,
3254
3264
  },
3255
3265
  },
3256
3266
  },
3267
+ '/expeditions/reminder/{shopId}': {
3268
+ get: {
3269
+ tags: ['Expeditions'],
3270
+ parameters: [
3271
+ {
3272
+ name: 'shopId',
3273
+ in: 'path',
3274
+ required: true,
3275
+ schema: { type: 'string' },
3276
+ description: `Shop Id to find expeditions reminder`,
3277
+ },
3278
+ ],
3279
+ summary: '[S] Reminder expiration',
3280
+ description: `
3281
+ Return reminder expiration from tody to -2 days.
3282
+
3283
+ ${securitySchemes.tokens}
3284
+
3285
+ ${securitySchemes.shopUserRole}
3286
+ `,
3287
+ responses: {
3288
+ '200': {
3289
+ description: 'Contains expeditions to reminder',
3290
+ content: { 'application/json': { schema: reminderResponse() } }
3291
+ },
3292
+ ' 400': responses.badRequest,
3293
+ ' 401': responses.invalidUserInCookieOrHeader,
3294
+ ' 401 ': responses.invalidCookieOrHeader,
3295
+ ' 401 ': responses.missingCookieOrHeader,
3296
+ ' 401 ': responses.unauthorized,
3297
+ ' 403': responses.forbidden,
3298
+ ' 500': responses.internalServerError,
3299
+ }
3300
+ }
3301
+ },
3257
3302
  '/pods/find': {
3258
3303
  post: {
3259
3304
  tags: ['Pods'],
@@ -3712,6 +3757,37 @@ The endpoint does not require any authorization, anyone who knows the \`shortId\
3712
3757
  },
3713
3758
  },
3714
3759
  },
3760
+ '/parcelShop/{street}/{limit}': {
3761
+ get: {
3762
+ tags: ['ParcelShop'],
3763
+ summary: 'Find parcel shop to street',
3764
+ description: ' Find parcel shop to street',
3765
+ parameters: [
3766
+ {
3767
+ name: 'street',
3768
+ in: 'path',
3769
+ required: true,
3770
+ schema: { type: 'string' },
3771
+ description: `Street to find`,
3772
+ },
3773
+ {
3774
+ name: 'limit',
3775
+ in: 'path',
3776
+ required: false,
3777
+ default: 10,
3778
+ schema: { type: 'string' },
3779
+ description: 'Limit to response'
3780
+ }
3781
+ ],
3782
+ responses: {
3783
+ '200': {
3784
+ description: 'Contains the Parcel Shops.',
3785
+ content: { 'application/json': { schema: findParcelShopsResponse() } },
3786
+ },
3787
+ '500': responses.internalServerError,
3788
+ }
3789
+ }
3790
+ }
3715
3791
  };
3716
3792
 
3717
3793
  module.exports = openApiSpec;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "34.10.0",
3
+ "version": "34.11.1",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "keywords": [
6
6
  "gls"
@@ -834,6 +834,25 @@ const updateExpeditionDerivationRequest = () => ({
834
834
  additionalProperties: false,
835
835
  });
836
836
 
837
+ const reminderResponse = () => ({
838
+ title: 'expeditions',
839
+ type: 'object',
840
+ properties:{
841
+ expeditions: {
842
+ type: 'array',
843
+ items: {
844
+ type: 'object',
845
+ properties: {
846
+ name: { type: 'string' },
847
+ address: { type: 'string' },
848
+ barcode: { type: 'integer' }
849
+ },
850
+ },
851
+ }
852
+ },
853
+ additionalProperties: false
854
+ });
855
+
837
856
  module.exports = {
838
857
  processedWithDriver,
839
858
  processedWithCustomer,
@@ -864,4 +883,5 @@ module.exports = {
864
883
  expireExpeditionRequest,
865
884
  unexpireExpeditionRequest,
866
885
  updateExpeditionDerivationRequest,
886
+ reminderResponse
867
887
  };
@@ -0,0 +1,120 @@
1
+ const { uuid, updateSelfRequest, pickProperties } = require('@gls_spain/common-json-schemas');
2
+
3
+ const findParcelShop = () => ({
4
+ title: 'findParcelShop',
5
+ type: 'object',
6
+ properties: {
7
+ street: { type: 'string' },
8
+ limit: { type: 'integer', minimum: 1, default: 10 }
9
+ },
10
+ required: ['street'],
11
+ additionalProperties: false,
12
+ });
13
+
14
+ const coordinates = () => ({
15
+ title: 'coordinates',
16
+ type: 'object',
17
+ properties: {
18
+ latitude: { type: 'number' },
19
+ longitude: { type: 'number' }
20
+ },
21
+ required: ['latitude', 'longitude'],
22
+ additionalProperties: false,
23
+ });
24
+
25
+ const address = () => ({
26
+ title: 'contact',
27
+ type: 'object',
28
+ properties: {
29
+ city: { type: 'string', trim: true },
30
+ postalCode: { type: 'integer' },
31
+ countryCode: { type: 'string', trim: true },
32
+ houseNumber: { type: 'integer' },
33
+ street: { type: 'string', trim: true },
34
+ description: { type: 'string', trim: true },
35
+ coordinates: coordinates()
36
+ },
37
+ required: ['name', 'email', 'phone'],
38
+ additionalProperties: false,
39
+ })
40
+
41
+ const hours = () => ({
42
+ title: 'hours',
43
+ type: 'object',
44
+ properties: {
45
+ openingTime: { type: 'string' },
46
+ closingTime: { type: 'string' }
47
+ }
48
+ });
49
+
50
+ const openingHours = () => ({
51
+ title: 'OpeningHours',
52
+ type: 'array',
53
+ items: {
54
+ title: 'openingHours',
55
+ type: 'object',
56
+ properties: {
57
+ weekday: { type: 'string', trim: true, enum: ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'] },
58
+ validForm: { type: 'string' },
59
+ hours: { type: 'array', items: hours(), minimum: 1, maximum: 2 }
60
+ }
61
+ }
62
+ });
63
+
64
+ const category = () => ({
65
+ title: 'Category',
66
+ type: 'object',
67
+ properties: {
68
+ name: { type: 'string', enum: ['businees', 'agency'] }
69
+ }
70
+ });
71
+
72
+ const phone = () => ({
73
+ title: 'phone',
74
+ type: 'object',
75
+ properties: {
76
+ countryPrefix: { type: 'string' },
77
+ number: { type: 'string' }
78
+ }
79
+ });
80
+
81
+ const parcelShops = () => ({
82
+ title: 'shops',
83
+ type: 'object',
84
+ properties: {
85
+ id: uuid(),
86
+ name: { type: 'string' },
87
+ address: address(),
88
+ openingHours: openingHours(),
89
+ distance: { type: 'number' },
90
+ category: category(),
91
+ phone: phone(),
92
+ email: { type: 'string'},
93
+ activity: { type: 'string' },
94
+ service: { type: 'string' }
95
+ },
96
+ required: ['id', 'name', 'address', 'openingHours', 'distance', 'category', 'phone', 'email', 'activity', 'service'],
97
+ additionalProperties: false,
98
+ });
99
+
100
+ const findParcelShopsRequest = () => {
101
+ updateSelfRequest({
102
+ type: 'object',
103
+ properties: { ...pickProperties(findParcelShop) },
104
+ additionalProperties: false,
105
+ });
106
+ };
107
+
108
+ const findParcelShopsResponse = () => ({
109
+ type: 'object',
110
+ properties: {
111
+ shops: parcelShops(),
112
+ },
113
+ required: ['shops'],
114
+ additionalProperties: false,
115
+ });
116
+
117
+ module.exports = {
118
+ findParcelShopsRequest,
119
+ findParcelShopsResponse
120
+ }
package/schemas/index.js CHANGED
@@ -80,6 +80,7 @@ const {
80
80
  expireExpeditionRequest,
81
81
  unexpireExpeditionRequest,
82
82
  updateExpeditionDerivationRequest,
83
+ reminderResponse
83
84
  } = require('./definitions/expeditions');
84
85
  const { findPodsRequest, findPodsResponse } = require('./definitions/pods');
85
86
  const {
@@ -124,6 +125,8 @@ const {
124
125
  downloadSaleLabelResponse,
125
126
  } = require('./definitions/sales');
126
127
 
128
+ const { findParcelShopsRequest, findParcelShopsResponse } = require('./definitions/findParcelShops')
129
+
127
130
  function request(schema, $id) {
128
131
  return addMetadata(schema, $id);
129
132
  }
@@ -220,6 +223,7 @@ const expeditionsDownloadLabelResponse = response(downloadExpeditionLabelRespons
220
223
  const expeditionsExpireRequest = request(expireExpeditionRequest(), 'expeditionsExpireRequest');
221
224
  const expeditionsUnexpireRequest = request(unexpireExpeditionRequest(), 'expeditionsUnexpireRequest');
222
225
  const expeditionsUpdateDerivationRequest = request(updateExpeditionDerivationRequest(), 'expeditionsUpdateDerivationRequest');
226
+ const expeditionsReminderRequest = request(reminderResponse(), 'expeditionsReminderRequest');
223
227
 
224
228
  const podsFindRequest = request(findPodsRequest(), 'podsFindRequest');
225
229
  const podsFindResponse = response(findPodsResponse(), 'podsFindResponse');
@@ -266,6 +270,9 @@ const salesUpdateResponse = response(updateSaleResponse(), 'salesUpdateResponse'
266
270
  const salesDownloadLabelRequest = request(downloadSaleLabelRequest(), 'salesDownloadLabelRequest');
267
271
  const salesDownloadLabelResponse = request(downloadSaleLabelResponse(), 'salesDownloadLabelResponse');
268
272
 
273
+ const parcelShopsRequest = request(findParcelShopsRequest(), 'parcelShopsRequest');
274
+ const parcelShopsResponse = request(findParcelShopsResponse(), 'parcelShopsResponse');
275
+
269
276
  module.exports = {
270
277
  errorResponse,
271
278
 
@@ -352,6 +359,7 @@ module.exports = {
352
359
  expeditionsExpireRequest,
353
360
  expeditionsUnexpireRequest,
354
361
  expeditionsUpdateDerivationRequest,
362
+ expeditionsReminderRequest,
355
363
 
356
364
  podsFindRequest,
357
365
  podsFindResponse,
@@ -397,4 +405,7 @@ module.exports = {
397
405
  salesUpdateResponse,
398
406
  salesDownloadLabelRequest,
399
407
  salesDownloadLabelResponse,
408
+
409
+ parcelShopsRequest,
410
+ parcelShopsResponse
400
411
  };