@gls_spain/gps-common 35.15.9 → 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,25 @@
1
- ## [35.15.9](https://github.com/GLS-Spain/gps-common/compare/v35.15.8...v35.15.9) (2026-03-11)
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
- * add varchar validation SQL apolo in lockers schema ([3ff50e2](https://github.com/GLS-Spain/gps-common/commit/3ff50e28f5347333cfbc801dfdf363cb6f2d2921))
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
+
8
23
  ## [35.15.8](https://github.com/GLS-Spain/gps-common/compare/v35.15.7...v35.15.8) (2026-03-10)
9
24
 
10
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "35.15.9",
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',
@@ -762,15 +762,15 @@ const createLockerRequest = () =>
762
762
  type: 'object',
763
763
  properties: {
764
764
  // ✅ Calle varchar(255)
765
- street: { type: 'string', trim: true, maxLength: 255 },
765
+ street: { type: 'string', trim: true, maxLength: 255 },
766
766
  // ✅ sin límite estricto en BD pero razonable
767
- door: { type: 'string', trim: true, maxLength: 20 },
767
+ door: { type: 'string', trim: true, maxLength: 20 },
768
768
  // ✅ cp varchar(15)
769
- postalCode: { type: 'string', trim: true, maxLength: 15 },
769
+ postalCode: { type: 'string', trim: true, maxLength: 15 },
770
770
  // ✅ Poblacion varchar(100)
771
- locality: { type: 'string', trim: true, maxLength: 100 },
771
+ locality: { type: 'string', trim: true, maxLength: 100 },
772
772
  // ✅ código país ISO 3166-1 alpha-2/3
773
- country: { type: 'string', trim: true, maxLength: 3 },
773
+ country: { type: 'string', trim: true, maxLength: 3 },
774
774
  access_descript_locker: { type: 'string', trim: true, maxLength: 500 },
775
775
  location: {
776
776
  type: 'object',
@@ -808,30 +808,30 @@ const createLockerRequest = () =>
808
808
  type: 'object',
809
809
  properties: {
810
810
  // ✅ IBAN estándar máximo 34 caracteres
811
- iban: { type: 'string', trim: true, maxLength: 34 },
811
+ iban: { type: 'string', trim: true, maxLength: 34 },
812
812
  // ✅ nombreComercial nvarchar(100)
813
- businessName: { type: 'string', trim: true, maxLength: 100 },
813
+ businessName: { type: 'string', trim: true, maxLength: 100 },
814
814
  // ✅ NIF/CIF español máximo 9 chars, margen para internacionales
815
- nif: { type: 'string', trim: true, maxLength: 20 },
816
- contacts: { type: 'array', items: contact() },
815
+ nif: { type: 'string', trim: true, maxLength: 20 },
816
+ contacts: { type: 'array', items: contact() },
817
817
  address: {
818
818
  type: 'object',
819
819
  properties: {
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 },
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
824
  // ✅ añadido country que faltaba y causaba el 400
825
- country: { type: 'string', trim: true, maxLength: 3 },
825
+ country: { type: 'string', trim: true, maxLength: 3 },
826
826
  },
827
827
  required: ['street', 'postalCode', 'locality', 'country'],
828
828
  additionalProperties: false,
829
829
  },
830
- paymentMethod: { type: 'string', trim: true, maxLength: 50 },
831
- dueDays: { type: 'integer', minimum: 0 },
830
+ paymentMethod: { type: 'string', trim: true, maxLength: 50 },
831
+ dueDays: { type: 'integer', minimum: 0 },
832
832
  // ✅ activity varchar(250) en BD relacional
833
- activity: { type: 'string', trim: true, maxLength: 50 },
834
- retention: { type: 'integer' },
833
+ activity: { type: 'string', trim: true, maxLength: 50 },
834
+ retention: { type: 'integer' },
835
835
  },
836
836
  required: ['iban', 'businessName', 'nif', 'contacts', 'address', 'dueDays', 'retention'],
837
837
  additionalProperties: false,
@@ -849,11 +849,11 @@ const createLockerRequest = () =>
849
849
 
850
850
  // ✅ Campos _locker con límites alineados a BD
851
851
  // Calle varchar(255)
852
- direccion_locker: { type: 'string', trim: true, maxLength: 255 },
852
+ direccion_locker: { type: 'string', trim: true, maxLength: 255 },
853
853
  // cp varchar(15)
854
- codpostal_locker: { type: 'string', trim: true, maxLength: 15 },
854
+ codpostal_locker: { type: 'string', trim: true, maxLength: 15 },
855
855
  // Poblacion varchar(100)
856
- ciudad_locker: { type: 'string', trim: true, maxLength: 100 },
856
+ ciudad_locker: { type: 'string', trim: true, maxLength: 100 },
857
857
  // ✅ lat/lng float en BD — rango geográfico válido
858
858
  longitud_locker: {
859
859
  type: 'number',
@@ -868,7 +868,7 @@ const createLockerRequest = () =>
868
868
  description: 'Fuente de verdad para latitude — sobreescribe address.location.geometry.coordinates[1]',
869
869
  },
870
870
  // ✅ capacidad razonable como string numérico
871
- capacity_locker: { type: 'string', maxLength: 20 },
871
+ capacity_locker: { type: 'string', maxLength: 20 },
872
872
  access_descript_locker: { type: 'string', trim: true, maxLength: 500 },
873
873
  },
874
874
  required: [
@@ -896,9 +896,9 @@ const createLockerRequest = () =>
896
896
  type: 'object',
897
897
  properties: {
898
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 },
899
+ name: { type: 'string', trim: true, maxLength: 100 },
900
+ lockerVersion: { type: 'string', trim: true, maxLength: 20 },
901
+ lockerModel: { type: 'string', trim: true, maxLength: 100 },
902
902
  },
903
903
  required: ['name'],
904
904
  additionalProperties: false,
@@ -907,18 +907,18 @@ const createLockerRequest = () =>
907
907
  location: {
908
908
  type: 'object',
909
909
  properties: {
910
- streetNumber: { type: 'string', trim: true, maxLength: 20 },
910
+ streetNumber: { type: 'string', trim: true, maxLength: 20 },
911
911
  // ✅ Calle varchar(255)
912
- street: { type: 'string', trim: true, maxLength: 255 },
912
+ street: { type: 'string', trim: true, maxLength: 255 },
913
913
  // ✅ cp varchar(15)
914
- postalCode: { type: 'string', trim: true, maxLength: 15 },
914
+ postalCode: { type: 'string', trim: true, maxLength: 15 },
915
915
  // ✅ float en BD
916
- lon: { type: 'number', minimum: -180, maximum: 180 },
917
- lat: { type: 'number', minimum: -90, maximum: 90 },
916
+ lon: { type: 'number', minimum: -180, maximum: 180 },
917
+ lat: { type: 'number', minimum: -90, maximum: 90 },
918
918
  // ✅ ya tenía minLength:2 maxLength:2 — correcto para ISO 3166-1 alpha-2
919
- countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 },
919
+ countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 },
920
920
  // ✅ Poblacion varchar(100)
921
- city: { type: 'string', trim: true, maxLength: 100 },
921
+ city: { type: 'string', trim: true, maxLength: 100 },
922
922
  },
923
923
  required: ['street', 'postalCode', 'countryCode', 'city'],
924
924
  additionalProperties: false,
@@ -927,8 +927,8 @@ const createLockerRequest = () =>
927
927
  features: {
928
928
  type: 'object',
929
929
  properties: {
930
- hasScreen: { type: 'boolean' },
931
- hasPinPad: { type: 'boolean' },
930
+ hasScreen: { type: 'boolean' },
931
+ hasPinPad: { type: 'boolean' },
932
932
  hasPinBarcodeReader: { type: 'boolean' },
933
933
  },
934
934
  additionalProperties: false,
@@ -938,10 +938,10 @@ const createLockerRequest = () =>
938
938
  type: 'object',
939
939
  properties: {
940
940
  // ✅ Nombre varchar(100)
941
- lockerName: { type: 'string', trim: true, maxLength: 100 },
941
+ lockerName: { type: 'string', trim: true, maxLength: 100 },
942
942
  activationDate: { type: 'string', format: 'date-time' },
943
943
  // ✅ UUID = 36 chars
944
- lockerId: { type: 'string', maxLength: 36 },
944
+ lockerId: { type: 'string', maxLength: 36 },
945
945
  },
946
946
  required: ['lockerName', 'lockerId'],
947
947
  additionalProperties: false,
@@ -968,6 +968,209 @@ const createLockerRequest = () =>
968
968
 
969
969
  const createLockerResponse = () => createResponse(locker());
970
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
+
971
1174
 
972
1175
  module.exports = {
973
1176
  shop,
@@ -986,4 +1189,6 @@ module.exports = {
986
1189
  upsertShopRequest,
987
1190
  createLockerRequest,
988
1191
  createLockerResponse,
1192
+ updateLockerRequest,
1193
+ updateLockerResponse,
989
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,