@gls_spain/gps-common 35.19.4 → 35.20.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/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/schemas/definitions/networks.js +29 -3
- package/schemas/definitions/shops.js +74 -35
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [35.20.0](https://github.com/GLS-Spain/gps-common/compare/v35.19.4...v35.20.0) (2026-10-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* network & shops updated schemas ([73ecb9e](https://github.com/GLS-Spain/gps-common/commit/73ecb9ed5c6c998a93763599507db3368beb68a8))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* shop.channeling ([f15c86b](https://github.com/GLS-Spain/gps-common/commit/f15c86b6c8c8c7685cbc0898ce8d48105ec1c034))
|
|
12
|
+
|
|
1
13
|
## [35.19.4](https://github.com/GLS-Spain/gps-common/compare/v35.19.3...v35.19.4) (2026-10-19)
|
|
2
14
|
|
|
3
15
|
|
package/package.json
CHANGED
|
@@ -15,6 +15,10 @@ const {
|
|
|
15
15
|
const { findAll, findById, findByName, objectWithUuidAndName, contact, fiscal, networkType } = require('./common');
|
|
16
16
|
const { defaults, derivationSettings, expirationSettings } = require('./defaults');
|
|
17
17
|
|
|
18
|
+
function parseAddressType() {
|
|
19
|
+
return ['auto'];
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
const network = () => ({
|
|
19
23
|
title: 'network',
|
|
20
24
|
type: 'object',
|
|
@@ -47,9 +51,31 @@ const network = () => ({
|
|
|
47
51
|
required: ['networkPercentage', 'shopPercentage'],
|
|
48
52
|
additionalProperties: false,
|
|
49
53
|
},
|
|
50
|
-
type: networkType()
|
|
54
|
+
type: networkType(),
|
|
55
|
+
isActive: { type: 'boolean' },
|
|
56
|
+
searchName: { type: 'string' },
|
|
57
|
+
canUpdate: { type: 'boolean' },
|
|
58
|
+
// country: countryCode(),
|
|
59
|
+
country: { type: 'string' },
|
|
60
|
+
isInternational: { type: 'boolean' },
|
|
61
|
+
mandatoryShopFiscalData: { type: 'boolean' },
|
|
62
|
+
calcChanneling: { type: 'boolean' },
|
|
63
|
+
parseAddress: { type: 'string', enum: parseAddressType() },
|
|
51
64
|
},
|
|
52
|
-
required: [
|
|
65
|
+
required: [
|
|
66
|
+
'_id',
|
|
67
|
+
'createdAt',
|
|
68
|
+
'updatedAt',
|
|
69
|
+
'deletable',
|
|
70
|
+
'readonly',
|
|
71
|
+
'defaults',
|
|
72
|
+
'name',
|
|
73
|
+
'contacts',
|
|
74
|
+
'salesSettings',
|
|
75
|
+
'type',
|
|
76
|
+
'isActive',
|
|
77
|
+
'searchName',
|
|
78
|
+
],
|
|
53
79
|
additionalProperties: false,
|
|
54
80
|
});
|
|
55
81
|
|
|
@@ -74,7 +100,7 @@ const createNetworkRequest = () =>
|
|
|
74
100
|
'derivationSettings',
|
|
75
101
|
'expirationSettings',
|
|
76
102
|
'salesSettings',
|
|
77
|
-
'type'
|
|
103
|
+
'type',
|
|
78
104
|
]),
|
|
79
105
|
},
|
|
80
106
|
required: ['name', 'salesSettings'],
|
|
@@ -19,7 +19,7 @@ const {
|
|
|
19
19
|
addressWithRequiredLocation,
|
|
20
20
|
findAll,
|
|
21
21
|
findById,
|
|
22
|
-
findByStringId,
|
|
22
|
+
findByStringId, // _id string numérico — usado en updateLockerRequest
|
|
23
23
|
findByName,
|
|
24
24
|
findByAddress,
|
|
25
25
|
findByCircularArea,
|
|
@@ -27,8 +27,8 @@ const {
|
|
|
27
27
|
timezone,
|
|
28
28
|
contact,
|
|
29
29
|
fiscal,
|
|
30
|
-
lockerAddress,
|
|
31
|
-
lockerFiscal,
|
|
30
|
+
lockerAddress, // address con maxLength de BD + campo access_descript_locker
|
|
31
|
+
lockerFiscal, // fiscal con required mínimo y maxLength de BD
|
|
32
32
|
findByFiscal,
|
|
33
33
|
findByIdInternational,
|
|
34
34
|
} = require('./common');
|
|
@@ -58,7 +58,7 @@ const shopSchedule = () => ({
|
|
|
58
58
|
saturday: shopDaySchedule(),
|
|
59
59
|
sunday: shopDaySchedule(),
|
|
60
60
|
},
|
|
61
|
-
required: ['type', 'weekly']
|
|
61
|
+
required: ['type', 'weekly'], // saturday and sunday are optional
|
|
62
62
|
additionalProperties: false,
|
|
63
63
|
},
|
|
64
64
|
{
|
|
@@ -95,7 +95,6 @@ const shopHoliday = () => ({
|
|
|
95
95
|
additionalProperties: false,
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
-
|
|
99
98
|
const shopRepresentative = () => ({
|
|
100
99
|
type: 'object',
|
|
101
100
|
properties: {
|
|
@@ -150,6 +149,40 @@ const shopActivity = () => ({
|
|
|
150
149
|
],
|
|
151
150
|
});
|
|
152
151
|
|
|
152
|
+
function channelingType() {
|
|
153
|
+
return ['postalCode', 'parcelShop'];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function shopChanneling() {
|
|
157
|
+
return {
|
|
158
|
+
type: 'object',
|
|
159
|
+
properties: {
|
|
160
|
+
at: { type: 'string', format: 'date-time' },
|
|
161
|
+
type: { type: 'string', enum: channelingType() },
|
|
162
|
+
agency: {
|
|
163
|
+
type: 'object',
|
|
164
|
+
properties: {
|
|
165
|
+
code: { type: 'integer' },
|
|
166
|
+
name: { type: 'string' },
|
|
167
|
+
nxt: {
|
|
168
|
+
description:'nxt data',
|
|
169
|
+
type: 'object',
|
|
170
|
+
properties: {
|
|
171
|
+
uid: { type: 'string' },
|
|
172
|
+
},
|
|
173
|
+
required: ['uid'],
|
|
174
|
+
additionalProperties: false,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
required: ['code', 'name'],
|
|
178
|
+
additionalProperties: false,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
required: ['at'],
|
|
182
|
+
additionalProperties: false,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
153
186
|
const shop = () => ({
|
|
154
187
|
title: 'shop',
|
|
155
188
|
type: 'object',
|
|
@@ -260,6 +293,8 @@ const shop = () => ({
|
|
|
260
293
|
required: ['code', 'updatedAt'],
|
|
261
294
|
additionalProperties: false,
|
|
262
295
|
},
|
|
296
|
+
// 2026-10-15 JL cálculo de canalización
|
|
297
|
+
shopChanneling: shopChanneling(),
|
|
263
298
|
},
|
|
264
299
|
required: [
|
|
265
300
|
'_id',
|
|
@@ -336,7 +371,7 @@ const createShopRequest = () =>
|
|
|
336
371
|
'clientCode',
|
|
337
372
|
'channelingAgencyCode',
|
|
338
373
|
]),
|
|
339
|
-
}
|
|
374
|
+
}, // Shop
|
|
340
375
|
required: ['network', 'status', 'name', 'address', 'openingSchedule', 'timezone'],
|
|
341
376
|
additionalProperties: false,
|
|
342
377
|
});
|
|
@@ -592,9 +627,9 @@ const locker = () => ({
|
|
|
592
627
|
|
|
593
628
|
// reutilizamos openingSchedule, timezone, activity y eco de shop()
|
|
594
629
|
openingSchedule: shop().properties.openingSchedule,
|
|
595
|
-
timezone:
|
|
596
|
-
activity:
|
|
597
|
-
eco:
|
|
630
|
+
timezone: shop().properties.timezone,
|
|
631
|
+
activity: shop().properties.activity,
|
|
632
|
+
eco: shop().properties.eco,
|
|
598
633
|
|
|
599
634
|
// fiscal con required mínimo y maxLength de BD — ver common.js
|
|
600
635
|
fiscal: lockerFiscal(),
|
|
@@ -610,17 +645,21 @@ const locker = () => ({
|
|
|
610
645
|
|
|
611
646
|
// ── Campos _locker — fuente de verdad para coordenadas y dirección ───────
|
|
612
647
|
direccion_locker: { type: 'string', trim: true, maxLength: 255 }, // varchar(255)
|
|
613
|
-
codpostal_locker: { type: 'string', trim: true, maxLength: 15 },
|
|
614
|
-
ciudad_locker:
|
|
648
|
+
codpostal_locker: { type: 'string', trim: true, maxLength: 15 }, // varchar(15)
|
|
649
|
+
ciudad_locker: { type: 'string', trim: true, maxLength: 100 }, // varchar(100)
|
|
615
650
|
longitud_locker: {
|
|
616
|
-
type: 'number',
|
|
651
|
+
type: 'number',
|
|
652
|
+
minimum: -180,
|
|
653
|
+
maximum: 180,
|
|
617
654
|
description: 'Fuente de verdad para longitude — sobreescribe address.location.geometry.coordinates[0]',
|
|
618
655
|
},
|
|
619
656
|
latitud_locker: {
|
|
620
|
-
type: 'number',
|
|
657
|
+
type: 'number',
|
|
658
|
+
minimum: -90,
|
|
659
|
+
maximum: 90,
|
|
621
660
|
description: 'Fuente de verdad para latitude — sobreescribe address.location.geometry.coordinates[1]',
|
|
622
661
|
},
|
|
623
|
-
capacity_locker:
|
|
662
|
+
capacity_locker: { type: 'string', maxLength: 20 },
|
|
624
663
|
access_descript_locker: { type: 'string', trim: true, maxLength: 500 },
|
|
625
664
|
},
|
|
626
665
|
required: [
|
|
@@ -648,9 +687,9 @@ const lockerNxt = () => ({
|
|
|
648
687
|
provider: {
|
|
649
688
|
type: 'object',
|
|
650
689
|
properties: {
|
|
651
|
-
name:
|
|
690
|
+
name: { type: 'string', trim: true, maxLength: 100 }, // PartnerKey varchar(100)
|
|
652
691
|
lockerVersion: { type: 'string', trim: true, maxLength: 20 },
|
|
653
|
-
lockerModel:
|
|
692
|
+
lockerModel: { type: 'string', trim: true, maxLength: 100 },
|
|
654
693
|
},
|
|
655
694
|
required: ['name'],
|
|
656
695
|
additionalProperties: false,
|
|
@@ -659,12 +698,12 @@ const lockerNxt = () => ({
|
|
|
659
698
|
type: 'object',
|
|
660
699
|
properties: {
|
|
661
700
|
streetNumber: { type: 'string', trim: true, maxLength: 20 },
|
|
662
|
-
street:
|
|
663
|
-
postalCode:
|
|
664
|
-
lon:
|
|
665
|
-
lat:
|
|
666
|
-
countryCode:
|
|
667
|
-
city:
|
|
701
|
+
street: { type: 'string', trim: true, maxLength: 255 }, // varchar(255)
|
|
702
|
+
postalCode: { type: 'string', trim: true, maxLength: 15 }, // varchar(15)
|
|
703
|
+
lon: { type: 'number', minimum: -180, maximum: 180 }, // float BD
|
|
704
|
+
lat: { type: 'number', minimum: -90, maximum: 90 },
|
|
705
|
+
countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 }, // ISO 3166-1 alpha-2
|
|
706
|
+
city: { type: 'string', trim: true, maxLength: 100 }, // varchar(100)
|
|
668
707
|
},
|
|
669
708
|
required: ['street', 'postalCode', 'countryCode', 'city'],
|
|
670
709
|
additionalProperties: false,
|
|
@@ -672,8 +711,8 @@ const lockerNxt = () => ({
|
|
|
672
711
|
features: {
|
|
673
712
|
type: 'object',
|
|
674
713
|
properties: {
|
|
675
|
-
hasScreen:
|
|
676
|
-
hasPinPad:
|
|
714
|
+
hasScreen: { type: 'boolean' },
|
|
715
|
+
hasPinPad: { type: 'boolean' },
|
|
677
716
|
hasPinBarcodeReader: { type: 'boolean' },
|
|
678
717
|
},
|
|
679
718
|
additionalProperties: false,
|
|
@@ -681,9 +720,9 @@ const lockerNxt = () => ({
|
|
|
681
720
|
carrier: {
|
|
682
721
|
type: 'object',
|
|
683
722
|
properties: {
|
|
684
|
-
lockerName:
|
|
723
|
+
lockerName: { type: 'string', trim: true, maxLength: 100 }, // Nombre varchar(100)
|
|
685
724
|
activationDate: { type: 'string', format: 'date-time' },
|
|
686
|
-
lockerId:
|
|
725
|
+
lockerId: { type: 'string', maxLength: 36 }, // UUID = 36 chars
|
|
687
726
|
},
|
|
688
727
|
required: ['lockerName'],
|
|
689
728
|
additionalProperties: false,
|
|
@@ -724,9 +763,9 @@ const createLockerRequest = () =>
|
|
|
724
763
|
...pickProperties(locker(), ['_id', 'createdAt']),
|
|
725
764
|
// relaciones como objectWithUuid
|
|
726
765
|
network: objectWithUuid(),
|
|
727
|
-
zone:
|
|
766
|
+
zone: objectWithUuid(),
|
|
728
767
|
// representantes en formato "set" (solo _id + since, sin name)
|
|
729
|
-
openingRepresentative:
|
|
768
|
+
openingRepresentative: setShopRepresentative(),
|
|
730
769
|
managingRepresentative: setShopRepresentative(),
|
|
731
770
|
// resto de campos tomados directamente del schema base locker()
|
|
732
771
|
...pickProperties(locker(), [
|
|
@@ -788,11 +827,11 @@ const updateLockerRequest = () =>
|
|
|
788
827
|
type: 'object',
|
|
789
828
|
properties: {
|
|
790
829
|
// relaciones y representantes con helpers reutilizados de shop
|
|
791
|
-
network:
|
|
792
|
-
zone:
|
|
793
|
-
openingRepresentative:
|
|
830
|
+
network: schemaOrNull(objectWithUuid()),
|
|
831
|
+
zone: schemaOrNull(objectWithUuid()),
|
|
832
|
+
openingRepresentative: schemaOrNull(setShopRepresentative()),
|
|
794
833
|
managingRepresentative: schemaOrNull(setShopRepresentative()),
|
|
795
|
-
status:
|
|
834
|
+
status: setShopStatus(),
|
|
796
835
|
|
|
797
836
|
// campos actualizables del schema base locker() — todos con schemaOrNull
|
|
798
837
|
...Object.fromEntries(
|
|
@@ -813,8 +852,8 @@ const updateLockerRequest = () =>
|
|
|
813
852
|
'latitud_locker',
|
|
814
853
|
'capacity_locker',
|
|
815
854
|
'access_descript_locker',
|
|
816
|
-
])
|
|
817
|
-
).map(([key, schema]) => [key, schemaOrNull(schema)])
|
|
855
|
+
]),
|
|
856
|
+
).map(([key, schema]) => [key, schemaOrNull(schema)]),
|
|
818
857
|
),
|
|
819
858
|
|
|
820
859
|
// capabilities: array, no nullable — va sin schemaOrNull
|
|
@@ -855,4 +894,4 @@ module.exports = {
|
|
|
855
894
|
createLockerResponse,
|
|
856
895
|
updateLockerRequest,
|
|
857
896
|
updateLockerResponse,
|
|
858
|
-
};
|
|
897
|
+
};
|