@zyacreatives/shared 2.5.4 → 2.5.7
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/constants.d.ts +2 -0
- package/dist/constants.js +2 -0
- package/dist/schemas/bookmark.d.ts +6 -0
- package/dist/schemas/comment.d.ts +4 -0
- package/dist/schemas/common.d.ts +2 -0
- package/dist/schemas/entity-stats.d.ts +2 -0
- package/dist/schemas/file.d.ts +8 -0
- package/dist/schemas/file.js +1 -4
- package/dist/schemas/like.d.ts +6 -0
- package/dist/schemas/message.d.ts +8 -0
- package/dist/schemas/notification.d.ts +12 -0
- package/dist/schemas/post.d.ts +38 -0
- package/dist/schemas/product.d.ts +70 -119
- package/dist/schemas/product.js +43 -90
- package/dist/schemas/project.d.ts +12 -0
- package/dist/schemas/transaction.d.ts +1 -1
- package/dist/schemas/user-strike.d.ts +6 -0
- package/dist/schemas/user.d.ts +88 -20
- package/dist/schemas/view.d.ts +2 -0
- package/package.json +1 -1
- package/src/constants.ts +2 -0
- package/src/schemas/file.ts +1 -4
- package/src/schemas/product.ts +55 -123
|
@@ -1,24 +1,4 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
-
export declare const CoverImageInputSchema: z.ZodObject<{
|
|
3
|
-
key: z.ZodString;
|
|
4
|
-
mimeType: z.ZodString;
|
|
5
|
-
isThumbnail: z.ZodDefault<z.ZodBoolean>;
|
|
6
|
-
order: z.ZodDefault<z.ZodNumber>;
|
|
7
|
-
}, z.core.$strip>;
|
|
8
|
-
export declare const DeliveryFileInputSchema: z.ZodObject<{
|
|
9
|
-
key: z.ZodString;
|
|
10
|
-
mimeType: z.ZodString;
|
|
11
|
-
order: z.ZodDefault<z.ZodNumber>;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
export declare const ProductCoverImageEntitySchema: z.ZodObject<{
|
|
14
|
-
fileId: z.ZodCUID2;
|
|
15
|
-
isThumbnail: z.ZodDefault<z.ZodBoolean>;
|
|
16
|
-
order: z.ZodDefault<z.ZodNumber>;
|
|
17
|
-
}, z.core.$strip>;
|
|
18
|
-
export declare const ProductDeliveryFileEntitySchema: z.ZodObject<{
|
|
19
|
-
fileId: z.ZodCUID2;
|
|
20
|
-
order: z.ZodDefault<z.ZodNumber>;
|
|
21
|
-
}, z.core.$strip>;
|
|
22
2
|
export declare const ProductDiscountEntitySchema: z.ZodObject<{
|
|
23
3
|
discountType: z.ZodEnum<{
|
|
24
4
|
readonly FIXED_AMOUNT: "Fixed Amount";
|
|
@@ -26,67 +6,12 @@ export declare const ProductDiscountEntitySchema: z.ZodObject<{
|
|
|
26
6
|
}>;
|
|
27
7
|
amount: z.ZodNumber;
|
|
28
8
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
29
|
-
|
|
9
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
30
10
|
}, z.core.$strip>;
|
|
31
11
|
export declare const ProductLinkSchema: z.ZodObject<{
|
|
32
12
|
title: z.ZodNullable<z.ZodString>;
|
|
33
13
|
url: z.ZodString;
|
|
34
14
|
}, z.core.$strip>;
|
|
35
|
-
export type ProductLink = z.infer<typeof ProductLinkSchema>;
|
|
36
|
-
export declare const BaseProductSchema: z.ZodObject<{
|
|
37
|
-
id: z.ZodCUID2;
|
|
38
|
-
createdAt: z.ZodDate;
|
|
39
|
-
updatedAt: z.ZodDate;
|
|
40
|
-
deletedAt: z.ZodNullable<z.ZodDate>;
|
|
41
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
42
|
-
readonly ACTIVE: "ACTIVE";
|
|
43
|
-
readonly UNDER_REVIEW: "UNDER_REVIEW";
|
|
44
|
-
readonly DRAFT: "DRAFT";
|
|
45
|
-
readonly ARCHIVED: "ARCHIVED";
|
|
46
|
-
readonly DELETED: "DELETED";
|
|
47
|
-
}>>;
|
|
48
|
-
sellerId: z.ZodCUID2;
|
|
49
|
-
title: z.ZodString;
|
|
50
|
-
description: z.ZodString;
|
|
51
|
-
keyFeatures: z.ZodString;
|
|
52
|
-
category: z.ZodString;
|
|
53
|
-
subcategory: z.ZodNullable<z.ZodString>;
|
|
54
|
-
tags: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
55
|
-
productLinks: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
56
|
-
title: z.ZodNullable<z.ZodString>;
|
|
57
|
-
url: z.ZodString;
|
|
58
|
-
}, z.core.$strip>>>;
|
|
59
|
-
pricingModel: z.ZodEnum<{
|
|
60
|
-
readonly FREE: "Free";
|
|
61
|
-
readonly FIXED: "Fixed";
|
|
62
|
-
readonly PWYW: "Pay What You Want";
|
|
63
|
-
}>;
|
|
64
|
-
currency: z.ZodEnum<{
|
|
65
|
-
readonly USD: "USD (United States Dollar)";
|
|
66
|
-
readonly EUR: "EUR (Euro)";
|
|
67
|
-
readonly GBP: "GBP (British Pound Sterling)";
|
|
68
|
-
readonly NGN: "NGN (Nigerian Naira)";
|
|
69
|
-
readonly CAD: "CAD (Canadian Dollar)";
|
|
70
|
-
readonly AUD: "AUD (Australian Dollar)";
|
|
71
|
-
readonly JPY: "JPY (Japanese Yen)";
|
|
72
|
-
readonly CHF: "CHF (Swiss Franc)";
|
|
73
|
-
readonly INR: "INR (Indian Rupee)";
|
|
74
|
-
readonly ZAR: "ZAR (South African Rand)";
|
|
75
|
-
}>;
|
|
76
|
-
price: z.ZodNullable<z.ZodNumber>;
|
|
77
|
-
suggestedPrice: z.ZodNullable<z.ZodNumber>;
|
|
78
|
-
discounts: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
79
|
-
discountType: z.ZodEnum<{
|
|
80
|
-
readonly FIXED_AMOUNT: "Fixed Amount";
|
|
81
|
-
readonly PERCENTAGE: "Percentage";
|
|
82
|
-
}>;
|
|
83
|
-
amount: z.ZodNumber;
|
|
84
|
-
discountCode: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
85
|
-
expiry: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
86
|
-
}, z.core.$strip>>>;
|
|
87
|
-
supportEmail: z.ZodNullable<z.ZodString>;
|
|
88
|
-
supportPhone: z.ZodNullable<z.ZodString>;
|
|
89
|
-
}, z.core.$strip>;
|
|
90
15
|
export declare const CreateProductInputSchema: z.ZodObject<{
|
|
91
16
|
id: z.ZodCUID2;
|
|
92
17
|
title: z.ZodString;
|
|
@@ -102,12 +27,28 @@ export declare const CreateProductInputSchema: z.ZodObject<{
|
|
|
102
27
|
category: z.ZodString;
|
|
103
28
|
subcategory: z.ZodOptional<z.ZodString>;
|
|
104
29
|
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
105
|
-
|
|
30
|
+
files: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
106
31
|
key: z.ZodString;
|
|
107
32
|
mimeType: z.ZodString;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
33
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
34
|
+
parentType: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
readonly PROJECT: "PROJECT";
|
|
36
|
+
readonly USER: "USER";
|
|
37
|
+
readonly JOB: "JOB";
|
|
38
|
+
readonly POST: "POST";
|
|
39
|
+
readonly PRODUCT: "PRODUCT";
|
|
40
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
41
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
42
|
+
readonly COMMENT: "COMMENT";
|
|
43
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
44
|
+
}>>;
|
|
45
|
+
isThumbnail: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
47
|
+
}, z.core.$strip>>>;
|
|
48
|
+
productLinks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
49
|
+
title: z.ZodNullable<z.ZodString>;
|
|
50
|
+
url: z.ZodString;
|
|
51
|
+
}, z.core.$strip>>>;
|
|
111
52
|
currency: z.ZodEnum<{
|
|
112
53
|
readonly USD: "USD (United States Dollar)";
|
|
113
54
|
readonly EUR: "EUR (Euro)";
|
|
@@ -120,15 +61,6 @@ export declare const CreateProductInputSchema: z.ZodObject<{
|
|
|
120
61
|
readonly INR: "INR (Indian Rupee)";
|
|
121
62
|
readonly ZAR: "ZAR (South African Rand)";
|
|
122
63
|
}>;
|
|
123
|
-
productFiles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
124
|
-
key: z.ZodString;
|
|
125
|
-
mimeType: z.ZodString;
|
|
126
|
-
order: z.ZodDefault<z.ZodNumber>;
|
|
127
|
-
}, z.core.$strip>>>;
|
|
128
|
-
productLinks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
129
|
-
title: z.ZodNullable<z.ZodString>;
|
|
130
|
-
url: z.ZodString;
|
|
131
|
-
}, z.core.$strip>>>;
|
|
132
64
|
pricingModel: z.ZodDefault<z.ZodEnum<{
|
|
133
65
|
readonly FREE: "Free";
|
|
134
66
|
readonly FIXED: "Fixed";
|
|
@@ -143,7 +75,7 @@ export declare const CreateProductInputSchema: z.ZodObject<{
|
|
|
143
75
|
}>;
|
|
144
76
|
amount: z.ZodNumber;
|
|
145
77
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
146
|
-
|
|
78
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
147
79
|
}, z.core.$strip>>>;
|
|
148
80
|
}, z.core.$strip>;
|
|
149
81
|
export declare const ProductServiceAndComplianceInputSchema: z.ZodObject<{
|
|
@@ -169,12 +101,28 @@ export declare const UpdateProductInputSchema: z.ZodObject<{
|
|
|
169
101
|
category: z.ZodOptional<z.ZodString>;
|
|
170
102
|
subcategory: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
171
103
|
tags: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
172
|
-
|
|
104
|
+
files: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
173
105
|
key: z.ZodString;
|
|
174
106
|
mimeType: z.ZodString;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
107
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
108
|
+
parentType: z.ZodOptional<z.ZodEnum<{
|
|
109
|
+
readonly PROJECT: "PROJECT";
|
|
110
|
+
readonly USER: "USER";
|
|
111
|
+
readonly JOB: "JOB";
|
|
112
|
+
readonly POST: "POST";
|
|
113
|
+
readonly PRODUCT: "PRODUCT";
|
|
114
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
115
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
116
|
+
readonly COMMENT: "COMMENT";
|
|
117
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
118
|
+
}>>;
|
|
119
|
+
isThumbnail: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
121
|
+
}, z.core.$strip>>>>;
|
|
122
|
+
productLinks: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
123
|
+
title: z.ZodNullable<z.ZodString>;
|
|
124
|
+
url: z.ZodString;
|
|
125
|
+
}, z.core.$strip>>>>;
|
|
178
126
|
currency: z.ZodOptional<z.ZodEnum<{
|
|
179
127
|
readonly USD: "USD (United States Dollar)";
|
|
180
128
|
readonly EUR: "EUR (Euro)";
|
|
@@ -187,15 +135,6 @@ export declare const UpdateProductInputSchema: z.ZodObject<{
|
|
|
187
135
|
readonly INR: "INR (Indian Rupee)";
|
|
188
136
|
readonly ZAR: "ZAR (South African Rand)";
|
|
189
137
|
}>>;
|
|
190
|
-
productFiles: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
191
|
-
key: z.ZodString;
|
|
192
|
-
mimeType: z.ZodString;
|
|
193
|
-
order: z.ZodDefault<z.ZodNumber>;
|
|
194
|
-
}, z.core.$strip>>>>;
|
|
195
|
-
productLinks: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
196
|
-
title: z.ZodNullable<z.ZodString>;
|
|
197
|
-
url: z.ZodString;
|
|
198
|
-
}, z.core.$strip>>>>;
|
|
199
138
|
pricingModel: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
200
139
|
readonly FREE: "Free";
|
|
201
140
|
readonly FIXED: "Fixed";
|
|
@@ -210,7 +149,7 @@ export declare const UpdateProductInputSchema: z.ZodObject<{
|
|
|
210
149
|
}>;
|
|
211
150
|
amount: z.ZodNumber;
|
|
212
151
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
213
|
-
|
|
152
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
214
153
|
}, z.core.$strip>>>>;
|
|
215
154
|
supportEmail: z.ZodOptional<z.ZodEmail>;
|
|
216
155
|
supportPhone: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -239,16 +178,28 @@ export declare const ProductEntitySchema: z.ZodObject<{
|
|
|
239
178
|
category: z.ZodString;
|
|
240
179
|
subcategory: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
241
180
|
tags: z.ZodArray<z.ZodString>;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
url: z.ZodURL;
|
|
247
|
-
}, z.core.$strip>>>;
|
|
248
|
-
productFiles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
249
|
-
fileId: z.ZodCUID2;
|
|
250
|
-
order: z.ZodDefault<z.ZodNumber>;
|
|
181
|
+
files: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
182
|
+
id: z.ZodCUID2;
|
|
183
|
+
key: z.ZodString;
|
|
184
|
+
mimeType: z.ZodString;
|
|
251
185
|
url: z.ZodURL;
|
|
186
|
+
parentId: z.ZodNullable<z.ZodCUID2>;
|
|
187
|
+
parentType: z.ZodNullable<z.ZodEnum<{
|
|
188
|
+
readonly PROJECT: "PROJECT";
|
|
189
|
+
readonly USER: "USER";
|
|
190
|
+
readonly JOB: "JOB";
|
|
191
|
+
readonly POST: "POST";
|
|
192
|
+
readonly PRODUCT: "PRODUCT";
|
|
193
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
194
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
195
|
+
readonly COMMENT: "COMMENT";
|
|
196
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
197
|
+
}>>;
|
|
198
|
+
isThumbnail: z.ZodNullable<z.ZodBoolean>;
|
|
199
|
+
order: z.ZodNumber;
|
|
200
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
201
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
202
|
+
deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
252
203
|
}, z.core.$strip>>>;
|
|
253
204
|
productLinks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
254
205
|
title: z.ZodNullable<z.ZodString>;
|
|
@@ -280,8 +231,12 @@ export declare const ProductEntitySchema: z.ZodObject<{
|
|
|
280
231
|
}>;
|
|
281
232
|
amount: z.ZodNumber;
|
|
282
233
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
283
|
-
|
|
234
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
284
235
|
}, z.core.$strip>>>;
|
|
236
|
+
ownsRights: z.ZodBoolean;
|
|
237
|
+
noHarmfulContent: z.ZodBoolean;
|
|
238
|
+
providesSupport: z.ZodBoolean;
|
|
239
|
+
agreesToTerms: z.ZodBoolean;
|
|
285
240
|
supportEmail: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
|
|
286
241
|
supportPhone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
287
242
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
@@ -456,18 +411,14 @@ export declare const GetMarketplaceInfoOutputSchema: z.ZodObject<{
|
|
|
456
411
|
deletedAt: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
457
412
|
}, z.core.$strip>>;
|
|
458
413
|
}, z.core.$strip>;
|
|
414
|
+
export type ProductLink = z.infer<typeof ProductLinkSchema>;
|
|
459
415
|
export type SearchProductInput = z.infer<typeof SearchProductInputSchema>;
|
|
460
416
|
export type SearchProductOutput = z.infer<typeof SearchProductOutputSchema>;
|
|
461
|
-
export type CoverImageInput = z.infer<typeof CoverImageInputSchema>;
|
|
462
|
-
export type DeliveryFileInput = z.infer<typeof DeliveryFileInputSchema>;
|
|
463
417
|
export type MarketplaceCategoryOutput = z.infer<typeof MarketplaceCategorySchema>;
|
|
464
418
|
export type GetMarketplaceInfoOutput = z.infer<typeof GetMarketplaceInfoOutputSchema>;
|
|
465
|
-
export type ProductCoverImageEntity = z.infer<typeof ProductCoverImageEntitySchema>;
|
|
466
|
-
export type ProductDeliveryFileEntity = z.infer<typeof ProductDeliveryFileEntitySchema>;
|
|
467
419
|
export type ProductDiscountEntity = z.infer<typeof ProductDiscountEntitySchema>;
|
|
468
420
|
export type CreateProductInputEntity = z.infer<typeof CreateProductInputSchema>;
|
|
469
421
|
export type ProductServiceAndComplianceInputEntity = z.infer<typeof ProductServiceAndComplianceInputSchema>;
|
|
470
422
|
export type UpdateProductInputEntity = z.infer<typeof UpdateProductInputSchema>;
|
|
471
423
|
export type ProductEntity = z.infer<typeof ProductEntitySchema>;
|
|
472
|
-
export type BaseProductEntity = z.infer<typeof BaseProductSchema>;
|
|
473
424
|
export type ProductSearchDocument = z.infer<typeof ProductSearchDocumentSchema>;
|
package/dist/schemas/product.js
CHANGED
|
@@ -1,32 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetMarketplaceInfoOutputSchema = exports.MarketplaceCategorySchema = exports.SearchProductOutputSchema = exports.SearchProductInputSchema = exports.ProductSearchDocumentSchema = exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.
|
|
3
|
+
exports.GetMarketplaceInfoOutputSchema = exports.MarketplaceCategorySchema = exports.SearchProductOutputSchema = exports.SearchProductInputSchema = exports.ProductSearchDocumentSchema = exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.ProductLinkSchema = exports.ProductDiscountEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
|
-
|
|
7
|
-
key: zod_openapi_1.z.string().openapi({ description: "Storage key of the uploaded file" }),
|
|
8
|
-
mimeType: zod_openapi_1.z.string().openapi({ example: "image/jpeg" }),
|
|
9
|
-
isThumbnail: zod_openapi_1.z.boolean().default(false),
|
|
10
|
-
order: zod_openapi_1.z.number().int().default(0),
|
|
11
|
-
});
|
|
12
|
-
exports.DeliveryFileInputSchema = zod_openapi_1.z.object({
|
|
13
|
-
key: zod_openapi_1.z.string().openapi({ description: "Storage key of the uploaded file" }),
|
|
14
|
-
mimeType: zod_openapi_1.z.string().openapi({ example: "application/zip" }),
|
|
15
|
-
order: zod_openapi_1.z.number().int().default(0),
|
|
16
|
-
});
|
|
17
|
-
exports.ProductCoverImageEntitySchema = zod_openapi_1.z.object({
|
|
18
|
-
fileId: zod_openapi_1.z
|
|
19
|
-
.cuid2()
|
|
20
|
-
.openapi({ example: "f123e4567-e89b-12d3-a456-426614174000" }),
|
|
21
|
-
isThumbnail: zod_openapi_1.z.boolean().default(false),
|
|
22
|
-
order: zod_openapi_1.z.number().int().default(0),
|
|
23
|
-
});
|
|
24
|
-
exports.ProductDeliveryFileEntitySchema = zod_openapi_1.z.object({
|
|
25
|
-
fileId: zod_openapi_1.z
|
|
26
|
-
.cuid2()
|
|
27
|
-
.openapi({ example: "f987e6543-e89b-12d3-a456-426614174000" }),
|
|
28
|
-
order: zod_openapi_1.z.number().int().default(0),
|
|
29
|
-
});
|
|
6
|
+
const file_1 = require("./file");
|
|
30
7
|
exports.ProductDiscountEntitySchema = zod_openapi_1.z.object({
|
|
31
8
|
discountType: zod_openapi_1.z.enum(constants_1.DISCOUNT_TYPES),
|
|
32
9
|
amount: zod_openapi_1.z
|
|
@@ -34,41 +11,12 @@ exports.ProductDiscountEntitySchema = zod_openapi_1.z.object({
|
|
|
34
11
|
.int("Amount must be a whole number")
|
|
35
12
|
.min(0, "Discount amount cannot be negative"),
|
|
36
13
|
discountCode: zod_openapi_1.z.string().optional(),
|
|
37
|
-
|
|
14
|
+
active: zod_openapi_1.z.boolean().default(true),
|
|
38
15
|
});
|
|
39
16
|
exports.ProductLinkSchema = zod_openapi_1.z.object({
|
|
40
17
|
title: zod_openapi_1.z.string().nullable(),
|
|
41
18
|
url: zod_openapi_1.z.string(),
|
|
42
19
|
});
|
|
43
|
-
exports.BaseProductSchema = zod_openapi_1.z.object({
|
|
44
|
-
id: zod_openapi_1.z.cuid2(),
|
|
45
|
-
createdAt: zod_openapi_1.z.date(),
|
|
46
|
-
updatedAt: zod_openapi_1.z.date(),
|
|
47
|
-
deletedAt: zod_openapi_1.z.date().nullable(),
|
|
48
|
-
status: zod_openapi_1.z.enum(constants_1.PRODUCT_STATUS).default("DRAFT"),
|
|
49
|
-
sellerId: zod_openapi_1.z.cuid2(),
|
|
50
|
-
title: zod_openapi_1.z.string(),
|
|
51
|
-
description: zod_openapi_1.z.string(),
|
|
52
|
-
keyFeatures: zod_openapi_1.z.string(),
|
|
53
|
-
category: zod_openapi_1.z.string(),
|
|
54
|
-
subcategory: zod_openapi_1.z.string().nullable(),
|
|
55
|
-
tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).nullable(),
|
|
56
|
-
productLinks: zod_openapi_1.z.array(exports.ProductLinkSchema).nullable(),
|
|
57
|
-
pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS),
|
|
58
|
-
currency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY),
|
|
59
|
-
price: zod_openapi_1.z.number().nullable(),
|
|
60
|
-
suggestedPrice: zod_openapi_1.z.number().nullable(),
|
|
61
|
-
discounts: zod_openapi_1.z
|
|
62
|
-
.array(zod_openapi_1.z.object({
|
|
63
|
-
discountType: zod_openapi_1.z.enum(constants_1.DISCOUNT_TYPES),
|
|
64
|
-
amount: zod_openapi_1.z.number(),
|
|
65
|
-
discountCode: zod_openapi_1.z.string().optional().nullable(),
|
|
66
|
-
expiry: zod_openapi_1.z.coerce.date().optional().nullable(),
|
|
67
|
-
}))
|
|
68
|
-
.nullable(),
|
|
69
|
-
supportEmail: zod_openapi_1.z.string().nullable(),
|
|
70
|
-
supportPhone: zod_openapi_1.z.string().nullable(),
|
|
71
|
-
});
|
|
72
20
|
const ProductCoreInputSchema = zod_openapi_1.z.object({
|
|
73
21
|
id: zod_openapi_1.z.cuid2().openapi({ description: "Client-generated ID for the product" }),
|
|
74
22
|
title: zod_openapi_1.z.string().min(1, "Title is required").max(255),
|
|
@@ -78,13 +26,9 @@ const ProductCoreInputSchema = zod_openapi_1.z.object({
|
|
|
78
26
|
category: zod_openapi_1.z.string().min(1, "Category is required"),
|
|
79
27
|
subcategory: zod_openapi_1.z.string().optional(),
|
|
80
28
|
tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).max(10, "Keep tags to a maximum of 10").default([]),
|
|
81
|
-
|
|
82
|
-
.array(exports.CoverImageInputSchema)
|
|
83
|
-
.min(1, "At least one cover image is required")
|
|
84
|
-
.max(5, "Maximum of 5 cover images allowed"),
|
|
85
|
-
currency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY),
|
|
86
|
-
productFiles: zod_openapi_1.z.array(exports.DeliveryFileInputSchema).default([]),
|
|
29
|
+
files: zod_openapi_1.z.array(file_1.CreateFileInputSchema).default([]),
|
|
87
30
|
productLinks: zod_openapi_1.z.array(exports.ProductLinkSchema).default([]),
|
|
31
|
+
currency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY),
|
|
88
32
|
pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS).default(constants_1.PRICING_MODELS.FIXED),
|
|
89
33
|
price: zod_openapi_1.z.number().int("Must be a whole number").min(0).optional(),
|
|
90
34
|
suggestedPrice: zod_openapi_1.z.number().int("Must be in cents").min(0).optional(),
|
|
@@ -101,14 +45,13 @@ exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx
|
|
|
101
45
|
}
|
|
102
46
|
if (data.pricingModel === constants_1.PRICING_MODELS.PWYW &&
|
|
103
47
|
data.suggestedPrice !== undefined &&
|
|
104
|
-
data.price !== undefined
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
48
|
+
data.price !== undefined &&
|
|
49
|
+
data.suggestedPrice < data.price) {
|
|
50
|
+
ctx.addIssue({
|
|
51
|
+
code: "custom",
|
|
52
|
+
message: "Suggested price cannot be lower than the minimum price.",
|
|
53
|
+
path: ["suggestedPrice"],
|
|
54
|
+
});
|
|
112
55
|
}
|
|
113
56
|
if (data.pricingModel === constants_1.PRICING_MODELS.FREE &&
|
|
114
57
|
data.price &&
|
|
@@ -119,21 +62,32 @@ exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx
|
|
|
119
62
|
path: ["price"],
|
|
120
63
|
});
|
|
121
64
|
}
|
|
122
|
-
|
|
65
|
+
const deliveryFiles = data.files.filter((f) => f.parentType === "PRODUCT_DELIVERY");
|
|
66
|
+
const coverImages = data.files.filter((f) => f.parentType === "PRODUCT_COVER");
|
|
67
|
+
if (deliveryFiles.length === 0 && data.productLinks.length === 0) {
|
|
123
68
|
ctx.addIssue({
|
|
124
69
|
code: "custom",
|
|
125
70
|
message: "You must provide at least one product file or a link for the buyer to receive.",
|
|
126
|
-
path: ["
|
|
71
|
+
path: ["files"],
|
|
127
72
|
});
|
|
128
73
|
}
|
|
129
|
-
|
|
130
|
-
if (thumbnails.length !== 1) {
|
|
74
|
+
if (coverImages.length < 1 || coverImages.length > 5) {
|
|
131
75
|
ctx.addIssue({
|
|
132
76
|
code: "custom",
|
|
133
|
-
message: "
|
|
134
|
-
path: ["
|
|
77
|
+
message: "Between 1 and 5 cover images are required.",
|
|
78
|
+
path: ["files"],
|
|
135
79
|
});
|
|
136
80
|
}
|
|
81
|
+
else {
|
|
82
|
+
const thumbnails = coverImages.filter((img) => img.isThumbnail);
|
|
83
|
+
if (thumbnails.length !== 1) {
|
|
84
|
+
ctx.addIssue({
|
|
85
|
+
code: "custom",
|
|
86
|
+
message: "Exactly one cover image must be set as the thumbnail.",
|
|
87
|
+
path: ["files"],
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
137
91
|
data.discounts.forEach((discount, index) => {
|
|
138
92
|
const isPercentage = String(discount.discountType).toUpperCase() === "PERCENTAGE";
|
|
139
93
|
const isFixed = String(discount.discountType).toUpperCase() === "FIXED";
|
|
@@ -144,14 +98,14 @@ exports.CreateProductInputSchema = ProductCoreInputSchema.superRefine((data, ctx
|
|
|
144
98
|
path: ["discounts", index, "amount"],
|
|
145
99
|
});
|
|
146
100
|
}
|
|
147
|
-
if (isFixed &&
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
101
|
+
if (isFixed &&
|
|
102
|
+
data.price !== undefined &&
|
|
103
|
+
discount.amount >= data.price) {
|
|
104
|
+
ctx.addIssue({
|
|
105
|
+
code: "custom",
|
|
106
|
+
message: "Fixed discount amounts must be less than the product price.",
|
|
107
|
+
path: ["discounts", index, "amount"],
|
|
108
|
+
});
|
|
155
109
|
}
|
|
156
110
|
});
|
|
157
111
|
});
|
|
@@ -159,7 +113,7 @@ exports.ProductServiceAndComplianceInputSchema = zod_openapi_1.z.object({
|
|
|
159
113
|
id: zod_openapi_1.z.cuid2().openapi({ description: "ID of the product" }),
|
|
160
114
|
supportEmail: zod_openapi_1.z.email("A valid support email is required"),
|
|
161
115
|
supportPhone: zod_openapi_1.z.string().optional(),
|
|
162
|
-
ownsRights: zod_openapi_1.z.literal(true, "You must confirm you own the rights to this product."),
|
|
116
|
+
ownsRights: zod_openapi_1.z.literal(true, '"You must confirm you own the rights to this product."'),
|
|
163
117
|
noHarmfulContent: zod_openapi_1.z.literal(true, "You must confirm no harmful content."),
|
|
164
118
|
providesSupport: zod_openapi_1.z.boolean(),
|
|
165
119
|
agreesToTerms: zod_openapi_1.z.literal(true, "You must agree to the Terms."),
|
|
@@ -183,18 +137,17 @@ exports.ProductEntitySchema = zod_openapi_1.z
|
|
|
183
137
|
category: zod_openapi_1.z.string(),
|
|
184
138
|
subcategory: zod_openapi_1.z.string().optional().nullable(),
|
|
185
139
|
tags: zod_openapi_1.z.array(zod_openapi_1.z.string()),
|
|
186
|
-
|
|
187
|
-
.array(exports.ProductCoverImageEntitySchema.extend({ url: zod_openapi_1.z.url() }))
|
|
188
|
-
.default([]),
|
|
189
|
-
productFiles: zod_openapi_1.z
|
|
190
|
-
.array(exports.ProductDeliveryFileEntitySchema.extend({ url: zod_openapi_1.z.url() }))
|
|
191
|
-
.default([]),
|
|
140
|
+
files: zod_openapi_1.z.array(file_1.FileEntitySchema).default([]),
|
|
192
141
|
productLinks: zod_openapi_1.z.array(exports.ProductLinkSchema).default([]),
|
|
193
142
|
pricingModel: zod_openapi_1.z.enum(constants_1.PRICING_MODELS),
|
|
194
143
|
currency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY),
|
|
195
144
|
price: zod_openapi_1.z.number().int().optional().nullable(),
|
|
196
145
|
suggestedPrice: zod_openapi_1.z.number().int().optional().nullable(),
|
|
197
146
|
discounts: zod_openapi_1.z.array(exports.ProductDiscountEntitySchema).default([]),
|
|
147
|
+
ownsRights: zod_openapi_1.z.boolean(),
|
|
148
|
+
noHarmfulContent: zod_openapi_1.z.boolean(),
|
|
149
|
+
providesSupport: zod_openapi_1.z.boolean(),
|
|
150
|
+
agreesToTerms: zod_openapi_1.z.boolean(),
|
|
198
151
|
supportEmail: zod_openapi_1.z.email().optional().nullable(),
|
|
199
152
|
supportPhone: zod_openapi_1.z.string().optional().nullable(),
|
|
200
153
|
createdAt: zod_openapi_1.z.coerce.date(),
|
|
@@ -169,6 +169,8 @@ export declare const CommentOnProjectInputSchema: z.ZodObject<{
|
|
|
169
169
|
readonly JOB: "JOB";
|
|
170
170
|
readonly POST: "POST";
|
|
171
171
|
readonly PRODUCT: "PRODUCT";
|
|
172
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
173
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
172
174
|
readonly COMMENT: "COMMENT";
|
|
173
175
|
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
174
176
|
}>;
|
|
@@ -466,6 +468,8 @@ export declare const ProjectWithProjectCommentsEntitySchema: z.ZodObject<{
|
|
|
466
468
|
readonly JOB: "JOB";
|
|
467
469
|
readonly POST: "POST";
|
|
468
470
|
readonly PRODUCT: "PRODUCT";
|
|
471
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
472
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
469
473
|
readonly COMMENT: "COMMENT";
|
|
470
474
|
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
471
475
|
}>;
|
|
@@ -500,6 +504,8 @@ export declare const GetProjectWithCommentsOutputSchema: z.ZodObject<{
|
|
|
500
504
|
readonly JOB: "JOB";
|
|
501
505
|
readonly POST: "POST";
|
|
502
506
|
readonly PRODUCT: "PRODUCT";
|
|
507
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
508
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
503
509
|
readonly COMMENT: "COMMENT";
|
|
504
510
|
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
505
511
|
}>;
|
|
@@ -587,6 +593,8 @@ export declare const ProjectWithProjectViewsEntitySchema: z.ZodObject<{
|
|
|
587
593
|
readonly JOB: "JOB";
|
|
588
594
|
readonly POST: "POST";
|
|
589
595
|
readonly PRODUCT: "PRODUCT";
|
|
596
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
597
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
590
598
|
readonly COMMENT: "COMMENT";
|
|
591
599
|
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
592
600
|
}>;
|
|
@@ -614,6 +622,8 @@ export declare const ProjectWithProjectBookmarksEntitySchema: z.ZodObject<{
|
|
|
614
622
|
readonly JOB: "JOB";
|
|
615
623
|
readonly POST: "POST";
|
|
616
624
|
readonly PRODUCT: "PRODUCT";
|
|
625
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
626
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
617
627
|
readonly COMMENT: "COMMENT";
|
|
618
628
|
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
619
629
|
}>;
|
|
@@ -819,6 +829,8 @@ export declare const CommentOnProjectOutputSchema: z.ZodObject<{
|
|
|
819
829
|
readonly JOB: "JOB";
|
|
820
830
|
readonly POST: "POST";
|
|
821
831
|
readonly PRODUCT: "PRODUCT";
|
|
832
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
833
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
822
834
|
readonly COMMENT: "COMMENT";
|
|
823
835
|
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
824
836
|
}>;
|
|
@@ -65,7 +65,6 @@ export declare const CreateTransactionInputSchema: z.ZodObject<{
|
|
|
65
65
|
readonly REFUNDED: "REFUNDED";
|
|
66
66
|
}>>;
|
|
67
67
|
amount: z.ZodNumber;
|
|
68
|
-
sellerId: z.ZodCUID2;
|
|
69
68
|
currency: z.ZodEnum<{
|
|
70
69
|
readonly USD: "USD (United States Dollar)";
|
|
71
70
|
readonly EUR: "EUR (Euro)";
|
|
@@ -78,6 +77,7 @@ export declare const CreateTransactionInputSchema: z.ZodObject<{
|
|
|
78
77
|
readonly INR: "INR (Indian Rupee)";
|
|
79
78
|
readonly ZAR: "ZAR (South African Rand)";
|
|
80
79
|
}>;
|
|
80
|
+
sellerId: z.ZodCUID2;
|
|
81
81
|
productId: z.ZodCUID2;
|
|
82
82
|
buyerId: z.ZodCUID2;
|
|
83
83
|
platformFee: z.ZodNumber;
|
|
@@ -11,6 +11,8 @@ export declare const UserStrikeEntitySchema: z.ZodObject<{
|
|
|
11
11
|
readonly JOB: "JOB";
|
|
12
12
|
readonly POST: "POST";
|
|
13
13
|
readonly PRODUCT: "PRODUCT";
|
|
14
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
15
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
14
16
|
readonly COMMENT: "COMMENT";
|
|
15
17
|
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
16
18
|
}>>;
|
|
@@ -27,6 +29,8 @@ export declare const UpsertUserStrikeInputSchema: z.ZodObject<{
|
|
|
27
29
|
readonly JOB: "JOB";
|
|
28
30
|
readonly POST: "POST";
|
|
29
31
|
readonly PRODUCT: "PRODUCT";
|
|
32
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
33
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
30
34
|
readonly COMMENT: "COMMENT";
|
|
31
35
|
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
32
36
|
}>>;
|
|
@@ -43,6 +47,8 @@ export declare const UpsertUserStrikeOutputSchema: z.ZodObject<{
|
|
|
43
47
|
readonly JOB: "JOB";
|
|
44
48
|
readonly POST: "POST";
|
|
45
49
|
readonly PRODUCT: "PRODUCT";
|
|
50
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
51
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
46
52
|
readonly COMMENT: "COMMENT";
|
|
47
53
|
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
48
54
|
}>>;
|