@azteam/express 1.2.331 → 1.2.333
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/lib/AdminController.js
CHANGED
|
@@ -153,7 +153,7 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
153
153
|
while (1) {
|
|
154
154
|
switch (_context5.prev = _context5.next) {
|
|
155
155
|
case 0:
|
|
156
|
-
return _context5.abrupt("return", _this.repository.createByUser(user.id, data));
|
|
156
|
+
return _context5.abrupt("return", _this.repository.createByUser(user.id, data, ['email', 'password', 'slug']));
|
|
157
157
|
case 1:
|
|
158
158
|
case "end":
|
|
159
159
|
return _context5.stop();
|
|
@@ -29,7 +29,7 @@ function _default(key) {
|
|
|
29
29
|
case 0:
|
|
30
30
|
redis = req.redis;
|
|
31
31
|
if (!redis) {
|
|
32
|
-
_context.next =
|
|
32
|
+
_context.next = 18;
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
35
|
cacheKey = key;
|
|
@@ -55,18 +55,27 @@ function _default(key) {
|
|
|
55
55
|
case 12:
|
|
56
56
|
cacheData = _context.sent;
|
|
57
57
|
if (!cacheData) {
|
|
58
|
-
_context.next =
|
|
58
|
+
_context.next = 17;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
if (cacheData.success) {
|
|
62
|
+
_context.next = 16;
|
|
59
63
|
break;
|
|
60
64
|
}
|
|
65
|
+
return _context.abrupt("return", res.json({
|
|
66
|
+
success: true,
|
|
67
|
+
data: cacheData
|
|
68
|
+
}));
|
|
69
|
+
case 16:
|
|
61
70
|
return _context.abrupt("return", res.json(cacheData));
|
|
62
|
-
case
|
|
71
|
+
case 17:
|
|
63
72
|
res.cache = {
|
|
64
73
|
key: cacheKey,
|
|
65
74
|
ttl: options.ttl
|
|
66
75
|
};
|
|
67
|
-
case
|
|
76
|
+
case 18:
|
|
68
77
|
return _context.abrupt("return", next());
|
|
69
|
-
case
|
|
78
|
+
case 19:
|
|
70
79
|
case "end":
|
|
71
80
|
return _context.stop();
|
|
72
81
|
}
|
package/package.json
CHANGED
package/src/AdminController.js
CHANGED
|
@@ -118,7 +118,7 @@ class AdminController extends Controller {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
methodPostCreate = async (data, user) => {
|
|
121
|
-
return this.repository.createByUser(user.id, data);
|
|
121
|
+
return this.repository.createByUser(user.id, data, ['email', 'password', 'slug']);
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
postCreate() {
|
|
@@ -25,6 +25,10 @@ export default function (key, options = {}) {
|
|
|
25
25
|
}
|
|
26
26
|
const cacheData = await redis.get(cacheKey);
|
|
27
27
|
if (cacheData) {
|
|
28
|
+
if (!cacheData.success) {
|
|
29
|
+
return res.json({success: true, data: cacheData});
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
return res.json(cacheData);
|
|
29
33
|
}
|
|
30
34
|
res.cache = {
|