@zyacreatives/shared 2.2.92 → 2.2.93
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/dist/schemas/post.js +1 -3
- package/dist/schemas/product.d.ts +33 -0
- package/dist/schemas/product.js +28 -1
- package/package.json +1 -1
- package/src/schemas/post.ts +7 -6
- package/src/schemas/product.ts +36 -0
package/dist/schemas/post.js
CHANGED
|
@@ -89,9 +89,7 @@ exports.PostEntitySchema = zod_openapi_1.z.object({
|
|
|
89
89
|
});
|
|
90
90
|
exports.PostFileEntitySchema = zod_openapi_1.z
|
|
91
91
|
.object({
|
|
92
|
-
id: zod_openapi_1.z
|
|
93
|
-
.cuid2()
|
|
94
|
-
.openapi({
|
|
92
|
+
id: zod_openapi_1.z.cuid2().openapi({
|
|
95
93
|
description: "CUID2 of the project file record.",
|
|
96
94
|
example: "cxy1a2b3c0000qwe",
|
|
97
95
|
}),
|
|
@@ -16,6 +16,38 @@ export declare const ProductDiscountEntitySchema: z.ZodObject<{
|
|
|
16
16
|
amount: z.ZodNumber;
|
|
17
17
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
18
18
|
}, z.core.$strip>;
|
|
19
|
+
export declare const BaseProductSchema: z.ZodObject<{
|
|
20
|
+
id: z.ZodCUID2;
|
|
21
|
+
createdAt: z.ZodDate;
|
|
22
|
+
updatedAt: z.ZodDate;
|
|
23
|
+
deletedAt: z.ZodNullable<z.ZodDate>;
|
|
24
|
+
sellerId: z.ZodCUID2;
|
|
25
|
+
title: z.ZodString;
|
|
26
|
+
description: z.ZodString;
|
|
27
|
+
keyFeatures: z.ZodString;
|
|
28
|
+
category: z.ZodString;
|
|
29
|
+
subcategory: z.ZodNullable<z.ZodString>;
|
|
30
|
+
tags: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
31
|
+
productLinks: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
32
|
+
pricingModel: z.ZodEnum<{
|
|
33
|
+
readonly FREE: "Free";
|
|
34
|
+
readonly FIXED: "Fixed";
|
|
35
|
+
readonly PWYW: "Pay What You Want";
|
|
36
|
+
}>;
|
|
37
|
+
currency: z.ZodString;
|
|
38
|
+
price: z.ZodNullable<z.ZodNumber>;
|
|
39
|
+
suggestedPrice: z.ZodNullable<z.ZodNumber>;
|
|
40
|
+
discounts: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
41
|
+
discountType: z.ZodEnum<{
|
|
42
|
+
readonly FIXED_AMOUNT: "Fixed Amount";
|
|
43
|
+
readonly PERCENTAGE: "Percentage";
|
|
44
|
+
}>;
|
|
45
|
+
amount: z.ZodNumber;
|
|
46
|
+
discountCode: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
47
|
+
}, z.core.$strip>>>;
|
|
48
|
+
supportEmail: z.ZodNullable<z.ZodString>;
|
|
49
|
+
supportPhone: z.ZodNullable<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>;
|
|
19
51
|
export declare const CreateProductInputSchema: z.ZodObject<{
|
|
20
52
|
title: z.ZodString;
|
|
21
53
|
description: z.ZodString;
|
|
@@ -151,3 +183,4 @@ export type CreateProductInputEntity = z.infer<typeof CreateProductInputSchema>;
|
|
|
151
183
|
export type ProductServiceAndComplianceInputEntity = z.infer<typeof ProductServiceAndComplianceInputSchema>;
|
|
152
184
|
export type UpdateProductInputEntity = z.infer<typeof UpdateProductInputSchema>;
|
|
153
185
|
export type ProductEntity = z.infer<typeof ProductEntitySchema>;
|
|
186
|
+
export type BaseProductEntity = z.infer<typeof BaseProductSchema>;
|
package/dist/schemas/product.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.ProductDiscountEntitySchema = exports.ProductDeliveryFileEntitySchema = exports.ProductCoverImageEntitySchema = void 0;
|
|
3
|
+
exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.BaseProductSchema = exports.ProductDiscountEntitySchema = exports.ProductDeliveryFileEntitySchema = exports.ProductCoverImageEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
exports.ProductCoverImageEntitySchema = zod_openapi_1.z.object({
|
|
@@ -24,6 +24,33 @@ exports.ProductDiscountEntitySchema = zod_openapi_1.z.object({
|
|
|
24
24
|
.min(0, "Discount amount cannot be negative"),
|
|
25
25
|
discountCode: zod_openapi_1.z.string().optional(),
|
|
26
26
|
});
|
|
27
|
+
exports.BaseProductSchema = zod_openapi_1.z.object({
|
|
28
|
+
id: zod_openapi_1.z.cuid2(),
|
|
29
|
+
createdAt: zod_openapi_1.z.date(),
|
|
30
|
+
updatedAt: zod_openapi_1.z.date(),
|
|
31
|
+
deletedAt: zod_openapi_1.z.date().nullable(),
|
|
32
|
+
sellerId: zod_openapi_1.z.cuid2(),
|
|
33
|
+
title: zod_openapi_1.z.string(),
|
|
34
|
+
description: zod_openapi_1.z.string(),
|
|
35
|
+
keyFeatures: zod_openapi_1.z.string(),
|
|
36
|
+
category: zod_openapi_1.z.string(),
|
|
37
|
+
subcategory: zod_openapi_1.z.string().nullable(),
|
|
38
|
+
tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).nullable(),
|
|
39
|
+
productLinks: zod_openapi_1.z.array(zod_openapi_1.z.string()).nullable(),
|
|
40
|
+
pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS),
|
|
41
|
+
currency: zod_openapi_1.z.string(),
|
|
42
|
+
price: zod_openapi_1.z.number().nullable(),
|
|
43
|
+
suggestedPrice: zod_openapi_1.z.number().nullable(),
|
|
44
|
+
discounts: zod_openapi_1.z
|
|
45
|
+
.array(zod_openapi_1.z.object({
|
|
46
|
+
discountType: zod_openapi_1.z.enum(constants_1.DISCOUNT_TYPES),
|
|
47
|
+
amount: zod_openapi_1.z.number(),
|
|
48
|
+
discountCode: zod_openapi_1.z.string().optional().nullable(),
|
|
49
|
+
}))
|
|
50
|
+
.nullable(),
|
|
51
|
+
supportEmail: zod_openapi_1.z.string().nullable(),
|
|
52
|
+
supportPhone: zod_openapi_1.z.string().nullable(),
|
|
53
|
+
});
|
|
27
54
|
const ProductCoreInputSchema = zod_openapi_1.z.object({
|
|
28
55
|
title: zod_openapi_1.z.string().min(1, "Title is required").max(255),
|
|
29
56
|
description: zod_openapi_1.z.string().min(1, "Description is required"),
|
package/package.json
CHANGED
package/src/schemas/post.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ACTIVITY_PARENT_TYPES,
|
|
4
4
|
POST_BADGE_TYPES,
|
|
5
5
|
POST_TYPES,
|
|
6
|
+
|
|
6
7
|
} from "../constants";
|
|
7
8
|
import { CreateFileInputSchema } from "./file";
|
|
8
9
|
import { CommentEntitySchema } from "./comment";
|
|
@@ -10,6 +11,8 @@ import { EntityStatsSchema } from "./entity-stats";
|
|
|
10
11
|
import { ActivitySchema } from "./activity";
|
|
11
12
|
import { cleanHtml } from "../utils/clean-html";
|
|
12
13
|
|
|
14
|
+
|
|
15
|
+
|
|
13
16
|
export const PostEntitySchema = z.object({
|
|
14
17
|
id: z
|
|
15
18
|
.cuid2()
|
|
@@ -98,12 +101,10 @@ export const PostEntitySchema = z.object({
|
|
|
98
101
|
|
|
99
102
|
export const PostFileEntitySchema = z
|
|
100
103
|
.object({
|
|
101
|
-
id: z
|
|
102
|
-
.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
example: "cxy1a2b3c0000qwe",
|
|
106
|
-
}),
|
|
104
|
+
id: z.cuid2().openapi({
|
|
105
|
+
description: "CUID2 of the project file record.",
|
|
106
|
+
example: "cxy1a2b3c0000qwe",
|
|
107
|
+
}),
|
|
107
108
|
postId: z.cuid2().openapi({
|
|
108
109
|
description: "CUID2 of the post this file belongs to.",
|
|
109
110
|
example: "ckj1a2b3c0000xyz",
|
package/src/schemas/product.ts
CHANGED
|
@@ -25,6 +25,40 @@ export const ProductDiscountEntitySchema = z.object({
|
|
|
25
25
|
discountCode: z.string().optional(),
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
export const BaseProductSchema = z.object({
|
|
29
|
+
id: z.cuid2(),
|
|
30
|
+
createdAt: z.date(),
|
|
31
|
+
updatedAt: z.date(),
|
|
32
|
+
deletedAt: z.date().nullable(),
|
|
33
|
+
|
|
34
|
+
sellerId: z.cuid2(),
|
|
35
|
+
|
|
36
|
+
title: z.string(),
|
|
37
|
+
description: z.string(),
|
|
38
|
+
keyFeatures: z.string(),
|
|
39
|
+
|
|
40
|
+
category: z.string(),
|
|
41
|
+
subcategory: z.string().nullable(),
|
|
42
|
+
tags: z.array(z.string()).nullable(),
|
|
43
|
+
|
|
44
|
+
productLinks: z.array(z.string()).nullable(),
|
|
45
|
+
pricingModel: z.enum(PRICING_MODELS),
|
|
46
|
+
currency: z.string(),
|
|
47
|
+
price: z.number().nullable(),
|
|
48
|
+
suggestedPrice: z.number().nullable(),
|
|
49
|
+
|
|
50
|
+
discounts: z
|
|
51
|
+
.array(
|
|
52
|
+
z.object({
|
|
53
|
+
discountType: z.enum(DISCOUNT_TYPES),
|
|
54
|
+
amount: z.number(),
|
|
55
|
+
discountCode: z.string().optional().nullable(),
|
|
56
|
+
}),
|
|
57
|
+
)
|
|
58
|
+
.nullable(),
|
|
59
|
+
supportEmail: z.string().nullable(),
|
|
60
|
+
supportPhone: z.string().nullable(),
|
|
61
|
+
});
|
|
28
62
|
|
|
29
63
|
const ProductCoreInputSchema = z.object({
|
|
30
64
|
title: z.string().min(1, "Title is required").max(255),
|
|
@@ -186,3 +220,5 @@ export type ProductServiceAndComplianceInputEntity = z.infer<
|
|
|
186
220
|
>;
|
|
187
221
|
export type UpdateProductInputEntity = z.infer<typeof UpdateProductInputSchema>;
|
|
188
222
|
export type ProductEntity = z.infer<typeof ProductEntitySchema>;
|
|
223
|
+
|
|
224
|
+
export type BaseProductEntity = z.infer<typeof BaseProductSchema>;
|