@zyacreatives/shared 2.5.58 → 2.5.59
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/notification.d.ts +6 -0
- package/dist/schemas/payout-method.d.ts +5 -0
- package/dist/schemas/seller.d.ts +29 -7
- package/dist/schemas/seller.js +25 -5
- package/dist/schemas/settings.d.ts +79 -2
- package/dist/schemas/settings.js +32 -3
- package/dist/schemas/transaction.d.ts +33 -13
- package/dist/schemas/transaction.js +22 -6
- package/package.json +1 -1
- package/src/schemas/notification.ts +20 -0
- package/src/schemas/payout-method.ts +14 -0
- package/src/schemas/seller.ts +37 -5
- package/src/schemas/settings.ts +42 -2
- package/src/schemas/transaction.ts +42 -22
|
@@ -114,6 +114,7 @@ export declare const NotificationEntitySchema: z.ZodObject<{
|
|
|
114
114
|
}>;
|
|
115
115
|
id: z.ZodCUID2;
|
|
116
116
|
}, z.core.$strip>;
|
|
117
|
+
export type NotificationEntity = z.infer<typeof NotificationEntitySchema>;
|
|
117
118
|
export declare const NotificationDetailsEntitySchema: z.ZodObject<{
|
|
118
119
|
isRead: z.ZodDefault<z.ZodBoolean>;
|
|
119
120
|
createdAt: z.ZodISODateTime;
|
|
@@ -198,6 +199,7 @@ export declare const NotificationDetailsEntitySchema: z.ZodObject<{
|
|
|
198
199
|
itemImgUrl: z.ZodOptional<z.ZodString>;
|
|
199
200
|
itemStatus: z.ZodOptional<z.ZodString>;
|
|
200
201
|
}, z.core.$strip>;
|
|
202
|
+
export type NotificationDetailsEntity = z.infer<typeof NotificationDetailsEntitySchema>;
|
|
201
203
|
/**
|
|
202
204
|
* --------------------------------
|
|
203
205
|
* INPUTS
|
|
@@ -226,9 +228,11 @@ export declare const ListNotificationsInputSchema: z.ZodObject<{
|
|
|
226
228
|
cursor: z.ZodOptional<z.ZodString>;
|
|
227
229
|
unreadOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
228
230
|
}, z.core.$strip>;
|
|
231
|
+
export type ListNotificationsInput = z.infer<typeof ListNotificationsInputSchema>;
|
|
229
232
|
export declare const MarkReadInputSchema: z.ZodObject<{
|
|
230
233
|
notificationIds: z.ZodArray<z.ZodCUID2>;
|
|
231
234
|
}, z.core.$strip>;
|
|
235
|
+
export type MarkReadInput = z.infer<typeof MarkReadInputSchema>;
|
|
232
236
|
/**
|
|
233
237
|
* --------------------------------
|
|
234
238
|
* OUTPUTS
|
|
@@ -322,7 +326,9 @@ export declare const ListNotificationsOutputSchema: z.ZodObject<{
|
|
|
322
326
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
323
327
|
unreadCount: z.ZodInt;
|
|
324
328
|
}, z.core.$strip>;
|
|
329
|
+
export type ListNotificationsOutput = z.infer<typeof ListNotificationsOutputSchema>;
|
|
325
330
|
export declare const NotificationCountOutputSchema: z.ZodObject<{
|
|
326
331
|
unreadCount: z.ZodInt;
|
|
327
332
|
}, z.core.$strip>;
|
|
333
|
+
export type NotificationCountOutput = z.infer<typeof NotificationCountOutputSchema>;
|
|
328
334
|
export {};
|
|
@@ -44,6 +44,7 @@ export declare const PayoutMethodEntitySchema: z.ZodObject<{
|
|
|
44
44
|
sellerId: z.ZodCUID2;
|
|
45
45
|
currency: z.ZodString;
|
|
46
46
|
}, z.core.$strip>;
|
|
47
|
+
export type PayoutMethodEntity = z.infer<typeof PayoutMethodEntitySchema>;
|
|
47
48
|
/**
|
|
48
49
|
* --------------------------------
|
|
49
50
|
* INPUTS
|
|
@@ -60,6 +61,7 @@ export declare const CreatePayoutMethodInputSchema: z.ZodObject<{
|
|
|
60
61
|
accountName: z.ZodString;
|
|
61
62
|
isDefault: z.ZodBoolean;
|
|
62
63
|
}, z.core.$strip>;
|
|
64
|
+
export type CreatePayoutMethodInput = z.infer<typeof CreatePayoutMethodInputSchema>;
|
|
63
65
|
export declare const UpdatePayoutMethodInputSchema: z.ZodObject<{
|
|
64
66
|
provider: z.ZodOptional<z.ZodEnum<{
|
|
65
67
|
readonly PAYSTACK: "PAYSTACK";
|
|
@@ -72,6 +74,7 @@ export declare const UpdatePayoutMethodInputSchema: z.ZodObject<{
|
|
|
72
74
|
externalBankId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
73
75
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
74
76
|
}, z.core.$strip>;
|
|
77
|
+
export type UpdatePayoutMethodInput = z.infer<typeof UpdatePayoutMethodInputSchema>;
|
|
75
78
|
/**
|
|
76
79
|
* --------------------------------
|
|
77
80
|
* OUTPUTS
|
|
@@ -80,8 +83,10 @@ export declare const UpdatePayoutMethodInputSchema: z.ZodObject<{
|
|
|
80
83
|
export declare const VerifyAccountOutputSchema: z.ZodObject<{
|
|
81
84
|
accountName: z.ZodString;
|
|
82
85
|
}, z.core.$strip>;
|
|
86
|
+
export type VerifyAccountOutput = z.infer<typeof VerifyAccountOutputSchema>;
|
|
83
87
|
export declare const BankListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
84
88
|
name: z.ZodString;
|
|
85
89
|
code: z.ZodString;
|
|
86
90
|
}, z.core.$strip>>;
|
|
91
|
+
export type BankListOutput = z.infer<typeof BankListOutputSchema>;
|
|
87
92
|
export {};
|
package/dist/schemas/seller.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
+
/**
|
|
3
|
+
* --------------------------------
|
|
4
|
+
* ENTITY
|
|
5
|
+
* --------------------------------
|
|
6
|
+
*/
|
|
2
7
|
export declare const SellerEntitySchema: z.ZodObject<{
|
|
3
8
|
id: z.ZodCUID2;
|
|
4
9
|
businessName: z.ZodString;
|
|
@@ -13,10 +18,15 @@ export declare const SellerEntitySchema: z.ZodObject<{
|
|
|
13
18
|
readonly PENDING: "PENDING";
|
|
14
19
|
readonly SUSPENDED: "SUSPENDED";
|
|
15
20
|
}>>;
|
|
16
|
-
createdAt: z.
|
|
17
|
-
updatedAt: z.
|
|
21
|
+
createdAt: z.ZodISODateTime;
|
|
22
|
+
updatedAt: z.ZodISODateTime;
|
|
18
23
|
}, z.core.$strip>;
|
|
19
24
|
export type SellerEntity = z.infer<typeof SellerEntitySchema>;
|
|
25
|
+
/**
|
|
26
|
+
* --------------------------------
|
|
27
|
+
* INPUTS
|
|
28
|
+
* --------------------------------
|
|
29
|
+
*/
|
|
20
30
|
export declare const CreateSellerEntityInputSchema: z.ZodObject<{
|
|
21
31
|
countryOfOperation: z.ZodEnum<{
|
|
22
32
|
readonly NG: "NG";
|
|
@@ -41,6 +51,11 @@ export declare const UpdateSellerEntitySchema: z.ZodObject<{
|
|
|
41
51
|
}>>;
|
|
42
52
|
}, z.core.$strip>;
|
|
43
53
|
export type UpdateSellerInput = z.infer<typeof UpdateSellerEntitySchema>;
|
|
54
|
+
/**
|
|
55
|
+
* --------------------------------
|
|
56
|
+
* PROFILE
|
|
57
|
+
* --------------------------------
|
|
58
|
+
*/
|
|
44
59
|
export declare const SellerProfileSchema: z.ZodObject<{
|
|
45
60
|
id: z.ZodCUID2;
|
|
46
61
|
businessName: z.ZodString;
|
|
@@ -55,8 +70,8 @@ export declare const SellerProfileSchema: z.ZodObject<{
|
|
|
55
70
|
readonly PENDING: "PENDING";
|
|
56
71
|
readonly SUSPENDED: "SUSPENDED";
|
|
57
72
|
}>>;
|
|
58
|
-
createdAt: z.
|
|
59
|
-
updatedAt: z.
|
|
73
|
+
createdAt: z.ZodISODateTime;
|
|
74
|
+
updatedAt: z.ZodISODateTime;
|
|
60
75
|
payoutMethods: z.ZodArray<z.ZodObject<{
|
|
61
76
|
status: z.ZodEnum<{
|
|
62
77
|
readonly VERIFIED: "VERIFIED";
|
|
@@ -81,10 +96,17 @@ export declare const SellerProfileSchema: z.ZodObject<{
|
|
|
81
96
|
}, z.core.$strip>>;
|
|
82
97
|
}, z.core.$strip>;
|
|
83
98
|
export type SellerProfile = z.infer<typeof SellerProfileSchema>;
|
|
99
|
+
/**
|
|
100
|
+
* --------------------------------
|
|
101
|
+
* STRIPE ONBOARDING
|
|
102
|
+
* --------------------------------
|
|
103
|
+
*/
|
|
84
104
|
export declare const GetStripeOnboardingUrlInputSchema: z.ZodObject<{
|
|
85
|
-
refreshUrl: z.
|
|
86
|
-
returnUrl: z.
|
|
105
|
+
refreshUrl: z.ZodURL;
|
|
106
|
+
returnUrl: z.ZodURL;
|
|
87
107
|
}, z.core.$strip>;
|
|
108
|
+
export type GetStripeOnboardingUrlInput = z.infer<typeof GetStripeOnboardingUrlInputSchema>;
|
|
88
109
|
export declare const GetStripeOnboardingUrlOutputSchema: z.ZodObject<{
|
|
89
|
-
url: z.
|
|
110
|
+
url: z.ZodURL;
|
|
90
111
|
}, z.core.$strip>;
|
|
112
|
+
export type GetStripeOnboardingUrlOutput = z.infer<typeof GetStripeOnboardingUrlOutputSchema>;
|
package/dist/schemas/seller.js
CHANGED
|
@@ -4,6 +4,11 @@ exports.GetStripeOnboardingUrlOutputSchema = exports.GetStripeOnboardingUrlInput
|
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const payout_method_1 = require("./payout-method");
|
|
7
|
+
/**
|
|
8
|
+
* --------------------------------
|
|
9
|
+
* ENTITY
|
|
10
|
+
* --------------------------------
|
|
11
|
+
*/
|
|
7
12
|
exports.SellerEntitySchema = zod_openapi_1.z.object({
|
|
8
13
|
id: zod_openapi_1.z.cuid2(),
|
|
9
14
|
businessName: zod_openapi_1.z.string(),
|
|
@@ -11,9 +16,14 @@ exports.SellerEntitySchema = zod_openapi_1.z.object({
|
|
|
11
16
|
stripeConnectId: zod_openapi_1.z.string().nullable(),
|
|
12
17
|
paystackSubaccountCode: zod_openapi_1.z.string().nullable(),
|
|
13
18
|
status: zod_openapi_1.z.enum(constants_1.SELLER_STATUS).default(constants_1.SELLER_STATUS.PENDING),
|
|
14
|
-
createdAt: zod_openapi_1.z.
|
|
15
|
-
updatedAt: zod_openapi_1.z.
|
|
19
|
+
createdAt: zod_openapi_1.z.iso.datetime(),
|
|
20
|
+
updatedAt: zod_openapi_1.z.iso.datetime(),
|
|
16
21
|
});
|
|
22
|
+
/**
|
|
23
|
+
* --------------------------------
|
|
24
|
+
* INPUTS
|
|
25
|
+
* --------------------------------
|
|
26
|
+
*/
|
|
17
27
|
exports.CreateSellerEntityInputSchema = zod_openapi_1.z.object({
|
|
18
28
|
countryOfOperation: zod_openapi_1.z.enum(constants_1.COUNTRY_OF_OPERATION),
|
|
19
29
|
bankCode: zod_openapi_1.z.string().nullable(),
|
|
@@ -28,13 +38,23 @@ exports.UpdateSellerEntitySchema = zod_openapi_1.z
|
|
|
28
38
|
status: zod_openapi_1.z.enum(constants_1.SELLER_STATUS),
|
|
29
39
|
})
|
|
30
40
|
.partial();
|
|
41
|
+
/**
|
|
42
|
+
* --------------------------------
|
|
43
|
+
* PROFILE
|
|
44
|
+
* --------------------------------
|
|
45
|
+
*/
|
|
31
46
|
exports.SellerProfileSchema = exports.SellerEntitySchema.extend({
|
|
32
47
|
payoutMethods: zod_openapi_1.z.array(payout_method_1.PayoutMethodEntitySchema),
|
|
33
48
|
});
|
|
49
|
+
/**
|
|
50
|
+
* --------------------------------
|
|
51
|
+
* STRIPE ONBOARDING
|
|
52
|
+
* --------------------------------
|
|
53
|
+
*/
|
|
34
54
|
exports.GetStripeOnboardingUrlInputSchema = zod_openapi_1.z.object({
|
|
35
|
-
refreshUrl: zod_openapi_1.z.
|
|
36
|
-
returnUrl: zod_openapi_1.z.
|
|
55
|
+
refreshUrl: zod_openapi_1.z.url(),
|
|
56
|
+
returnUrl: zod_openapi_1.z.url(),
|
|
37
57
|
});
|
|
38
58
|
exports.GetStripeOnboardingUrlOutputSchema = zod_openapi_1.z.object({
|
|
39
|
-
url: zod_openapi_1.z.
|
|
59
|
+
url: zod_openapi_1.z.url(),
|
|
40
60
|
});
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* --------------------------------
|
|
4
|
+
* PROFILE VISIBILITY
|
|
5
|
+
* --------------------------------
|
|
6
|
+
*/
|
|
2
7
|
export declare const ProfileVisibilitySettingsSchema: z.ZodNullable<z.ZodObject<{
|
|
3
8
|
privateAccount: z.ZodDefault<z.ZodBoolean>;
|
|
4
9
|
showAboutMe: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -21,6 +26,11 @@ export declare const ProfileVisibilitySettingsSchema: z.ZodNullable<z.ZodObject<
|
|
|
21
26
|
}>>;
|
|
22
27
|
}, z.core.$strip>>;
|
|
23
28
|
export type ProfileVisibilitySettings = z.infer<typeof ProfileVisibilitySettingsSchema>;
|
|
29
|
+
/**
|
|
30
|
+
* --------------------------------
|
|
31
|
+
* EXPLORE & FEED
|
|
32
|
+
* --------------------------------
|
|
33
|
+
*/
|
|
24
34
|
export declare const ExploreAndFeedSettingsSchema: z.ZodNullable<z.ZodObject<{
|
|
25
35
|
feedAlgorithm: z.ZodDefault<z.ZodEnum<{
|
|
26
36
|
following: "following";
|
|
@@ -31,6 +41,11 @@ export declare const ExploreAndFeedSettingsSchema: z.ZodNullable<z.ZodObject<{
|
|
|
31
41
|
enableFeedRecommendations: z.ZodDefault<z.ZodBoolean>;
|
|
32
42
|
}, z.core.$strip>>;
|
|
33
43
|
export type ExploreAndFeedSettings = z.infer<typeof ExploreAndFeedSettingsSchema>;
|
|
44
|
+
/**
|
|
45
|
+
* --------------------------------
|
|
46
|
+
* NOTIFICATIONS
|
|
47
|
+
* --------------------------------
|
|
48
|
+
*/
|
|
34
49
|
export declare const NotificationsSettingsSchema: z.ZodNullable<z.ZodObject<{
|
|
35
50
|
enableNotifications: z.ZodDefault<z.ZodBoolean>;
|
|
36
51
|
emailNotifications: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -47,6 +62,11 @@ export declare const NotificationsSettingsSchema: z.ZodNullable<z.ZodObject<{
|
|
|
47
62
|
zyaDigestNotif: z.ZodDefault<z.ZodBoolean>;
|
|
48
63
|
}, z.core.$strip>>;
|
|
49
64
|
export type NotificationsSettings = z.infer<typeof NotificationsSettingsSchema>;
|
|
65
|
+
/**
|
|
66
|
+
* --------------------------------
|
|
67
|
+
* ENTITY
|
|
68
|
+
* --------------------------------
|
|
69
|
+
*/
|
|
50
70
|
export declare const UserSettingsSchema: z.ZodObject<{
|
|
51
71
|
id: z.ZodCUID2;
|
|
52
72
|
userId: z.ZodCUID2;
|
|
@@ -95,10 +115,15 @@ export declare const UserSettingsSchema: z.ZodObject<{
|
|
|
95
115
|
platformAnnouncementsNotif: z.ZodDefault<z.ZodBoolean>;
|
|
96
116
|
zyaDigestNotif: z.ZodDefault<z.ZodBoolean>;
|
|
97
117
|
}, z.core.$strip>>;
|
|
98
|
-
createdAt: z.
|
|
99
|
-
updatedAt: z.
|
|
118
|
+
createdAt: z.ZodISODateTime;
|
|
119
|
+
updatedAt: z.ZodISODateTime;
|
|
100
120
|
}, z.core.$strip>;
|
|
101
121
|
export type UserSettings = z.infer<typeof UserSettingsSchema>;
|
|
122
|
+
/**
|
|
123
|
+
* --------------------------------
|
|
124
|
+
* INPUTS
|
|
125
|
+
* --------------------------------
|
|
126
|
+
*/
|
|
102
127
|
export declare const CreateUserSettingsInputSchema: z.ZodObject<{
|
|
103
128
|
userId: z.ZodCUID2;
|
|
104
129
|
profileVisibilitySettings: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -148,3 +173,55 @@ export declare const CreateUserSettingsInputSchema: z.ZodObject<{
|
|
|
148
173
|
}, z.core.$strip>>>;
|
|
149
174
|
}, z.core.$strip>;
|
|
150
175
|
export type CreateUserSettingsInput = z.infer<typeof CreateUserSettingsInputSchema>;
|
|
176
|
+
/**
|
|
177
|
+
* Optional but useful (you’ll likely need this soon)
|
|
178
|
+
*/
|
|
179
|
+
export declare const UpdateUserSettingsInputSchema: z.ZodObject<{
|
|
180
|
+
userId: z.ZodOptional<z.ZodCUID2>;
|
|
181
|
+
profileVisibilitySettings: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
182
|
+
privateAccount: z.ZodDefault<z.ZodBoolean>;
|
|
183
|
+
showAboutMe: z.ZodDefault<z.ZodBoolean>;
|
|
184
|
+
showLocation: z.ZodDefault<z.ZodBoolean>;
|
|
185
|
+
showVerificationBadge: z.ZodDefault<z.ZodBoolean>;
|
|
186
|
+
allowDirectMessaging: z.ZodDefault<z.ZodBoolean>;
|
|
187
|
+
whoCanSendChatRequests: z.ZodDefault<z.ZodEnum<{
|
|
188
|
+
followers: "followers";
|
|
189
|
+
everyone: "everyone";
|
|
190
|
+
nobody: "nobody";
|
|
191
|
+
}>>;
|
|
192
|
+
showPostsOnProfile: z.ZodDefault<z.ZodBoolean>;
|
|
193
|
+
showProjectsOnProfile: z.ZodDefault<z.ZodBoolean>;
|
|
194
|
+
enableCommentsOnPosts: z.ZodDefault<z.ZodBoolean>;
|
|
195
|
+
enableCommentsOnProjects: z.ZodDefault<z.ZodBoolean>;
|
|
196
|
+
whoCanMentionYou: z.ZodDefault<z.ZodEnum<{
|
|
197
|
+
followers: "followers";
|
|
198
|
+
everyone: "everyone";
|
|
199
|
+
nobody: "nobody";
|
|
200
|
+
}>>;
|
|
201
|
+
}, z.core.$strip>>>>;
|
|
202
|
+
exploreAndFeedSettings: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
203
|
+
feedAlgorithm: z.ZodDefault<z.ZodEnum<{
|
|
204
|
+
following: "following";
|
|
205
|
+
latest: "latest";
|
|
206
|
+
recommended: "recommended";
|
|
207
|
+
}>>;
|
|
208
|
+
filterSensitiveContent: z.ZodDefault<z.ZodBoolean>;
|
|
209
|
+
enableFeedRecommendations: z.ZodDefault<z.ZodBoolean>;
|
|
210
|
+
}, z.core.$strip>>>>;
|
|
211
|
+
notificationSettings: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
212
|
+
enableNotifications: z.ZodDefault<z.ZodBoolean>;
|
|
213
|
+
emailNotifications: z.ZodDefault<z.ZodBoolean>;
|
|
214
|
+
allowMentionNotif: z.ZodDefault<z.ZodBoolean>;
|
|
215
|
+
allowPostCommentNotif: z.ZodDefault<z.ZodBoolean>;
|
|
216
|
+
allowProjectCommentNotif: z.ZodDefault<z.ZodBoolean>;
|
|
217
|
+
allowLikeNotif: z.ZodDefault<z.ZodBoolean>;
|
|
218
|
+
allowFollowNotif: z.ZodDefault<z.ZodBoolean>;
|
|
219
|
+
allowOpportunityUpdateNotif: z.ZodDefault<z.ZodBoolean>;
|
|
220
|
+
allowInvestmentSignalNotif: z.ZodDefault<z.ZodBoolean>;
|
|
221
|
+
allowDirectMessageNotif: z.ZodDefault<z.ZodBoolean>;
|
|
222
|
+
zyaUpdatesNotif: z.ZodDefault<z.ZodBoolean>;
|
|
223
|
+
platformAnnouncementsNotif: z.ZodDefault<z.ZodBoolean>;
|
|
224
|
+
zyaDigestNotif: z.ZodDefault<z.ZodBoolean>;
|
|
225
|
+
}, z.core.$strip>>>>;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
export type UpdateUserSettingsInput = z.infer<typeof UpdateUserSettingsInputSchema>;
|
package/dist/schemas/settings.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CreateUserSettingsInputSchema = exports.UserSettingsSchema = exports.NotificationsSettingsSchema = exports.ExploreAndFeedSettingsSchema = exports.ProfileVisibilitySettingsSchema = void 0;
|
|
3
|
+
exports.UpdateUserSettingsInputSchema = exports.CreateUserSettingsInputSchema = exports.UserSettingsSchema = exports.NotificationsSettingsSchema = exports.ExploreAndFeedSettingsSchema = exports.ProfileVisibilitySettingsSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* --------------------------------
|
|
7
|
+
* PROFILE VISIBILITY
|
|
8
|
+
* --------------------------------
|
|
9
|
+
*/
|
|
5
10
|
exports.ProfileVisibilitySettingsSchema = zod_1.z
|
|
6
11
|
.object({
|
|
7
12
|
privateAccount: zod_1.z.boolean().default(false),
|
|
@@ -21,6 +26,11 @@ exports.ProfileVisibilitySettingsSchema = zod_1.z
|
|
|
21
26
|
.default("everyone"),
|
|
22
27
|
})
|
|
23
28
|
.nullable();
|
|
29
|
+
/**
|
|
30
|
+
* --------------------------------
|
|
31
|
+
* EXPLORE & FEED
|
|
32
|
+
* --------------------------------
|
|
33
|
+
*/
|
|
24
34
|
exports.ExploreAndFeedSettingsSchema = zod_1.z
|
|
25
35
|
.object({
|
|
26
36
|
feedAlgorithm: zod_1.z
|
|
@@ -30,6 +40,11 @@ exports.ExploreAndFeedSettingsSchema = zod_1.z
|
|
|
30
40
|
enableFeedRecommendations: zod_1.z.boolean().default(true),
|
|
31
41
|
})
|
|
32
42
|
.nullable();
|
|
43
|
+
/**
|
|
44
|
+
* --------------------------------
|
|
45
|
+
* NOTIFICATIONS
|
|
46
|
+
* --------------------------------
|
|
47
|
+
*/
|
|
33
48
|
exports.NotificationsSettingsSchema = zod_1.z
|
|
34
49
|
.object({
|
|
35
50
|
enableNotifications: zod_1.z.boolean().default(true),
|
|
@@ -47,18 +62,32 @@ exports.NotificationsSettingsSchema = zod_1.z
|
|
|
47
62
|
zyaDigestNotif: zod_1.z.boolean().default(true),
|
|
48
63
|
})
|
|
49
64
|
.nullable();
|
|
65
|
+
/**
|
|
66
|
+
* --------------------------------
|
|
67
|
+
* ENTITY
|
|
68
|
+
* --------------------------------
|
|
69
|
+
*/
|
|
50
70
|
exports.UserSettingsSchema = zod_1.z.object({
|
|
51
71
|
id: zod_1.z.cuid2(),
|
|
52
72
|
userId: zod_1.z.cuid2(),
|
|
53
73
|
profileVisibilitySettings: exports.ProfileVisibilitySettingsSchema,
|
|
54
74
|
exploreAndFeedSettings: exports.ExploreAndFeedSettingsSchema,
|
|
55
75
|
notificationSettings: exports.NotificationsSettingsSchema,
|
|
56
|
-
createdAt: zod_1.z.
|
|
57
|
-
updatedAt: zod_1.z.
|
|
76
|
+
createdAt: zod_1.z.iso.datetime(),
|
|
77
|
+
updatedAt: zod_1.z.iso.datetime(),
|
|
58
78
|
});
|
|
79
|
+
/**
|
|
80
|
+
* --------------------------------
|
|
81
|
+
* INPUTS
|
|
82
|
+
* --------------------------------
|
|
83
|
+
*/
|
|
59
84
|
exports.CreateUserSettingsInputSchema = zod_1.z.object({
|
|
60
85
|
userId: zod_1.z.cuid2(),
|
|
61
86
|
profileVisibilitySettings: exports.ProfileVisibilitySettingsSchema.optional(),
|
|
62
87
|
exploreAndFeedSettings: exports.ExploreAndFeedSettingsSchema.optional(),
|
|
63
88
|
notificationSettings: exports.NotificationsSettingsSchema.optional(),
|
|
64
89
|
});
|
|
90
|
+
/**
|
|
91
|
+
* Optional but useful (you’ll likely need this soon)
|
|
92
|
+
*/
|
|
93
|
+
exports.UpdateUserSettingsInputSchema = exports.CreateUserSettingsInputSchema.partial();
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
+
/**
|
|
3
|
+
* --------------------------------
|
|
4
|
+
* BASE
|
|
5
|
+
* --------------------------------
|
|
6
|
+
*/
|
|
2
7
|
export declare const BaseTransactionSchema: z.ZodObject<{
|
|
3
8
|
id: z.ZodCUID2;
|
|
4
9
|
productId: z.ZodCUID2;
|
|
@@ -41,9 +46,15 @@ export declare const BaseTransactionSchema: z.ZodObject<{
|
|
|
41
46
|
active: z.ZodDefault<z.ZodBoolean>;
|
|
42
47
|
}, z.core.$strip>>>;
|
|
43
48
|
productNameSnapshot: z.ZodOptional<z.ZodString>;
|
|
44
|
-
createdAt: z.
|
|
45
|
-
updatedAt: z.
|
|
49
|
+
createdAt: z.ZodISODateTime;
|
|
50
|
+
updatedAt: z.ZodISODateTime;
|
|
46
51
|
}, z.core.$strip>;
|
|
52
|
+
export type BaseTransactionEntity = z.infer<typeof BaseTransactionSchema>;
|
|
53
|
+
/**
|
|
54
|
+
* --------------------------------
|
|
55
|
+
* INPUTS
|
|
56
|
+
* --------------------------------
|
|
57
|
+
*/
|
|
47
58
|
export declare const InitTransactionInputSchema: z.ZodObject<{
|
|
48
59
|
productId: z.ZodCUID2;
|
|
49
60
|
firstName: z.ZodOptional<z.ZodString>;
|
|
@@ -52,6 +63,7 @@ export declare const InitTransactionInputSchema: z.ZodObject<{
|
|
|
52
63
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
53
64
|
amount: z.ZodNumber;
|
|
54
65
|
}, z.core.$strip>;
|
|
66
|
+
export type InitTransactionInput = z.infer<typeof InitTransactionInputSchema>;
|
|
55
67
|
export declare const CreateTransactionInputSchema: z.ZodObject<{
|
|
56
68
|
status: z.ZodDefault<z.ZodEnum<{
|
|
57
69
|
readonly PENDING: "PENDING";
|
|
@@ -93,6 +105,7 @@ export declare const CreateTransactionInputSchema: z.ZodObject<{
|
|
|
93
105
|
}, z.core.$strip>>;
|
|
94
106
|
providerTransactionId: z.ZodOptional<z.ZodString>;
|
|
95
107
|
}, z.core.$strip>;
|
|
108
|
+
export type CreateTransactionInput = z.infer<typeof CreateTransactionInputSchema>;
|
|
96
109
|
export declare const UpdateTransactionWebhookInputSchema: z.ZodObject<{
|
|
97
110
|
status: z.ZodEnum<{
|
|
98
111
|
readonly PENDING: "PENDING";
|
|
@@ -102,10 +115,17 @@ export declare const UpdateTransactionWebhookInputSchema: z.ZodObject<{
|
|
|
102
115
|
}>;
|
|
103
116
|
providerTransactionId: z.ZodString;
|
|
104
117
|
}, z.core.$strip>;
|
|
118
|
+
export type UpdateTransactionWebhookInput = z.infer<typeof UpdateTransactionWebhookInputSchema>;
|
|
119
|
+
/**
|
|
120
|
+
* --------------------------------
|
|
121
|
+
* ENTITY
|
|
122
|
+
* --------------------------------
|
|
123
|
+
*/
|
|
105
124
|
export declare const TransactionEntitySchema: z.ZodObject<{
|
|
106
125
|
id: z.ZodCUID2;
|
|
107
126
|
productId: z.ZodCUID2;
|
|
108
127
|
buyerId: z.ZodCUID2;
|
|
128
|
+
sellerId: z.ZodCUID2;
|
|
109
129
|
amount: z.ZodNumber;
|
|
110
130
|
platformFee: z.ZodNumber;
|
|
111
131
|
sellerAmount: z.ZodNumber;
|
|
@@ -143,21 +163,27 @@ export declare const TransactionEntitySchema: z.ZodObject<{
|
|
|
143
163
|
active: z.ZodDefault<z.ZodBoolean>;
|
|
144
164
|
}, z.core.$strip>>>;
|
|
145
165
|
productNameSnapshot: z.ZodOptional<z.ZodString>;
|
|
146
|
-
createdAt: z.
|
|
147
|
-
updatedAt: z.
|
|
166
|
+
createdAt: z.ZodISODateTime;
|
|
167
|
+
updatedAt: z.ZodISODateTime;
|
|
148
168
|
productTitle: z.ZodOptional<z.ZodString>;
|
|
149
169
|
sellerName: z.ZodOptional<z.ZodString>;
|
|
150
|
-
sellerId: z.ZodOptional<z.ZodString>;
|
|
151
170
|
sellerUsername: z.ZodOptional<z.ZodString>;
|
|
152
171
|
buyerName: z.ZodOptional<z.ZodString>;
|
|
153
172
|
buyerUsername: z.ZodOptional<z.ZodString>;
|
|
154
173
|
buyerEmail: z.ZodEmail;
|
|
155
174
|
}, z.core.$strip>;
|
|
175
|
+
export type TransactionEntity = z.infer<typeof TransactionEntitySchema>;
|
|
176
|
+
/**
|
|
177
|
+
* --------------------------------
|
|
178
|
+
* OUTPUTS
|
|
179
|
+
* --------------------------------
|
|
180
|
+
*/
|
|
156
181
|
export declare const InitTransactionOutputSchema: z.ZodObject<{
|
|
157
182
|
transaction: z.ZodObject<{
|
|
158
183
|
id: z.ZodCUID2;
|
|
159
184
|
productId: z.ZodCUID2;
|
|
160
185
|
buyerId: z.ZodCUID2;
|
|
186
|
+
sellerId: z.ZodCUID2;
|
|
161
187
|
amount: z.ZodNumber;
|
|
162
188
|
platformFee: z.ZodNumber;
|
|
163
189
|
sellerAmount: z.ZodNumber;
|
|
@@ -195,11 +221,10 @@ export declare const InitTransactionOutputSchema: z.ZodObject<{
|
|
|
195
221
|
active: z.ZodDefault<z.ZodBoolean>;
|
|
196
222
|
}, z.core.$strip>>>;
|
|
197
223
|
productNameSnapshot: z.ZodOptional<z.ZodString>;
|
|
198
|
-
createdAt: z.
|
|
199
|
-
updatedAt: z.
|
|
224
|
+
createdAt: z.ZodISODateTime;
|
|
225
|
+
updatedAt: z.ZodISODateTime;
|
|
200
226
|
productTitle: z.ZodOptional<z.ZodString>;
|
|
201
227
|
sellerName: z.ZodOptional<z.ZodString>;
|
|
202
|
-
sellerId: z.ZodOptional<z.ZodString>;
|
|
203
228
|
sellerUsername: z.ZodOptional<z.ZodString>;
|
|
204
229
|
buyerName: z.ZodOptional<z.ZodString>;
|
|
205
230
|
buyerUsername: z.ZodOptional<z.ZodString>;
|
|
@@ -207,9 +232,4 @@ export declare const InitTransactionOutputSchema: z.ZodObject<{
|
|
|
207
232
|
}, z.core.$strip>;
|
|
208
233
|
checkoutUrl: z.ZodNullable<z.ZodURL>;
|
|
209
234
|
}, z.core.$strip>;
|
|
210
|
-
export type BaseTransactionEntity = z.infer<typeof BaseTransactionSchema>;
|
|
211
|
-
export type InitTransactionInput = z.infer<typeof InitTransactionInputSchema>;
|
|
212
|
-
export type CreateTransactionInput = z.infer<typeof CreateTransactionInputSchema>;
|
|
213
|
-
export type UpdateTransactionWebhookInput = z.infer<typeof UpdateTransactionWebhookInputSchema>;
|
|
214
|
-
export type TransactionEntity = z.infer<typeof TransactionEntitySchema>;
|
|
215
235
|
export type InitTransactionResult = z.infer<typeof InitTransactionOutputSchema>;
|
|
@@ -4,6 +4,11 @@ exports.InitTransactionOutputSchema = exports.TransactionEntitySchema = exports.
|
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const product_1 = require("./product");
|
|
7
|
+
/**
|
|
8
|
+
* --------------------------------
|
|
9
|
+
* BASE
|
|
10
|
+
* --------------------------------
|
|
11
|
+
*/
|
|
7
12
|
exports.BaseTransactionSchema = zod_openapi_1.z.object({
|
|
8
13
|
id: zod_openapi_1.z.cuid2(),
|
|
9
14
|
productId: zod_openapi_1.z.cuid2(),
|
|
@@ -18,9 +23,14 @@ exports.BaseTransactionSchema = zod_openapi_1.z.object({
|
|
|
18
23
|
providerTransactionId: zod_openapi_1.z.string().nullable().optional(),
|
|
19
24
|
discountApplied: product_1.ProductDiscountEntitySchema.nullable().optional(),
|
|
20
25
|
productNameSnapshot: zod_openapi_1.z.string().optional(),
|
|
21
|
-
createdAt: zod_openapi_1.z.
|
|
22
|
-
updatedAt: zod_openapi_1.z.
|
|
26
|
+
createdAt: zod_openapi_1.z.iso.datetime(),
|
|
27
|
+
updatedAt: zod_openapi_1.z.iso.datetime(),
|
|
23
28
|
});
|
|
29
|
+
/**
|
|
30
|
+
* --------------------------------
|
|
31
|
+
* INPUTS
|
|
32
|
+
* --------------------------------
|
|
33
|
+
*/
|
|
24
34
|
exports.InitTransactionInputSchema = zod_openapi_1.z.object({
|
|
25
35
|
productId: zod_openapi_1.z
|
|
26
36
|
.cuid2()
|
|
@@ -49,18 +59,24 @@ exports.UpdateTransactionWebhookInputSchema = zod_openapi_1.z.object({
|
|
|
49
59
|
status: zod_openapi_1.z.enum(constants_1.TRANSACTION_STATUSES),
|
|
50
60
|
providerTransactionId: zod_openapi_1.z.string(),
|
|
51
61
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
/**
|
|
63
|
+
* --------------------------------
|
|
64
|
+
* ENTITY
|
|
65
|
+
* --------------------------------
|
|
66
|
+
*/
|
|
55
67
|
exports.TransactionEntitySchema = exports.BaseTransactionSchema.extend({
|
|
56
68
|
productTitle: zod_openapi_1.z.string().optional(),
|
|
57
69
|
sellerName: zod_openapi_1.z.string().optional(),
|
|
58
|
-
sellerId: zod_openapi_1.z.string().optional(),
|
|
59
70
|
sellerUsername: zod_openapi_1.z.string().optional(),
|
|
60
71
|
buyerName: zod_openapi_1.z.string().optional(),
|
|
61
72
|
buyerUsername: zod_openapi_1.z.string().optional(),
|
|
62
73
|
buyerEmail: zod_openapi_1.z.email(),
|
|
63
74
|
}).openapi({ title: "TransactionEntity" });
|
|
75
|
+
/**
|
|
76
|
+
* --------------------------------
|
|
77
|
+
* OUTPUTS
|
|
78
|
+
* --------------------------------
|
|
79
|
+
*/
|
|
64
80
|
exports.InitTransactionOutputSchema = zod_openapi_1.z
|
|
65
81
|
.object({
|
|
66
82
|
transaction: exports.TransactionEntitySchema,
|
package/package.json
CHANGED
|
@@ -40,6 +40,8 @@ export const NotificationEntitySchema = z
|
|
|
40
40
|
})
|
|
41
41
|
.openapi("Notification");
|
|
42
42
|
|
|
43
|
+
export type NotificationEntity = z.infer<typeof NotificationEntitySchema>;
|
|
44
|
+
|
|
43
45
|
export const NotificationDetailsEntitySchema = NotificationEntitySchema.extend({
|
|
44
46
|
actor: MinimalUserSchema,
|
|
45
47
|
recipient: MinimalUserSchema,
|
|
@@ -49,6 +51,10 @@ export const NotificationDetailsEntitySchema = NotificationEntitySchema.extend({
|
|
|
49
51
|
itemStatus: z.string().optional(),
|
|
50
52
|
});
|
|
51
53
|
|
|
54
|
+
export type NotificationDetailsEntity = z.infer<
|
|
55
|
+
typeof NotificationDetailsEntitySchema
|
|
56
|
+
>;
|
|
57
|
+
|
|
52
58
|
/**
|
|
53
59
|
* --------------------------------
|
|
54
60
|
* INPUTS
|
|
@@ -61,10 +67,16 @@ export const ListNotificationsInputSchema = z.object({
|
|
|
61
67
|
unreadOnly: z.boolean().optional().default(false),
|
|
62
68
|
});
|
|
63
69
|
|
|
70
|
+
export type ListNotificationsInput = z.infer<
|
|
71
|
+
typeof ListNotificationsInputSchema
|
|
72
|
+
>;
|
|
73
|
+
|
|
64
74
|
export const MarkReadInputSchema = z.object({
|
|
65
75
|
notificationIds: z.array(z.cuid2()).min(1),
|
|
66
76
|
});
|
|
67
77
|
|
|
78
|
+
export type MarkReadInput = z.infer<typeof MarkReadInputSchema>;
|
|
79
|
+
|
|
68
80
|
/**
|
|
69
81
|
* --------------------------------
|
|
70
82
|
* OUTPUTS
|
|
@@ -77,6 +89,14 @@ export const ListNotificationsOutputSchema = z.object({
|
|
|
77
89
|
unreadCount: z.int(),
|
|
78
90
|
});
|
|
79
91
|
|
|
92
|
+
export type ListNotificationsOutput = z.infer<
|
|
93
|
+
typeof ListNotificationsOutputSchema
|
|
94
|
+
>;
|
|
95
|
+
|
|
80
96
|
export const NotificationCountOutputSchema = z.object({
|
|
81
97
|
unreadCount: z.int(),
|
|
82
98
|
});
|
|
99
|
+
|
|
100
|
+
export type NotificationCountOutput = z.infer<
|
|
101
|
+
typeof NotificationCountOutputSchema
|
|
102
|
+
>;
|
|
@@ -37,6 +37,8 @@ export const PayoutMethodEntitySchema = z
|
|
|
37
37
|
})
|
|
38
38
|
.openapi("PayoutMethod");
|
|
39
39
|
|
|
40
|
+
export type PayoutMethodEntity = z.infer<typeof PayoutMethodEntitySchema>;
|
|
41
|
+
|
|
40
42
|
/**
|
|
41
43
|
* --------------------------------
|
|
42
44
|
* INPUTS
|
|
@@ -47,8 +49,16 @@ export const CreatePayoutMethodInputSchema = PayoutMethodShape.omit({
|
|
|
47
49
|
externalBankId: true,
|
|
48
50
|
});
|
|
49
51
|
|
|
52
|
+
export type CreatePayoutMethodInput = z.infer<
|
|
53
|
+
typeof CreatePayoutMethodInputSchema
|
|
54
|
+
>;
|
|
55
|
+
|
|
50
56
|
export const UpdatePayoutMethodInputSchema = PayoutMethodShape.partial();
|
|
51
57
|
|
|
58
|
+
export type UpdatePayoutMethodInput = z.infer<
|
|
59
|
+
typeof UpdatePayoutMethodInputSchema
|
|
60
|
+
>;
|
|
61
|
+
|
|
52
62
|
/**
|
|
53
63
|
* --------------------------------
|
|
54
64
|
* OUTPUTS
|
|
@@ -59,9 +69,13 @@ export const VerifyAccountOutputSchema = z.object({
|
|
|
59
69
|
accountName: z.string(),
|
|
60
70
|
});
|
|
61
71
|
|
|
72
|
+
export type VerifyAccountOutput = z.infer<typeof VerifyAccountOutputSchema>;
|
|
73
|
+
|
|
62
74
|
export const BankListOutputSchema = z.array(
|
|
63
75
|
z.object({
|
|
64
76
|
name: z.string(),
|
|
65
77
|
code: z.string(),
|
|
66
78
|
}),
|
|
67
79
|
);
|
|
80
|
+
|
|
81
|
+
export type BankListOutput = z.infer<typeof BankListOutputSchema>;
|
package/src/schemas/seller.ts
CHANGED
|
@@ -2,6 +2,12 @@ import { z } from "@hono/zod-openapi";
|
|
|
2
2
|
import { COUNTRY_OF_OPERATION, SELLER_STATUS } from "../constants";
|
|
3
3
|
import { PayoutMethodEntitySchema } from "./payout-method";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* --------------------------------
|
|
7
|
+
* ENTITY
|
|
8
|
+
* --------------------------------
|
|
9
|
+
*/
|
|
10
|
+
|
|
5
11
|
export const SellerEntitySchema = z.object({
|
|
6
12
|
id: z.cuid2(),
|
|
7
13
|
businessName: z.string(),
|
|
@@ -9,12 +15,18 @@ export const SellerEntitySchema = z.object({
|
|
|
9
15
|
stripeConnectId: z.string().nullable(),
|
|
10
16
|
paystackSubaccountCode: z.string().nullable(),
|
|
11
17
|
status: z.enum(SELLER_STATUS).default(SELLER_STATUS.PENDING),
|
|
12
|
-
createdAt: z.
|
|
13
|
-
updatedAt: z.
|
|
18
|
+
createdAt: z.iso.datetime(),
|
|
19
|
+
updatedAt: z.iso.datetime(),
|
|
14
20
|
});
|
|
15
21
|
|
|
16
22
|
export type SellerEntity = z.infer<typeof SellerEntitySchema>;
|
|
17
23
|
|
|
24
|
+
/**
|
|
25
|
+
* --------------------------------
|
|
26
|
+
* INPUTS
|
|
27
|
+
* --------------------------------
|
|
28
|
+
*/
|
|
29
|
+
|
|
18
30
|
export const CreateSellerEntityInputSchema = z.object({
|
|
19
31
|
countryOfOperation: z.enum(COUNTRY_OF_OPERATION),
|
|
20
32
|
bankCode: z.string().nullable(),
|
|
@@ -35,17 +47,37 @@ export const UpdateSellerEntitySchema = z
|
|
|
35
47
|
|
|
36
48
|
export type UpdateSellerInput = z.infer<typeof UpdateSellerEntitySchema>;
|
|
37
49
|
|
|
50
|
+
/**
|
|
51
|
+
* --------------------------------
|
|
52
|
+
* PROFILE
|
|
53
|
+
* --------------------------------
|
|
54
|
+
*/
|
|
55
|
+
|
|
38
56
|
export const SellerProfileSchema = SellerEntitySchema.extend({
|
|
39
57
|
payoutMethods: z.array(PayoutMethodEntitySchema),
|
|
40
58
|
});
|
|
41
59
|
|
|
42
60
|
export type SellerProfile = z.infer<typeof SellerProfileSchema>;
|
|
43
61
|
|
|
62
|
+
/**
|
|
63
|
+
* --------------------------------
|
|
64
|
+
* STRIPE ONBOARDING
|
|
65
|
+
* --------------------------------
|
|
66
|
+
*/
|
|
67
|
+
|
|
44
68
|
export const GetStripeOnboardingUrlInputSchema = z.object({
|
|
45
|
-
refreshUrl: z.
|
|
46
|
-
returnUrl: z.
|
|
69
|
+
refreshUrl: z.url(),
|
|
70
|
+
returnUrl: z.url(),
|
|
47
71
|
});
|
|
48
72
|
|
|
73
|
+
export type GetStripeOnboardingUrlInput = z.infer<
|
|
74
|
+
typeof GetStripeOnboardingUrlInputSchema
|
|
75
|
+
>;
|
|
76
|
+
|
|
49
77
|
export const GetStripeOnboardingUrlOutputSchema = z.object({
|
|
50
|
-
url: z.
|
|
78
|
+
url: z.url(),
|
|
51
79
|
});
|
|
80
|
+
|
|
81
|
+
export type GetStripeOnboardingUrlOutput = z.infer<
|
|
82
|
+
typeof GetStripeOnboardingUrlOutputSchema
|
|
83
|
+
>;
|
package/src/schemas/settings.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* --------------------------------
|
|
5
|
+
* PROFILE VISIBILITY
|
|
6
|
+
* --------------------------------
|
|
7
|
+
*/
|
|
8
|
+
|
|
3
9
|
export const ProfileVisibilitySettingsSchema = z
|
|
4
10
|
.object({
|
|
5
11
|
privateAccount: z.boolean().default(false),
|
|
@@ -24,6 +30,12 @@ export type ProfileVisibilitySettings = z.infer<
|
|
|
24
30
|
typeof ProfileVisibilitySettingsSchema
|
|
25
31
|
>;
|
|
26
32
|
|
|
33
|
+
/**
|
|
34
|
+
* --------------------------------
|
|
35
|
+
* EXPLORE & FEED
|
|
36
|
+
* --------------------------------
|
|
37
|
+
*/
|
|
38
|
+
|
|
27
39
|
export const ExploreAndFeedSettingsSchema = z
|
|
28
40
|
.object({
|
|
29
41
|
feedAlgorithm: z
|
|
@@ -38,6 +50,12 @@ export type ExploreAndFeedSettings = z.infer<
|
|
|
38
50
|
typeof ExploreAndFeedSettingsSchema
|
|
39
51
|
>;
|
|
40
52
|
|
|
53
|
+
/**
|
|
54
|
+
* --------------------------------
|
|
55
|
+
* NOTIFICATIONS
|
|
56
|
+
* --------------------------------
|
|
57
|
+
*/
|
|
58
|
+
|
|
41
59
|
export const NotificationsSettingsSchema = z
|
|
42
60
|
.object({
|
|
43
61
|
enableNotifications: z.boolean().default(true),
|
|
@@ -58,18 +76,30 @@ export const NotificationsSettingsSchema = z
|
|
|
58
76
|
|
|
59
77
|
export type NotificationsSettings = z.infer<typeof NotificationsSettingsSchema>;
|
|
60
78
|
|
|
79
|
+
/**
|
|
80
|
+
* --------------------------------
|
|
81
|
+
* ENTITY
|
|
82
|
+
* --------------------------------
|
|
83
|
+
*/
|
|
84
|
+
|
|
61
85
|
export const UserSettingsSchema = z.object({
|
|
62
86
|
id: z.cuid2(),
|
|
63
87
|
userId: z.cuid2(),
|
|
64
88
|
profileVisibilitySettings: ProfileVisibilitySettingsSchema,
|
|
65
89
|
exploreAndFeedSettings: ExploreAndFeedSettingsSchema,
|
|
66
90
|
notificationSettings: NotificationsSettingsSchema,
|
|
67
|
-
createdAt: z.
|
|
68
|
-
updatedAt: z.
|
|
91
|
+
createdAt: z.iso.datetime(),
|
|
92
|
+
updatedAt: z.iso.datetime(),
|
|
69
93
|
});
|
|
70
94
|
|
|
71
95
|
export type UserSettings = z.infer<typeof UserSettingsSchema>;
|
|
72
96
|
|
|
97
|
+
/**
|
|
98
|
+
* --------------------------------
|
|
99
|
+
* INPUTS
|
|
100
|
+
* --------------------------------
|
|
101
|
+
*/
|
|
102
|
+
|
|
73
103
|
export const CreateUserSettingsInputSchema = z.object({
|
|
74
104
|
userId: z.cuid2(),
|
|
75
105
|
|
|
@@ -83,3 +113,13 @@ export const CreateUserSettingsInputSchema = z.object({
|
|
|
83
113
|
export type CreateUserSettingsInput = z.infer<
|
|
84
114
|
typeof CreateUserSettingsInputSchema
|
|
85
115
|
>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Optional but useful (you’ll likely need this soon)
|
|
119
|
+
*/
|
|
120
|
+
export const UpdateUserSettingsInputSchema =
|
|
121
|
+
CreateUserSettingsInputSchema.partial();
|
|
122
|
+
|
|
123
|
+
export type UpdateUserSettingsInput = z.infer<
|
|
124
|
+
typeof UpdateUserSettingsInputSchema
|
|
125
|
+
>;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
import {
|
|
3
|
-
DISCOUNT_TYPES,
|
|
4
3
|
WAGES_CURRENCY,
|
|
5
4
|
TRANSACTION_STATUSES,
|
|
6
5
|
PAYMENT_PROVIDERS,
|
|
7
6
|
} from "../constants";
|
|
8
7
|
import { ProductDiscountEntitySchema } from "./product";
|
|
9
8
|
|
|
9
|
+
/**
|
|
10
|
+
* --------------------------------
|
|
11
|
+
* BASE
|
|
12
|
+
* --------------------------------
|
|
13
|
+
*/
|
|
14
|
+
|
|
10
15
|
export const BaseTransactionSchema = z.object({
|
|
11
16
|
id: z.cuid2(),
|
|
12
17
|
productId: z.cuid2(),
|
|
@@ -24,10 +29,19 @@ export const BaseTransactionSchema = z.object({
|
|
|
24
29
|
|
|
25
30
|
discountApplied: ProductDiscountEntitySchema.nullable().optional(),
|
|
26
31
|
productNameSnapshot: z.string().optional(),
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
|
|
33
|
+
createdAt: z.iso.datetime(),
|
|
34
|
+
updatedAt: z.iso.datetime(),
|
|
29
35
|
});
|
|
30
36
|
|
|
37
|
+
export type BaseTransactionEntity = z.infer<typeof BaseTransactionSchema>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* --------------------------------
|
|
41
|
+
* INPUTS
|
|
42
|
+
* --------------------------------
|
|
43
|
+
*/
|
|
44
|
+
|
|
31
45
|
export const InitTransactionInputSchema = z.object({
|
|
32
46
|
productId: z
|
|
33
47
|
.cuid2()
|
|
@@ -39,6 +53,8 @@ export const InitTransactionInputSchema = z.object({
|
|
|
39
53
|
amount: z.number().int("Amount must be a whole number (cents/kobo)").min(0),
|
|
40
54
|
});
|
|
41
55
|
|
|
56
|
+
export type InitTransactionInput = z.infer<typeof InitTransactionInputSchema>;
|
|
57
|
+
|
|
42
58
|
export const CreateTransactionInputSchema = BaseTransactionSchema.pick({
|
|
43
59
|
productId: true,
|
|
44
60
|
buyerId: true,
|
|
@@ -54,25 +70,44 @@ export const CreateTransactionInputSchema = BaseTransactionSchema.pick({
|
|
|
54
70
|
providerTransactionId: z.string().optional(),
|
|
55
71
|
});
|
|
56
72
|
|
|
73
|
+
export type CreateTransactionInput = z.infer<
|
|
74
|
+
typeof CreateTransactionInputSchema
|
|
75
|
+
>;
|
|
76
|
+
|
|
57
77
|
export const UpdateTransactionWebhookInputSchema = z.object({
|
|
58
78
|
status: z.enum(TRANSACTION_STATUSES),
|
|
59
79
|
providerTransactionId: z.string(),
|
|
60
80
|
});
|
|
61
81
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
82
|
+
export type UpdateTransactionWebhookInput = z.infer<
|
|
83
|
+
typeof UpdateTransactionWebhookInputSchema
|
|
84
|
+
>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* --------------------------------
|
|
88
|
+
* ENTITY
|
|
89
|
+
* --------------------------------
|
|
90
|
+
*/
|
|
65
91
|
|
|
66
92
|
export const TransactionEntitySchema = BaseTransactionSchema.extend({
|
|
67
93
|
productTitle: z.string().optional(),
|
|
94
|
+
|
|
68
95
|
sellerName: z.string().optional(),
|
|
69
|
-
sellerId: z.string().optional(),
|
|
70
96
|
sellerUsername: z.string().optional(),
|
|
97
|
+
|
|
71
98
|
buyerName: z.string().optional(),
|
|
72
99
|
buyerUsername: z.string().optional(),
|
|
73
100
|
buyerEmail: z.email(),
|
|
74
101
|
}).openapi({ title: "TransactionEntity" });
|
|
75
102
|
|
|
103
|
+
export type TransactionEntity = z.infer<typeof TransactionEntitySchema>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* --------------------------------
|
|
107
|
+
* OUTPUTS
|
|
108
|
+
* --------------------------------
|
|
109
|
+
*/
|
|
110
|
+
|
|
76
111
|
export const InitTransactionOutputSchema = z
|
|
77
112
|
.object({
|
|
78
113
|
transaction: TransactionEntitySchema,
|
|
@@ -82,19 +117,4 @@ export const InitTransactionOutputSchema = z
|
|
|
82
117
|
})
|
|
83
118
|
.openapi({ title: "InitTransactionResult" });
|
|
84
119
|
|
|
85
|
-
// ==========================================
|
|
86
|
-
// TYPES EXPORTS
|
|
87
|
-
// ==========================================
|
|
88
|
-
|
|
89
|
-
export type BaseTransactionEntity = z.infer<typeof BaseTransactionSchema>;
|
|
90
|
-
|
|
91
|
-
export type InitTransactionInput = z.infer<typeof InitTransactionInputSchema>;
|
|
92
|
-
export type CreateTransactionInput = z.infer<
|
|
93
|
-
typeof CreateTransactionInputSchema
|
|
94
|
-
>;
|
|
95
|
-
export type UpdateTransactionWebhookInput = z.infer<
|
|
96
|
-
typeof UpdateTransactionWebhookInputSchema
|
|
97
|
-
>;
|
|
98
|
-
|
|
99
|
-
export type TransactionEntity = z.infer<typeof TransactionEntitySchema>;
|
|
100
120
|
export type InitTransactionResult = z.infer<typeof InitTransactionOutputSchema>;
|