@jsdev_ninja/core 0.6.0 → 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.
@@ -1,14 +1,19 @@
1
1
  import { z } from "zod";
2
- // 5. Cart Schema
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
- userId: z.string().uuid(), // Reference to User ID
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
- productId: z.string().uuid(), // Reference to Product ID
9
- quantity: z.number().int().positive({ message: "Quantity must be a positive integer." }),
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>;
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { ProductSchema } from "@jsdev_ninja/core";
3
3
  import { AddressSchema } from "./Address";
4
+ import { ProfileSchema } from "./Profile";
4
5
 
5
6
  // pending - order created / by user
6
7
  // processing order accepted by store by admin
@@ -1,2 +1,5 @@
1
1
  export * from "./Product";
2
2
  export * from "./Category";
3
+ export * from "./Order";
4
+ export * from "./Profile";
5
+ export * from "./Cart";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsdev_ninja/core",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "main": "dist/core.cjs.js",
6
6
  "module": "dist/core.es.js",