@gls_spain/gps-common 34.2.0 → 34.3.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.
- package/.idea/workspace.xml +20 -20
- package/CHANGELOG.md +7 -0
- package/errors/ShopCannotSellError.js +11 -0
- package/errors/index.js +3 -0
- package/open-api-spec/index.js +10 -1
- package/package.json +1 -1
- package/schemas/definitions/shops.js +1 -1
package/.idea/workspace.xml
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
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 afterPath="$PROJECT_DIR$/errors/ShopCannotSellError.js" afterDir="false" />
|
|
6
|
+
<change beforePath="$PROJECT_DIR$/errors/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/index.js" afterDir="false" />
|
|
5
7
|
<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$/
|
|
7
|
-
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/schemas/definitions/sales.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/sales.js" afterDir="false" />
|
|
9
|
-
<change beforePath="$PROJECT_DIR$/schemas/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/index.js" afterDir="false" />
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/schemas/definitions/shops.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/shops.js" afterDir="false" />
|
|
10
9
|
</list>
|
|
11
10
|
<option name="SHOW_DIALOG" value="false" />
|
|
12
11
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -65,13 +64,6 @@
|
|
|
65
64
|
<property name="vue.rearranger.settings.migration" value="true" />
|
|
66
65
|
</component>
|
|
67
66
|
<component name="RecentsManager">
|
|
68
|
-
<key name="CopyFile.RECENT_KEYS">
|
|
69
|
-
<recent name="$PROJECT_DIR$/errors" />
|
|
70
|
-
<recent name="$PROJECT_DIR$/schemas/definitions" />
|
|
71
|
-
<recent name="$PROJECT_DIR$" />
|
|
72
|
-
<recent name="$PROJECT_DIR$/schemas" />
|
|
73
|
-
<recent name="$PROJECT_DIR$/lib/scripts" />
|
|
74
|
-
</key>
|
|
75
67
|
<key name="MoveFile.RECENT_KEYS">
|
|
76
68
|
<recent name="$PROJECT_DIR$/open-api" />
|
|
77
69
|
<recent name="$PROJECT_DIR$" />
|
|
@@ -79,6 +71,13 @@
|
|
|
79
71
|
<recent name="$PROJECT_DIR$/open-api-spec" />
|
|
80
72
|
<recent name="$PROJECT_DIR$/errors" />
|
|
81
73
|
</key>
|
|
74
|
+
<key name="CopyFile.RECENT_KEYS">
|
|
75
|
+
<recent name="$PROJECT_DIR$/errors" />
|
|
76
|
+
<recent name="$PROJECT_DIR$/schemas/definitions" />
|
|
77
|
+
<recent name="$PROJECT_DIR$" />
|
|
78
|
+
<recent name="$PROJECT_DIR$/schemas" />
|
|
79
|
+
<recent name="$PROJECT_DIR$/lib/scripts" />
|
|
80
|
+
</key>
|
|
82
81
|
</component>
|
|
83
82
|
<component name="RunManager" selected="JavaScript Debug.documentation.html (1)">
|
|
84
83
|
<configuration name="documentation.html (1)" type="JavascriptDebugType" temporary="true" nameIsGenerated="true" uri="http://localhost:63342/gps-common/build/documentation/documentation.html" useBuiltInWebServerPort="true">
|
|
@@ -625,7 +624,8 @@
|
|
|
625
624
|
<workItem from="1599574256014" duration="436000" />
|
|
626
625
|
<workItem from="1599675057970" duration="1442000" />
|
|
627
626
|
<workItem from="1599722212402" duration="763000" />
|
|
628
|
-
<workItem from="1600358026541" duration="
|
|
627
|
+
<workItem from="1600358026541" duration="773000" />
|
|
628
|
+
<workItem from="1600676045368" duration="641000" />
|
|
629
629
|
</task>
|
|
630
630
|
<servers />
|
|
631
631
|
</component>
|
|
@@ -668,22 +668,22 @@
|
|
|
668
668
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
669
669
|
</state>
|
|
670
670
|
<state x="762" y="341" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1595577705727" />
|
|
671
|
-
<state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="
|
|
671
|
+
<state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1600358643265">
|
|
672
672
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
673
673
|
</state>
|
|
674
|
-
<state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
675
|
-
<state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="
|
|
674
|
+
<state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1600358643265" />
|
|
675
|
+
<state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1600358643265">
|
|
676
676
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
677
677
|
</state>
|
|
678
|
-
<state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
679
|
-
<state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="
|
|
678
|
+
<state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1600358643265" />
|
|
679
|
+
<state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1600358643265">
|
|
680
680
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
681
681
|
</state>
|
|
682
|
-
<state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
683
|
-
<state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="
|
|
682
|
+
<state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1600358643265" />
|
|
683
|
+
<state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1600358643265">
|
|
684
684
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
685
685
|
</state>
|
|
686
|
-
<state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
686
|
+
<state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1600358643265" />
|
|
687
687
|
<state x="725" y="342" width="736" height="612" key="find.popup" timestamp="1598206991663">
|
|
688
688
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
689
689
|
</state>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [34.3.0](https://github.com/GLS-Spain/gps-common/compare/v34.2.0...v34.3.0) (2020-09-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add sell capability to shops and allow only shops with it to create sales ([74f9c41](https://github.com/GLS-Spain/gps-common/commit/74f9c415ed6b8e3c17d891a1c2c25e16193f2328))
|
|
7
|
+
|
|
1
8
|
# [34.2.0](https://github.com/GLS-Spain/gps-common/compare/v34.1.1...v34.2.0) (2020-09-17)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { DatabaseError } = require('@gls_spain/mongodb');
|
|
2
|
+
|
|
3
|
+
class ShopCannotSellError extends DatabaseError {
|
|
4
|
+
constructor(message = 'Shop cannot sell.') {
|
|
5
|
+
// noinspection JSCheckFunctionSignatures
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'ShopCannotSellError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = ShopCannotSellError;
|
package/errors/index.js
CHANGED
|
@@ -12,6 +12,7 @@ const ShopDoesNotExistError = require('./ShopDoesNotExistError');
|
|
|
12
12
|
const ShopAlreadyExistsError = require('./ShopAlreadyExistsError');
|
|
13
13
|
const ShopCannotBeUpdatedError = require('./ShopCannotBeUpdatedError');
|
|
14
14
|
const ShopCannotBeDeletedError = require('./ShopCannotBeDeletedError');
|
|
15
|
+
const ShopCannotSellError = require('./ShopCannotSellError');
|
|
15
16
|
const ShopNotEnabledError = require('./ShopNotEnabledError');
|
|
16
17
|
const WrongShopError = require('./WrongShopError');
|
|
17
18
|
const WrongPasswordError = require('./WrongPasswordError');
|
|
@@ -47,6 +48,7 @@ const errorsNames = {
|
|
|
47
48
|
ShopAlreadyExistsError: 'ShopAlreadyExistsError',
|
|
48
49
|
ShopCannotBeUpdatedError: 'ShopCannotBeUpdatedError',
|
|
49
50
|
ShopCannotBeDeletedError: 'ShopCannotBeDeletedError',
|
|
51
|
+
ShopCannotSellError: 'ShopCannotSellError',
|
|
50
52
|
ShopNotEnabledError: 'ShopNotEnabledError',
|
|
51
53
|
WrongShopError: 'WrongShopError',
|
|
52
54
|
WrongPasswordError: 'WrongPasswordError',
|
|
@@ -83,6 +85,7 @@ module.exports = {
|
|
|
83
85
|
ShopAlreadyExistsError,
|
|
84
86
|
ShopCannotBeUpdatedError,
|
|
85
87
|
ShopCannotBeDeletedError,
|
|
88
|
+
ShopCannotSellError,
|
|
86
89
|
ShopNotEnabledError,
|
|
87
90
|
WrongShopError,
|
|
88
91
|
WrongPasswordError,
|
package/open-api-spec/index.js
CHANGED
|
@@ -24,6 +24,7 @@ const {
|
|
|
24
24
|
ShopAlreadyExistsError,
|
|
25
25
|
ShopCannotBeUpdatedError,
|
|
26
26
|
ShopCannotBeDeletedError,
|
|
27
|
+
ShopCannotSellError,
|
|
27
28
|
ShopNotEnabledError,
|
|
28
29
|
WrongPasswordError,
|
|
29
30
|
ExpeditionDoesNotExistError,
|
|
@@ -887,6 +888,7 @@ const errors = {
|
|
|
887
888
|
shopAlreadyExists: new ShopAlreadyExistsError(),
|
|
888
889
|
shopCannotBeUpdated: new ShopCannotBeUpdatedError(),
|
|
889
890
|
shopCannotBeDeleted: new ShopCannotBeDeletedError(),
|
|
891
|
+
shopCannotSell: new ShopCannotSellError(),
|
|
890
892
|
shopNotEnabled: new ShopNotEnabledError(),
|
|
891
893
|
wrongPassword: new WrongPasswordError(),
|
|
892
894
|
expeditionDoesNotExist: new ExpeditionDoesNotExistError(),
|
|
@@ -996,6 +998,10 @@ const responses = {
|
|
|
996
998
|
description: 'The shop cannot be deleted.',
|
|
997
999
|
content: { 'application/json': { schema: specificHttpError(errors.shopCannotBeDeleted) } },
|
|
998
1000
|
},
|
|
1001
|
+
shopCannotSell: {
|
|
1002
|
+
description: 'The shop does not have the capability to sell.',
|
|
1003
|
+
content: { 'application/json': { schema: specificHttpError(errors.shopCannotSell) } },
|
|
1004
|
+
},
|
|
999
1005
|
shopNotEnabled: {
|
|
1000
1006
|
description: 'The shop is not enabled.',
|
|
1001
1007
|
content: { 'application/json': { schema: specificHttpError(errors.shopNotEnabled) } },
|
|
@@ -3128,6 +3134,8 @@ The \`price\` field will be calculated from the \`size\` and \`settings\` fields
|
|
|
3128
3134
|
If the shop the user belongs to is not enabled the API will return a \`500 ShopNotEnabledError\` and if the shop is readonly it will
|
|
3129
3135
|
return a \`500 ShopCannotBeUpdatedError\`.
|
|
3130
3136
|
|
|
3137
|
+
If the shop does not have the capability to sell the API will return a \`500 ShopCannotSellError\`.
|
|
3138
|
+
|
|
3131
3139
|
If the destination is invalid the API will return a \`500 InvalidSaleDestinationError\`.
|
|
3132
3140
|
|
|
3133
3141
|
${securitySchemes.tokens}
|
|
@@ -3152,7 +3160,8 @@ ${securitySchemes.shopUserRole}`,
|
|
|
3152
3160
|
' 500 ': responses.saleAlreadyExists,
|
|
3153
3161
|
' 500 ': responses.shopNotEnabled,
|
|
3154
3162
|
' 500 ': responses.shopCannotBeUpdated,
|
|
3155
|
-
' 500 ': responses.
|
|
3163
|
+
' 500 ': responses.shopCannotSell,
|
|
3164
|
+
' 500 ': responses.invalidSaleDestination,
|
|
3156
3165
|
},
|
|
3157
3166
|
},
|
|
3158
3167
|
},
|
package/package.json
CHANGED
|
@@ -187,7 +187,7 @@ const shop = () => ({
|
|
|
187
187
|
address: addressWithRequiredLocation(),
|
|
188
188
|
capabilities: {
|
|
189
189
|
type: 'array',
|
|
190
|
-
items: { type: 'string', enum: ['deliver', 'pickup'] },
|
|
190
|
+
items: { type: 'string', enum: ['deliver', 'pickup', 'sell'] },
|
|
191
191
|
uniqueItems: true,
|
|
192
192
|
},
|
|
193
193
|
openingSchedule: shopSchedule(),
|