@simplysm/sd-orm-common
Advanced tools
Comparing version 3.4.63 to 3.4.64
@@ -225,3 +225,2 @@ "use strict"; | ||
Queryable.prototype.search = function (fwd, searchText) { | ||
var _a; | ||
var result = new Queryable(this._db, this); | ||
@@ -270,4 +269,3 @@ var splitSearchText = searchText.trim().split(" ") | ||
}); | ||
result._def.orderBy = (_a = result._def.orderBy) !== null && _a !== void 0 ? _a : []; | ||
result._def.orderBy.insert(0, ["[__searchOrder]", "DESC"]); | ||
result.orderBy(function (item) { return item["__searchOrder"]; }, true); | ||
return result; | ||
@@ -574,13 +572,15 @@ }; | ||
Queryable.prototype.countAsync = function () { | ||
var _a; | ||
var _a, _b; | ||
return tslib_1.__awaiter(this, void 0, Promise, function () { | ||
var item; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: return [4, this | ||
.select(function () { return ({ cnt: new QueryUnit_1.QueryUnit(Number, "COUNT(*)") }); }) | ||
.singleAsync()]; | ||
var queryable, item; | ||
return tslib_1.__generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
queryable = this.select(function () { return ({ cnt: new QueryUnit_1.QueryUnit(Number, "COUNT(*)") }); }); | ||
(_a = queryable._def.orderBy) === null || _a === void 0 ? void 0 : _a.remove(function (item) { return item[0] === "[__searchOrder]"; }); | ||
delete queryable._entity["__searchOrder"]; | ||
return [4, queryable.singleAsync()]; | ||
case 1: | ||
item = _b.sent(); | ||
return [2, ((_a = item === null || item === void 0 ? void 0 : item.cnt) !== null && _a !== void 0 ? _a : 0)]; | ||
item = _c.sent(); | ||
return [2, ((_b = item === null || item === void 0 ? void 0 : item.cnt) !== null && _b !== void 0 ? _b : 0)]; | ||
} | ||
@@ -587,0 +587,0 @@ }); |
@@ -216,3 +216,2 @@ "use strict"; | ||
search(fwd, searchText) { | ||
var _a; | ||
let result = new Queryable(this._db, this); | ||
@@ -254,4 +253,3 @@ const splitSearchText = searchText.trim().split(" ") | ||
}); | ||
result._def.orderBy = (_a = result._def.orderBy) !== null && _a !== void 0 ? _a : []; | ||
result._def.orderBy.insert(0, ["[__searchOrder]", "DESC"]); | ||
result.orderBy(item => item["__searchOrder"], true); | ||
return result; | ||
@@ -527,7 +525,8 @@ } | ||
async countAsync() { | ||
var _a; | ||
const item = await this | ||
.select(() => ({ cnt: new QueryUnit_1.QueryUnit(Number, "COUNT(*)") })) | ||
.singleAsync(); | ||
return ((_a = item === null || item === void 0 ? void 0 : item.cnt) !== null && _a !== void 0 ? _a : 0); | ||
var _a, _b; | ||
const queryable = this.select(() => ({ cnt: new QueryUnit_1.QueryUnit(Number, "COUNT(*)") })); | ||
(_a = queryable._def.orderBy) === null || _a === void 0 ? void 0 : _a.remove(item => item[0] === "[__searchOrder]"); | ||
delete queryable._entity["__searchOrder"]; | ||
const item = await queryable.singleAsync(); | ||
return ((_b = item === null || item === void 0 ? void 0 : item.cnt) !== null && _b !== void 0 ? _b : 0); | ||
} | ||
@@ -534,0 +533,0 @@ async insertAsync(record) { |
{ | ||
"name": "@simplysm/sd-orm-common", | ||
"version": "3.4.63", | ||
"version": "3.4.64", | ||
"description": "심플리즘 패키지 - ORM 모듈 (browser/node)", | ||
@@ -13,4 +13,4 @@ "author": "김석래", | ||
"dependencies": { | ||
"@simplysm/sd-core-common": "3.4.63" | ||
"@simplysm/sd-core-common": "3.4.64" | ||
} | ||
} |
@@ -115,2 +115,5 @@ import { | ||
const newEntity = fwd(this._entity); | ||
// if (this._entity["__searchOrder"] !== undefined && this._def.orderBy?.some(item => item[0] === "[__searchOrder]")) { | ||
// newEntity["__searchOrder"] = this._entity["__searchOrder"]; | ||
// } | ||
return new Queryable(this._db, this, newEntity); | ||
@@ -178,2 +181,8 @@ } | ||
result._def.groupBy = fwd(this._entity).map(item => QueryUtils.getQueryValue(item)); | ||
// if (this._entity["__searchOrder"] !== undefined && this._def.orderBy?.some(item => item[0] === "[__searchOrder]")) { | ||
// result._def.orderBy?.remove(item => item[0] === "[__searchOrder]"); | ||
// delete result._entity["__searchOrder"]; | ||
// } | ||
return result; | ||
@@ -374,4 +383,5 @@ } | ||
// ORDER BY | ||
result._def.orderBy = result._def.orderBy ?? []; | ||
result._def.orderBy.insert(0, ["[__searchOrder]", "DESC"]); | ||
result.orderBy(item => item["__searchOrder"], true); | ||
/*result._def.orderBy = result._def.orderBy ?? []; | ||
result._def.orderBy.insert(0, ["[__searchOrder]", "DESC"]);*/ | ||
return result; | ||
@@ -730,5 +740,6 @@ } | ||
public async countAsync(): Promise<number> { | ||
const item = await this | ||
.select(() => ({cnt: new QueryUnit(Number, "COUNT(*)")})) | ||
.singleAsync(); | ||
const queryable = this.select(() => ({cnt: new QueryUnit(Number, "COUNT(*)")})); | ||
queryable._def.orderBy?.remove(item => item[0] === "[__searchOrder]"); | ||
delete queryable._entity["__searchOrder"]; | ||
const item = await queryable.singleAsync(); | ||
@@ -735,0 +746,0 @@ return (item?.cnt ?? 0) as any; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
523373
7813
+ Added@simplysm/sd-core-common@3.4.64(transitive)
- Removed@simplysm/sd-core-common@3.4.63(transitive)