@gls_spain/gps-common 32.0.3 → 32.1.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.
@@ -2,8 +2,9 @@
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
4
  <list default="true" id="c2833e40-3178-44f3-9bc5-203849985c7f" name="Default Changelist" comment="">
5
- <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
6
5
  <change beforePath="$PROJECT_DIR$/open-api-spec/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/open-api-spec/index.js" afterDir="false" />
6
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/expeditions.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/expeditions.js" afterDir="false" />
7
+ <change beforePath="$PROJECT_DIR$/schemas/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/index.js" afterDir="false" />
7
8
  </list>
8
9
  <option name="SHOW_DIALOG" value="false" />
9
10
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -122,8 +123,8 @@
122
123
  </configuration>
123
124
  <recent_temporary>
124
125
  <list>
125
- <item itemvalue="JavaScript Debug.documentation.html (1)" />
126
126
  <item itemvalue="npm.build-documentation" />
127
+ <item itemvalue="JavaScript Debug.documentation.html (1)" />
127
128
  <item itemvalue="npm.test" />
128
129
  <item itemvalue="Jest.index.test.js" />
129
130
  <item itemvalue="Jest.#errors" />
@@ -548,7 +549,12 @@
548
549
  <workItem from="1586074623503" duration="583000" />
549
550
  <workItem from="1586187589788" duration="2393000" />
550
551
  <workItem from="1586338496466" duration="17000" />
551
- <workItem from="1587155562828" duration="428000" />
552
+ <workItem from="1587155562828" duration="643000" />
553
+ <workItem from="1587566126161" duration="142000" />
554
+ <workItem from="1587569584217" duration="5000" />
555
+ <workItem from="1588001875839" duration="425000" />
556
+ <workItem from="1588014009601" duration="1578000" />
557
+ <workItem from="1588016472441" duration="409000" />
552
558
  </task>
553
559
  <servers />
554
560
  </component>
@@ -595,30 +601,26 @@
595
601
  <screen x="0" y="23" width="2048" height="1129" />
596
602
  </state>
597
603
  <state x="762" y="341" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1584283363756" />
598
- <state x="100" y="123" width="1848" height="929" key="DiffContextDialog" timestamp="1579112408515">
599
- <screen x="0" y="23" width="2048" height="1129" />
600
- </state>
601
- <state x="100" y="123" width="1848" height="929" key="DiffContextDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1579112408515" />
602
604
  <state x="606" y="280" key="EditFileWatcherDialog" timestamp="1580283934403">
603
605
  <screen x="0" y="23" width="2048" height="1129" />
604
606
  </state>
605
607
  <state x="606" y="280" key="EditFileWatcherDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1580283934403" />
606
- <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1585769591024">
608
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1588016102260">
607
609
  <screen x="0" y="23" width="2048" height="1129" />
608
610
  </state>
609
- <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1585769591024" />
610
- <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1585769591023">
611
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1588016102260" />
612
+ <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1588016102260">
611
613
  <screen x="0" y="23" width="2048" height="1129" />
612
614
  </state>
613
- <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1585769591023" />
614
- <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1585769591023">
615
+ <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1588016102260" />
616
+ <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1588016102260">
615
617
  <screen x="0" y="23" width="2048" height="1129" />
616
618
  </state>
617
- <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1585769591023" />
618
- <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1585769591024">
619
+ <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1588016102260" />
620
+ <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1588016102260">
619
621
  <screen x="0" y="23" width="2048" height="1129" />
620
622
  </state>
621
- <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1585769591024" />
623
+ <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1588016102260" />
622
624
  <state x="0" y="23" width="2048" height="1129" key="SettingsEditor" timestamp="1580283935326">
623
625
  <screen x="0" y="23" width="2048" height="1129" />
624
626
  </state>
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [32.1.1](https://github.com/GLS-Spain/gps-common/compare/v32.1.0...v32.1.1) (2020-04-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * split find expeditions between network admins and shop users ([299e03c](https://github.com/GLS-Spain/gps-common/commit/299e03cad70be83123c5d5f710eff02a46e68e0e))
7
+
8
+ # [32.1.0](https://github.com/GLS-Spain/gps-common/compare/v32.0.3...v32.1.0) (2020-04-27)
9
+
10
+
11
+ ### Features
12
+
13
+ * add find expeditions by shop and types and status ([7f6d137](https://github.com/GLS-Spain/gps-common/commit/7f6d13773419f5aa215435646d0862cd0a4cb7e7))
14
+
1
15
  ## [32.0.3](https://github.com/GLS-Spain/gps-common/compare/v32.0.2...v32.0.3) (2020-04-17)
2
16
 
3
17
 
@@ -102,7 +102,8 @@ const {
102
102
  createExpeditionRequest,
103
103
  createExpeditionResponse,
104
104
  findExpeditionsSuperAdminRequest,
105
- findExpeditionsNetworkAdminAndShopUserRequest,
105
+ findExpeditionsNetworkAdminRequest,
106
+ findExpeditionsShopUserRequest,
106
107
  findExpeditionsResponse,
107
108
  updateExpeditionRequest,
108
109
  updateExpeditionResponse,
@@ -2543,19 +2544,53 @@ ${securitySchemes.anyRole}`,
2543
2544
  '/expeditions/find ': {
2544
2545
  post: {
2545
2546
  tags: ['Expeditions'],
2546
- summary: '[NU] Find',
2547
+ summary: '[N] Find',
2548
+ description: `
2549
+ Finds expeditions by one of several filters.
2550
+
2551
+ ${descriptions.findLimitTip}
2552
+
2553
+ The results will be limited to the network the admin belongs to, so for example if he finds by \`_id\` and the expedition is from another
2554
+ network, the find will return no results.
2555
+
2556
+ ${securitySchemes.tokens}
2557
+ ${securitySchemes.anyRole}`,
2558
+ requestBody: {
2559
+ content: { 'application/json': { schema: findExpeditionsNetworkAdminRequest() } },
2560
+ required: true,
2561
+ },
2562
+ responses: {
2563
+ ' 200': {
2564
+ description: 'Contains the found expeditions.',
2565
+ content: { 'application/json': { schema: findExpeditionsResponse() } },
2566
+ },
2567
+ ' 400': responses.badRequest,
2568
+ ' 401': responses.invalidUserInCookieOrHeader,
2569
+ ' 401 ': responses.invalidCookieOrHeader,
2570
+ ' 401 ': responses.missingCookieOrHeader,
2571
+ ' 401 ': responses.unauthorized,
2572
+ ' 403': responses.forbidden,
2573
+ ' 415': responses.unsupportedMediaType,
2574
+ ' 500': responses.internalServerError,
2575
+ },
2576
+ },
2577
+ },
2578
+ '/expeditions/find ': {
2579
+ post: {
2580
+ tags: ['Expeditions'],
2581
+ summary: '[U] Find',
2547
2582
  description: `
2548
2583
  Finds expeditions by one of several filters.
2549
2584
 
2550
2585
  ${descriptions.findLimitTip}
2551
2586
 
2552
- Both roles can find by the same filters but the results will be limited to their network or shop, so for example if a shop user finds
2553
- by \`_id\` and the expedition is from another network or shop, the find will return no results.
2587
+ The results will be limited to the shop the user belongs to, so for example if he finds by \`_id\` and the expedition is from another
2588
+ network or shop, the find will return no results.
2554
2589
 
2555
2590
  ${securitySchemes.tokens}
2556
2591
  ${securitySchemes.anyRole}`,
2557
2592
  requestBody: {
2558
- content: { 'application/json': { schema: findExpeditionsNetworkAdminAndShopUserRequest() } },
2593
+ content: { 'application/json': { schema: findExpeditionsShopUserRequest() } },
2559
2594
  required: true,
2560
2595
  },
2561
2596
  responses: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "32.0.3",
3
+ "version": "32.1.1",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -408,6 +408,35 @@ const findByStatus = () => ({
408
408
  additionalProperties: false,
409
409
  });
410
410
 
411
+ const findByShopAndTypesAndStatus = () =>
412
+ mergeSchemas(findByShop(), {
413
+ title: 'find by shop and types and status',
414
+ type: 'object',
415
+ properties: {
416
+ typesAndStatus: {
417
+ type: 'array',
418
+ items: {
419
+ type: 'object',
420
+ properties: {
421
+ type: expedition().properties.type,
422
+ status: {
423
+ type: 'object',
424
+ properties: { code: expedition().properties.status.properties.code },
425
+ required: ['code'],
426
+ additionalProperties: false,
427
+ },
428
+ },
429
+ required: ['type', 'status'],
430
+ additionalProperties: false,
431
+ },
432
+ uniqueItems: true,
433
+ minItems: 1,
434
+ },
435
+ },
436
+ required: ['typesAndStatus'],
437
+ additionalProperties: false,
438
+ });
439
+
411
440
  const findByShopAndStatus = () => mergeSchemas(findByShop(), findByStatus(), { title: 'find by shop and status' });
412
441
 
413
442
  const findByNoShopAndStatus = () => mergeSchemas(findByNoShop(), findByStatus(), { title: 'find by no shop and status' });
@@ -445,9 +474,22 @@ const findExpeditionsSuperAdminRequest = () =>
445
474
  ],
446
475
  });
447
476
 
448
- const findExpeditionsNetworkAdminAndShopUserRequest = () =>
477
+ const findExpeditionsNetworkAdminRequest = () =>
449
478
  findRequest({ oneOf: [findById(), findByShop(), findByShopAndStatus(), findByNoShop(), findByNoShopAndStatus(), findByCode()] });
450
479
 
480
+ const findExpeditionsShopUserRequest = () =>
481
+ findRequest({
482
+ oneOf: [
483
+ findById(),
484
+ findByShop(),
485
+ findByShopAndStatus(),
486
+ findByShopAndTypesAndStatus(),
487
+ findByNoShop(),
488
+ findByNoShopAndStatus(),
489
+ findByCode(),
490
+ ],
491
+ });
492
+
451
493
  const findExpeditionsResponse = () => findResponse(expedition());
452
494
 
453
495
  const updateExpeditionRequest = () =>
@@ -689,7 +731,8 @@ module.exports = {
689
731
  createExpeditionRequest,
690
732
  createExpeditionResponse,
691
733
  findExpeditionsSuperAdminRequest,
692
- findExpeditionsNetworkAdminAndShopUserRequest,
734
+ findExpeditionsNetworkAdminRequest,
735
+ findExpeditionsShopUserRequest,
693
736
  findExpeditionsResponse,
694
737
  updateExpeditionRequest,
695
738
  updateExpeditionResponse,
package/schemas/index.js CHANGED
@@ -59,7 +59,8 @@ const {
59
59
  createExpeditionRequest,
60
60
  createExpeditionResponse,
61
61
  findExpeditionsSuperAdminRequest,
62
- findExpeditionsNetworkAdminAndShopUserRequest,
62
+ findExpeditionsNetworkAdminRequest,
63
+ findExpeditionsShopUserRequest,
63
64
  findExpeditionsResponse,
64
65
  updateExpeditionRequest,
65
66
  updateExpeditionResponse,
@@ -176,10 +177,8 @@ const shopUsersDeleteResponse = response(deleteShopUserResponse(), 'shopUsersDel
176
177
  const expeditionsCreateRequest = request(createExpeditionRequest(), 'expeditionsCreateRequest');
177
178
  const expeditionsCreateResponse = response(createExpeditionResponse(), 'expeditionsCreateResponse');
178
179
  const expeditionsFindSuperAdminRequest = request(findExpeditionsSuperAdminRequest(), 'expeditionsFindSuperAdminRequest');
179
- const expeditionsFindNetworkAdminAndShopUserRequest = request(
180
- findExpeditionsNetworkAdminAndShopUserRequest(),
181
- 'expeditionsFindNetworkAdminAndShopUserRequest',
182
- );
180
+ const expeditionsFindNetworkAdminRequest = request(findExpeditionsNetworkAdminRequest(), 'expeditionsFindNetworkAdminRequest');
181
+ const expeditionsFindShopUserRequest = request(findExpeditionsShopUserRequest(), 'expeditionsFindShopUserRequest');
183
182
  const expeditionsFindResponse = response(findExpeditionsResponse(), 'expeditionsFindResponse');
184
183
  const expeditionsUpdateRequest = request(updateExpeditionRequest(), 'expeditionsUpdateRequest');
185
184
  const expeditionsUpdateResponse = response(updateExpeditionResponse(), 'expeditionsUpdateResponse');
@@ -295,7 +294,8 @@ module.exports = {
295
294
  expeditionsCreateRequest,
296
295
  expeditionsCreateResponse,
297
296
  expeditionsFindSuperAdminRequest,
298
- expeditionsFindNetworkAdminAndShopUserRequest,
297
+ expeditionsFindNetworkAdminRequest,
298
+ expeditionsFindShopUserRequest,
299
299
  expeditionsFindResponse,
300
300
  expeditionsUpdateRequest,
301
301
  expeditionsUpdateResponse,