@gls_spain/gps-common 35.17.0 → 35.17.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.
@@ -1,80 +1,45 @@
1
1
  name: Claude Code Review
2
-
3
2
  on:
4
3
  pull_request:
5
4
  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
5
 
13
6
  jobs:
14
7
  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
8
  runs-on: ubuntu-latest
22
9
  permissions:
23
10
  contents: read
24
- pull-requests: read
25
- issues: read
11
+ pull-requests: write
12
+ issues: write
26
13
  id-token: write
14
+ actions: read
27
15
 
28
16
  steps:
29
17
  - name: Checkout repository
30
- uses: actions/checkout@v4
18
+ uses: actions/checkout@v4.2.2
31
19
  with:
32
20
  fetch-depth: 1
33
21
 
34
22
  - name: Run Claude Code Review
35
23
  id: claude-review
36
- uses: anthropics/claude-code-action@beta
24
+ uses: anthropics/claude-code-action@v1
37
25
  with:
38
26
  claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
27
+ prompt: |
28
+ Revisa la PR número ${{ github.event.pull_request.number }} de este repositorio.
29
+ Ejecuta `gh pr view ${{ github.event.pull_request.number }}` y `gh pr diff ${{ github.event.pull_request.number }}` para obtener los detalles y el diff.
39
30
 
40
- # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
41
- # model: "claude-opus-4-1-20250805"
42
-
43
- # Direct prompt for automated review (no @claude mention needed)
44
- direct_prompt: |
45
- Actúa como un code reviewer senior exigente pero constructivo.Por favor revisa esta pull request y provee feedback en base a estas dimensiones:
31
+ Actúa como un code reviewer senior exigente pero constructivo. Provee feedback en base a estas dimensiones:
46
32
  - Calidad del código y mejores prácticas
47
33
  - Posibles errores o problemas
48
34
  - Consideraciones de rendimiento
49
35
  - Preocupaciones de seguridad
50
-
51
- Sé constructivo y útil en tus comentarios.
52
36
 
37
+ Sé constructivo y útil en tus comentarios.
38
+ No tengas en cuenta las consideraciones referentes a sentencias con NOLOCK. Por defecto, en este codebase todo va con NOLOCK.
53
39
  Al final, da una puntuación global de 1 a 10 con un resumen de una línea.
54
-
55
40
  El idioma a usar es el español.
56
41
 
57
- # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
58
- use_sticky_comment: false
59
-
60
- # Optional: Customize review based on file types
61
- # direct_prompt: |
62
- # Review this PR focusing on:
63
- # - For TypeScript files: Type safety and proper interface usage
64
- # - For API endpoints: Security, input validation, and error handling
65
- # - For React components: Performance, accessibility, and best practices
66
- # - For tests: Coverage, edge cases, and test quality
67
-
68
- # Optional: Different prompts for different authors
69
- # direct_prompt: |
70
- # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
71
- # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
72
- # 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
73
-
74
- # Optional: Add specific tools for running tests or linting
75
- # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
76
-
77
- # Optional: Skip review for certain conditions
78
- # if: |
79
- # !contains(github.event.pull_request.title, '[skip-review]') &&
80
- # !contains(github.event.pull_request.title, '[WIP]')
42
+ Publica el resultado como comentario en la PR usando: gh pr comment ${{ github.event.pull_request.number }} --body "..."
43
+ claude_args: |
44
+ --model claude-sonnet-4-6
45
+ --allowedTools "Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh pr comment:*)"
@@ -1,5 +1,4 @@
1
1
  name: Claude Code
2
-
3
2
  on:
4
3
  issue_comment:
5
4
  types: [created]
@@ -23,7 +22,7 @@ jobs:
23
22
  pull-requests: read
24
23
  issues: read
25
24
  id-token: write
26
- actions: read # Required for Claude to read CI results on PRs
25
+ actions: read
27
26
  steps:
28
27
  - name: Checkout repository
29
28
  uses: actions/checkout@v4
@@ -32,32 +31,10 @@ jobs:
32
31
 
33
32
  - name: Run Claude Code
34
33
  id: claude
35
- uses: anthropics/claude-code-action@beta
34
+ uses: anthropics/claude-code-action@v1 # ← @beta → @v1
36
35
  with:
37
36
  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
37
  additional_permissions: |
41
38
  actions: read
42
-
43
- # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
44
- # model: "claude-opus-4-1-20250805"
45
-
46
- # Optional: Customize the trigger phrase (default: @claude)
47
- # trigger_phrase: "/claude"
48
-
49
- # Optional: Trigger when specific user is assigned to an issue
50
- # assignee_trigger: "claude-bot"
51
-
52
- # Optional: Allow Claude to run specific commands
53
- # allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
54
-
55
- # Optional: Add custom instructions for Claude to customize its behavior for your project
56
- # custom_instructions: |
57
- # Follow our coding standards
58
- # Ensure all new code has tests
59
- # Use TypeScript for new files
60
-
61
- # Optional: Custom environment variables for Claude
62
- # claude_env: |
63
- # NODE_ENV: test
39
+ claude_args: |
40
+ --model claude-sonnet-4-6 # ← modelo válido actual
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [35.17.1](https://github.com/GLS-Spain/gps-common/compare/v35.17.0...v35.17.1) (2026-05-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add sunday and minor fix validation ([00129c8](https://github.com/GLS-Spain/gps-common/commit/00129c8e72d9e62b7b8b6627514b5c432d3e1774))
7
+ * commit version task INN 563 ([f0dcb28](https://github.com/GLS-Spain/gps-common/commit/f0dcb28bb609aaac664d0f992bfc7d25d896a42a))
8
+
1
9
  # [35.17.0](https://github.com/GLS-Spain/gps-common/compare/v35.16.0...v35.17.0) (2026-05-04)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "35.17.0",
3
+ "version": "35.17.1",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "keywords": [
6
6
  "gls"
@@ -307,6 +307,18 @@ const findAll = () => ({
307
307
 
308
308
  const findById = () => mergeSchemas(objectWithUuid(), { title: 'find by _id' });
309
309
 
310
+ // ── findByStringId ────────────────────────────────────────────────────────────
311
+ // Equivalente a findById() pero para entidades cuyo _id no es UUID.
312
+ // Usado en updateLockerRequest: el _id del locker es un string numérico ("6237514999")
313
+ // ─────────────────────────────────────────────────────────────────────────────
314
+ const findByStringId = () => ({
315
+ title: 'find by _id (string)',
316
+ type: 'object',
317
+ properties: { _id: { type: 'string', trim: true } },
318
+ required: ['_id'],
319
+ additionalProperties: false,
320
+ });
321
+
310
322
  const findByIds = () => ({
311
323
  title: 'find by _ids',
312
324
  type: 'object',
@@ -448,20 +460,99 @@ const findByIdInternational = () => ({
448
460
  },
449
461
  required: ['international'],
450
462
  additionalProperties: false,
451
-
452
463
  });
453
464
 
454
-
455
465
  const networkType = () => ({
456
466
  type: 'string',
457
467
  enum: [
458
468
  'Business',
459
469
  'Locker',
460
470
  'Agency',
461
- 'Premium'
471
+ 'Premium',
462
472
  ]
463
473
  });
464
474
 
475
+ // ── lockerAddress ─────────────────────────────────────────────────────────────
476
+ // Variante de addressWithRequiredLocation para lockers:
477
+ // - maxLength alineados con las columnas de BD relacional (ps_puntos Apolo)
478
+ // - campo extra access_descript_locker (descripción de acceso al locker)
479
+ // No se puede reutilizar addressWithRequiredLocation() directamente porque:
480
+ // 1. Tiene additionalProperties: false → no admite access_descript_locker
481
+ // 2. No define maxLength en sus campos → necesario para mapear contra varchar(N)
482
+ // ─────────────────────────────────────────────────────────────────────────────
483
+ const lockerAddress = () => ({
484
+ type: 'object',
485
+ properties: {
486
+ street: { type: 'string', trim: true, maxLength: 255 }, // Calle varchar(255)
487
+ door: { type: 'string', trim: true, maxLength: 20 },
488
+ postalCode: { type: 'string', trim: true, maxLength: 15 }, // cp varchar(15)
489
+ locality: { type: 'string', trim: true, maxLength: 100 }, // Poblacion varchar(100)
490
+ country: { type: 'string', trim: true, maxLength: 3 }, // ISO 3166-1 alpha-2/3
491
+ // campo específico de locker
492
+ access_descript_locker: { type: 'string', trim: true, maxLength: 500 },
493
+ location: {
494
+ type: 'object',
495
+ properties: {
496
+ geometry: {
497
+ type: 'object',
498
+ properties: {
499
+ type: { type: 'string', enum: ['Point'] },
500
+ coordinates: { type: 'array', items: { type: 'number' }, minItems: 2, maxItems: 2 },
501
+ },
502
+ required: ['type', 'coordinates'],
503
+ additionalProperties: false,
504
+ },
505
+ precision: { type: 'string' },
506
+ },
507
+ required: ['geometry'],
508
+ additionalProperties: false,
509
+ },
510
+ },
511
+ required: ['street', 'postalCode', 'locality', 'country', 'location'],
512
+ additionalProperties: false,
513
+ });
514
+
515
+ // ── lockerFiscal ──────────────────────────────────────────────────────────────
516
+ // Variante de fiscal() para lockers. No se puede reutilizar fiscal() de shop porque:
517
+ // - fiscal() de shop tiene required completo:
518
+ // ['iban', 'businessName', 'nif', 'contacts', 'address', 'paymentMethod', 'dueDays', 'activity', 'retention']
519
+ // - lockerFiscal tiene required mínimo: ['contacts', 'address', 'dueDays']
520
+ // (iban y nif son opcionales en locker — puede no tenerlos en el momento del alta)
521
+ // - Los campos de texto tienen maxLength alineados con las columnas de BD relacional
522
+ // - paymentMethod en locker es string libre (no enum como en shop)
523
+ // ─────────────────────────────────────────────────────────────────────────────
524
+ const lockerFiscal = () => ({
525
+ type: 'object',
526
+ properties: {
527
+ iban: { type: 'string', trim: true, maxLength: 34 }, // IBAN estándar 34 chars
528
+ businessName: { type: 'string', trim: true, maxLength: 100 }, // nombreComercial nvarchar(100)
529
+ nif: { type: 'string', trim: true, maxLength: 20 }, // NIF/CIF — margen para internacionales
530
+ contacts: {
531
+ type: 'array',
532
+ items: contact(),
533
+ },
534
+ address: {
535
+ type: 'object',
536
+ properties: {
537
+ street: { type: 'string', trim: true, maxLength: 255 },
538
+ door: { type: 'string', trim: true, maxLength: 20 },
539
+ postalCode: { type: 'string', trim: true, maxLength: 15 },
540
+ locality: { type: 'string', trim: true, maxLength: 100 },
541
+ country: { type: 'string', trim: true, maxLength: 3 },
542
+ },
543
+ required: ['street', 'postalCode', 'locality', 'country'],
544
+ additionalProperties: false,
545
+ },
546
+ paymentMethod: { type: 'string', trim: true, maxLength: 50 }, // string libre (vs enum en shop)
547
+ dueDays: { type: 'integer', minimum: 0 },
548
+ activity: { type: 'string', trim: true, maxLength: 50 }, // IAE — activity varchar(250) BD
549
+ retention: { type: 'integer' },
550
+ },
551
+ // iban y nif son opcionales en locker — required mínimo
552
+ required: ['contacts', 'address', 'dueDays'],
553
+ additionalProperties: false,
554
+ });
555
+
465
556
  module.exports = {
466
557
  specificErrorResponse,
467
558
  date,
@@ -469,8 +560,11 @@ module.exports = {
469
560
  country,
470
561
  address,
471
562
  addressWithRequiredLocation,
563
+ lockerAddress,
564
+ lockerFiscal,
472
565
  findAll,
473
566
  findById,
567
+ findByStringId,
474
568
  findByIds,
475
569
  findByName,
476
570
  findByAddress,
@@ -487,5 +581,5 @@ module.exports = {
487
581
  fiscal,
488
582
  findByFiscal,
489
583
  findByIdInternational,
490
- networkType
491
- };
584
+ networkType,
585
+ };
@@ -19,6 +19,7 @@ const {
19
19
  addressWithRequiredLocation,
20
20
  findAll,
21
21
  findById,
22
+ findByStringId, // _id string numérico — usado en updateLockerRequest
22
23
  findByName,
23
24
  findByAddress,
24
25
  findByCircularArea,
@@ -26,9 +27,10 @@ const {
26
27
  timezone,
27
28
  contact,
28
29
  fiscal,
30
+ lockerAddress, // address con maxLength de BD + campo access_descript_locker
31
+ lockerFiscal, // fiscal con required mínimo y maxLength de BD
29
32
  findByFiscal,
30
33
  findByIdInternational,
31
- address,
32
34
  } = require('./common');
33
35
  const { network, objectWithNetworkId } = require('./networks');
34
36
  const { defaults, derivationSettings, expirationSettings } = require('./defaults');
@@ -54,8 +56,9 @@ const shopSchedule = () => ({
54
56
  type: { type: 'string', enum: ['weekly'] },
55
57
  weekly: shopDaySchedule(),
56
58
  saturday: shopDaySchedule(),
59
+ sunday: shopDaySchedule(),
57
60
  },
58
- required: ['type', 'weekly', 'saturday'],
61
+ required: ['type', 'weekly', 'saturday'], // sunday not required
59
62
  additionalProperties: false,
60
63
  },
61
64
  {
@@ -69,8 +72,9 @@ const shopSchedule = () => ({
69
72
  thursday: shopDaySchedule(),
70
73
  friday: shopDaySchedule(),
71
74
  saturday: shopDaySchedule(),
75
+ sunday: shopDaySchedule(),
72
76
  },
73
- required: ['type', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'],
77
+ required: ['type', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'], // sunday not required
74
78
  additionalProperties: false,
75
79
  },
76
80
  ],
@@ -91,33 +95,6 @@ const shopHoliday = () => ({
91
95
  additionalProperties: false,
92
96
  });
93
97
 
94
- /*
95
- 2024-05-28 JL+SB este esquema con "absences" no se está utilizando
96
-
97
- const absencesHolidaysShop = () => ({
98
- title: 'Absences holidays shop',
99
- type: 'object',
100
- properties: {
101
- _id: uuid(),
102
- from: datetime(),
103
- to: datetime(),
104
- description: { type: 'string' },
105
- createAt: datetime(),
106
- },
107
- required: ['from', 'to', '_id', 'createAt'],
108
- additionalProperties: false,
109
- });
110
-
111
- const shopHolidays = () => ({
112
- title: 'Holidays shop',
113
- type: 'array',
114
- properties: {
115
- absences: absencesHolidaysShop(),
116
- },
117
- required: ['absences'],
118
- additionalProperties: false,
119
- });
120
- */
121
98
 
122
99
  const shopRepresentative = () => ({
123
100
  type: 'object',
@@ -264,8 +241,6 @@ const shop = () => ({
264
241
  radical: { type: 'boolean', default: false },
265
242
  operations: { type: ['boolean', 'string'], trim: true },
266
243
  reverseLogistic: { type: 'boolean', default: false },
267
- // squareCode: { type: 'string' },
268
- // clientCode: { type: 'string' },
269
244
  // 2023-01-12 JL están definidos como string
270
245
  // TODO en el momento que el frontend sea capaz de mandar integer, se quita "string"
271
246
  squareCode: { type: ['integer', 'string'], minimum: 0, maximum: 32767, description: 'agency code' },
@@ -275,7 +250,6 @@ const shop = () => ({
275
250
  // Volume capacity 07/11/2024
276
251
  capacity: { type: 'string' },
277
252
  // NXT integration
278
- // courierAccessCode: { type: 'string' }
279
253
  // 2024-12-24 JL courierAccessCode es un objeto!!!!
280
254
  courierAccessCode: {
281
255
  type: 'object',
@@ -362,7 +336,7 @@ const createShopRequest = () =>
362
336
  'clientCode',
363
337
  'channelingAgencyCode',
364
338
  ]),
365
- },
339
+ },// Shop
366
340
  required: ['network', 'status', 'name', 'address', 'openingSchedule', 'timezone'],
367
341
  additionalProperties: false,
368
342
  });
@@ -556,8 +530,20 @@ const upsertShopResponse = () => ({
556
530
  additionalProperties: false,
557
531
  });
558
532
 
559
- // LOCKERS
560
-
533
+ // ── LOCKERS ───────────────────────────────────────────────────────────────────
534
+ //
535
+ // Estructura equivalente a shop() + campos específicos de locker:
536
+ // - nxt → referencia al parcelShopId externo NXT
537
+ // - *_locker → campos de BD relacional (fuente de verdad para coords y dirección)
538
+ // - lockerNxt → sub-objeto con datos del hardware (provider, location, features, carrier)
539
+ //
540
+ // Patrón seguido:
541
+ // locker() → schema base de respuesta (≈ shop())
542
+ // lockerNxt() → schema del sub-objeto NXT (provider + location + features + carrier)
543
+ // lockerNxtUpdate()→ variante de lockerNxt sin lockerId en required (para updates)
544
+ // createLockerRequest → pickProperties(locker(), [...]) + setShopRepresentative()
545
+ // updateLockerRequest → findByStringId() + pickProperties(locker(), [...]) con schemaOrNull
546
+ // ─────────────────────────────────────────────────────────────────────────────
561
547
 
562
548
  const locker = () => ({
563
549
  title: 'locker',
@@ -567,22 +553,7 @@ const locker = () => ({
567
553
  createdAt: datetime(),
568
554
  updatedAt: datetime(),
569
555
  deletable: { type: 'boolean' },
570
- readonly: { type: 'boolean', description: 'readonly shops do not allow updates or adding expeditions to them' },
571
- international: {
572
- type: 'object',
573
- properties: {
574
- partnerKey: { type: 'string' },
575
- parcelShopId: { type: 'string' },
576
- },
577
- required: ['partnerKey', 'parcelShopId'],
578
- additionalProperties: false,
579
- },
580
- defaults: {
581
- type: 'object',
582
- properties: { ...pickProperties(defaults(), ['derivationSettings', 'expirationSettings']) },
583
- required: ['derivationSettings', 'expirationSettings'],
584
- additionalProperties: false,
585
- },
556
+ readonly: { type: 'boolean', description: 'readonly lockers do not allow updates or adding expeditions to them' },
586
557
  network: {
587
558
  type: 'object',
588
559
  properties: { ...pickProperties(network(), ['_id', 'name', 'derivationSettings', 'expirationSettings']) },
@@ -597,98 +568,47 @@ const locker = () => ({
597
568
  },
598
569
  openingRepresentative: shopRepresentative(),
599
570
  managingRepresentative: shopRepresentative(),
600
- status: {
571
+ // reutilizamos el status de shop — mismos códigos y sub-objetos
572
+ status: shop().properties.status,
573
+
574
+ // ✅ Nombre varchar(100) — ps_puntos Apolo
575
+ name: { type: 'string', trim: true, maxLength: 100 },
576
+
577
+ // address con maxLength de BD + campo access_descript_locker — ver common.js
578
+ address: lockerAddress(),
579
+
580
+ // reutilizamos openingSchedule, timezone, activity y eco de shop()
581
+ openingSchedule: shop().properties.openingSchedule,
582
+ timezone: shop().properties.timezone,
583
+ activity: shop().properties.activity,
584
+ eco: shop().properties.eco,
585
+
586
+ // fiscal con required mínimo y maxLength de BD — ver common.js
587
+ fiscal: lockerFiscal(),
588
+
589
+ nxt: {
601
590
  type: 'object',
602
591
  properties: {
603
- code: { type: 'string', enum: ['enabled', 'disabled', 'manuallyDisabled'] },
604
- disabled: {
605
- type: 'object',
606
- properties: {
607
- at: datetime(),
608
- reason: { type: 'string', trim: true },
609
- },
610
- required: ['at', 'reason'],
611
- additionalProperties: false,
612
- },
613
- manuallyDisabled: {
614
- type: 'object',
615
- properties: {
616
- _id: uuid(),
617
- at: datetime(),
618
- to: datetime(),
619
- reason: { type: 'string', trim: true },
620
- },
621
- required: ['at', 'reason'],
622
- additionalProperties: false,
623
- },
592
+ parcelShopId: { type: 'string', maxLength: 100 }, // varchar(100)
624
593
  },
625
- required: ['code'],
594
+ required: ['parcelShopId'],
626
595
  additionalProperties: false,
627
596
  },
628
- name: { type: 'string', trim: true },
629
- address: addressWithRequiredLocation(),
630
- capabilities: {
631
- type: 'array',
632
- items: { type: 'string', enum: ['deliver', 'pickup', 'sell', 'sellplus'] },
633
- uniqueItems: true,
634
- },
635
- openingSchedule: shopSchedule(),
636
- holidays: { type: 'array', items: shopHoliday(), uniqueItems: true },
637
- timezone: timezone(),
638
- contacts: {
639
- type: 'array',
640
- items: contact(),
641
- },
642
- fiscal: {
643
- type: 'object',
644
- properties: {
645
- iban: { type: 'string', trim: true },
646
- businessName: { type: 'string', trim: true },
647
- nif: { type: 'string', trim: true },
648
- contacts: { type: 'array', items: contact() },
649
- // ✅ address inline — address() tiene additionalProperties:false sin 'door'
650
- address: {
651
- type: 'object',
652
- properties: {
653
- street: { type: 'string', trim: true },
654
- door: { type: 'string', trim: true },
655
- postalCode: { type: 'string', trim: true },
656
- locality: { type: 'string', trim: true },
657
- country: { type: 'string', trim: true },
658
- },
659
- required: ['street', 'postalCode', 'locality', 'country'],
660
- additionalProperties: false,
661
- },
662
- paymentMethod: { type: 'string', trim: true },
663
- dueDays: { type: 'integer', minimum: 0 },
664
- activity: { type: 'string', trim: true, maxLength: 50 },
665
- retention: { type: 'integer' },
666
- },
667
- required: ['iban', 'businessName', 'nif', 'contacts', 'address', 'dueDays', 'retention'],
668
- additionalProperties: false,
597
+
598
+ // ── Campos _locker — fuente de verdad para coordenadas y dirección ───────
599
+ direccion_locker: { type: 'string', trim: true, maxLength: 255 }, // varchar(255)
600
+ codpostal_locker: { type: 'string', trim: true, maxLength: 15 }, // varchar(15)
601
+ ciudad_locker: { type: 'string', trim: true, maxLength: 100 }, // varchar(100)
602
+ longitud_locker: {
603
+ type: 'number', minimum: -180, maximum: 180,
604
+ description: 'Fuente de verdad para longitude — sobreescribe address.location.geometry.coordinates[0]',
669
605
  },
670
- activity: shopActivity(),
671
- notes: { type: 'string', trim: true },
672
- derivationSettings: derivationSettings(),
673
- expirationSettings: expirationSettings(),
674
- eco: { type: 'boolean', default: false },
675
- gold: { type: 'boolean', default: false },
676
- radical: { type: 'boolean', default: false },
677
- operations: { type: ['boolean', 'string'], trim: true },
678
- reverseLogistic: { type: 'boolean', default: false },
679
- squareCode: { type: ['integer', 'string'], minimum: 0, maximum: 32767, description: 'agency code' },
680
- clientCode: { type: ['integer', 'string'], description: 'client code' },
681
- channelingAgencyCode: { type: ['integer', 'string', 'null'], description: 'Channeling Agency Code' },
682
- capacity: { type: 'string' },
683
- courierAccessCode: {
684
- type: 'object',
685
- properties: {
686
- code: { type: 'string' },
687
- updatedAt: { type: 'string', format: 'date-time' },
688
- },
689
- required: ['code', 'updatedAt'],
690
- additionalProperties: false,
606
+ latitud_locker: {
607
+ type: 'number', minimum: -90, maximum: 90,
608
+ description: 'Fuente de verdad para latitude — sobreescribe address.location.geometry.coordinates[1]',
691
609
  },
610
+ capacity_locker: { type: 'string', maxLength: 20 },
611
+ access_descript_locker: { type: 'string', trim: true, maxLength: 500 },
692
612
  },
693
613
  required: [
694
614
  '_id',
@@ -696,178 +616,124 @@ const locker = () => ({
696
616
  'updatedAt',
697
617
  'deletable',
698
618
  'readonly',
699
- 'international',
700
- 'defaults',
701
619
  'network',
702
620
  'status',
703
621
  'name',
704
622
  'address',
705
- 'capabilities',
706
623
  'openingSchedule',
707
624
  'timezone',
708
- 'contacts',
709
625
  ],
710
626
  additionalProperties: false,
711
627
  });
712
628
 
629
+ // ── Schema del sub-objeto NXT (hardware del locker) ───────────────────────────
630
+
631
+ const lockerNxt = () => ({
632
+ title: 'lockerNxt',
633
+ type: 'object',
634
+ properties: {
635
+ provider: {
636
+ type: 'object',
637
+ properties: {
638
+ name: { type: 'string', trim: true, maxLength: 100 }, // PartnerKey varchar(100)
639
+ lockerVersion: { type: 'string', trim: true, maxLength: 20 },
640
+ lockerModel: { type: 'string', trim: true, maxLength: 100 },
641
+ },
642
+ required: ['name'],
643
+ additionalProperties: false,
644
+ },
645
+ location: {
646
+ type: 'object',
647
+ properties: {
648
+ streetNumber: { type: 'string', trim: true, maxLength: 20 },
649
+ street: { type: 'string', trim: true, maxLength: 255 }, // varchar(255)
650
+ postalCode: { type: 'string', trim: true, maxLength: 15 }, // varchar(15)
651
+ lon: { type: 'number', minimum: -180, maximum: 180 }, // float BD
652
+ lat: { type: 'number', minimum: -90, maximum: 90 },
653
+ countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 }, // ISO 3166-1 alpha-2
654
+ city: { type: 'string', trim: true, maxLength: 100 }, // varchar(100)
655
+ },
656
+ required: ['street', 'postalCode', 'countryCode', 'city'],
657
+ additionalProperties: false,
658
+ },
659
+ features: {
660
+ type: 'object',
661
+ properties: {
662
+ hasScreen: { type: 'boolean' },
663
+ hasPinPad: { type: 'boolean' },
664
+ hasPinBarcodeReader: { type: 'boolean' },
665
+ },
666
+ additionalProperties: false,
667
+ },
668
+ carrier: {
669
+ type: 'object',
670
+ properties: {
671
+ lockerName: { type: 'string', trim: true, maxLength: 100 }, // Nombre varchar(100)
672
+ activationDate: { type: 'string', format: 'date-time' },
673
+ lockerId: { type: 'string', maxLength: 36 }, // UUID = 36 chars
674
+ },
675
+ required: ['lockerName', 'lockerId'],
676
+ additionalProperties: false,
677
+ },
678
+ },
679
+ required: ['provider', 'location', 'carrier'],
680
+ additionalProperties: false,
681
+ });
682
+
683
+ // ── Variante de lockerNxt para update: lockerId fuera de required ─────────────
684
+ // El body real de updateLocker no envía lockerId
685
+
686
+ const lockerNxtUpdate = () => ({
687
+ ...lockerNxt(),
688
+ properties: {
689
+ ...lockerNxt().properties,
690
+ carrier: {
691
+ ...lockerNxt().properties.carrier,
692
+ required: ['lockerName'],
693
+ },
694
+ },
695
+ });
696
+
697
+ // ── createLockerRequest ───────────────────────────────────────────────────────
698
+ // Mismo patrón que createShopRequest:
699
+ // - pickProperties(locker(), [...]) para los campos del parcelshop
700
+ // - setShopRepresentative() para los representantes (formato "set": solo _id + since)
701
+ // - lockerNxt() para el sub-objeto hardware
713
702
 
714
703
  const createLockerRequest = () =>
715
704
  createRequest({
716
705
  type: 'object',
717
706
  properties: {
718
-
719
707
  parcelshop: {
720
708
  type: 'object',
721
709
  properties: {
722
- _id: uuid(),
723
- createdAt: datetime(),
710
+ // campos de identidad opcionales en create
711
+ ...pickProperties(locker(), ['_id', 'createdAt']),
712
+ // relaciones como objectWithUuid
724
713
  network: objectWithUuid(),
725
- zone: objectWithUuid(),
726
- openingRepresentative: setShopRepresentative(),
714
+ zone: objectWithUuid(),
715
+ // representantes en formato "set" (solo _id + since, sin name)
716
+ openingRepresentative: setShopRepresentative(),
727
717
  managingRepresentative: setShopRepresentative(),
728
-
729
- status: {
730
- type: 'object',
731
- properties: {
732
- code: { type: 'string', enum: ['enabled', 'disabled', 'manuallyDisabled'] },
733
- disabled: {
734
- type: 'object',
735
- properties: {
736
- at: datetime(),
737
- reason: { type: 'string', trim: true },
738
- },
739
- required: ['at', 'reason'],
740
- additionalProperties: false,
741
- },
742
- manuallyDisabled: {
743
- type: 'object',
744
- properties: {
745
- _id: uuid(),
746
- at: datetime(),
747
- to: datetime(),
748
- reason: { type: 'string', trim: true },
749
- },
750
- required: ['at', 'reason'],
751
- additionalProperties: false,
752
- },
753
- },
754
- required: ['code'],
755
- additionalProperties: false,
756
- },
757
-
758
- // ✅ maxLength alineado con Nombre varchar(100)
759
- name: { type: 'string', trim: true, maxLength: 100 },
760
-
761
- address: {
762
- type: 'object',
763
- properties: {
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
- location: {
775
- type: 'object',
776
- properties: {
777
- geometry: {
778
- type: 'object',
779
- properties: {
780
- type: { type: 'string', enum: ['Point'] },
781
- coordinates: {
782
- type: 'array',
783
- items: { type: 'number' },
784
- minItems: 2,
785
- maxItems: 2,
786
- },
787
- },
788
- required: ['type', 'coordinates'],
789
- additionalProperties: false,
790
- },
791
- precision: { type: 'string' },
792
- },
793
- required: ['geometry'],
794
- additionalProperties: false,
795
- },
796
- },
797
- required: ['street', 'postalCode', 'locality', 'country', 'location'],
798
- additionalProperties: false,
799
- },
800
-
801
- openingSchedule: shop().properties.openingSchedule,
802
- timezone: shop().properties.timezone,
803
- activity: shop().properties.activity,
804
- eco: shop().properties.eco,
805
-
806
- fiscal: {
807
- type: 'object',
808
- properties: {
809
- // ✅ IBAN estándar máximo 34 caracteres
810
- iban: { type: 'string', trim: true, maxLength: 34 },
811
- // ✅ nombreComercial nvarchar(100)
812
- businessName: { type: 'string', trim: true, maxLength: 100 },
813
- // ✅ NIF/CIF español máximo 9 chars, margen para internacionales
814
- nif: { type: 'string', trim: true, maxLength: 20 },
815
- contacts: { type: 'array', items: contact() },
816
- address: {
817
- type: 'object',
818
- properties: {
819
- street: { type: 'string', trim: true, maxLength: 255 },
820
- door: { type: 'string', trim: true, maxLength: 20 },
821
- postalCode: { type: 'string', trim: true, maxLength: 15 },
822
- locality: { type: 'string', trim: true, maxLength: 100 },
823
- country: { type: 'string', trim: true, maxLength: 3 },
824
- },
825
- required: ['street', 'postalCode', 'locality', 'country'],
826
- additionalProperties: false,
827
- },
828
- paymentMethod: { type: 'string', trim: true, maxLength: 50 },
829
- dueDays: { type: 'integer', minimum: 0 },
830
- // ✅ activity varchar(250) en BD relacional
831
- activity: { type: 'string', trim: true, maxLength: 50 },
832
- retention: { type: 'integer' },
833
- },
834
- required: ['contacts', 'address', 'dueDays'],
835
- additionalProperties: false,
836
- },
837
-
838
- nxt: {
839
- type: 'object',
840
- properties: {
841
- // ✅ ParcelShopId varchar(100)
842
- parcelShopId: { type: 'string', maxLength: 100 },
843
- },
844
- required: ['parcelShopId'],
845
- additionalProperties: false,
846
- },
847
-
848
- // ✅ Campos _locker con límites alineados a BD
849
- // Calle varchar(255)
850
- direccion_locker: { type: 'string', trim: true, maxLength: 255 },
851
- // cp varchar(15)
852
- codpostal_locker: { type: 'string', trim: true, maxLength: 15 },
853
- // Poblacion varchar(100)
854
- ciudad_locker: { type: 'string', trim: true, maxLength: 100 },
855
- // ✅ lat/lng float en BD — rango geográfico válido
856
- longitud_locker: {
857
- type: 'number',
858
- minimum: -180,
859
- maximum: 180,
860
- description: 'Fuente de verdad para longitude — sobreescribe address.location.geometry.coordinates[0]',
861
- },
862
- latitud_locker: {
863
- type: 'number',
864
- minimum: -90,
865
- maximum: 90,
866
- description: 'Fuente de verdad para latitude — sobreescribe address.location.geometry.coordinates[1]',
867
- },
868
- // ✅ capacidad razonable como string numérico
869
- capacity_locker: { type: 'string', maxLength: 20 },
870
- access_descript_locker: { type: 'string', trim: true, maxLength: 500 },
718
+ // resto de campos tomados directamente del schema base locker()
719
+ ...pickProperties(locker(), [
720
+ 'status',
721
+ 'name',
722
+ 'address',
723
+ 'openingSchedule',
724
+ 'timezone',
725
+ 'activity',
726
+ 'eco',
727
+ 'fiscal',
728
+ 'nxt',
729
+ 'direccion_locker',
730
+ 'codpostal_locker',
731
+ 'ciudad_locker',
732
+ 'longitud_locker',
733
+ 'latitud_locker',
734
+ 'capacity_locker',
735
+ 'access_descript_locker',
736
+ ]),
871
737
  },
872
738
  required: [
873
739
  'network',
@@ -884,290 +750,82 @@ const createLockerRequest = () =>
884
750
  ],
885
751
  additionalProperties: false,
886
752
  },
887
-
888
- locker: {
889
- title: 'locker',
890
- type: 'object',
891
- properties: {
892
-
893
- provider: {
894
- type: 'object',
895
- properties: {
896
- // ✅ PartnerKey varchar(100)
897
- name: { type: 'string', trim: true, maxLength: 100 },
898
- lockerVersion: { type: 'string', trim: true, maxLength: 20 },
899
- lockerModel: { type: 'string', trim: true, maxLength: 100 },
900
- },
901
- required: ['name'],
902
- additionalProperties: false,
903
- },
904
-
905
- location: {
906
- type: 'object',
907
- properties: {
908
- streetNumber: { type: 'string', trim: true, maxLength: 20 },
909
- // ✅ Calle varchar(255)
910
- street: { type: 'string', trim: true, maxLength: 255 },
911
- // ✅ cp varchar(15)
912
- postalCode: { type: 'string', trim: true, maxLength: 15 },
913
- // ✅ float en BD
914
- lon: { type: 'number', minimum: -180, maximum: 180 },
915
- lat: { type: 'number', minimum: -90, maximum: 90 },
916
- // ✅ ya tenía minLength:2 maxLength:2 — correcto para ISO 3166-1 alpha-2
917
- countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 },
918
- // ✅ Poblacion varchar(100)
919
- city: { type: 'string', trim: true, maxLength: 100 },
920
- },
921
- required: ['street', 'postalCode', 'countryCode', 'city'],
922
- additionalProperties: false,
923
- },
924
-
925
- features: {
926
- type: 'object',
927
- properties: {
928
- hasScreen: { type: 'boolean' },
929
- hasPinPad: { type: 'boolean' },
930
- hasPinBarcodeReader: { type: 'boolean' },
931
- },
932
- additionalProperties: false,
933
- },
934
-
935
- carrier: {
936
- type: 'object',
937
- properties: {
938
- // ✅ Nombre varchar(100)
939
- lockerName: { type: 'string', trim: true, maxLength: 100 },
940
- activationDate: { type: 'string', format: 'date-time' },
941
- // ✅ UUID = 36 chars
942
- lockerId: { type: 'string', maxLength: 36 },
943
- },
944
- required: ['lockerName', 'lockerId'],
945
- additionalProperties: false,
946
- },
947
-
948
- },
949
- required: ['provider', 'location', 'carrier'],
950
- additionalProperties: false,
951
- },
952
-
753
+ locker: lockerNxt(),
953
754
  },
954
755
  required: ['parcelshop', 'locker'],
955
756
  additionalProperties: false,
956
757
  });
957
758
 
958
-
959
759
  const createLockerResponse = () => createResponse(locker());
960
760
 
761
+ // ── updateLockerRequest ───────────────────────────────────────────────────────
762
+ // Mismo patrón que updateShopRequest:
763
+ // - findByStringId() como find (el _id del locker es string numérico, no UUID)
764
+ // - pickProperties(locker(), [...]) con schemaOrNull para el set parcial
765
+ // - setShopRepresentative() / setShopStatus() para representantes y status
766
+ // - lockerNxtUpdate() para el sub-objeto hardware (lockerId no obligatorio)
767
+
961
768
  const updateLockerRequest = () =>
962
769
  updateRequest(
963
- // ── find: busca el locker por su _id (UUID) ──────────────────────────────
964
- findById(),
770
+ // find: _id no es UUID, es string numérico tipo "6237514999"
771
+ findByStringId(),
965
772
 
966
- // ── set: campos actualizables — todos opcionales (patch parcial) ─────────
773
+ // set: todos los campos opcionales (patch parcial)
967
774
  {
968
775
  type: 'object',
969
776
  properties: {
970
- network: schemaOrNull(objectWithUuid()),
971
- zone: schemaOrNull(objectWithUuid()),
972
- openingRepresentative: schemaOrNull(setShopRepresentative()),
777
+ // relaciones y representantes con helpers reutilizados de shop
778
+ network: schemaOrNull(objectWithUuid()),
779
+ zone: schemaOrNull(objectWithUuid()),
780
+ openingRepresentative: schemaOrNull(setShopRepresentative()),
973
781
  managingRepresentative: schemaOrNull(setShopRepresentative()),
974
- status: setShopStatus(),
975
-
976
- // ✅ Nombre varchar(100) — ps_puntos Apolo
977
- name: schemaOrNull({ type: 'string', trim: true, maxLength: 100 }),
782
+ status: setShopStatus(),
783
+
784
+ // campos actualizables del schema base locker() — todos con schemaOrNull
785
+ ...Object.fromEntries(
786
+ Object.entries(
787
+ pickProperties(locker(), [
788
+ 'name',
789
+ 'address',
790
+ 'openingSchedule',
791
+ 'timezone',
792
+ 'activity',
793
+ 'eco',
794
+ 'fiscal',
795
+ 'nxt',
796
+ 'direccion_locker',
797
+ 'codpostal_locker',
798
+ 'ciudad_locker',
799
+ 'longitud_locker',
800
+ 'latitud_locker',
801
+ 'capacity_locker',
802
+ 'access_descript_locker',
803
+ ])
804
+ ).map(([key, schema]) => [key, schemaOrNull(schema)])
805
+ ),
978
806
 
979
- address: schemaOrNull({
980
- type: 'object',
981
- properties: {
982
- // ✅ Calle varchar(255) — ps_puntos Apolo
983
- street: { type: 'string', trim: true, maxLength: 255 },
984
- door: { type: 'string', trim: true, maxLength: 20 },
985
- // ✅ cp varchar(15) — ps_puntos Apolo
986
- postalCode: { type: 'string', trim: true, maxLength: 15 },
987
- // ✅ Poblacion varchar(100) — ps_puntos Apolo
988
- locality: { type: 'string', trim: true, maxLength: 100 },
989
- // ✅ ISO 3166-1 alpha-2
990
- country: { type: 'string', trim: true, maxLength: 3 },
991
- access_descript_locker: { type: 'string', trim: true, maxLength: 500 },
992
- location: {
993
- type: 'object',
994
- properties: {
995
- geometry: {
996
- type: 'object',
997
- properties: {
998
- type: { type: 'string', enum: ['Point'] },
999
- coordinates: {
1000
- type: 'array',
1001
- items: { type: 'number' },
1002
- minItems: 2,
1003
- maxItems: 2,
1004
- },
1005
- },
1006
- required: ['type', 'coordinates'],
1007
- additionalProperties: false,
1008
- },
1009
- precision: { type: 'string' },
1010
- },
1011
- required: ['geometry'],
1012
- additionalProperties: false,
1013
- },
1014
- },
1015
- required: ['street', 'postalCode', 'locality', 'country', 'location'],
1016
- additionalProperties: false,
1017
- }),
807
+ // capabilities: array, no nullable — va sin schemaOrNull
1018
808
  capabilities: {
1019
809
  type: 'array',
1020
810
  items: { type: 'string', enum: ['deliver', 'pickup', 'sell', 'sellplus'] },
1021
811
  uniqueItems: true,
1022
812
  },
1023
- openingSchedule: schemaOrNull(shop().properties.openingSchedule),
1024
- timezone: schemaOrNull(shop().properties.timezone),
1025
- activity: schemaOrNull(shop().properties.activity),
1026
- eco: schemaOrNull(shop().properties.eco),
1027
-
1028
- fiscal: schemaOrNull({
1029
- type: 'object',
1030
- properties: {
1031
- // ✅ IBAN estándar 34 chars
1032
- iban: { type: 'string', trim: true, maxLength: 34 },
1033
- // ✅ nombreComercial nvarchar(100) — ps_puntos Apolo
1034
- businessName: { type: 'string', trim: true, maxLength: 100 },
1035
- // ✅ NIF/CIF máximo 20 chars
1036
- nif: { type: 'string', trim: true, maxLength: 20 },
1037
- contacts: { type: 'array', items: contact() },
1038
- address: {
1039
- type: 'object',
1040
- properties: {
1041
- street: { type: 'string', trim: true, maxLength: 255 },
1042
- door: { type: 'string', trim: true, maxLength: 20 },
1043
- postalCode: { type: 'string', trim: true, maxLength: 15 },
1044
- locality: { type: 'string', trim: true, maxLength: 100 },
1045
- country: { type: 'string', trim: true, maxLength: 3 },
1046
- },
1047
- required: ['street', 'postalCode', 'locality', 'country'],
1048
- additionalProperties: false,
1049
- },
1050
- paymentMethod: { type: 'string', trim: true, maxLength: 50 },
1051
- dueDays: { type: 'integer', minimum: 0 },
1052
- activity: { type: 'string', trim: true, maxLength: 50 },
1053
- retention: { type: 'integer' },
1054
- },
1055
- // iban y nif fuera de required
1056
- required: ['contacts', 'address', 'dueDays'],
1057
- additionalProperties: false,
1058
- }),
1059
-
1060
- nxt: schemaOrNull({
1061
- type: 'object',
1062
- properties: {
1063
- // ✅ ParcelShopId varchar(100) — ps_puntos Apolo
1064
- parcelShopId: { type: 'string', maxLength: 100 },
1065
- },
1066
- required: ['parcelShopId'],
1067
- additionalProperties: false,
1068
- }),
1069
-
1070
- // ✅ Campos _locker — fuente de verdad para coordenadas y dirección
1071
- // Calle varchar(255) — ps_puntos Apolo
1072
- direccion_locker: schemaOrNull({ type: 'string', trim: true, maxLength: 255 }),
1073
- // cp varchar(15) — ps_puntos Apolo
1074
- codpostal_locker: schemaOrNull({ type: 'string', trim: true, maxLength: 15 }),
1075
- // Poblacion varchar(100) — ps_puntos Apolo
1076
- ciudad_locker: schemaOrNull({ type: 'string', trim: true, maxLength: 100 }),
1077
- // ✅ float — rango geográfico válido, ps_puntos Apolo
1078
- longitud_locker: schemaOrNull({
1079
- type: 'number',
1080
- minimum: -180,
1081
- maximum: 180,
1082
- description: 'Fuente de verdad para longitude — sobreescribe address.location.geometry.coordinates[0]',
1083
- }),
1084
- latitud_locker: schemaOrNull({
1085
- type: 'number',
1086
- minimum: -90,
1087
- maximum: 90,
1088
- description: 'Fuente de verdad para latitude — sobreescribe address.location.geometry.coordinates[1]',
1089
- }),
1090
- capacity_locker: schemaOrNull({ type: 'string', maxLength: 20 }),
1091
- access_descript_locker: schemaOrNull({ type: 'string', trim: true, maxLength: 500 }),
1092
-
1093
- // ── Objeto locker (NXT) ──────────────────────────────────────────────
1094
- locker: schemaOrNull({
1095
- title: 'locker',
1096
- type: 'object',
1097
- properties: {
1098
-
1099
- provider: {
1100
- type: 'object',
1101
- properties: {
1102
- // ✅ PartnerKey varchar(100) — ps_puntos Apolo
1103
- name: { type: 'string', trim: true, maxLength: 100 },
1104
- lockerVersion: { type: 'string', trim: true, maxLength: 20 },
1105
- lockerModel: { type: 'string', trim: true, maxLength: 100 },
1106
- },
1107
- required: ['name'],
1108
- additionalProperties: false,
1109
- },
1110
-
1111
- location: {
1112
- type: 'object',
1113
- properties: {
1114
- streetNumber: { type: 'string', trim: true, maxLength: 20 },
1115
- // ✅ Calle varchar(255) — ps_puntos Apolo
1116
- street: { type: 'string', trim: true, maxLength: 255 },
1117
- // ✅ cp varchar(15) — ps_puntos Apolo
1118
- postalCode: { type: 'string', trim: true, maxLength: 15 },
1119
- // ✅ float — rango geográfico válido
1120
- lon: { type: 'number', minimum: -180, maximum: 180 },
1121
- lat: { type: 'number', minimum: -90, maximum: 90 },
1122
- // ✅ ISO 3166-1 alpha-2 — minLength/maxLength: 2
1123
- countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 },
1124
- // ✅ Poblacion varchar(100) — ps_puntos Apolo
1125
- city: { type: 'string', trim: true, maxLength: 100 },
1126
- },
1127
- required: ['street', 'postalCode', 'countryCode', 'city'],
1128
- additionalProperties: false,
1129
- },
1130
-
1131
- features: {
1132
- type: 'object',
1133
- properties: {
1134
- hasScreen: { type: 'boolean' },
1135
- hasPinPad: { type: 'boolean' },
1136
- hasPinBarcodeReader: { type: 'boolean' },
1137
- },
1138
- additionalProperties: false,
1139
- },
1140
-
1141
- carrier: {
1142
- type: 'object',
1143
- properties: {
1144
- // ✅ Nombre varchar(100) — ps_puntos Apolo
1145
- lockerName: { type: 'string', trim: true, maxLength: 100 },
1146
- activationDate: { type: 'string', format: 'date-time' },
1147
- // [6] lockerId fuera de required — el body real de updateLocker no lo envía
1148
- lockerId: { type: 'string', maxLength: 36 },
1149
- },
1150
- required: ['lockerName'],
1151
- additionalProperties: false,
1152
- },
1153
-
1154
- },
1155
- required: ['provider', 'location', 'carrier'],
1156
- additionalProperties: false,
1157
- }),
1158
813
 
814
+ // sub-objeto hardware NXT con variante update (lockerId no obligatorio)
815
+ locker: schemaOrNull(lockerNxtUpdate()),
1159
816
  },
1160
- minProperties: 0, // permite updates parciales — ningún campo es obligatorio en el set
817
+ minProperties: 0, // permite updates parciales — ningún campo es obligatorio en el set
1161
818
  additionalProperties: false,
1162
819
  },
1163
820
  );
1164
821
 
1165
822
  const updateLockerResponse = () => updateResponse(locker());
1166
823
 
1167
-
1168
824
  module.exports = {
1169
825
  shop,
1170
826
  locker,
827
+ lockerNxt,
828
+ lockerNxtUpdate,
1171
829
  objectWithShopId,
1172
830
  createShopRequest,
1173
831
  createShopResponse,
@@ -1184,4 +842,4 @@ module.exports = {
1184
842
  createLockerResponse,
1185
843
  updateLockerRequest,
1186
844
  updateLockerResponse,
1187
- };
845
+ };