@jsdev_ninja/core 0.6.1 → 0.6.2
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/lib/entities/Cart.ts +11 -6
- package/lib/entities/index.ts +3 -0
- package/package.json +1 -1
package/lib/entities/Cart.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
import { ProductSchema } from "./Product";
|
|
3
|
+
|
|
3
4
|
export const CartSchema = z.object({
|
|
5
|
+
type: z.literal("Cart"),
|
|
4
6
|
id: z.string().uuid(),
|
|
5
|
-
|
|
7
|
+
companyId: z.string().uuid(),
|
|
8
|
+
storeId: z.string().uuid(),
|
|
9
|
+
userId: z.string().uuid(),
|
|
10
|
+
status: z.enum(["active", "draft", "completed"]),
|
|
6
11
|
items: z.array(
|
|
7
12
|
z.object({
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
product: ProductSchema,
|
|
14
|
+
amount: z.number().int().positive({ message: "Quantity must be a positive integer." }),
|
|
10
15
|
})
|
|
11
16
|
),
|
|
12
|
-
createdAt: z.date().default(new Date()),
|
|
13
|
-
updatedAt: z.date().optional(),
|
|
14
17
|
});
|
|
18
|
+
|
|
19
|
+
export type TCart = z.infer<typeof CartSchema>;
|
package/lib/entities/index.ts
CHANGED