@gls_spain/gps-common 35.15.8 → 35.16.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.
@@ -0,0 +1,44 @@
1
+ name: Claude Code Review
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened]
6
+ # Optional: Only run on specific file changes
7
+ # paths:
8
+ # - "src/**/*.ts"
9
+ # - "src/**/*.tsx"
10
+ # - "src/**/*.js"
11
+ # - "src/**/*.jsx"
12
+
13
+ jobs:
14
+ claude-review:
15
+ # Optional: Filter by PR author
16
+ # if: |
17
+ # github.event.pull_request.user.login == 'external-contributor' ||
18
+ # github.event.pull_request.user.login == 'new-developer' ||
19
+ # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20
+
21
+ runs-on: ubuntu-latest
22
+ permissions:
23
+ contents: read
24
+ pull-requests: read
25
+ issues: read
26
+ id-token: write
27
+
28
+ steps:
29
+ - name: Checkout repository
30
+ uses: actions/checkout@v4
31
+ with:
32
+ fetch-depth: 1
33
+
34
+ - name: Run Claude Code Review
35
+ id: claude-review
36
+ uses: anthropics/claude-code-action@v1
37
+ with:
38
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39
+ plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
40
+ plugins: 'code-review@claude-code-plugins'
41
+ prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
42
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
43
+ # or https://code.claude.com/docs/en/cli-reference for available options
44
+
@@ -0,0 +1,50 @@
1
+ name: Claude Code
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+ issues:
9
+ types: [opened, assigned]
10
+ pull_request_review:
11
+ types: [submitted]
12
+
13
+ jobs:
14
+ claude:
15
+ if: |
16
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: read
23
+ pull-requests: read
24
+ issues: read
25
+ id-token: write
26
+ actions: read # Required for Claude to read CI results on PRs
27
+ steps:
28
+ - name: Checkout repository
29
+ uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 1
32
+
33
+ - name: Run Claude Code
34
+ id: claude
35
+ uses: anthropics/claude-code-action@v1
36
+ with:
37
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38
+
39
+ # This is an optional setting that allows Claude to read CI results on PRs
40
+ additional_permissions: |
41
+ actions: read
42
+
43
+ # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44
+ # prompt: 'Update the pull request description to include a summary of changes.'
45
+
46
+ # Optional: Add claude_args to customize behavior and configuration
47
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48
+ # or https://code.claude.com/docs/en/cli-reference for available options
49
+ # claude_args: '--allowed-tools Bash(gh pr:*)'
50
+
package/CHANGELOG.md CHANGED
@@ -1,10 +1,32 @@
1
- ## [35.15.8](https://github.com/GLS-Spain/gps-common/compare/v35.15.7...v35.15.8) (2026-03-10)
1
+ # [35.16.0](https://github.com/GLS-Spain/gps-common/compare/v35.15.10...v35.16.0) (2026-04-10)
2
2
 
3
3
 
4
- ### Bug Fixes
4
+ ### Features
5
5
 
6
- * fix door property ([8980881](https://github.com/GLS-Spain/gps-common/commit/8980881dc14fdedad49a7179af810ab0bac36b55))
6
+ * add optional per-service rates (delivery, pickup, s2s) to derivationRate ([1e8af9c](https://github.com/GLS-Spain/gps-common/commit/1e8af9c1ec10f21b79a30513b9d15de3cc0d8910))
7
7
 
8
+ ## [35.15.10](https://github.com/GLS-Spain/gps-common/compare/v35.15.9...v35.15.10) (2026-03-13)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add update lockers schema ([2ba0fc6](https://github.com/GLS-Spain/gps-common/commit/2ba0fc6ca3228651c08640499bfe81263b1589f0))
14
+ * fix add imports ([95439f4](https://github.com/GLS-Spain/gps-common/commit/95439f48fdcdd71495959d9f48ed811cc11eafe1))
15
+
16
+ ## [35.15.9](https://github.com/GLS-Spain/gps-common/compare/v35.15.8...v35.15.9) (2026-03-11)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * add varchar validation SQL apolo in lockers schema ([3ff50e2](https://github.com/GLS-Spain/gps-common/commit/3ff50e28f5347333cfbc801dfdf363cb6f2d2921))
22
+
23
+ ## [35.15.8](https://github.com/GLS-Spain/gps-common/compare/v35.15.7...v35.15.8) (2026-03-10)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * fix door property ([8980881](https://github.com/GLS-Spain/gps-common/commit/8980881dc14fdedad49a7179af810ab0bac36b55))
29
+
8
30
  ## [35.15.7](https://github.com/GLS-Spain/gps-common/compare/v35.15.6...v35.15.7) (2026-03-10)
9
31
 
10
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "35.15.8",
3
+ "version": "35.16.0",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "keywords": [
6
6
  "gls"
@@ -1,8 +1,10 @@
1
1
  const { uuid, datetime, money, updateSelfRequest, updateResponse, pickProperties } = require('@gls_spain/common-json-schemas');
2
2
  const { country } = require('./common');
3
3
 
4
- const derivationRate = () => ({
5
- title: 'derivation rate',
4
+ // Extraigo los objetos de tarifa (serviceRate, derivationRate) para poder usarlos también en las tarifas de shop y network,
5
+ // que ahora pueden tener tarifas distintas por servicio (delivery, pickup, s2s)
6
+ const serviceRate = () => ({
7
+ title: 'service rate',
6
8
  type: 'object',
7
9
  properties: {
8
10
  constant: { ...money(), description: 'fixed amount paid in cents, per package' },
@@ -15,6 +17,25 @@ const derivationRate = () => ({
15
17
  description: 'pricePerPackage = constant + max(0, weight - variableStart) * variable',
16
18
  });
17
19
 
20
+ // La tarifa de derivación es un objeto que contiene las tarifas por servicio (delivery, pickup, s2s) tanto para shop como para network,
21
+ // y mantiene los campos legacy (constant, variableStart, variable) para compatibilidad con los datos existentes, aunque ya no se usen en el cálculo de la tarifa de derivación.
22
+ const derivationRate = () => ({
23
+ title: 'derivation rate',
24
+ type: 'object',
25
+ properties: {
26
+ constant: { ...money(), description: 'fixed amount paid in cents, per package' },
27
+ constantShopReturn: { ...money(), description: 'fixed amount paid in cents, per package' },
28
+ variableStart: { type: 'number', description: 'weight threshold in kg to start paying the variable, per package' },
29
+ variable: { ...money(), description: 'amount paid in cents for each additional kg beyond the weight threshold, per package' },
30
+ delivery: serviceRate(), // tarifa específica para el servicio de delivery
31
+ pickup: serviceRate(), // tarifa específica para el servicio de pickup
32
+ s2s: serviceRate(), // tarifa específica para el servicio de s2s
33
+ },
34
+ required: ['delivery', 'pickup', 's2s'],
35
+ additionalProperties: false,
36
+ description: 'Per-service rates: delivery, pickup, s2s. Legacy base fields (constant, variableStart, variable) are optional for backward compatibility with existing data.',
37
+ });
38
+
18
39
  const derivationSettings = () => ({
19
40
  title: 'derivation settings',
20
41
  type: 'object',
@@ -755,17 +755,23 @@ const createLockerRequest = () =>
755
755
  additionalProperties: false,
756
756
  },
757
757
 
758
- name: { type: 'string', trim: true },
758
+ // ✅ maxLength alineado con Nombre varchar(100)
759
+ name: { type: 'string', trim: true, maxLength: 100 },
759
760
 
760
761
  address: {
761
762
  type: 'object',
762
763
  properties: {
763
- street: { type: 'string', trim: true },
764
- door: { type: 'string', trim: true },
765
- postalCode: { type: 'string', trim: true },
766
- locality: { type: 'string', trim: true },
767
- country: { type: 'string', trim: true },
768
- access_descript_locker: { type: 'string', trim: true },
764
+ // ✅ Calle varchar(255)
765
+ street: { type: 'string', trim: true, maxLength: 255 },
766
+ // ✅ sin límite estricto en BD pero razonable
767
+ door: { type: 'string', trim: true, maxLength: 20 },
768
+ // ✅ cp varchar(15)
769
+ postalCode: { type: 'string', trim: true, maxLength: 15 },
770
+ // ✅ Poblacion varchar(100)
771
+ locality: { type: 'string', trim: true, maxLength: 100 },
772
+ // ✅ código país ISO 3166-1 alpha-2/3
773
+ country: { type: 'string', trim: true, maxLength: 3 },
774
+ access_descript_locker: { type: 'string', trim: true, maxLength: 500 },
769
775
  location: {
770
776
  type: 'object',
771
777
  properties: {
@@ -797,27 +803,33 @@ const createLockerRequest = () =>
797
803
  timezone: shop().properties.timezone,
798
804
  activity: shop().properties.activity,
799
805
  eco: shop().properties.eco,
806
+
800
807
  fiscal: {
801
808
  type: 'object',
802
809
  properties: {
803
- iban: { type: 'string', trim: true },
804
- businessName: { type: 'string', trim: true },
805
- nif: { type: 'string', trim: true },
810
+ // ✅ IBAN estándar máximo 34 caracteres
811
+ iban: { type: 'string', trim: true, maxLength: 34 },
812
+ // ✅ nombreComercial nvarchar(100)
813
+ businessName: { type: 'string', trim: true, maxLength: 100 },
814
+ // ✅ NIF/CIF español máximo 9 chars, margen para internacionales
815
+ nif: { type: 'string', trim: true, maxLength: 20 },
806
816
  contacts: { type: 'array', items: contact() },
807
817
  address: {
808
818
  type: 'object',
809
819
  properties: {
810
- street: { type: 'string', trim: true },
811
- door: { type: 'string', trim: true },
812
- postalCode: { type: 'string', trim: true },
813
- locality: { type: 'string', trim: true },
814
- country: { type: 'string', trim: true },
820
+ street: { type: 'string', trim: true, maxLength: 255 },
821
+ door: { type: 'string', trim: true, maxLength: 20 },
822
+ postalCode: { type: 'string', trim: true, maxLength: 15 },
823
+ locality: { type: 'string', trim: true, maxLength: 100 },
824
+ // ✅ añadido country que faltaba y causaba el 400
825
+ country: { type: 'string', trim: true, maxLength: 3 },
815
826
  },
816
827
  required: ['street', 'postalCode', 'locality', 'country'],
817
828
  additionalProperties: false,
818
829
  },
819
- paymentMethod: { type: 'string', trim: true },
830
+ paymentMethod: { type: 'string', trim: true, maxLength: 50 },
820
831
  dueDays: { type: 'integer', minimum: 0 },
832
+ // ✅ activity varchar(250) en BD relacional
821
833
  activity: { type: 'string', trim: true, maxLength: 50 },
822
834
  retention: { type: 'integer' },
823
835
  },
@@ -828,21 +840,36 @@ const createLockerRequest = () =>
828
840
  nxt: {
829
841
  type: 'object',
830
842
  properties: {
831
- parcelShopId: { type: 'string' },
843
+ // ✅ ParcelShopId varchar(100)
844
+ parcelShopId: { type: 'string', maxLength: 100 },
832
845
  },
833
846
  required: ['parcelShopId'],
834
847
  additionalProperties: false,
835
848
  },
836
849
 
837
- // Campos _locker: fuente de verdad para coordenadas y dirección
838
- direccion_locker: { type: 'string', trim: true },
839
- codpostal_locker: { type: 'string', trim: true },
840
- ciudad_locker: { type: 'string', trim: true },
841
- // ✅ longitud_locker y latitud_locker son la fuente de verdad de coordenadas
842
- longitud_locker: { type: 'number', description: 'Fuente de verdad para longitude — sobreescribe address.location.geometry.coordinates[0]' },
843
- latitud_locker: { type: 'number', description: 'Fuente de verdad para latitude — sobreescribe address.location.geometry.coordinates[1]' },
844
- capacity_locker: { type: 'string' },
845
- access_descript_locker: { type: 'string', trim: true },
850
+ // ✅ Campos _locker con límites alineados a BD
851
+ // Calle varchar(255)
852
+ direccion_locker: { type: 'string', trim: true, maxLength: 255 },
853
+ // cp varchar(15)
854
+ codpostal_locker: { type: 'string', trim: true, maxLength: 15 },
855
+ // Poblacion varchar(100)
856
+ ciudad_locker: { type: 'string', trim: true, maxLength: 100 },
857
+ // ✅ lat/lng float en BD — rango geográfico válido
858
+ longitud_locker: {
859
+ type: 'number',
860
+ minimum: -180,
861
+ maximum: 180,
862
+ description: 'Fuente de verdad para longitude — sobreescribe address.location.geometry.coordinates[0]',
863
+ },
864
+ latitud_locker: {
865
+ type: 'number',
866
+ minimum: -90,
867
+ maximum: 90,
868
+ description: 'Fuente de verdad para latitude — sobreescribe address.location.geometry.coordinates[1]',
869
+ },
870
+ // ✅ capacidad razonable como string numérico
871
+ capacity_locker: { type: 'string', maxLength: 20 },
872
+ access_descript_locker: { type: 'string', trim: true, maxLength: 500 },
846
873
  },
847
874
  required: [
848
875
  'network',
@@ -868,9 +895,10 @@ const createLockerRequest = () =>
868
895
  provider: {
869
896
  type: 'object',
870
897
  properties: {
871
- name: { type: 'string', trim: true },
872
- lockerVersion: { type: 'string', trim: true },
873
- lockerModel: { type: 'string', trim: true },
898
+ // ✅ PartnerKey varchar(100)
899
+ name: { type: 'string', trim: true, maxLength: 100 },
900
+ lockerVersion: { type: 'string', trim: true, maxLength: 20 },
901
+ lockerModel: { type: 'string', trim: true, maxLength: 100 },
874
902
  },
875
903
  required: ['name'],
876
904
  additionalProperties: false,
@@ -879,13 +907,18 @@ const createLockerRequest = () =>
879
907
  location: {
880
908
  type: 'object',
881
909
  properties: {
882
- streetNumber: { type: 'string', trim: true },
883
- street: { type: 'string', trim: true },
884
- postalCode: { type: 'string', trim: true },
885
- lon: { type: 'number' },
886
- lat: { type: 'number' },
910
+ streetNumber: { type: 'string', trim: true, maxLength: 20 },
911
+ // ✅ Calle varchar(255)
912
+ street: { type: 'string', trim: true, maxLength: 255 },
913
+ // ✅ cp varchar(15)
914
+ postalCode: { type: 'string', trim: true, maxLength: 15 },
915
+ // ✅ float en BD
916
+ lon: { type: 'number', minimum: -180, maximum: 180 },
917
+ lat: { type: 'number', minimum: -90, maximum: 90 },
918
+ // ✅ ya tenía minLength:2 maxLength:2 — correcto para ISO 3166-1 alpha-2
887
919
  countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 },
888
- city: { type: 'string', trim: true },
920
+ // ✅ Poblacion varchar(100)
921
+ city: { type: 'string', trim: true, maxLength: 100 },
889
922
  },
890
923
  required: ['street', 'postalCode', 'countryCode', 'city'],
891
924
  additionalProperties: false,
@@ -904,9 +937,11 @@ const createLockerRequest = () =>
904
937
  carrier: {
905
938
  type: 'object',
906
939
  properties: {
907
- lockerName: { type: 'string', trim: true },
940
+ // ✅ Nombre varchar(100)
941
+ lockerName: { type: 'string', trim: true, maxLength: 100 },
908
942
  activationDate: { type: 'string', format: 'date-time' },
909
- lockerId: { type: 'string' }, // asignado por el handler con parcelshop._id
943
+ // ✅ UUID = 36 chars
944
+ lockerId: { type: 'string', maxLength: 36 },
910
945
  },
911
946
  required: ['lockerName', 'lockerId'],
912
947
  additionalProperties: false,
@@ -918,13 +953,224 @@ const createLockerRequest = () =>
918
953
  },
919
954
 
920
955
  },
921
- // FIX: era ['parcelshop', 'locker'] con 'lockerDevice' en properties → siempre fallaba
922
956
  required: ['parcelshop', 'locker'],
923
957
  additionalProperties: false,
924
958
  });
925
959
 
960
+
961
+
962
+
963
+
964
+
965
+
966
+
967
+
968
+
926
969
  const createLockerResponse = () => createResponse(locker());
927
970
 
971
+ const updateLockerRequest = () =>
972
+ updateRequest(
973
+ // ── find: busca el locker por su _id (UUID) ──────────────────────────────
974
+ findById(),
975
+
976
+ // ── set: campos actualizables — todos opcionales (patch parcial) ─────────
977
+ {
978
+ type: 'object',
979
+ properties: {
980
+ network: schemaOrNull(objectWithUuid()),
981
+ zone: schemaOrNull(objectWithUuid()),
982
+ openingRepresentative: schemaOrNull(setShopRepresentative()),
983
+ managingRepresentative: schemaOrNull(setShopRepresentative()),
984
+ status: setShopStatus(),
985
+
986
+ // ✅ Nombre varchar(100) — ps_puntos Apolo
987
+ name: schemaOrNull({ type: 'string', trim: true, maxLength: 100 }),
988
+
989
+ address: schemaOrNull({
990
+ type: 'object',
991
+ properties: {
992
+ // ✅ Calle varchar(255) — ps_puntos Apolo
993
+ street: { type: 'string', trim: true, maxLength: 255 },
994
+ door: { type: 'string', trim: true, maxLength: 20 },
995
+ // ✅ cp varchar(15) — ps_puntos Apolo
996
+ postalCode: { type: 'string', trim: true, maxLength: 15 },
997
+ // ✅ Poblacion varchar(100) — ps_puntos Apolo
998
+ locality: { type: 'string', trim: true, maxLength: 100 },
999
+ // ✅ ISO 3166-1 alpha-2
1000
+ country: { type: 'string', trim: true, maxLength: 3 },
1001
+ access_descript_locker: { type: 'string', trim: true, maxLength: 500 },
1002
+ location: {
1003
+ type: 'object',
1004
+ properties: {
1005
+ geometry: {
1006
+ type: 'object',
1007
+ properties: {
1008
+ type: { type: 'string', enum: ['Point'] },
1009
+ coordinates: {
1010
+ type: 'array',
1011
+ items: { type: 'number' },
1012
+ minItems: 2,
1013
+ maxItems: 2,
1014
+ },
1015
+ },
1016
+ required: ['type', 'coordinates'],
1017
+ additionalProperties: false,
1018
+ },
1019
+ precision: { type: 'string' },
1020
+ },
1021
+ required: ['geometry'],
1022
+ additionalProperties: false,
1023
+ },
1024
+ },
1025
+ required: ['street', 'postalCode', 'locality', 'country', 'location'],
1026
+ additionalProperties: false,
1027
+ }),
1028
+
1029
+ openingSchedule: schemaOrNull(shop().properties.openingSchedule),
1030
+ timezone: schemaOrNull(shop().properties.timezone),
1031
+ activity: schemaOrNull(shop().properties.activity),
1032
+ eco: schemaOrNull(shop().properties.eco),
1033
+
1034
+ fiscal: schemaOrNull({
1035
+ type: 'object',
1036
+ properties: {
1037
+ // ✅ IBAN estándar 34 chars
1038
+ iban: { type: 'string', trim: true, maxLength: 34 },
1039
+ // ✅ nombreComercial nvarchar(100) — ps_puntos Apolo
1040
+ businessName: { type: 'string', trim: true, maxLength: 100 },
1041
+ // ✅ NIF/CIF máximo 20 chars
1042
+ nif: { type: 'string', trim: true, maxLength: 20 },
1043
+ contacts: { type: 'array', items: contact() },
1044
+ address: {
1045
+ type: 'object',
1046
+ properties: {
1047
+ street: { type: 'string', trim: true, maxLength: 255 },
1048
+ door: { type: 'string', trim: true, maxLength: 20 },
1049
+ postalCode: { type: 'string', trim: true, maxLength: 15 },
1050
+ locality: { type: 'string', trim: true, maxLength: 100 },
1051
+ // ✅ country declarado explícitamente — evita additionalProperties 400
1052
+ country: { type: 'string', trim: true, maxLength: 3 },
1053
+ },
1054
+ required: ['street', 'postalCode', 'locality', 'country'],
1055
+ additionalProperties: false,
1056
+ },
1057
+ paymentMethod: { type: 'string', trim: true, maxLength: 50 },
1058
+ dueDays: { type: 'integer', minimum: 0 },
1059
+ activity: { type: 'string', trim: true, maxLength: 50 },
1060
+ retention: { type: 'integer' },
1061
+ },
1062
+ required: ['iban', 'businessName', 'nif', 'contacts', 'address', 'dueDays', 'retention'],
1063
+ additionalProperties: false,
1064
+ }),
1065
+
1066
+ nxt: schemaOrNull({
1067
+ type: 'object',
1068
+ properties: {
1069
+ // ✅ ParcelShopId varchar(100) — ps_puntos Apolo
1070
+ parcelShopId: { type: 'string', maxLength: 100 },
1071
+ },
1072
+ required: ['parcelShopId'],
1073
+ additionalProperties: false,
1074
+ }),
1075
+
1076
+ // ✅ Campos _locker — fuente de verdad para coordenadas y dirección
1077
+ // Calle varchar(255) — ps_puntos Apolo
1078
+ direccion_locker: schemaOrNull({ type: 'string', trim: true, maxLength: 255 }),
1079
+ // cp varchar(15) — ps_puntos Apolo
1080
+ codpostal_locker: schemaOrNull({ type: 'string', trim: true, maxLength: 15 }),
1081
+ // Poblacion varchar(100) — ps_puntos Apolo
1082
+ ciudad_locker: schemaOrNull({ type: 'string', trim: true, maxLength: 100 }),
1083
+ // ✅ float — rango geográfico válido, ps_puntos Apolo
1084
+ longitud_locker: schemaOrNull({
1085
+ type: 'number',
1086
+ minimum: -180,
1087
+ maximum: 180,
1088
+ description: 'Fuente de verdad para longitude — sobreescribe address.location.geometry.coordinates[0]',
1089
+ }),
1090
+ latitud_locker: schemaOrNull({
1091
+ type: 'number',
1092
+ minimum: -90,
1093
+ maximum: 90,
1094
+ description: 'Fuente de verdad para latitude — sobreescribe address.location.geometry.coordinates[1]',
1095
+ }),
1096
+ capacity_locker: schemaOrNull({ type: 'string', maxLength: 20 }),
1097
+ access_descript_locker: schemaOrNull({ type: 'string', trim: true, maxLength: 500 }),
1098
+
1099
+ // ── Objeto locker (NXT) ──────────────────────────────────────────────
1100
+ locker: schemaOrNull({
1101
+ title: 'locker',
1102
+ type: 'object',
1103
+ properties: {
1104
+
1105
+ provider: {
1106
+ type: 'object',
1107
+ properties: {
1108
+ // ✅ PartnerKey varchar(100) — ps_puntos Apolo
1109
+ name: { type: 'string', trim: true, maxLength: 100 },
1110
+ lockerVersion: { type: 'string', trim: true, maxLength: 20 },
1111
+ lockerModel: { type: 'string', trim: true, maxLength: 100 },
1112
+ },
1113
+ required: ['name'],
1114
+ additionalProperties: false,
1115
+ },
1116
+
1117
+ location: {
1118
+ type: 'object',
1119
+ properties: {
1120
+ streetNumber: { type: 'string', trim: true, maxLength: 20 },
1121
+ // ✅ Calle varchar(255) — ps_puntos Apolo
1122
+ street: { type: 'string', trim: true, maxLength: 255 },
1123
+ // ✅ cp varchar(15) — ps_puntos Apolo
1124
+ postalCode: { type: 'string', trim: true, maxLength: 15 },
1125
+ // ✅ float — rango geográfico válido
1126
+ lon: { type: 'number', minimum: -180, maximum: 180 },
1127
+ lat: { type: 'number', minimum: -90, maximum: 90 },
1128
+ // ✅ ISO 3166-1 alpha-2 — minLength/maxLength: 2
1129
+ countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 },
1130
+ // ✅ Poblacion varchar(100) — ps_puntos Apolo
1131
+ city: { type: 'string', trim: true, maxLength: 100 },
1132
+ },
1133
+ required: ['street', 'postalCode', 'countryCode', 'city'],
1134
+ additionalProperties: false,
1135
+ },
1136
+
1137
+ features: {
1138
+ type: 'object',
1139
+ properties: {
1140
+ hasScreen: { type: 'boolean' },
1141
+ hasPinPad: { type: 'boolean' },
1142
+ hasPinBarcodeReader: { type: 'boolean' },
1143
+ },
1144
+ additionalProperties: false,
1145
+ },
1146
+
1147
+ carrier: {
1148
+ type: 'object',
1149
+ properties: {
1150
+ // ✅ Nombre varchar(100) — ps_puntos Apolo
1151
+ lockerName: { type: 'string', trim: true, maxLength: 100 },
1152
+ activationDate: { type: 'string', format: 'date-time' },
1153
+ // ✅ UUID 36 chars
1154
+ lockerId: { type: 'string', maxLength: 36 },
1155
+ },
1156
+ required: ['lockerName', 'lockerId'],
1157
+ additionalProperties: false,
1158
+ },
1159
+
1160
+ },
1161
+ required: ['provider', 'location', 'carrier'],
1162
+ additionalProperties: false,
1163
+ }),
1164
+
1165
+ },
1166
+ minProperties: 0, // permite updates parciales — ningún campo es obligatorio en el set
1167
+ additionalProperties: false,
1168
+ },
1169
+ );
1170
+
1171
+ const updateLockerResponse = () => updateResponse(locker());
1172
+
1173
+
928
1174
 
929
1175
  module.exports = {
930
1176
  shop,
@@ -943,4 +1189,6 @@ module.exports = {
943
1189
  upsertShopRequest,
944
1190
  createLockerRequest,
945
1191
  createLockerResponse,
1192
+ updateLockerRequest,
1193
+ updateLockerResponse,
946
1194
  };
package/schemas/index.js CHANGED
@@ -62,6 +62,7 @@ const {
62
62
  upsertShopResponse,
63
63
  shop,
64
64
  createLockerRequest,
65
+ updateLockerRequest,
65
66
  locker,
66
67
  } = require('./definitions/shops');
67
68
  const {
@@ -304,6 +305,7 @@ const parcelShopsRequest = request(findParcelShopsRequest(), 'parcelShopsRequest
304
305
  const parcelShopsResponse = request(findParcelShopsResponse(), 'parcelShopsResponse');
305
306
 
306
307
  const lockersCreateRequest = request(createLockerRequest(), 'lockersCreateRequest');
308
+ const lockersUpdateRequest = request(updateLockerRequest(), 'lockersUpdateRequest');
307
309
 
308
310
  const superAdminSchema = addMetadata(superAdmin(), 'superAdmin');
309
311
  const networkAdminSchema = addMetadata(networkAdmin(), 'networkAdmin');
@@ -371,6 +373,7 @@ module.exports = {
371
373
  shopsDeleteResponse,
372
374
 
373
375
  lockersCreateRequest,
376
+ lockersUpdateRequest,
374
377
 
375
378
  shopUsersCreateRequest,
376
379
  shopUsersCreateResponse,