@jsdev_ninja/core 0.5.66 → 0.6.0
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/Address.ts +9 -11
- package/lib/entities/Order.ts +31 -11
- package/lib/entities/Profile.ts +19 -0
- package/package.json +1 -1
- package/vite.config.ts +0 -1
- package/lib/appApi/index.tsx +0 -1
package/lib/entities/Address.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
// 6. Address Schema
|
|
4
3
|
export const AddressSchema = z.object({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
street: z.string()
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
isDefault: z.boolean().default(false),
|
|
13
|
-
createdAt: z.date().default(new Date()),
|
|
14
|
-
updatedAt: z.date().optional(),
|
|
4
|
+
country: z.string(),
|
|
5
|
+
city: z.string(),
|
|
6
|
+
street: z.string(),
|
|
7
|
+
streetNumber: z.string(),
|
|
8
|
+
floor: z.string(),
|
|
9
|
+
apartmentEnterNumber: z.string(),
|
|
10
|
+
apartmentNumber: z.string(),
|
|
15
11
|
});
|
|
12
|
+
|
|
13
|
+
export type TAddress = z.infer<typeof AddressSchema>;
|
package/lib/entities/Order.ts
CHANGED
|
@@ -1,15 +1,35 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { ProductSchema } from "@jsdev_ninja/core";
|
|
3
|
+
import { AddressSchema } from "./Address";
|
|
4
|
+
|
|
5
|
+
// pending - order created / by user
|
|
6
|
+
// processing order accepted by store by admin
|
|
7
|
+
// delivered - order delivered by admin
|
|
8
|
+
// canceled - order canceled by user/admin
|
|
9
|
+
// completed - order paid by admin
|
|
10
|
+
|
|
11
|
+
// type PaymentStatus = "pending" | "completed" | "failed" | "refunded" | "partially_refunded";
|
|
12
|
+
|
|
13
|
+
// type PaymentMethod = "credit_card" | "paypal" | "bank_transfer" | "cash_on_delivery";
|
|
2
14
|
|
|
3
|
-
// 4. Order Schema
|
|
4
15
|
export const OrderSchema = z.object({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
type: z.literal("Order"),
|
|
17
|
+
id: z.string(),
|
|
18
|
+
companyId: z.string(),
|
|
19
|
+
storeId: z.string(),
|
|
20
|
+
userId: z.string(),
|
|
21
|
+
status: z.enum(["pending", "processing", "delivered", "canceled", "completed", "refunded"]),
|
|
22
|
+
cart: z.object({
|
|
23
|
+
id: z.string(),
|
|
24
|
+
items: z.array(z.object({ product: ProductSchema, amount: z.number() })),
|
|
25
|
+
cartTotal: z.number(),
|
|
26
|
+
cartDiscount: z.number(),
|
|
27
|
+
cartVat: z.number(),
|
|
28
|
+
}),
|
|
29
|
+
date: z.number(),
|
|
30
|
+
deliveryDate: z.number().optional(),
|
|
31
|
+
client: ProfileSchema,
|
|
32
|
+
address: AddressSchema,
|
|
15
33
|
});
|
|
34
|
+
|
|
35
|
+
export type TOrder = z.infer<typeof OrderSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AddressSchema } from "./Address";
|
|
3
|
+
|
|
4
|
+
export const ProfileSchema = z.object({
|
|
5
|
+
type: z.literal("Profile"),
|
|
6
|
+
id: z.string(),
|
|
7
|
+
companyId: z.string(),
|
|
8
|
+
storeId: z.string(),
|
|
9
|
+
tenantId: z.string(),
|
|
10
|
+
clientType: z.enum(["user", "company"]),
|
|
11
|
+
displayName: z.string().min(1),
|
|
12
|
+
email: z.string().email(),
|
|
13
|
+
phoneNumber: z.object({
|
|
14
|
+
code: z.string(),
|
|
15
|
+
number: z.string(),
|
|
16
|
+
}),
|
|
17
|
+
address: AddressSchema,
|
|
18
|
+
});
|
|
19
|
+
export type TProfile = z.infer<typeof ProfileSchema>;
|
package/package.json
CHANGED
package/vite.config.ts
CHANGED
package/lib/appApi/index.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const appApi = {};
|