@rxdrag/website-lib-core 0.0.127 → 0.0.128
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/README.md +1 -1
- package/index.ts +1 -1
- package/package.json +4 -4
- package/src/astro/animation.ts +146 -146
- package/src/astro/background.ts +82 -86
- package/src/astro/base.ts +7 -0
- package/src/astro/business.ts +13 -0
- package/src/astro/grid/consts.ts +80 -80
- package/src/astro/grid/index.ts +2 -2
- package/src/astro/grid/types.ts +35 -35
- package/src/astro/image.ts +239 -239
- package/src/astro/index.ts +12 -10
- package/src/astro/link.ts +20 -21
- package/src/astro/media.ts +123 -123
- package/src/astro/nav.ts +13 -13
- package/src/astro/section/index.ts +7 -12
- package/src/component-logic/index.ts +1 -1
- package/src/component-logic/link-client.ts +32 -32
- package/src/component-logic/link.ts +61 -61
- package/src/design-tokens.ts +160 -160
- package/src/entify/Entify.ts +533 -530
- package/src/entify/IEntify.ts +151 -177
- package/src/entify/index.ts +4 -4
- package/src/entify/lib/collectCategoryIds.ts +20 -20
- package/src/entify/lib/fulltextSearch.ts +63 -62
- package/src/entify/lib/langFields.ts +14 -14
- package/src/entify/lib/listToTree.ts +23 -23
- package/src/entify/lib/newAvatarQueryOptions.ts +4 -4
- package/src/entify/lib/newOgImageQueryOptions.ts +5 -5
- package/src/entify/lib/newQueryPostOptions.ts +42 -45
- package/src/entify/lib/newQueryProductOptions.ts +96 -98
- package/src/entify/lib/newQueryProductsMediaOptions.ts +28 -28
- package/src/entify/lib/queryAllProducts.ts +40 -40
- package/src/entify/lib/queryBulletin.ts +28 -16
- package/src/entify/lib/queryEntityList.ts +41 -41
- package/src/entify/lib/queryFeaturedProducts.ts +69 -68
- package/src/entify/lib/queryLangs.ts +36 -60
- package/src/entify/lib/queryLatestPosts.ts +92 -91
- package/src/entify/lib/queryOneEntity.ts +63 -63
- package/src/entify/lib/queryOneMedia.ts +27 -27
- package/src/entify/lib/queryOnePostById.ts +21 -21
- package/src/entify/lib/queryOnePostBySlug.ts +40 -39
- package/src/entify/lib/queryOnePostCategoryBySlug.ts +35 -35
- package/src/entify/lib/queryOneProductById.ts +20 -20
- package/src/entify/lib/queryOneProductBySlug.ts +53 -52
- package/src/entify/lib/queryOneProductCategoryBySlug.ts +50 -49
- package/src/entify/lib/queryOneTheme.ts +54 -72
- package/src/entify/lib/queryOneUser.ts +38 -38
- package/src/entify/lib/queryPostCategories.ts +67 -67
- package/src/entify/lib/queryPostSlugs.ts +37 -37
- package/src/entify/lib/queryPosts.ts +175 -174
- package/src/entify/lib/queryProductCategories.ts +59 -59
- package/src/entify/lib/queryProducts.ts +145 -144
- package/src/entify/lib/queryProductsInMenu.ts +45 -45
- package/src/entify/lib/queryTagCategories.ts +58 -58
- package/src/entify/lib/queryTags.ts +57 -57
- package/src/entify/lib/queryUserIds.ts +24 -24
- package/src/entify/lib/queryUserPosts.ts +80 -79
- package/src/entify/lib/queryWebSiteSettings.ts +28 -28
- package/src/entify/lib/queryWebsite.ts +43 -43
- package/src/entify/lib/sendEmail.ts +7 -7
- package/src/entify/lib/toQueryOptions.ts +19 -19
- package/src/entify/lib/upsertEntity.ts +8 -8
- package/src/entify/types/index.ts +1 -1
- package/src/entify/types/utils.ts +11 -6
- package/src/entify/types/variables.ts +5 -6
- package/src/entify/view-model/funcs.ts +230 -230
- package/src/entify/view-model/index.ts +1 -1
- package/src/entify/view-model/models.ts +135 -135
- package/src/global.d.ts +7 -7
- package/src/index.ts +8 -8
- package/src/lib/formatDate.ts +15 -15
- package/src/lib/index.ts +3 -3
- package/src/lib/pagination.ts +114 -114
- package/src/lib/utils.ts +135 -135
- package/src/react/components/Analytics/eventHandlers.ts +173 -173
- package/src/react/components/Analytics/index.tsx +21 -21
- package/src/react/components/Analytics/singleton.ts +214 -214
- package/src/react/components/Analytics/tracking.ts +221 -221
- package/src/react/components/Analytics/types.ts +60 -60
- package/src/react/components/Analytics/utils.ts +95 -95
- package/src/react/components/AttachmentIcon/index.tsx +53 -53
- package/src/react/components/BackgroundHlsVideoPlayer.tsx +97 -97
- package/src/react/components/BackgroundVideoPlayer.tsx +32 -32
- package/src/react/components/Bulletin.tsx +30 -30
- package/src/react/components/ContactForm/ContactForm.tsx +289 -289
- package/src/react/components/ContactForm/Input.tsx +48 -48
- package/src/react/components/ContactForm/Input2.tsx +59 -59
- package/src/react/components/ContactForm/Submit.tsx +48 -48
- package/src/react/components/ContactForm/TelInput.tsx +215 -215
- package/src/react/components/ContactForm/Textarea.tsx +48 -48
- package/src/react/components/ContactForm/Textarea2.tsx +89 -89
- package/src/react/components/ContactForm/funcs.ts +64 -64
- package/src/react/components/ContactForm/index.ts +7 -7
- package/src/react/components/ContactForm/types.ts +68 -68
- package/src/react/components/GoogleConsent/CookieItemPanel.tsx +80 -80
- package/src/react/components/GoogleConsent/CumtomizedModal.tsx +148 -148
- package/src/react/components/GoogleConsent/GoogleConsent.tsx +100 -100
- package/src/react/components/GoogleConsent/gtags.ts +67 -67
- package/src/react/components/GoogleConsent/index.ts +2 -2
- package/src/react/components/GoogleConsent/types.ts +18 -18
- package/src/react/components/GoogleConsent//345/217/202/350/200/203.md +4 -4
- package/src/react/components/Icon/index.tsx +19 -19
- package/src/react/components/Medias/MainMedia.tsx +257 -257
- package/src/react/components/Medias/Thumbnail.tsx +62 -62
- package/src/react/components/Medias/VideoPlayer.tsx +114 -114
- package/src/react/components/Medias/index.tsx +271 -271
- package/src/react/components/ProductCard/ProductCard.tsx +24 -24
- package/src/react/components/ProductCard/ProductCta/index.tsx +28 -28
- package/src/react/components/ProductCard/ProductCta/style.css +3 -3
- package/src/react/components/ProductCard/ProductDescription/index.tsx +12 -12
- package/src/react/components/ProductCard/ProductDescription/style.css +5 -5
- package/src/react/components/ProductCard/ProductMedia/index.tsx +35 -35
- package/src/react/components/ProductCard/ProductMedia/style.css +5 -5
- package/src/react/components/ProductCard/ProductTitle/index.tsx +7 -7
- package/src/react/components/ProductCard/ProductTitle/style.css +3 -3
- package/src/react/components/ProductCard/ProductView.tsx +36 -36
- package/src/react/components/ProductCard/index.ts +4 -4
- package/src/react/components/ProductCard/useQueryProduct.ts +32 -32
- package/src/react/components/ReactModalTrigger.tsx +28 -28
- package/src/react/components/ReactVideoPlayer.tsx +29 -52
- package/src/react/components/RichTextOutline/index.tsx +75 -75
- package/src/react/components/RichTextOutline/useAnchorScroll.ts +23 -23
- package/src/react/components/Scroller.tsx +39 -39
- package/src/react/components/SearchInput.tsx +21 -21
- package/src/react/components/Share/index.tsx +86 -86
- package/src/react/components/Share/socials.tsx +79 -77
- package/src/react/components/Share//350/265/204/346/226/231.md +7 -7
- package/src/react/components/ToTop.tsx +72 -72
- package/src/react/components/VideoPlayIcon.tsx +43 -0
- package/src/react/components/all.ts +38 -38
- package/src/react/components/index.ts +16 -16
- package/src/robots.ts +4 -4
- package/src/entify/lib/newPageMetaOptions.ts +0 -18
- package/src/entify/lib/newQueryPageOptions.ts +0 -14
- package/src/entify/lib/queryOneIcon.ts +0 -27
- package/src/entify/lib/queryPageBySlug.ts +0 -43
- package/src/entify/lib/queryPageByType.ts +0 -44
|
@@ -1,45 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PostQueryOptions,
|
|
3
|
-
PostFields,
|
|
4
|
-
UserQueryOptions,
|
|
5
|
-
UserFields,
|
|
6
|
-
MediaQueryOptions,
|
|
7
|
-
PostCategoryFields,
|
|
8
|
-
ImageSize,
|
|
9
|
-
TagFields,
|
|
10
|
-
} from "@rxdrag/rxcms-models";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
PostFields.
|
|
24
|
-
PostFields.
|
|
25
|
-
PostFields.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
UserFields.
|
|
32
|
-
UserFields.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
])
|
|
44
|
-
.tags([TagFields.id, TagFields.name, TagFields.color]);
|
|
45
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
PostQueryOptions,
|
|
3
|
+
PostFields,
|
|
4
|
+
UserQueryOptions,
|
|
5
|
+
UserFields,
|
|
6
|
+
MediaQueryOptions,
|
|
7
|
+
PostCategoryFields,
|
|
8
|
+
ImageSize,
|
|
9
|
+
TagFields,
|
|
10
|
+
} from "@rxdrag/rxcms-models";
|
|
11
|
+
|
|
12
|
+
//查询一个产品的参数,不带条件
|
|
13
|
+
export function newQueryOnePostOptions(coverSize?: ImageSize) {
|
|
14
|
+
const coverFields = ["thumbnail", "url"];
|
|
15
|
+
if (coverSize?.width && coverSize?.height) {
|
|
16
|
+
coverFields.push(
|
|
17
|
+
`resize(width:${coverSize.width}, height:${coverSize.height})`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return new PostQueryOptions([
|
|
21
|
+
PostFields.id,
|
|
22
|
+
PostFields.slug,
|
|
23
|
+
PostFields.title,
|
|
24
|
+
PostFields.content,
|
|
25
|
+
PostFields.extends,
|
|
26
|
+
])
|
|
27
|
+
.author(
|
|
28
|
+
new UserQueryOptions([
|
|
29
|
+
UserFields.id,
|
|
30
|
+
UserFields.name,
|
|
31
|
+
UserFields.position,
|
|
32
|
+
UserFields.email,
|
|
33
|
+
]).avatar(new MediaQueryOptions().file(["thumbnail"]))
|
|
34
|
+
)
|
|
35
|
+
.cover(new MediaQueryOptions().file(coverFields))
|
|
36
|
+
.category([
|
|
37
|
+
PostCategoryFields.id,
|
|
38
|
+
PostCategoryFields.slug,
|
|
39
|
+
PostCategoryFields.name,
|
|
40
|
+
])
|
|
41
|
+
.tags([TagFields.id, TagFields.name, TagFields.color]);
|
|
42
|
+
}
|
|
@@ -1,98 +1,96 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ProductQueryOptions,
|
|
3
|
-
ProductFields,
|
|
4
|
-
MediaQueryOptions,
|
|
5
|
-
MediaFields,
|
|
6
|
-
MediaOnProductQueryOptions,
|
|
7
|
-
MediaOnProductFields,
|
|
8
|
-
AttachmentOnProductQueryOptions,
|
|
9
|
-
AttachmentOnProductFields,
|
|
10
|
-
ProductCategoryFields,
|
|
11
|
-
ProductRelatedPivotQueryOptions,
|
|
12
|
-
ImageSize,
|
|
13
|
-
TagFields,
|
|
14
|
-
} from "@rxdrag/rxcms-models";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
MediaOnProductFields.
|
|
30
|
-
MediaOnProductFields.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
ProductFields.
|
|
46
|
-
ProductFields.
|
|
47
|
-
ProductFields.
|
|
48
|
-
ProductFields.
|
|
49
|
-
ProductFields.
|
|
50
|
-
ProductFields.
|
|
51
|
-
ProductFields.
|
|
52
|
-
ProductFields.
|
|
53
|
-
ProductFields.
|
|
54
|
-
ProductFields.
|
|
55
|
-
ProductFields.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
MediaFields.
|
|
70
|
-
MediaFields.
|
|
71
|
-
MediaFields.
|
|
72
|
-
MediaFields.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
ProductCategoryFields.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
.tags([TagFields.id, TagFields.name, TagFields.color]);
|
|
98
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
ProductQueryOptions,
|
|
3
|
+
ProductFields,
|
|
4
|
+
MediaQueryOptions,
|
|
5
|
+
MediaFields,
|
|
6
|
+
MediaOnProductQueryOptions,
|
|
7
|
+
MediaOnProductFields,
|
|
8
|
+
AttachmentOnProductQueryOptions,
|
|
9
|
+
AttachmentOnProductFields,
|
|
10
|
+
ProductCategoryFields,
|
|
11
|
+
ProductRelatedPivotQueryOptions,
|
|
12
|
+
ImageSize,
|
|
13
|
+
TagFields,
|
|
14
|
+
} from "@rxdrag/rxcms-models";
|
|
15
|
+
|
|
16
|
+
function creatProductMediaOptions(imagSize?: ImageSize) {
|
|
17
|
+
const imageFields = ["thumbnail(width:400, height:320)", "url", "original"];
|
|
18
|
+
if (imagSize?.width && imagSize?.height) {
|
|
19
|
+
imageFields.push(
|
|
20
|
+
`resize(width:${imagSize.width}, height:${imagSize.height})`
|
|
21
|
+
);
|
|
22
|
+
} else {
|
|
23
|
+
imageFields.push(`resize(width:800, height:600)`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return new MediaOnProductQueryOptions(
|
|
27
|
+
[
|
|
28
|
+
MediaOnProductFields.id,
|
|
29
|
+
MediaOnProductFields.seqValue,
|
|
30
|
+
MediaOnProductFields.altText,
|
|
31
|
+
],
|
|
32
|
+
{
|
|
33
|
+
orderBy: [
|
|
34
|
+
{
|
|
35
|
+
[MediaOnProductFields.seqValue]: "asc",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
}
|
|
39
|
+
).media(new MediaQueryOptions().mediaType().description().file(imageFields));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function newQueryProductOptions(imagSize?: ImageSize) {
|
|
43
|
+
return new ProductQueryOptions([
|
|
44
|
+
ProductFields.id,
|
|
45
|
+
ProductFields.title,
|
|
46
|
+
ProductFields.shortTitle,
|
|
47
|
+
ProductFields.slug,
|
|
48
|
+
ProductFields.externalVideoUrl,
|
|
49
|
+
ProductFields.content,
|
|
50
|
+
ProductFields.content2,
|
|
51
|
+
ProductFields.content3,
|
|
52
|
+
ProductFields.extends,
|
|
53
|
+
ProductFields.description,
|
|
54
|
+
ProductFields.features,
|
|
55
|
+
ProductFields.relatedSlugs,
|
|
56
|
+
])
|
|
57
|
+
.mediaPivots(creatProductMediaOptions(imagSize))
|
|
58
|
+
.attachmentPivots(
|
|
59
|
+
new AttachmentOnProductQueryOptions(undefined, {
|
|
60
|
+
orderBy: [
|
|
61
|
+
{
|
|
62
|
+
[AttachmentOnProductFields.seqValue]: "asc",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
}).attachment(
|
|
66
|
+
new MediaQueryOptions([
|
|
67
|
+
MediaFields.id,
|
|
68
|
+
MediaFields.mediaRef,
|
|
69
|
+
MediaFields.description,
|
|
70
|
+
MediaFields.name,
|
|
71
|
+
MediaFields.extName,
|
|
72
|
+
MediaFields.mediaType,
|
|
73
|
+
]).file(["url"])
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
.relatedPivots(
|
|
77
|
+
new ProductRelatedPivotQueryOptions([ProductFields.id]).product(
|
|
78
|
+
new ProductQueryOptions(
|
|
79
|
+
[ProductFields.id, ProductFields.slug, ProductFields.title],
|
|
80
|
+
{
|
|
81
|
+
orderBy: [
|
|
82
|
+
{
|
|
83
|
+
[ProductFields.id]: "asc",
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
}
|
|
87
|
+
).mediaPivots(creatProductMediaOptions(imagSize))
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
.category([
|
|
91
|
+
ProductCategoryFields.id,
|
|
92
|
+
ProductCategoryFields.slug,
|
|
93
|
+
ProductCategoryFields.name,
|
|
94
|
+
])
|
|
95
|
+
.tags([TagFields.id, TagFields.name, TagFields.color]);
|
|
96
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MediaOnProductQueryOptions,
|
|
3
|
-
MediaOnProductFields,
|
|
4
|
-
MediaQueryOptions,
|
|
5
|
-
ImageSize,
|
|
6
|
-
MediaFields,
|
|
7
|
-
} from "@rxdrag/rxcms-models";
|
|
8
|
-
|
|
9
|
-
export function newQueryProductsMediaOptions(imageSize?: ImageSize | undefined) {
|
|
10
|
-
return new MediaOnProductQueryOptions(
|
|
11
|
-
[MediaOnProductFields.seqValue, MediaOnProductFields.altText],
|
|
12
|
-
{
|
|
13
|
-
orderBy: [
|
|
14
|
-
{
|
|
15
|
-
[MediaOnProductFields.seqValue]: "asc",
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
}
|
|
19
|
-
).media(
|
|
20
|
-
new MediaQueryOptions([MediaFields.id, MediaFields.mediaType, MediaFields.mediaRef]).file([
|
|
21
|
-
"thumbnail(width:400, height:320)",
|
|
22
|
-
"url",
|
|
23
|
-
imageSize
|
|
24
|
-
? `resize(width:${imageSize.width}, height:${imageSize.height})`
|
|
25
|
-
: "resize(width:500, height:400)",
|
|
26
|
-
])
|
|
27
|
-
);
|
|
28
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
MediaOnProductQueryOptions,
|
|
3
|
+
MediaOnProductFields,
|
|
4
|
+
MediaQueryOptions,
|
|
5
|
+
ImageSize,
|
|
6
|
+
MediaFields,
|
|
7
|
+
} from "@rxdrag/rxcms-models";
|
|
8
|
+
|
|
9
|
+
export function newQueryProductsMediaOptions(imageSize?: ImageSize | undefined) {
|
|
10
|
+
return new MediaOnProductQueryOptions(
|
|
11
|
+
[MediaOnProductFields.seqValue, MediaOnProductFields.altText],
|
|
12
|
+
{
|
|
13
|
+
orderBy: [
|
|
14
|
+
{
|
|
15
|
+
[MediaOnProductFields.seqValue]: "asc",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
}
|
|
19
|
+
).media(
|
|
20
|
+
new MediaQueryOptions([MediaFields.id, MediaFields.mediaType, MediaFields.mediaRef]).file([
|
|
21
|
+
"thumbnail(width:400, height:320)",
|
|
22
|
+
"url",
|
|
23
|
+
imageSize
|
|
24
|
+
? `resize(width:${imageSize.width}, height:${imageSize.height})`
|
|
25
|
+
: "resize(width:500, height:400)",
|
|
26
|
+
])
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Product,
|
|
3
|
-
ProductBoolExp,
|
|
4
|
-
ProductDistinctExp,
|
|
5
|
-
ProductFields,
|
|
6
|
-
ProductOrderBy,
|
|
7
|
-
ProductQueryOptions,
|
|
8
|
-
PublishableStatus,
|
|
9
|
-
} from "@rxdrag/rxcms-models";
|
|
10
|
-
import { EnvVariables } from "../types";
|
|
11
|
-
import { ListResult } from "@rxdrag/entify-lib";
|
|
12
|
-
import { TProduct } from "../view-model";
|
|
13
|
-
import { queryEntityList } from "./queryEntityList";
|
|
14
|
-
|
|
15
|
-
export async function queryAllProducts(envVariables: EnvVariables) {
|
|
16
|
-
const queryOptions = new ProductQueryOptions(
|
|
17
|
-
[ProductFields.id, ProductFields.slug],
|
|
18
|
-
{
|
|
19
|
-
where: {
|
|
20
|
-
[ProductFields.status]: {
|
|
21
|
-
_eq: PublishableStatus.published,
|
|
22
|
-
},
|
|
23
|
-
lang: {
|
|
24
|
-
abbr: {
|
|
25
|
-
_eq:
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
orderBy: [{ [ProductFields.seqValue]: "asc" }],
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
const result = await queryEntityList<
|
|
34
|
-
Product,
|
|
35
|
-
ProductBoolExp,
|
|
36
|
-
ProductOrderBy,
|
|
37
|
-
ProductDistinctExp
|
|
38
|
-
>(queryOptions, envVariables);
|
|
39
|
-
return result as ListResult<TProduct> | undefined;
|
|
40
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
Product,
|
|
3
|
+
ProductBoolExp,
|
|
4
|
+
ProductDistinctExp,
|
|
5
|
+
ProductFields,
|
|
6
|
+
ProductOrderBy,
|
|
7
|
+
ProductQueryOptions,
|
|
8
|
+
PublishableStatus,
|
|
9
|
+
} from "@rxdrag/rxcms-models";
|
|
10
|
+
import { EnvVariables } from "../types";
|
|
11
|
+
import { ListResult } from "@rxdrag/entify-lib";
|
|
12
|
+
import { TProduct } from "../view-model";
|
|
13
|
+
import { queryEntityList } from "./queryEntityList";
|
|
14
|
+
|
|
15
|
+
export async function queryAllProducts(envVariables: EnvVariables, langAbbr: string) {
|
|
16
|
+
const queryOptions = new ProductQueryOptions(
|
|
17
|
+
[ProductFields.id, ProductFields.slug],
|
|
18
|
+
{
|
|
19
|
+
where: {
|
|
20
|
+
[ProductFields.status]: {
|
|
21
|
+
_eq: PublishableStatus.published,
|
|
22
|
+
},
|
|
23
|
+
lang: {
|
|
24
|
+
abbr: {
|
|
25
|
+
_eq: langAbbr,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
orderBy: [{ [ProductFields.seqValue]: "asc" }],
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const result = await queryEntityList<
|
|
34
|
+
Product,
|
|
35
|
+
ProductBoolExp,
|
|
36
|
+
ProductOrderBy,
|
|
37
|
+
ProductDistinctExp
|
|
38
|
+
>(queryOptions, envVariables);
|
|
39
|
+
return result as ListResult<TProduct> | undefined;
|
|
40
|
+
}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
import { BulletinBoolExp, BulletinDistinctExp, BulletinOrderBy, BulletinQueryOptions, BulletinFields, Bulletin } from "@rxdrag/rxcms-models";
|
|
2
|
-
import { EnvVariables } from "../types";
|
|
3
|
-
import { queryOneEntity } from "./queryOneEntity";
|
|
4
|
-
|
|
5
|
-
export const queryBulletin = async (
|
|
6
|
-
envVariables: EnvVariables
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { BulletinBoolExp, BulletinDistinctExp, BulletinOrderBy, BulletinQueryOptions, BulletinFields, Bulletin } from "@rxdrag/rxcms-models";
|
|
2
|
+
import { EnvVariables } from "../types";
|
|
3
|
+
import { queryOneEntity } from "./queryOneEntity";
|
|
4
|
+
|
|
5
|
+
export const queryBulletin = async (
|
|
6
|
+
envVariables: EnvVariables,
|
|
7
|
+
langAbbr: string
|
|
8
|
+
) => {
|
|
9
|
+
const bulletin = await queryOneEntity<Bulletin, BulletinBoolExp, BulletinOrderBy, BulletinDistinctExp>(
|
|
10
|
+
new BulletinQueryOptions(
|
|
11
|
+
[
|
|
12
|
+
BulletinFields.id,
|
|
13
|
+
BulletinFields.title,
|
|
14
|
+
BulletinFields.content,
|
|
15
|
+
],
|
|
16
|
+
{
|
|
17
|
+
where: {
|
|
18
|
+
lang: {
|
|
19
|
+
abbr: {
|
|
20
|
+
_eq: langAbbr,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
envVariables
|
|
27
|
+
);
|
|
28
|
+
return bulletin;
|
|
17
29
|
};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { IQueryOptions, ListResult } from "@rxdrag/entify-lib";
|
|
2
|
-
import { createEntifyClient } from "./createEntifyClient";
|
|
3
|
-
import { EnvVariables } from "../types";
|
|
4
|
-
import { Post, PostCategoryEntityName, PostEntityName, Product, ProductCategoryEntityName, ProductEntityName, UserEntityName } from "@rxdrag/rxcms-models";
|
|
5
|
-
import { postCategoriesToViewModel, postListToViewModel, productCategoriesToViewModel, productListToViewModel, userListToViewModel } from "../view-model";
|
|
6
|
-
|
|
7
|
-
export async function queryEntityList<T, WhereExp = unknown, OrderBy = unknown, DistinctExp = unknown>(
|
|
8
|
-
options: IQueryOptions<T, WhereExp, OrderBy, DistinctExp>,
|
|
9
|
-
envVariables: EnvVariables,
|
|
10
|
-
) {
|
|
11
|
-
const client = createEntifyClient(envVariables);
|
|
12
|
-
|
|
13
|
-
const result = await client.enityList<T, WhereExp, OrderBy, DistinctExp>(
|
|
14
|
-
!envVariables.websiteId
|
|
15
|
-
? options
|
|
16
|
-
: options.setQueryArgs(
|
|
17
|
-
{
|
|
18
|
-
...options.getQueryArgs(),
|
|
19
|
-
where: {
|
|
20
|
-
website: {
|
|
21
|
-
id: { "_eq": envVariables.websiteId }
|
|
22
|
-
},
|
|
23
|
-
...options.getQueryArgs()?.where
|
|
24
|
-
} as WhereExp
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
switch (options.entityName) {
|
|
30
|
-
case ProductEntityName:
|
|
31
|
-
return productListToViewModel(result as ListResult<Product> | undefined);
|
|
32
|
-
case PostEntityName:
|
|
33
|
-
return postListToViewModel(result as ListResult<Post> | undefined);
|
|
34
|
-
case ProductCategoryEntityName:
|
|
35
|
-
return productCategoriesToViewModel(result as ListResult<Product> | undefined);
|
|
36
|
-
case PostCategoryEntityName:
|
|
37
|
-
return postCategoriesToViewModel(result as ListResult<Post> | undefined);
|
|
38
|
-
case UserEntityName:
|
|
39
|
-
return userListToViewModel(result as ListResult<Post> | undefined);
|
|
40
|
-
}
|
|
41
|
-
return result;
|
|
1
|
+
import { IQueryOptions, ListResult } from "@rxdrag/entify-lib";
|
|
2
|
+
import { createEntifyClient } from "./createEntifyClient";
|
|
3
|
+
import { EnvVariables } from "../types";
|
|
4
|
+
import { Post, PostCategoryEntityName, PostEntityName, Product, ProductCategoryEntityName, ProductEntityName, UserEntityName } from "@rxdrag/rxcms-models";
|
|
5
|
+
import { postCategoriesToViewModel, postListToViewModel, productCategoriesToViewModel, productListToViewModel, userListToViewModel } from "../view-model";
|
|
6
|
+
|
|
7
|
+
export async function queryEntityList<T, WhereExp = unknown, OrderBy = unknown, DistinctExp = unknown>(
|
|
8
|
+
options: IQueryOptions<T, WhereExp, OrderBy, DistinctExp>,
|
|
9
|
+
envVariables: EnvVariables,
|
|
10
|
+
) {
|
|
11
|
+
const client = createEntifyClient(envVariables);
|
|
12
|
+
|
|
13
|
+
const result = await client.enityList<T, WhereExp, OrderBy, DistinctExp>(
|
|
14
|
+
!envVariables.websiteId
|
|
15
|
+
? options
|
|
16
|
+
: options.setQueryArgs(
|
|
17
|
+
{
|
|
18
|
+
...options.getQueryArgs(),
|
|
19
|
+
where: {
|
|
20
|
+
website: {
|
|
21
|
+
id: { "_eq": envVariables.websiteId }
|
|
22
|
+
},
|
|
23
|
+
...options.getQueryArgs()?.where
|
|
24
|
+
} as WhereExp
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
switch (options.entityName) {
|
|
30
|
+
case ProductEntityName:
|
|
31
|
+
return productListToViewModel(result as ListResult<Product> | undefined);
|
|
32
|
+
case PostEntityName:
|
|
33
|
+
return postListToViewModel(result as ListResult<Post> | undefined);
|
|
34
|
+
case ProductCategoryEntityName:
|
|
35
|
+
return productCategoriesToViewModel(result as ListResult<Product> | undefined);
|
|
36
|
+
case PostCategoryEntityName:
|
|
37
|
+
return postCategoriesToViewModel(result as ListResult<Post> | undefined);
|
|
38
|
+
case UserEntityName:
|
|
39
|
+
return userListToViewModel(result as ListResult<Post> | undefined);
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
42
|
}
|