@gls_spain/gps-common 32.1.0 → 32.2.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.
@@ -2,7 +2,7 @@
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$/schemas/definitions/expeditions.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/expeditions.js" afterDir="false" />
5
+ <change beforePath="$PROJECT_DIR$/schemas/definitions/shops.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/shops.js" afterDir="false" />
6
6
  </list>
7
7
  <option name="SHOW_DIALOG" value="false" />
8
8
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -121,8 +121,8 @@
121
121
  </configuration>
122
122
  <recent_temporary>
123
123
  <list>
124
- <item itemvalue="npm.build-documentation" />
125
124
  <item itemvalue="JavaScript Debug.documentation.html (1)" />
125
+ <item itemvalue="npm.build-documentation" />
126
126
  <item itemvalue="npm.test" />
127
127
  <item itemvalue="Jest.index.test.js" />
128
128
  <item itemvalue="Jest.#errors" />
@@ -551,7 +551,13 @@
551
551
  <workItem from="1587566126161" duration="142000" />
552
552
  <workItem from="1587569584217" duration="5000" />
553
553
  <workItem from="1588001875839" duration="425000" />
554
- <workItem from="1588014009601" duration="1351000" />
554
+ <workItem from="1588014009601" duration="1578000" />
555
+ <workItem from="1588016472441" duration="477000" />
556
+ <workItem from="1588613126613" duration="538000" />
557
+ <workItem from="1588661146603" duration="148000" />
558
+ <workItem from="1589785291101" duration="1725000" />
559
+ <workItem from="1589830264435" duration="1000" />
560
+ <workItem from="1591786805051" duration="676000" />
555
561
  </task>
556
562
  <servers />
557
563
  </component>
@@ -602,22 +608,22 @@
602
608
  <screen x="0" y="23" width="2048" height="1129" />
603
609
  </state>
604
610
  <state x="606" y="280" key="EditFileWatcherDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1580283934403" />
605
- <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1588016053665">
611
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1588016801036">
606
612
  <screen x="0" y="23" width="2048" height="1129" />
607
613
  </state>
608
- <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1588016053665" />
609
- <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1588016053665">
614
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1588016801036" />
615
+ <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1588016801036">
610
616
  <screen x="0" y="23" width="2048" height="1129" />
611
617
  </state>
612
- <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1588016053665" />
613
- <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1588016053665">
618
+ <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1588016801036" />
619
+ <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1588016801036">
614
620
  <screen x="0" y="23" width="2048" height="1129" />
615
621
  </state>
616
- <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1588016053665" />
617
- <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1588016053665">
622
+ <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1588016801036" />
623
+ <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1588016801036">
618
624
  <screen x="0" y="23" width="2048" height="1129" />
619
625
  </state>
620
- <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1588016053665" />
626
+ <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1588016801036" />
621
627
  <state x="0" y="23" width="2048" height="1129" key="SettingsEditor" timestamp="1580283935326">
622
628
  <screen x="0" y="23" width="2048" height="1129" />
623
629
  </state>
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [32.2.0](https://github.com/GLS-Spain/gps-common/compare/v32.1.1...v32.2.0) (2020-06-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * add activity to shops ([7d9d73e](https://github.com/GLS-Spain/gps-common/commit/7d9d73e37276ea4565839e75466bfe3dd025b14c)), closes [#GPS-369](https://github.com/GLS-Spain/gps-common/issues/GPS-369)
7
+
8
+ ## [32.1.1](https://github.com/GLS-Spain/gps-common/compare/v32.1.0...v32.1.1) (2020-04-27)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * split find expeditions between network admins and shop users ([299e03c](https://github.com/GLS-Spain/gps-common/commit/299e03cad70be83123c5d5f710eff02a46e68e0e))
14
+
1
15
  # [32.1.0](https://github.com/GLS-Spain/gps-common/compare/v32.0.3...v32.1.0) (2020-04-27)
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.1.0",
3
+ "version": "32.2.0",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -474,7 +474,10 @@ const findExpeditionsSuperAdminRequest = () =>
474
474
  ],
475
475
  });
476
476
 
477
- const findExpeditionsNetworkAdminAndShopUserRequest = () =>
477
+ const findExpeditionsNetworkAdminRequest = () =>
478
+ findRequest({ oneOf: [findById(), findByShop(), findByShopAndStatus(), findByNoShop(), findByNoShopAndStatus(), findByCode()] });
479
+
480
+ const findExpeditionsShopUserRequest = () =>
478
481
  findRequest({
479
482
  oneOf: [
480
483
  findById(),
@@ -728,7 +731,8 @@ module.exports = {
728
731
  createExpeditionRequest,
729
732
  createExpeditionResponse,
730
733
  findExpeditionsSuperAdminRequest,
731
- findExpeditionsNetworkAdminAndShopUserRequest,
734
+ findExpeditionsNetworkAdminRequest,
735
+ findExpeditionsShopUserRequest,
732
736
  findExpeditionsResponse,
733
737
  updateExpeditionRequest,
734
738
  updateExpeditionResponse,
@@ -84,6 +84,41 @@ const shopRepresentative = () => ({
84
84
  additionalProperties: false,
85
85
  });
86
86
 
87
+ const shopActivity = () => ({
88
+ type: 'string',
89
+ enum: [
90
+ 'bookshop',
91
+ 'press',
92
+ 'bazaar',
93
+ 'telecom',
94
+ 'mobileAccessories',
95
+ 'inkSupplies',
96
+ 'computer',
97
+ 'optics',
98
+ 'pharmacy',
99
+ 'food',
100
+ 'hardware',
101
+ 'tobacco',
102
+ 'lottery',
103
+ 'clothing',
104
+ 'barberShop',
105
+ 'bar',
106
+ 'appliances',
107
+ 'repairShop',
108
+ 'gasStation',
109
+ 'realState',
110
+ 'travelAgency',
111
+ 'legal',
112
+ 'academy',
113
+ 'sportsShop',
114
+ 'gardenAndPets',
115
+ 'photos',
116
+ 'jewelryStore',
117
+ 'shoeShop',
118
+ 'other',
119
+ ],
120
+ });
121
+
87
122
  const shop = () => ({
88
123
  title: 'shop',
89
124
  type: 'object',
@@ -152,6 +187,7 @@ const shop = () => ({
152
187
  items: contact(),
153
188
  },
154
189
  fiscal: fiscal(),
190
+ activity: shopActivity(),
155
191
  notes: { type: 'string', trim: true },
156
192
  derivationSettings: derivationSettings(),
157
193
  expirationSettings: expirationSettings(),
@@ -215,6 +251,7 @@ const createShopRequest = () =>
215
251
  'timezone',
216
252
  'contacts',
217
253
  'fiscal',
254
+ 'activity',
218
255
  'notes',
219
256
  'derivationSettings',
220
257
  'expirationSettings',
@@ -320,7 +357,7 @@ const updateShopRequest = () =>
320
357
  ...pickProperties(
321
358
  shop(),
322
359
  ['name', 'address', 'capabilities', 'openingSchedule', 'contacts'],
323
- ['fiscal', 'notes', 'derivationSettings', 'expirationSettings'],
360
+ ['fiscal', 'activity', 'notes', 'derivationSettings', 'expirationSettings'],
324
361
  ),
325
362
  },
326
363
  minProperties: 1,
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,