@azteam/express 1.2.341 → 1.2.343
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.
|
@@ -23,6 +23,7 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
23
23
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
24
24
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
25
25
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
26
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
27
|
var TEMPLATE_DIR = _path["default"].join(__dirname, '..', '..', 'template/sitemap');
|
|
27
28
|
var SitemapController = /*#__PURE__*/function (_Controller) {
|
|
28
29
|
_inherits(SitemapController, _Controller);
|
|
@@ -32,10 +33,16 @@ var SitemapController = /*#__PURE__*/function (_Controller) {
|
|
|
32
33
|
var pathName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
33
34
|
_classCallCheck(this, SitemapController);
|
|
34
35
|
_this = _super.call(this, repository, pathName);
|
|
36
|
+
_defineProperty(_assertThisInitialized(_this), "select", 'slug modified_at');
|
|
35
37
|
_this.sitemapName = _lodash["default"].camelCase(_this.name);
|
|
36
38
|
return _this;
|
|
37
39
|
}
|
|
38
40
|
_createClass(SitemapController, [{
|
|
41
|
+
key: "customPath",
|
|
42
|
+
value: function customPath(item, pattern) {
|
|
43
|
+
return _util["default"].format(pattern, item.slug);
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
39
46
|
key: "postGetSitemap",
|
|
40
47
|
value: function postGetSitemap() {
|
|
41
48
|
var _this2 = this;
|
|
@@ -58,7 +65,7 @@ var SitemapController = /*#__PURE__*/function (_Controller) {
|
|
|
58
65
|
domains: req.rootOrigin,
|
|
59
66
|
metadata_disable: 0
|
|
60
67
|
}, {
|
|
61
|
-
select:
|
|
68
|
+
select: _this2.select,
|
|
62
69
|
page: page,
|
|
63
70
|
limit: 1000
|
|
64
71
|
});
|
|
@@ -68,7 +75,7 @@ var SitemapController = /*#__PURE__*/function (_Controller) {
|
|
|
68
75
|
data = paginateData.docs.map(function (item) {
|
|
69
76
|
if (item.slug !== 'home') {
|
|
70
77
|
return {
|
|
71
|
-
path:
|
|
78
|
+
path: _this2.customPath(item, pattern),
|
|
72
79
|
modified_at: item.modified_at
|
|
73
80
|
};
|
|
74
81
|
}
|
package/package.json
CHANGED
|
@@ -7,11 +7,17 @@ import Controller from './Controller';
|
|
|
7
7
|
const TEMPLATE_DIR = path.join(__dirname, '..', '..', 'template/sitemap');
|
|
8
8
|
|
|
9
9
|
class SitemapController extends Controller {
|
|
10
|
+
select = 'slug modified_at';
|
|
11
|
+
|
|
10
12
|
constructor(repository, pathName = null) {
|
|
11
13
|
super(repository, pathName);
|
|
12
14
|
this.sitemapName = _.camelCase(this.name);
|
|
13
15
|
}
|
|
14
16
|
|
|
17
|
+
customPath(item, pattern) {
|
|
18
|
+
return util.format(pattern, item.slug);
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
postGetSitemap() {
|
|
16
22
|
return {
|
|
17
23
|
path: '/sitemap',
|
|
@@ -25,7 +31,7 @@ class SitemapController extends Controller {
|
|
|
25
31
|
metadata_disable: 0,
|
|
26
32
|
},
|
|
27
33
|
{
|
|
28
|
-
select:
|
|
34
|
+
select: this.select,
|
|
29
35
|
page,
|
|
30
36
|
limit: 1000,
|
|
31
37
|
}
|
|
@@ -34,7 +40,7 @@ class SitemapController extends Controller {
|
|
|
34
40
|
data = paginateData.docs.map((item) => {
|
|
35
41
|
if (item.slug !== 'home') {
|
|
36
42
|
return {
|
|
37
|
-
path:
|
|
43
|
+
path: this.customPath(item, pattern),
|
|
38
44
|
modified_at: item.modified_at,
|
|
39
45
|
};
|
|
40
46
|
}
|