@zyacreatives/shared 2.5.54 → 2.5.55
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/schemas/activity.d.ts +1 -0
- package/dist/schemas/auth.d.ts +2 -0
- package/dist/schemas/bookmark.d.ts +62 -7
- package/dist/schemas/bookmark.js +32 -30
- package/dist/schemas/brand.d.ts +3 -3
- package/dist/schemas/chat.d.ts +96 -52
- package/dist/schemas/chat.js +44 -18
- package/dist/schemas/comment.d.ts +65 -21
- package/dist/schemas/comment.js +48 -54
- package/dist/schemas/common.d.ts +15 -11
- package/dist/schemas/creative.d.ts +3 -3
- package/dist/schemas/discipline.d.ts +63 -12
- package/dist/schemas/discipline.js +62 -65
- package/dist/schemas/entity-stats.d.ts +35 -3
- package/dist/schemas/entity-stats.js +24 -38
- package/dist/schemas/feed.d.ts +50 -3
- package/dist/schemas/feed.js +43 -13
- package/dist/schemas/file.d.ts +65 -24
- package/dist/schemas/file.js +60 -49
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/investor-shortlist.d.ts +68 -11
- package/dist/schemas/investor-shortlist.js +46 -24
- package/dist/schemas/investor-signal.d.ts +52 -12
- package/dist/schemas/investor-signal.js +59 -39
- package/dist/schemas/investor.d.ts +3 -3
- package/dist/schemas/job-application.d.ts +291 -279
- package/dist/schemas/job-application.js +59 -95
- package/dist/schemas/job.d.ts +200 -659
- package/dist/schemas/job.js +98 -231
- package/dist/schemas/like.d.ts +3 -0
- package/dist/schemas/message.d.ts +125 -94
- package/dist/schemas/message.js +54 -55
- package/dist/schemas/notification.d.ts +99 -32
- package/dist/schemas/notification.js +46 -42
- package/dist/schemas/payout-method.d.ts +51 -31
- package/dist/schemas/payout-method.js +48 -58
- package/dist/schemas/post.d.ts +295 -204
- package/dist/schemas/post.js +148 -272
- package/dist/schemas/product.d.ts +308 -229
- package/dist/schemas/product.js +111 -94
- package/dist/schemas/project.d.ts +75 -107
- package/dist/schemas/project.js +1 -5
- package/dist/schemas/seller.d.ts +10 -10
- package/dist/schemas/user-strike.d.ts +3 -0
- package/dist/schemas/user.d.ts +114 -123
- package/dist/schemas/username.d.ts +1 -0
- package/dist/schemas/view.d.ts +1 -0
- package/dist/types/activity.d.ts +1 -3
- package/dist/types/auth.d.ts +1 -4
- package/dist/types/bookmark.d.ts +1 -3
- package/dist/types/chat.d.ts +1 -11
- package/dist/types/comment.d.ts +1 -5
- package/dist/types/common.d.ts +2 -8
- package/dist/types/discipline.d.ts +1 -11
- package/dist/types/entity-stats.d.ts +1 -3
- package/dist/types/feed.d.ts +1 -5
- package/dist/types/investor-shortlist.d.ts +1 -6
- package/dist/types/investor-signal.d.ts +1 -7
- package/dist/types/like.d.ts +1 -3
- package/dist/types/message.d.ts +1 -9
- package/dist/types/notification.d.ts +1 -9
- package/dist/types/user-strike.d.ts +1 -5
- package/dist/types/username.d.ts +1 -3
- package/package.json +1 -1
- package/src/index.ts +4 -5
- package/src/schemas/activity.ts +5 -4
- package/src/schemas/auth.ts +14 -10
- package/src/schemas/bookmark.ts +48 -29
- package/src/schemas/chat.ts +79 -18
- package/src/schemas/comment.ts +63 -49
- package/src/schemas/common.ts +8 -3
- package/src/schemas/discipline.ts +103 -71
- package/src/schemas/entity-stats.ts +32 -38
- package/src/schemas/feed.ts +62 -15
- package/src/schemas/file.ts +85 -58
- package/src/schemas/index.ts +1 -0
- package/src/schemas/investor-shortlist.ts +57 -8
- package/src/schemas/investor-signal.ts +79 -27
- package/src/schemas/job-application.ts +81 -115
- package/src/schemas/job.ts +160 -301
- package/src/schemas/like.ts +5 -1
- package/src/schemas/message.ts +71 -64
- package/src/schemas/notification.ts +63 -51
- package/src/schemas/payout-method.ts +47 -63
- package/src/schemas/post.ts +211 -272
- package/src/schemas/product.ts +202 -139
- package/src/schemas/project.ts +7 -10
- package/src/schemas/user-strike.ts +7 -1
- package/src/schemas/user.ts +2 -6
- package/src/schemas/username.ts +5 -3
- package/src/schemas/view.ts +0 -50
- package/src/types/activity.ts +0 -4
- package/src/types/auth.ts +0 -5
- package/src/types/bookmark.ts +0 -4
- package/src/types/chat.ts +0 -31
- package/src/types/comment.ts +0 -12
- package/src/types/common.ts +0 -14
- package/src/types/discipline.ts +0 -32
- package/src/types/entity-stats.ts +0 -4
- package/src/types/feed.ts +0 -10
- package/src/types/index.ts +0 -16
- package/src/types/investor-shortlist.ts +0 -18
- package/src/types/investor-signal.ts +0 -26
- package/src/types/like.ts +0 -4
- package/src/types/message.ts +0 -26
- package/src/types/notification.ts +0 -34
- package/src/types/user-strike.ts +0 -10
- package/src/types/username.ts +0 -4
package/src/schemas/product.ts
CHANGED
|
@@ -1,47 +1,127 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
2
3
|
import {
|
|
3
4
|
DISCOUNT_TYPES,
|
|
4
5
|
PRICING_MODELS,
|
|
5
6
|
PRODUCT_STATUS,
|
|
6
7
|
WAGES_CURRENCY,
|
|
7
8
|
} from "../constants";
|
|
9
|
+
|
|
8
10
|
import { CreateFileInputSchema, FileEntitySchema } from "./file";
|
|
9
11
|
|
|
12
|
+
/**
|
|
13
|
+
* --------------------------------
|
|
14
|
+
* SHARED
|
|
15
|
+
* --------------------------------
|
|
16
|
+
*/
|
|
17
|
+
|
|
10
18
|
export const ProductDiscountEntitySchema = z.object({
|
|
11
19
|
discountType: z.enum(DISCOUNT_TYPES),
|
|
12
|
-
amount: z
|
|
13
|
-
.number()
|
|
14
|
-
.int("Amount must be a whole number")
|
|
15
|
-
.min(0, "Discount amount cannot be negative"),
|
|
20
|
+
amount: z.number().int().min(0),
|
|
16
21
|
discountCode: z.string().optional(),
|
|
17
22
|
active: z.boolean().default(true),
|
|
18
23
|
});
|
|
19
24
|
|
|
25
|
+
export type ProductDiscountEntity = z.infer<typeof ProductDiscountEntitySchema>;
|
|
26
|
+
|
|
20
27
|
export const ProductLinkSchema = z.object({
|
|
21
28
|
title: z.string().nullable(),
|
|
22
29
|
url: z.string(),
|
|
23
30
|
});
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
export type ProductLink = z.infer<typeof ProductLinkSchema>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* --------------------------------
|
|
36
|
+
* SHAPE
|
|
37
|
+
* --------------------------------
|
|
38
|
+
*/
|
|
27
39
|
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
const ProductShape = z.object({
|
|
41
|
+
title: z.string().min(1).max(255),
|
|
42
|
+
description: z.string().min(1),
|
|
30
43
|
keyFeatures: z.string(),
|
|
44
|
+
|
|
31
45
|
status: z.enum(PRODUCT_STATUS).default("DRAFT"),
|
|
32
|
-
|
|
46
|
+
|
|
47
|
+
category: z.string().min(1),
|
|
33
48
|
subcategory: z.string().optional(),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
productLinks: z.array(ProductLinkSchema).default([]),
|
|
49
|
+
|
|
50
|
+
tags: z.array(z.string()).max(10).default([]),
|
|
37
51
|
|
|
38
52
|
currency: z.enum(WAGES_CURRENCY),
|
|
39
53
|
pricingModel: z.enum(PRICING_MODELS).default(PRICING_MODELS.FIXED),
|
|
40
|
-
price: z.number().int(
|
|
41
|
-
suggestedPrice: z.number().int(
|
|
54
|
+
price: z.number().int().min(0).optional(),
|
|
55
|
+
suggestedPrice: z.number().int().min(0).optional(),
|
|
56
|
+
|
|
42
57
|
discounts: z.array(ProductDiscountEntitySchema).max(3).default([]),
|
|
43
58
|
});
|
|
44
59
|
|
|
60
|
+
export type ProductShapeType = z.infer<typeof ProductShape>;
|
|
61
|
+
|
|
62
|
+
const ProductComplianceShape = z.object({
|
|
63
|
+
supportEmail: z.email(),
|
|
64
|
+
supportPhone: z.string().optional(),
|
|
65
|
+
|
|
66
|
+
ownsRights: z.literal(true),
|
|
67
|
+
noHarmfulContent: z.literal(true),
|
|
68
|
+
providesSupport: z.boolean(),
|
|
69
|
+
agreesToTerms: z.literal(true),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export type ProductComplianceShapeType = z.infer<typeof ProductComplianceShape>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* --------------------------------
|
|
76
|
+
* BASE ENTITY
|
|
77
|
+
* --------------------------------
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
export const ProductEntitySchema = z
|
|
81
|
+
.object({
|
|
82
|
+
id: z.cuid2(),
|
|
83
|
+
|
|
84
|
+
sellerId: z.cuid2(),
|
|
85
|
+
sellerUsername: z.string(),
|
|
86
|
+
sellerName: z.string(),
|
|
87
|
+
sellerImageUrl: z.url().nullable().optional(),
|
|
88
|
+
|
|
89
|
+
...ProductShape.shape,
|
|
90
|
+
|
|
91
|
+
subcategory: z.string().nullable().optional(),
|
|
92
|
+
|
|
93
|
+
files: z.array(FileEntitySchema).default([]),
|
|
94
|
+
productLinks: z.array(ProductLinkSchema).default([]),
|
|
95
|
+
|
|
96
|
+
ownsRights: z.boolean(),
|
|
97
|
+
noHarmfulContent: z.boolean(),
|
|
98
|
+
providesSupport: z.boolean(),
|
|
99
|
+
agreesToTerms: z.boolean(),
|
|
100
|
+
|
|
101
|
+
supportEmail: z.email().nullable().optional(),
|
|
102
|
+
supportPhone: z.string().nullable().optional(),
|
|
103
|
+
|
|
104
|
+
createdAt: z.iso.datetime(),
|
|
105
|
+
updatedAt: z.iso.datetime(),
|
|
106
|
+
deletedAt: z.iso.datetime().nullable().optional(),
|
|
107
|
+
})
|
|
108
|
+
.openapi("Product");
|
|
109
|
+
|
|
110
|
+
export type ProductEntity = z.infer<typeof ProductEntitySchema>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* --------------------------------
|
|
114
|
+
* INPUTS
|
|
115
|
+
* --------------------------------
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
const ProductCoreInputSchema = ProductShape.extend({
|
|
119
|
+
id: z.cuid2(),
|
|
120
|
+
|
|
121
|
+
files: z.array(CreateFileInputSchema).default([]),
|
|
122
|
+
productLinks: z.array(ProductLinkSchema).default([]),
|
|
123
|
+
});
|
|
124
|
+
|
|
45
125
|
export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
|
|
46
126
|
(data, ctx) => {
|
|
47
127
|
if (
|
|
@@ -81,10 +161,11 @@ export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
|
|
|
81
161
|
}
|
|
82
162
|
|
|
83
163
|
const deliveryFiles = data.files.filter(
|
|
84
|
-
(
|
|
164
|
+
(file) => file.parentType === "PRODUCT_DELIVERY",
|
|
85
165
|
);
|
|
166
|
+
|
|
86
167
|
const coverImages = data.files.filter(
|
|
87
|
-
(
|
|
168
|
+
(file) => file.parentType === "PRODUCT_COVER",
|
|
88
169
|
);
|
|
89
170
|
|
|
90
171
|
if (deliveryFiles.length === 0 && data.productLinks.length === 0) {
|
|
@@ -103,7 +184,8 @@ export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
|
|
|
103
184
|
path: ["files"],
|
|
104
185
|
});
|
|
105
186
|
} else {
|
|
106
|
-
const thumbnails = coverImages.filter((
|
|
187
|
+
const thumbnails = coverImages.filter((image) => image.isThumbnail);
|
|
188
|
+
|
|
107
189
|
if (thumbnails.length !== 1) {
|
|
108
190
|
ctx.addIssue({
|
|
109
191
|
code: "custom",
|
|
@@ -142,209 +224,190 @@ export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
|
|
|
142
224
|
},
|
|
143
225
|
);
|
|
144
226
|
|
|
145
|
-
export
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
agreesToTerms: z.literal(true, "You must agree to the Terms."),
|
|
156
|
-
});
|
|
227
|
+
export type CreateProductInputEntity = z.infer<typeof CreateProductInputSchema>;
|
|
228
|
+
|
|
229
|
+
export const ProductServiceAndComplianceInputSchema =
|
|
230
|
+
ProductComplianceShape.extend({
|
|
231
|
+
id: z.cuid2(),
|
|
232
|
+
}).openapi("ProductServiceAndComplianceInput");
|
|
233
|
+
|
|
234
|
+
export type ProductServiceAndComplianceInputEntity = z.infer<
|
|
235
|
+
typeof ProductServiceAndComplianceInputSchema
|
|
236
|
+
>;
|
|
157
237
|
|
|
158
238
|
export const UpdateProductInputSchema = ProductCoreInputSchema.extend(
|
|
159
|
-
|
|
239
|
+
ProductComplianceShape.shape,
|
|
160
240
|
)
|
|
161
241
|
.partial()
|
|
162
242
|
.extend({
|
|
163
|
-
id: z.cuid2()
|
|
243
|
+
id: z.cuid2(),
|
|
164
244
|
});
|
|
165
245
|
|
|
166
|
-
export
|
|
167
|
-
.object({
|
|
168
|
-
id: z.cuid2(),
|
|
169
|
-
sellerId: z.cuid2().openapi({ description: "ID of the creator/seller" }),
|
|
170
|
-
sellerUsername: z.string(),
|
|
171
|
-
sellerName: z.string(),
|
|
172
|
-
sellerImageUrl: z.url().optional().nullable(),
|
|
246
|
+
export type UpdateProductInputEntity = z.infer<typeof UpdateProductInputSchema>;
|
|
173
247
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
248
|
+
export const SearchProductInputSchema = z.object({
|
|
249
|
+
queryString: z.string().max(200).optional(),
|
|
250
|
+
cursor: z.string().optional(),
|
|
251
|
+
limit: z.coerce.number().int().min(1).max(100).default(30),
|
|
252
|
+
tags: z.array(z.string()).optional(),
|
|
253
|
+
filters: z.array(z.string()).optional(),
|
|
254
|
+
category: z.string().optional(),
|
|
255
|
+
subcategory: z.string().optional(),
|
|
256
|
+
});
|
|
181
257
|
|
|
182
|
-
|
|
183
|
-
productLinks: z.array(ProductLinkSchema).default([]),
|
|
258
|
+
export type SearchProductInput = z.infer<typeof SearchProductInputSchema>;
|
|
184
259
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
discounts: z.array(ProductDiscountEntitySchema).default([]),
|
|
260
|
+
export const ProductDiscountCheckInputSchema = z.object({
|
|
261
|
+
discountCode: z.string(),
|
|
262
|
+
productId: z.cuid2(),
|
|
263
|
+
});
|
|
190
264
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
agreesToTerms: z.boolean(),
|
|
195
|
-
supportEmail: z.email().optional().nullable(),
|
|
196
|
-
supportPhone: z.string().optional().nullable(),
|
|
265
|
+
export type ProductDiscountCheckInput = z.infer<
|
|
266
|
+
typeof ProductDiscountCheckInputSchema
|
|
267
|
+
>;
|
|
197
268
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
269
|
+
export const RevenueChartInputSchema = z.object({
|
|
270
|
+
startDate: z.string().optional(),
|
|
271
|
+
endDate: z.string().optional(),
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
export type RevenueChartInput = z.infer<typeof RevenueChartInputSchema>;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* --------------------------------
|
|
278
|
+
* SEARCH / MARKETPLACE
|
|
279
|
+
* --------------------------------
|
|
280
|
+
*/
|
|
203
281
|
|
|
204
282
|
export const ProductSearchDocumentSchema = z.object({
|
|
205
283
|
id: z.cuid2(),
|
|
284
|
+
|
|
206
285
|
sellerId: z.cuid2(),
|
|
207
286
|
sellerUsername: z.string(),
|
|
208
287
|
sellerName: z.string(),
|
|
209
|
-
status: z.enum(PRODUCT_STATUS),
|
|
210
288
|
sellerImageUrl: z.url().nullable(),
|
|
289
|
+
|
|
290
|
+
status: z.enum(PRODUCT_STATUS),
|
|
291
|
+
|
|
211
292
|
title: z.string(),
|
|
212
293
|
category: z.string(),
|
|
213
294
|
subcategory: z.string().nullable(),
|
|
214
295
|
tags: z.array(z.string()),
|
|
296
|
+
|
|
215
297
|
thumbnailImgUrl: z.url().nullable(),
|
|
298
|
+
|
|
216
299
|
currency: z.enum(WAGES_CURRENCY),
|
|
217
300
|
price: z.number().nullable(),
|
|
218
301
|
suggestedPrice: z.number().nullable(),
|
|
219
|
-
createdAt: z.coerce.date(),
|
|
220
|
-
updatedAt: z.coerce.date(),
|
|
221
|
-
deletedAt: z.coerce.date().optional().nullable(),
|
|
222
|
-
});
|
|
223
302
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
.max(200, { message: "Search string cannot exceed 200 characters" })
|
|
228
|
-
.optional()
|
|
229
|
-
.openapi({ example: "typescript utility types" }),
|
|
230
|
-
cursor: z.string().optional().openapi({ example: "ckj1a2b3c0000cur" }),
|
|
231
|
-
limit: z.coerce.number().int().min(1).max(100).optional().default(30),
|
|
232
|
-
tags: z.array(z.string()).optional(),
|
|
233
|
-
filters: z.array(z.string()).optional(),
|
|
234
|
-
category: z.string().optional(),
|
|
235
|
-
subcategory: z.string().optional(),
|
|
303
|
+
createdAt: z.iso.datetime(),
|
|
304
|
+
updatedAt: z.iso.datetime(),
|
|
305
|
+
deletedAt: z.iso.datetime().nullable().optional(),
|
|
236
306
|
});
|
|
237
307
|
|
|
238
|
-
export
|
|
239
|
-
|
|
240
|
-
|
|
308
|
+
export type ProductSearchDocument = z.infer<typeof ProductSearchDocumentSchema>;
|
|
309
|
+
|
|
310
|
+
export const MarketplaceProductEntitySchema = ProductEntitySchema.omit({
|
|
311
|
+
discounts: true,
|
|
241
312
|
});
|
|
242
313
|
|
|
314
|
+
export type MarketplaceProductEntity = z.infer<
|
|
315
|
+
typeof MarketplaceProductEntitySchema
|
|
316
|
+
>;
|
|
317
|
+
|
|
243
318
|
export const MarketplaceCategorySchema = z.object({
|
|
244
319
|
name: z.string(),
|
|
245
320
|
imgUrl: z.url(),
|
|
246
321
|
subcategories: z.array(z.string()),
|
|
247
322
|
});
|
|
248
323
|
|
|
324
|
+
export type MarketplaceCategoryOutput = z.infer<
|
|
325
|
+
typeof MarketplaceCategorySchema
|
|
326
|
+
>;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* --------------------------------
|
|
330
|
+
* OUTPUTS
|
|
331
|
+
* --------------------------------
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
export const SearchProductOutputSchema = z.object({
|
|
335
|
+
products: z.array(ProductSearchDocumentSchema),
|
|
336
|
+
nextCursor: z.string().optional(),
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
export type SearchProductOutput = z.infer<typeof SearchProductOutputSchema>;
|
|
340
|
+
|
|
249
341
|
export const GetMarketplaceInfoOutputSchema = z.object({
|
|
250
342
|
categories: z.array(MarketplaceCategorySchema),
|
|
251
343
|
whatsHot: z.array(ProductSearchDocumentSchema),
|
|
252
344
|
communityFavourites: z.array(ProductSearchDocumentSchema),
|
|
253
345
|
});
|
|
254
346
|
|
|
255
|
-
export
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
export const ProductDiscountCheckInputSchema = z.object({
|
|
260
|
-
discountCode: z.string(),
|
|
261
|
-
productId: z.cuid2(),
|
|
262
|
-
});
|
|
347
|
+
export type GetMarketplaceInfoOutput = z.infer<
|
|
348
|
+
typeof GetMarketplaceInfoOutputSchema
|
|
349
|
+
>;
|
|
263
350
|
|
|
264
351
|
export const ProductDiscountCheckOutputSchema = z.object({
|
|
265
352
|
exists: z.boolean(),
|
|
266
353
|
discount: ProductDiscountEntitySchema.nullable(),
|
|
267
354
|
});
|
|
268
355
|
|
|
356
|
+
export type ProductDiscountCheckOutput = z.infer<
|
|
357
|
+
typeof ProductDiscountCheckOutputSchema
|
|
358
|
+
>;
|
|
359
|
+
|
|
269
360
|
export const ProductStatsOutputSchema = z.object({
|
|
270
361
|
salesToday: z.number().int(),
|
|
271
362
|
revenueToday: z.number().int(),
|
|
272
363
|
totalProductRevenue: z.number().int(),
|
|
273
364
|
});
|
|
274
365
|
|
|
366
|
+
export type ProductStatsOutput = z.infer<typeof ProductStatsOutputSchema>;
|
|
367
|
+
|
|
275
368
|
export const ProductTransactionItemSchema = z.object({
|
|
276
369
|
id: z.string(),
|
|
277
370
|
customerEmail: z.string().nullable(),
|
|
278
371
|
orderId: z.string().nullable(),
|
|
279
372
|
price: z.number().int(),
|
|
280
373
|
status: z.string(),
|
|
281
|
-
date: z.
|
|
374
|
+
date: z.iso.datetime(),
|
|
282
375
|
});
|
|
283
376
|
|
|
377
|
+
export type ProductTransactionItem = z.infer<
|
|
378
|
+
typeof ProductTransactionItemSchema
|
|
379
|
+
>;
|
|
380
|
+
|
|
284
381
|
export const ProductTransactionsOutputSchema = z.object({
|
|
285
382
|
transactions: z.array(ProductTransactionItemSchema),
|
|
286
383
|
});
|
|
287
384
|
|
|
385
|
+
export type ProductTransactionsOutput = z.infer<
|
|
386
|
+
typeof ProductTransactionsOutputSchema
|
|
387
|
+
>;
|
|
388
|
+
|
|
288
389
|
export const RevenueChartPointSchema = z.object({
|
|
289
|
-
date: z.string()
|
|
390
|
+
date: z.string(),
|
|
290
391
|
revenue: z.number().int(),
|
|
291
392
|
});
|
|
292
393
|
|
|
394
|
+
export type RevenueChartPoint = z.infer<typeof RevenueChartPointSchema>;
|
|
395
|
+
|
|
293
396
|
export const ProductRevenueChartOutputSchema = z.object({
|
|
294
397
|
chartData: z.array(RevenueChartPointSchema),
|
|
295
398
|
});
|
|
296
399
|
|
|
297
|
-
export
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
});
|
|
400
|
+
export type ProductRevenueChartOutput = z.infer<
|
|
401
|
+
typeof ProductRevenueChartOutputSchema
|
|
402
|
+
>;
|
|
301
403
|
|
|
302
404
|
export const SellerDashboardStatsOutputSchema = z.object({
|
|
303
405
|
totalSales: z.number().int(),
|
|
304
|
-
totalViews: z.number().int(),
|
|
406
|
+
totalViews: z.number().int(),
|
|
305
407
|
totalProducts: z.number().int(),
|
|
306
408
|
totalDrafts: z.number().int(),
|
|
307
409
|
});
|
|
308
410
|
|
|
309
|
-
export type SellerDashboardStatsOutput = z.infer<
|
|
310
|
-
|
|
311
|
-
export type ProductLink = z.infer<typeof ProductLinkSchema>;
|
|
312
|
-
export type SearchProductInput = z.infer<typeof SearchProductInputSchema>;
|
|
313
|
-
export type SearchProductOutput = z.infer<typeof SearchProductOutputSchema>;
|
|
314
|
-
export type MarketplaceCategoryOutput = z.infer<
|
|
315
|
-
typeof MarketplaceCategorySchema
|
|
316
|
-
>;
|
|
317
|
-
export type GetMarketplaceInfoOutput = z.infer<
|
|
318
|
-
typeof GetMarketplaceInfoOutputSchema
|
|
319
|
-
>;
|
|
320
|
-
|
|
321
|
-
export type ProductDiscountEntity = z.infer<typeof ProductDiscountEntitySchema>;
|
|
322
|
-
export type CreateProductInputEntity = z.infer<typeof CreateProductInputSchema>;
|
|
323
|
-
export type ProductServiceAndComplianceInputEntity = z.infer<
|
|
324
|
-
typeof ProductServiceAndComplianceInputSchema
|
|
325
|
-
>;
|
|
326
|
-
export type UpdateProductInputEntity = z.infer<typeof UpdateProductInputSchema>;
|
|
327
|
-
export type ProductEntity = z.infer<typeof ProductEntitySchema>;
|
|
328
|
-
export type ProductSearchDocument = z.infer<typeof ProductSearchDocumentSchema>;
|
|
329
|
-
export type MarketplaceProductEntity = z.infer<
|
|
330
|
-
typeof MarketplaceProductEntitySchema
|
|
331
|
-
>;
|
|
332
|
-
|
|
333
|
-
export type ProductDiscountCheckInput = z.infer<
|
|
334
|
-
typeof ProductDiscountCheckInputSchema
|
|
335
|
-
>;
|
|
336
|
-
export type ProductDiscountCheckOutput = z.infer<
|
|
337
|
-
typeof ProductDiscountCheckOutputSchema
|
|
411
|
+
export type SellerDashboardStatsOutput = z.infer<
|
|
412
|
+
typeof SellerDashboardStatsOutputSchema
|
|
338
413
|
>;
|
|
339
|
-
export type ProductStatsOutput = z.infer<typeof ProductStatsOutputSchema>;
|
|
340
|
-
export type ProductTransactionItem = z.infer<
|
|
341
|
-
typeof ProductTransactionItemSchema
|
|
342
|
-
>;
|
|
343
|
-
export type ProductTransactionsOutput = z.infer<
|
|
344
|
-
typeof ProductTransactionsOutputSchema
|
|
345
|
-
>;
|
|
346
|
-
export type RevenueChartPoint = z.infer<typeof RevenueChartPointSchema>;
|
|
347
|
-
export type ProductRevenueChartOutput = z.infer<
|
|
348
|
-
typeof ProductRevenueChartOutputSchema
|
|
349
|
-
>;
|
|
350
|
-
export type RevenueChartInput = z.infer<typeof RevenueChartInputSchema>;
|
package/src/schemas/project.ts
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from "../constants";
|
|
9
9
|
import { CommentEntitySchema } from "./comment";
|
|
10
10
|
import { BookmarkEntitySchema } from "./bookmark";
|
|
11
|
-
import { ViewEntitySchema } from "./view";
|
|
12
11
|
import { MinimalUserSchema } from "./user";
|
|
13
12
|
import { ActivitySchema } from "./activity";
|
|
14
13
|
import { FileEntitySchema } from "./file";
|
|
@@ -76,6 +75,13 @@ export const ProjectSocialGraphEntitySchema = z
|
|
|
76
75
|
})
|
|
77
76
|
.openapi("ProjectSocialGraphEntity");
|
|
78
77
|
|
|
78
|
+
export type ProjectSocialGraphEntity = z.infer<
|
|
79
|
+
typeof ProjectSocialGraphEntitySchema
|
|
80
|
+
>;
|
|
81
|
+
export type PostSocialGraphEntity = z.infer<
|
|
82
|
+
typeof ProjectSocialGraphEntitySchema
|
|
83
|
+
>;
|
|
84
|
+
|
|
79
85
|
export const CreateProjectInputSchema = z
|
|
80
86
|
.object({
|
|
81
87
|
id: z.cuid2().optional(),
|
|
@@ -302,14 +308,6 @@ export type GetProjectWithLikesOutput = z.infer<
|
|
|
302
308
|
typeof GetProjectWithLikesOutputSchema
|
|
303
309
|
>;
|
|
304
310
|
|
|
305
|
-
export const ProjectWithProjectViewsEntitySchema = MinimalProjectSchema.extend({
|
|
306
|
-
views: z.array(ViewEntitySchema),
|
|
307
|
-
}).openapi("ProjectWithProjectViewsEntity");
|
|
308
|
-
|
|
309
|
-
export type ProjectWithProjectViewsEntity = z.infer<
|
|
310
|
-
typeof ProjectWithProjectViewsEntitySchema
|
|
311
|
-
>;
|
|
312
|
-
|
|
313
311
|
export const ProjectWithProjectBookmarksEntitySchema =
|
|
314
312
|
MinimalProjectSchema.extend({
|
|
315
313
|
bookmarks: z.array(BookmarkEntitySchema),
|
|
@@ -343,6 +341,5 @@ export type CommentOnProjectOutput = z.infer<
|
|
|
343
341
|
export const ProjectIdSchema = z.object({ projectId: z.cuid2() });
|
|
344
342
|
export type ProjectIdInput = z.infer<typeof ProjectIdSchema>;
|
|
345
343
|
|
|
346
|
-
export type ProjectViewEntity = z.infer<typeof ViewEntitySchema>;
|
|
347
344
|
export type ProjectLikeEntity = z.infer<typeof LikeEntitySchema>;
|
|
348
345
|
export type ProjectCommentEntity = z.infer<typeof CommentEntitySchema>;
|
|
@@ -18,4 +18,10 @@ export const UpsertUserStrikeInputSchema = z.object({
|
|
|
18
18
|
parentType: z.enum(ACTIVITY_PARENT_TYPES).optional(),
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
export const UpsertUserStrikeOutputSchema = UserStrikeEntitySchema;
|
|
21
|
+
export const UpsertUserStrikeOutputSchema = UserStrikeEntitySchema;
|
|
22
|
+
|
|
23
|
+
export type UserStrikeEntity = z.infer<typeof UserStrikeEntitySchema>;
|
|
24
|
+
export type UpsertUserStrikeInput = z.infer<typeof UpsertUserStrikeInputSchema>;
|
|
25
|
+
export type UpsertUserStrikeOutput = z.infer<
|
|
26
|
+
typeof UpsertUserStrikeOutputSchema
|
|
27
|
+
>;
|
package/src/schemas/user.ts
CHANGED
|
@@ -22,11 +22,7 @@ import { LikeEntitySchema } from "./like";
|
|
|
22
22
|
import { BrandEntitySchema } from "./brand";
|
|
23
23
|
import { CreativeEntitySchema } from "./creative";
|
|
24
24
|
import { InvestorEntitySchema } from "./investor";
|
|
25
|
-
import {
|
|
26
|
-
FeedPostEntitySchema,
|
|
27
|
-
PostEntitySchema,
|
|
28
|
-
PostWithFilesEntitySchema,
|
|
29
|
-
} from "./post";
|
|
25
|
+
import { PostEntitySchema, PostWithFilesEntitySchema } from "./post";
|
|
30
26
|
import { JobSearchDocumentSchema } from "./job";
|
|
31
27
|
import { ProductEntitySchema } from "./product";
|
|
32
28
|
|
|
@@ -226,7 +222,7 @@ export const UserWithJobBookmarksInputSchema = z.object({
|
|
|
226
222
|
export type UserAuthStatusEntity = z.infer<typeof UserAuthStatusEntitySchema>;
|
|
227
223
|
export type UserWithJobBookmarksInput = z.infer<
|
|
228
224
|
typeof UserWithJobBookmarksEntitySchema
|
|
229
|
-
>;
|
|
225
|
+
>;
|
|
230
226
|
|
|
231
227
|
/**
|
|
232
228
|
* --------------------------------
|
package/src/schemas/username.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
|
|
3
|
-
export const UsernameSchema = z.object({
|
|
3
|
+
export const UsernameSchema = z.object({
|
|
4
4
|
username: z
|
|
5
5
|
.string()
|
|
6
6
|
.min(3, { message: "Username must be at least 3 characters" })
|
|
7
7
|
.max(32, { message: "Username must be at most 32 characters" })
|
|
8
8
|
.regex(/^[a-zA-Z0-9_]+$/, {
|
|
9
9
|
message: "Username may only contain letters, numbers, and underscores",
|
|
10
|
-
}),
|
|
11
|
-
});
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type UsernameInput = z.infer<typeof UsernameSchema>;
|
package/src/schemas/view.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import { ACTIVITY_PARENT_TYPES } from "../constants";
|
|
3
|
-
|
|
4
|
-
export const ViewEntitySchema = z
|
|
5
|
-
.object({
|
|
6
|
-
id: z.cuid2().openapi({
|
|
7
|
-
description: "Unique identifier of the view record.",
|
|
8
|
-
title: "View ID",
|
|
9
|
-
}),
|
|
10
|
-
userId: z.cuid2().nullable().openapi({
|
|
11
|
-
description:
|
|
12
|
-
"Identifier of the user who viewed the entity, if authenticated.",
|
|
13
|
-
title: "User ID",
|
|
14
|
-
}),
|
|
15
|
-
ipAddress: z.string().nullable().openapi({
|
|
16
|
-
description: "IP address from which the entity was viewed.",
|
|
17
|
-
title: "IP Address",
|
|
18
|
-
}),
|
|
19
|
-
userAgent: z.string().nullable().openapi({
|
|
20
|
-
description:
|
|
21
|
-
"User agent string identifying the client device or browser.",
|
|
22
|
-
title: "User Agent",
|
|
23
|
-
}),
|
|
24
|
-
parentId: z.cuid2().openapi({
|
|
25
|
-
description: "Identifier of the parent entity being viewed.",
|
|
26
|
-
title: "Parent ID",
|
|
27
|
-
}),
|
|
28
|
-
parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
|
|
29
|
-
description: "Type of the parent entity (e.g., project, post, etc.).",
|
|
30
|
-
title: "Parent Type",
|
|
31
|
-
}),
|
|
32
|
-
sessionId: z.string().nullable().openapi({
|
|
33
|
-
description:
|
|
34
|
-
"Session identifier associated with the view event, if available.",
|
|
35
|
-
title: "Session ID",
|
|
36
|
-
}),
|
|
37
|
-
viewedAt: z.coerce.date().optional().openapi({
|
|
38
|
-
description: "Exact timestamp when the view occurred.",
|
|
39
|
-
title: "Viewed At",
|
|
40
|
-
}),
|
|
41
|
-
viewDate: z.coerce.date().optional().openapi({
|
|
42
|
-
description:
|
|
43
|
-
"Calendar date corresponding to the view event, used for aggregation.",
|
|
44
|
-
title: "View Date",
|
|
45
|
-
}),
|
|
46
|
-
})
|
|
47
|
-
.openapi({
|
|
48
|
-
description: "Represents a record of a single view event for an entity.",
|
|
49
|
-
title: "View",
|
|
50
|
-
});
|
package/src/types/activity.ts
DELETED
package/src/types/auth.ts
DELETED
package/src/types/bookmark.ts
DELETED
package/src/types/chat.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
import {
|
|
3
|
-
AcceptMessageRequestInputSchema,
|
|
4
|
-
BaseChatEntitySchema,
|
|
5
|
-
ChatEntitySchema,
|
|
6
|
-
ChatIdSchema,
|
|
7
|
-
CreateChatInputSchema,
|
|
8
|
-
CreateChatOutputSchema,
|
|
9
|
-
GetChatsForUserOutputSchema,
|
|
10
|
-
GetChatsOutputSchema,
|
|
11
|
-
} from "../schemas/chat";
|
|
12
|
-
|
|
13
|
-
export type BaseChatEntity = z.infer<typeof BaseChatEntitySchema>;
|
|
14
|
-
|
|
15
|
-
export type ChatEntity = z.infer<typeof ChatEntitySchema>;
|
|
16
|
-
|
|
17
|
-
export type CreateChatInput = z.infer<typeof CreateChatInputSchema>;
|
|
18
|
-
|
|
19
|
-
export type CreateChatOutput = z.infer<typeof CreateChatOutputSchema>;
|
|
20
|
-
|
|
21
|
-
export type ChatIdInput = z.infer<typeof ChatIdSchema>;
|
|
22
|
-
|
|
23
|
-
export type GetChatsOutput = z.infer<typeof GetChatsOutputSchema>;
|
|
24
|
-
|
|
25
|
-
export type GetChatsForUserOutput = z.infer<typeof GetChatsForUserOutputSchema>;
|
|
26
|
-
|
|
27
|
-
export type AcceptMessageRequestInput = z.infer<
|
|
28
|
-
typeof AcceptMessageRequestInputSchema
|
|
29
|
-
>;
|
|
30
|
-
|
|
31
|
-
export type DeclineMessageRequestInput = AcceptMessageRequestInput;
|