@zyacreatives/shared 2.5.71 → 2.5.73
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 +30 -6
- package/dist/constants.js +33 -7
- package/dist/schemas/investor-shortlist.d.ts +0 -18
- package/dist/schemas/investor-signal.d.ts +0 -12
- package/dist/schemas/job-application.d.ts +0 -24
- package/dist/schemas/job.d.ts +0 -102
- package/dist/schemas/product.d.ts +59 -54
- package/dist/schemas/product.js +24 -1
- package/dist/schemas/project.d.ts +0 -66
- package/dist/schemas/transaction.d.ts +234 -29
- package/dist/schemas/transaction.js +7 -3
- package/dist/schemas/user.d.ts +0 -24
- package/package.json +1 -1
- package/src/constants.ts +35 -6
- package/src/schemas/product.ts +36 -1
- package/src/schemas/transaction.ts +19 -5
|
@@ -4,7 +4,10 @@ import {
|
|
|
4
4
|
TRANSACTION_STATUSES,
|
|
5
5
|
PAYMENT_PROVIDERS,
|
|
6
6
|
} from "../constants";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
ProductDiscountEntitySchema,
|
|
9
|
+
ProductPurchaseSnapshotSchema,
|
|
10
|
+
} from "./product";
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* --------------------------------
|
|
@@ -14,6 +17,7 @@ import { ProductDiscountEntitySchema } from "./product";
|
|
|
14
17
|
|
|
15
18
|
export const BaseTransactionSchema = z.object({
|
|
16
19
|
id: z.cuid2(),
|
|
20
|
+
|
|
17
21
|
productId: z.cuid2(),
|
|
18
22
|
buyerId: z.cuid2(),
|
|
19
23
|
sellerId: z.cuid2(),
|
|
@@ -28,7 +32,8 @@ export const BaseTransactionSchema = z.object({
|
|
|
28
32
|
providerTransactionId: z.string().nullable().optional(),
|
|
29
33
|
|
|
30
34
|
discountApplied: ProductDiscountEntitySchema.nullable().optional(),
|
|
31
|
-
|
|
35
|
+
|
|
36
|
+
productSnapshot: ProductPurchaseSnapshotSchema.nullable().optional(),
|
|
32
37
|
|
|
33
38
|
createdAt: z.iso.datetime(),
|
|
34
39
|
updatedAt: z.iso.datetime(),
|
|
@@ -46,11 +51,17 @@ export const InitTransactionInputSchema = z.object({
|
|
|
46
51
|
productId: z
|
|
47
52
|
.cuid2()
|
|
48
53
|
.openapi({ description: "ID of the product being purchased" }),
|
|
54
|
+
|
|
49
55
|
firstName: z.string().optional(),
|
|
50
56
|
lastName: z.string().optional(),
|
|
51
57
|
email: z.email(),
|
|
58
|
+
|
|
52
59
|
discountCode: z.string().optional(),
|
|
53
|
-
|
|
60
|
+
|
|
61
|
+
amount: z
|
|
62
|
+
.number()
|
|
63
|
+
.int("Amount must be a whole number in the smallest currency unit")
|
|
64
|
+
.min(0),
|
|
54
65
|
});
|
|
55
66
|
|
|
56
67
|
export type InitTransactionInput = z.infer<typeof InitTransactionInputSchema>;
|
|
@@ -66,8 +77,9 @@ export const CreateTransactionInputSchema = BaseTransactionSchema.pick({
|
|
|
66
77
|
paymentProvider: true,
|
|
67
78
|
status: true,
|
|
68
79
|
}).extend({
|
|
69
|
-
discountApplied: ProductDiscountEntitySchema.optional(),
|
|
80
|
+
discountApplied: ProductDiscountEntitySchema.nullable().optional(),
|
|
70
81
|
providerTransactionId: z.string().optional(),
|
|
82
|
+
productSnapshot: ProductPurchaseSnapshotSchema.nullable().optional(),
|
|
71
83
|
});
|
|
72
84
|
|
|
73
85
|
export type CreateTransactionInput = z.infer<
|
|
@@ -117,4 +129,6 @@ export const InitTransactionOutputSchema = z
|
|
|
117
129
|
})
|
|
118
130
|
.openapi({ title: "InitTransactionResult" });
|
|
119
131
|
|
|
120
|
-
export type InitTransactionResult = z.infer<
|
|
132
|
+
export type InitTransactionResult = z.infer<
|
|
133
|
+
typeof InitTransactionOutputSchema
|
|
134
|
+
>;
|