@rxdrag/website-lib-core 0.0.32 → 0.0.34
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdrag/website-lib-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.ts"
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"@types/react-dom": "^18.2.7",
|
|
25
25
|
"eslint": "^7.32.0",
|
|
26
26
|
"typescript": "^5",
|
|
27
|
-
"@rxdrag/
|
|
28
|
-
"@rxdrag/entify-hooks": "0.2.51",
|
|
27
|
+
"@rxdrag/entify-hooks": "0.2.53",
|
|
29
28
|
"@rxdrag/eslint-config-custom": "0.2.12",
|
|
29
|
+
"@rxdrag/tsconfig": "0.2.0",
|
|
30
30
|
"@rxdrag/slate-preview": "1.2.57"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"lodash-es": "^4.17.21",
|
|
36
36
|
"react": "^18.2.0",
|
|
37
37
|
"react-dom": "^18.2.0",
|
|
38
|
-
"@rxdrag/rxcms-models": "0.3.
|
|
38
|
+
"@rxdrag/rxcms-models": "0.3.61"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"astro": "^4.0.0 || ^5.0.0"
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
MediaQueryOptions,
|
|
11
11
|
UserQueryOptions,
|
|
12
12
|
UserFields,
|
|
13
|
+
ProductOrderBy,
|
|
13
14
|
} from "@rxdrag/rxcms-models";
|
|
14
15
|
import { queryEntityList } from "./queryEntityList";
|
|
15
16
|
import { ListResult } from "@rxdrag/entify-hooks";
|
|
@@ -20,6 +21,7 @@ export interface ListConditions {
|
|
|
20
21
|
category?: string; //category slug
|
|
21
22
|
page?: number;
|
|
22
23
|
pageSize: number;
|
|
24
|
+
orderBy?: ProductOrderBy[];
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export async function queryPosts(
|
|
@@ -21,7 +21,12 @@ export async function queryProducts(
|
|
|
21
21
|
envVariables: EnvVariables,
|
|
22
22
|
addonFields?: (keyof Product)[]
|
|
23
23
|
) {
|
|
24
|
-
const {
|
|
24
|
+
const {
|
|
25
|
+
category: categorySlug,
|
|
26
|
+
page = 1,
|
|
27
|
+
pageSize = 10,
|
|
28
|
+
orderBy,
|
|
29
|
+
} = conditions;
|
|
25
30
|
|
|
26
31
|
let where = {};
|
|
27
32
|
if (categorySlug) {
|
|
@@ -41,6 +46,8 @@ export async function queryProducts(
|
|
|
41
46
|
ProductFields.title,
|
|
42
47
|
ProductFields.shortTitle,
|
|
43
48
|
ProductFields.description,
|
|
49
|
+
ProductFields.seqValue,
|
|
50
|
+
ProductFields.updatedAt,
|
|
44
51
|
];
|
|
45
52
|
|
|
46
53
|
// 使用指定的字段或默认字段
|
|
@@ -60,8 +67,9 @@ export async function queryProducts(
|
|
|
60
67
|
},
|
|
61
68
|
...where,
|
|
62
69
|
},
|
|
63
|
-
orderBy: [
|
|
64
|
-
{ [ProductFields.seqValue]: "asc"
|
|
70
|
+
orderBy: orderBy || [
|
|
71
|
+
{ [ProductFields.seqValue]: "asc" },
|
|
72
|
+
{ [ProductFields.updatedAt]: "desc" },
|
|
65
73
|
],
|
|
66
74
|
});
|
|
67
75
|
|