@abtnode/core 1.16.47-beta-20250729-133234-77359596 → 1.16.47-beta-20250730-070104-87a128a5
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/states/user.js +22 -5
- package/package.json +24 -24
package/lib/states/user.js
CHANGED
|
@@ -261,11 +261,6 @@ class User extends ExtendBase {
|
|
|
261
261
|
where.approved = approved;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
const sorting = pickBy(sort, (x) => !isNullOrUndefined(x));
|
|
265
|
-
if (!Object.keys(sorting).length) {
|
|
266
|
-
sorting.createdAt = -1;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
264
|
if (search) {
|
|
270
265
|
if (search.length > 50) {
|
|
271
266
|
throw new CustomError(400, 'the length of search text should not more than 50');
|
|
@@ -385,6 +380,28 @@ SELECT did,inviter,generation FROM UserTree`.trim();
|
|
|
385
380
|
include.push(this.getConnectedInclude());
|
|
386
381
|
}
|
|
387
382
|
|
|
383
|
+
const dialect = this.model.sequelize.getDialect();
|
|
384
|
+
const isPostgres = dialect === 'postgres';
|
|
385
|
+
|
|
386
|
+
const sorting = [];
|
|
387
|
+
const cleanedSort = pickBy(sort, (x) => !isNullOrUndefined(x));
|
|
388
|
+
if (cleanedSort.lastLoginAt) {
|
|
389
|
+
const direction = cleanedSort.lastLoginAt === -1 ? 'DESC' : 'ASC';
|
|
390
|
+
if (isPostgres) {
|
|
391
|
+
sorting.push(Sequelize.literal(`"lastLoginAt" ${direction} NULLS LAST`));
|
|
392
|
+
} else {
|
|
393
|
+
sorting.push(['lastLoginAt', direction]); // SQLite 等不支持 NULLS LAST 语法,DESC 默认就是 NULLS LAST
|
|
394
|
+
}
|
|
395
|
+
} else if (Object.keys(cleanedSort).length) {
|
|
396
|
+
for (const [key, dir] of Object.entries(cleanedSort)) {
|
|
397
|
+
if (key !== 'lastLoginAt') {
|
|
398
|
+
sorting.push([key, dir === -1 ? 'DESC' : 'ASC']);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
} else {
|
|
402
|
+
sorting.push(['createdAt', 'DESC']);
|
|
403
|
+
}
|
|
404
|
+
|
|
388
405
|
const result = await this.paginate({ where, include, replacements }, sorting, paging);
|
|
389
406
|
return { list: result.list, paging: { ...result.paging, total: total || result.paging.total } };
|
|
390
407
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.47-beta-
|
|
6
|
+
"version": "1.16.47-beta-20250730-070104-87a128a5",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,22 +19,22 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/analytics": "1.16.47-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.47-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.47-beta-
|
|
25
|
-
"@abtnode/client": "1.16.47-beta-
|
|
26
|
-
"@abtnode/constant": "1.16.47-beta-
|
|
27
|
-
"@abtnode/cron": "1.16.47-beta-
|
|
28
|
-
"@abtnode/db-cache": "1.16.47-beta-
|
|
29
|
-
"@abtnode/docker-utils": "1.16.47-beta-
|
|
30
|
-
"@abtnode/logger": "1.16.47-beta-
|
|
31
|
-
"@abtnode/models": "1.16.47-beta-
|
|
32
|
-
"@abtnode/queue": "1.16.47-beta-
|
|
33
|
-
"@abtnode/rbac": "1.16.47-beta-
|
|
34
|
-
"@abtnode/router-provider": "1.16.47-beta-
|
|
35
|
-
"@abtnode/static-server": "1.16.47-beta-
|
|
36
|
-
"@abtnode/timemachine": "1.16.47-beta-
|
|
37
|
-
"@abtnode/util": "1.16.47-beta-
|
|
22
|
+
"@abtnode/analytics": "1.16.47-beta-20250730-070104-87a128a5",
|
|
23
|
+
"@abtnode/auth": "1.16.47-beta-20250730-070104-87a128a5",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.47-beta-20250730-070104-87a128a5",
|
|
25
|
+
"@abtnode/client": "1.16.47-beta-20250730-070104-87a128a5",
|
|
26
|
+
"@abtnode/constant": "1.16.47-beta-20250730-070104-87a128a5",
|
|
27
|
+
"@abtnode/cron": "1.16.47-beta-20250730-070104-87a128a5",
|
|
28
|
+
"@abtnode/db-cache": "1.16.47-beta-20250730-070104-87a128a5",
|
|
29
|
+
"@abtnode/docker-utils": "1.16.47-beta-20250730-070104-87a128a5",
|
|
30
|
+
"@abtnode/logger": "1.16.47-beta-20250730-070104-87a128a5",
|
|
31
|
+
"@abtnode/models": "1.16.47-beta-20250730-070104-87a128a5",
|
|
32
|
+
"@abtnode/queue": "1.16.47-beta-20250730-070104-87a128a5",
|
|
33
|
+
"@abtnode/rbac": "1.16.47-beta-20250730-070104-87a128a5",
|
|
34
|
+
"@abtnode/router-provider": "1.16.47-beta-20250730-070104-87a128a5",
|
|
35
|
+
"@abtnode/static-server": "1.16.47-beta-20250730-070104-87a128a5",
|
|
36
|
+
"@abtnode/timemachine": "1.16.47-beta-20250730-070104-87a128a5",
|
|
37
|
+
"@abtnode/util": "1.16.47-beta-20250730-070104-87a128a5",
|
|
38
38
|
"@aigne/aigne-hub": "^0.2.2",
|
|
39
39
|
"@arcblock/did": "1.21.0",
|
|
40
40
|
"@arcblock/did-auth": "1.21.0",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"@arcblock/pm2-events": "^0.0.5",
|
|
47
47
|
"@arcblock/validator": "1.21.0",
|
|
48
48
|
"@arcblock/vc": "1.21.0",
|
|
49
|
-
"@blocklet/constant": "1.16.47-beta-
|
|
49
|
+
"@blocklet/constant": "1.16.47-beta-20250730-070104-87a128a5",
|
|
50
50
|
"@blocklet/did-space-js": "^1.1.10",
|
|
51
|
-
"@blocklet/env": "1.16.47-beta-
|
|
51
|
+
"@blocklet/env": "1.16.47-beta-20250730-070104-87a128a5",
|
|
52
52
|
"@blocklet/error": "^0.2.5",
|
|
53
|
-
"@blocklet/meta": "1.16.47-beta-
|
|
54
|
-
"@blocklet/resolver": "1.16.47-beta-
|
|
55
|
-
"@blocklet/sdk": "1.16.47-beta-
|
|
56
|
-
"@blocklet/store": "1.16.47-beta-
|
|
53
|
+
"@blocklet/meta": "1.16.47-beta-20250730-070104-87a128a5",
|
|
54
|
+
"@blocklet/resolver": "1.16.47-beta-20250730-070104-87a128a5",
|
|
55
|
+
"@blocklet/sdk": "1.16.47-beta-20250730-070104-87a128a5",
|
|
56
|
+
"@blocklet/store": "1.16.47-beta-20250730-070104-87a128a5",
|
|
57
57
|
"@blocklet/theme": "^3.0.35",
|
|
58
58
|
"@fidm/x509": "^1.2.1",
|
|
59
59
|
"@ocap/mcrypto": "1.21.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"jest": "^29.7.0",
|
|
118
118
|
"unzipper": "^0.10.11"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "a202f415488de553a2534d1a3d2a489dda27936c"
|
|
121
121
|
}
|