@rxdrag/website-lib-core 0.0.80 → 0.0.82

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.80",
3
+ "version": "0.0.82",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.ts"
@@ -36,8 +36,8 @@
36
36
  "lodash-es": "^4.17.21",
37
37
  "react": "^19.1.0",
38
38
  "react-dom": "^19.1.0",
39
- "@rxdrag/entify-lib": "0.0.23",
40
- "@rxdrag/rxcms-models": "0.3.94"
39
+ "@rxdrag/rxcms-models": "0.3.94",
40
+ "@rxdrag/entify-lib": "0.0.23"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "astro": "^4.0.0 || ^5.0.0"
@@ -12,6 +12,8 @@ import {
12
12
  UserFields,
13
13
  ProductOrderBy,
14
14
  ImageSize,
15
+ PostCategoryFields,
16
+ MediaFields,
15
17
  } from "@rxdrag/rxcms-models";
16
18
  import { queryEntityList } from "./queryEntityList";
17
19
  import { ListResult } from "@rxdrag/entify-lib";
@@ -75,10 +77,16 @@ export async function queryPosts(
75
77
  },
76
78
  orderBy: [
77
79
  {
78
- [PostFields.createdAt]: "desc",
80
+ [PostFields.pinToTop]: "desc",
81
+ },
82
+ {
83
+ [PostFields.seqValue]: "asc",
84
+ },
85
+ {
86
+ [PostFields.updatedAt]: "desc",
79
87
  },
80
88
  ],
81
- });
89
+ }).category([PostCategoryFields.id, PostCategoryFields.name, PostCategoryFields.slug]);
82
90
 
83
91
  // 只有在需要查询封面图时才添加封面图查询
84
92
  if (!selectFields || selectFields.includes("cover" as keyof Post)) {
@@ -96,7 +104,8 @@ export async function queryPosts(
96
104
  if (!selectFields || selectFields.includes("author" as keyof Post)) {
97
105
  queryOptions.author(
98
106
  new UserQueryOptions([UserFields.id, UserFields.name]).avatar(
99
- new MediaQueryOptions().file(["thumbnail"])
107
+ new MediaQueryOptions([MediaFields.id, MediaFields.mediaType, MediaFields.mediaRef])
108
+ .file(["thumbnail", "original"])
100
109
  )
101
110
  );
102
111
  }
@@ -96,7 +96,7 @@ export function productToViewModel(product?: Product): TProduct | undefined {
96
96
  meta: product?.meta,
97
97
  category:
98
98
  product?.category && productCategoryToViewModel(product?.category),
99
- cover: medias?.[0],
99
+ cover: medias?.filter?.(media => media.mediaType === "image")?.[0],
100
100
  medias: medias,
101
101
  attachments:
102
102
  product?.attachmentPivots &&