@gigapay-dev/contracts 1.8.6 → 2.0.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/README.md +1 -0
- package/build/client.d.ts +934 -0
- package/build/client.d.ts.map +1 -0
- package/build/client.js +184 -0
- package/build/client.js.map +1 -0
- package/build/commands/api-response.d.ts +1 -0
- package/build/commands/api-response.d.ts.map +1 -0
- package/build/commands/api-response.js +1 -0
- package/build/commands/api-response.js.map +1 -0
- package/build/commands/auth/confirm.d.ts +1 -0
- package/build/commands/auth/confirm.d.ts.map +1 -0
- package/build/commands/auth/confirm.js +1 -0
- package/build/commands/auth/confirm.js.map +1 -0
- package/build/commands/auth/endpoints.d.ts +1 -0
- package/build/commands/auth/endpoints.d.ts.map +1 -0
- package/build/commands/auth/endpoints.js +1 -0
- package/build/commands/auth/endpoints.js.map +1 -0
- package/build/commands/auth/index.d.ts +2 -0
- package/build/commands/auth/index.d.ts.map +1 -0
- package/build/commands/auth/index.js +2 -0
- package/build/commands/auth/index.js.map +1 -0
- package/build/commands/auth/login.d.ts +1 -0
- package/build/commands/auth/login.d.ts.map +1 -0
- package/build/commands/auth/login.js +1 -0
- package/build/commands/auth/login.js.map +1 -0
- package/build/commands/auth/profile.d.ts +1 -0
- package/build/commands/auth/profile.d.ts.map +1 -0
- package/build/commands/auth/profile.js +1 -0
- package/build/commands/auth/profile.js.map +1 -0
- package/build/commands/auth/register.d.ts +1 -0
- package/build/commands/auth/register.d.ts.map +1 -0
- package/build/commands/auth/register.js +1 -0
- package/build/commands/auth/register.js.map +1 -0
- package/build/commands/auth/reset.d.ts +1 -0
- package/build/commands/auth/reset.d.ts.map +1 -0
- package/build/commands/auth/reset.js +1 -0
- package/build/commands/auth/reset.js.map +1 -0
- package/build/commands/common.d.ts +65 -0
- package/build/commands/common.d.ts.map +1 -0
- package/build/commands/common.js +29 -0
- package/build/commands/common.js.map +1 -0
- package/build/commands/consts.d.ts +1 -0
- package/build/commands/consts.d.ts.map +1 -0
- package/build/commands/consts.js +1 -0
- package/build/commands/consts.js.map +1 -0
- package/build/commands/endpoints.d.ts +4643 -0
- package/build/commands/endpoints.d.ts.map +1 -0
- package/build/commands/endpoints.js +26 -0
- package/build/commands/endpoints.js.map +1 -0
- package/build/commands/index.d.ts +3 -0
- package/build/commands/index.d.ts.map +1 -0
- package/build/commands/index.js +3 -0
- package/build/commands/index.js.map +1 -0
- package/build/commands/orders/create.d.ts +5 -0
- package/build/commands/orders/create.d.ts.map +1 -0
- package/build/commands/orders/create.js +3 -0
- package/build/commands/orders/create.js.map +1 -0
- package/build/commands/orders/endpoints.d.ts +40 -24
- package/build/commands/orders/endpoints.d.ts.map +1 -0
- package/build/commands/orders/endpoints.js +1 -0
- package/build/commands/orders/endpoints.js.map +1 -0
- package/build/commands/orders/enums.d.ts +1 -0
- package/build/commands/orders/enums.d.ts.map +1 -0
- package/build/commands/orders/enums.js +1 -0
- package/build/commands/orders/enums.js.map +1 -0
- package/build/commands/orders/index.d.ts +1 -0
- package/build/commands/orders/index.d.ts.map +1 -0
- package/build/commands/orders/index.js +1 -0
- package/build/commands/orders/index.js.map +1 -0
- package/build/commands/orders/query.d.ts +7 -6
- package/build/commands/orders/query.d.ts.map +1 -0
- package/build/commands/orders/query.js +1 -0
- package/build/commands/orders/query.js.map +1 -0
- package/build/commands/orders/read.d.ts +8 -3
- package/build/commands/orders/read.d.ts.map +1 -0
- package/build/commands/orders/read.js +4 -1
- package/build/commands/orders/read.js.map +1 -0
- package/build/commands/orders/update.d.ts +1 -0
- package/build/commands/orders/update.d.ts.map +1 -0
- package/build/commands/orders/update.js +1 -0
- package/build/commands/orders/update.js.map +1 -0
- package/build/commands/pagination.d.ts +8 -7
- package/build/commands/pagination.d.ts.map +1 -0
- package/build/commands/pagination.js +5 -7
- package/build/commands/pagination.js.map +1 -0
- package/build/commands/payment-methods/create.d.ts +1 -0
- package/build/commands/payment-methods/create.d.ts.map +1 -0
- package/build/commands/payment-methods/create.js +1 -0
- package/build/commands/payment-methods/create.js.map +1 -0
- package/build/commands/payment-methods/endpoints.d.ts +1 -0
- package/build/commands/payment-methods/endpoints.d.ts.map +1 -0
- package/build/commands/payment-methods/endpoints.js +1 -0
- package/build/commands/payment-methods/endpoints.js.map +1 -0
- package/build/commands/payment-methods/index.d.ts +1 -0
- package/build/commands/payment-methods/index.d.ts.map +1 -0
- package/build/commands/payment-methods/index.js +1 -0
- package/build/commands/payment-methods/index.js.map +1 -0
- package/build/commands/payment-methods/read.d.ts +1 -0
- package/build/commands/payment-methods/read.d.ts.map +1 -0
- package/build/commands/payment-methods/read.js +1 -0
- package/build/commands/payment-methods/read.js.map +1 -0
- package/build/commands/payment-methods/update.d.ts +1 -0
- package/build/commands/payment-methods/update.d.ts.map +1 -0
- package/build/commands/payment-methods/update.js +1 -0
- package/build/commands/payment-methods/update.js.map +1 -0
- package/build/commands/products/create.d.ts +13 -0
- package/build/commands/products/create.d.ts.map +1 -0
- package/build/commands/products/create.js +7 -0
- package/build/commands/products/create.js.map +1 -0
- package/build/commands/products/endpoints.d.ts +99 -0
- package/build/commands/products/endpoints.d.ts.map +1 -0
- package/build/commands/products/endpoints.js +1 -0
- package/build/commands/products/endpoints.js.map +1 -0
- package/build/commands/products/enums.d.ts +1 -0
- package/build/commands/products/enums.d.ts.map +1 -0
- package/build/commands/products/enums.js +1 -0
- package/build/commands/products/enums.js.map +1 -0
- package/build/commands/products/index.d.ts +1 -0
- package/build/commands/products/index.d.ts.map +1 -0
- package/build/commands/products/index.js +1 -0
- package/build/commands/products/index.js.map +1 -0
- package/build/commands/products/query.d.ts +1 -0
- package/build/commands/products/query.d.ts.map +1 -0
- package/build/commands/products/query.js +1 -0
- package/build/commands/products/query.js.map +1 -0
- package/build/commands/products/read.d.ts +55 -0
- package/build/commands/products/read.d.ts.map +1 -0
- package/build/commands/products/read.js +11 -0
- package/build/commands/products/read.js.map +1 -0
- package/build/commands/products/update.d.ts +7 -0
- package/build/commands/products/update.d.ts.map +1 -0
- package/build/commands/products/update.js +1 -0
- package/build/commands/products/update.js.map +1 -0
- package/build/commands/promocode-activations/create.d.ts +1 -0
- package/build/commands/promocode-activations/create.d.ts.map +1 -0
- package/build/commands/promocode-activations/create.js +1 -0
- package/build/commands/promocode-activations/create.js.map +1 -0
- package/build/commands/promocode-activations/endpoints.d.ts +158 -0
- package/build/commands/promocode-activations/endpoints.d.ts.map +1 -0
- package/build/commands/promocode-activations/endpoints.js +39 -0
- package/build/commands/promocode-activations/endpoints.js.map +1 -0
- package/build/commands/promocode-activations/index.d.ts +2 -0
- package/build/commands/promocode-activations/index.d.ts.map +1 -0
- package/build/commands/promocode-activations/index.js +2 -0
- package/build/commands/promocode-activations/index.js.map +1 -0
- package/build/commands/promocode-activations/read.d.ts +1 -0
- package/build/commands/promocode-activations/read.d.ts.map +1 -0
- package/build/commands/promocode-activations/read.js +1 -0
- package/build/commands/promocode-activations/read.js.map +1 -0
- package/build/commands/promocode-activations/update.d.ts +1 -0
- package/build/commands/promocode-activations/update.d.ts.map +1 -0
- package/build/commands/promocode-activations/update.js +1 -0
- package/build/commands/promocode-activations/update.js.map +1 -0
- package/build/commands/promocodes/create.d.ts +1 -0
- package/build/commands/promocodes/create.d.ts.map +1 -0
- package/build/commands/promocodes/create.js +1 -0
- package/build/commands/promocodes/create.js.map +1 -0
- package/build/commands/promocodes/endpoints.d.ts +1 -0
- package/build/commands/promocodes/endpoints.d.ts.map +1 -0
- package/build/commands/promocodes/endpoints.js +1 -0
- package/build/commands/promocodes/endpoints.js.map +1 -0
- package/build/commands/promocodes/enums.d.ts +1 -0
- package/build/commands/promocodes/enums.d.ts.map +1 -0
- package/build/commands/promocodes/enums.js +1 -0
- package/build/commands/promocodes/enums.js.map +1 -0
- package/build/commands/promocodes/index.d.ts +1 -0
- package/build/commands/promocodes/index.d.ts.map +1 -0
- package/build/commands/promocodes/index.js +1 -0
- package/build/commands/promocodes/index.js.map +1 -0
- package/build/commands/promocodes/read.d.ts +1 -0
- package/build/commands/promocodes/read.d.ts.map +1 -0
- package/build/commands/promocodes/read.js +1 -0
- package/build/commands/promocodes/read.js.map +1 -0
- package/build/commands/promocodes/update.d.ts +1 -0
- package/build/commands/promocodes/update.d.ts.map +1 -0
- package/build/commands/promocodes/update.js +1 -0
- package/build/commands/promocodes/update.js.map +1 -0
- package/build/commands/refresh-sessions/create.d.ts +1 -0
- package/build/commands/refresh-sessions/create.d.ts.map +1 -0
- package/build/commands/refresh-sessions/create.js +1 -0
- package/build/commands/refresh-sessions/create.js.map +1 -0
- package/build/commands/refresh-sessions/endpoints.d.ts +216 -0
- package/build/commands/refresh-sessions/endpoints.d.ts.map +1 -0
- package/build/commands/refresh-sessions/endpoints.js +47 -0
- package/build/commands/refresh-sessions/endpoints.js.map +1 -0
- package/build/commands/refresh-sessions/enums.d.ts +1 -0
- package/build/commands/refresh-sessions/enums.d.ts.map +1 -0
- package/build/commands/refresh-sessions/enums.js +1 -0
- package/build/commands/refresh-sessions/enums.js.map +1 -0
- package/build/commands/refresh-sessions/index.d.ts +2 -0
- package/build/commands/refresh-sessions/index.d.ts.map +1 -0
- package/build/commands/refresh-sessions/index.js +2 -0
- package/build/commands/refresh-sessions/index.js.map +1 -0
- package/build/commands/refresh-sessions/read.d.ts +1 -0
- package/build/commands/refresh-sessions/read.d.ts.map +1 -0
- package/build/commands/refresh-sessions/read.js +1 -0
- package/build/commands/refresh-sessions/read.js.map +1 -0
- package/build/commands/refresh-sessions/update.d.ts +1 -0
- package/build/commands/refresh-sessions/update.d.ts.map +1 -0
- package/build/commands/refresh-sessions/update.js +1 -0
- package/build/commands/refresh-sessions/update.js.map +1 -0
- package/build/commands/settings/endpoints.d.ts +1 -0
- package/build/commands/settings/endpoints.d.ts.map +1 -0
- package/build/commands/settings/endpoints.js +1 -0
- package/build/commands/settings/endpoints.js.map +1 -0
- package/build/commands/settings/index.d.ts +1 -0
- package/build/commands/settings/index.d.ts.map +1 -0
- package/build/commands/settings/index.js +1 -0
- package/build/commands/settings/index.js.map +1 -0
- package/build/commands/settings/read.d.ts +1 -0
- package/build/commands/settings/read.d.ts.map +1 -0
- package/build/commands/settings/read.js +1 -0
- package/build/commands/settings/read.js.map +1 -0
- package/build/commands/settings/update.d.ts +1 -0
- package/build/commands/settings/update.d.ts.map +1 -0
- package/build/commands/settings/update.js +1 -0
- package/build/commands/settings/update.js.map +1 -0
- package/build/commands/stats/endpoints.d.ts +1 -0
- package/build/commands/stats/endpoints.d.ts.map +1 -0
- package/build/commands/stats/endpoints.js +1 -0
- package/build/commands/stats/endpoints.js.map +1 -0
- package/build/commands/stats/index.d.ts +1 -0
- package/build/commands/stats/index.d.ts.map +1 -0
- package/build/commands/stats/index.js +1 -0
- package/build/commands/stats/index.js.map +1 -0
- package/build/commands/stats/query.d.ts +1 -0
- package/build/commands/stats/query.d.ts.map +1 -0
- package/build/commands/stats/query.js +1 -0
- package/build/commands/stats/query.js.map +1 -0
- package/build/commands/stats/read.d.ts +1 -0
- package/build/commands/stats/read.d.ts.map +1 -0
- package/build/commands/stats/read.js +1 -0
- package/build/commands/stats/read.js.map +1 -0
- package/build/commands/users/create.d.ts +1 -0
- package/build/commands/users/create.d.ts.map +1 -0
- package/build/commands/users/create.js +1 -0
- package/build/commands/users/create.js.map +1 -0
- package/build/commands/users/endpoints.d.ts +7 -6
- package/build/commands/users/endpoints.d.ts.map +1 -0
- package/build/commands/users/endpoints.js +1 -0
- package/build/commands/users/endpoints.js.map +1 -0
- package/build/commands/users/enums.d.ts +1 -0
- package/build/commands/users/enums.d.ts.map +1 -0
- package/build/commands/users/enums.js +1 -0
- package/build/commands/users/enums.js.map +1 -0
- package/build/commands/users/index.d.ts +1 -0
- package/build/commands/users/index.d.ts.map +1 -0
- package/build/commands/users/index.js +1 -0
- package/build/commands/users/index.js.map +1 -0
- package/build/commands/users/query.d.ts +7 -6
- package/build/commands/users/query.d.ts.map +1 -0
- package/build/commands/users/query.js +1 -0
- package/build/commands/users/query.js.map +1 -0
- package/build/commands/users/read.d.ts +1 -0
- package/build/commands/users/read.d.ts.map +1 -0
- package/build/commands/users/read.js +1 -0
- package/build/commands/users/read.js.map +1 -0
- package/build/commands/users/update.d.ts +1 -0
- package/build/commands/users/update.d.ts.map +1 -0
- package/build/commands/users/update.js +1 -0
- package/build/commands/users/update.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -0
- package/build/types.d.ts +1 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +1 -0
- package/build/types.js.map +1 -0
- package/package.json +48 -17
- package/commands/api-response.ts +0 -10
- package/commands/auth/confirm.ts +0 -10
- package/commands/auth/endpoints.ts +0 -51
- package/commands/auth/index.ts +0 -5
- package/commands/auth/login.ts +0 -13
- package/commands/auth/profile.ts +0 -10
- package/commands/auth/register.ts +0 -8
- package/commands/auth/reset.ts +0 -9
- package/commands/consts.ts +0 -1
- package/commands/index.ts +0 -13
- package/commands/orders/create.ts +0 -41
- package/commands/orders/endpoints.ts +0 -51
- package/commands/orders/enums.ts +0 -25
- package/commands/orders/index.ts +0 -6
- package/commands/orders/query.ts +0 -46
- package/commands/orders/read.ts +0 -83
- package/commands/orders/update.ts +0 -16
- package/commands/pagination.ts +0 -8
- package/commands/payment-methods/create.ts +0 -19
- package/commands/payment-methods/endpoints.ts +0 -67
- package/commands/payment-methods/index.ts +0 -4
- package/commands/payment-methods/read.ts +0 -30
- package/commands/payment-methods/update.ts +0 -19
- package/commands/products/create.ts +0 -134
- package/commands/products/endpoints.ts +0 -108
- package/commands/products/enums.ts +0 -33
- package/commands/products/index.ts +0 -6
- package/commands/products/query.ts +0 -52
- package/commands/products/read.ts +0 -268
- package/commands/products/update.ts +0 -11
- package/commands/promocode-activations/create.ts +0 -10
- package/commands/promocode-activations/index.ts +0 -3
- package/commands/promocode-activations/read.ts +0 -11
- package/commands/promocode-activations/update.ts +0 -10
- package/commands/promocodes/create.ts +0 -18
- package/commands/promocodes/endpoints.ts +0 -62
- package/commands/promocodes/enums.ts +0 -9
- package/commands/promocodes/index.ts +0 -5
- package/commands/promocodes/read.ts +0 -20
- package/commands/promocodes/update.ts +0 -16
- package/commands/refresh-sessions/create.ts +0 -13
- package/commands/refresh-sessions/enums.ts +0 -4
- package/commands/refresh-sessions/index.ts +0 -4
- package/commands/refresh-sessions/read.ts +0 -14
- package/commands/refresh-sessions/update.ts +0 -13
- package/commands/settings/endpoints.ts +0 -52
- package/commands/settings/index.ts +0 -3
- package/commands/settings/read.ts +0 -10
- package/commands/settings/update.ts +0 -10
- package/commands/stats/endpoints.ts +0 -23
- package/commands/stats/index.ts +0 -3
- package/commands/stats/query.ts +0 -18
- package/commands/stats/read.ts +0 -14
- package/commands/users/create.ts +0 -19
- package/commands/users/endpoints.ts +0 -47
- package/commands/users/enums.ts +0 -10
- package/commands/users/index.ts +0 -6
- package/commands/users/query.ts +0 -20
- package/commands/users/read.ts +0 -25
- package/commands/users/update.ts +0 -19
- package/index.ts +0 -1
- package/tsconfig.json +0 -111
- package/types.ts +0 -9
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
import { OrderReadResponseSchema } from "./read";
|
|
3
|
-
import { EndpointContract } from "../../types";
|
|
4
|
-
import { OrderCreateRequestSchema, OrderCreateResponseSchema } from "./create";
|
|
5
|
-
import { OrdersListQuerySchema } from "./query";
|
|
6
|
-
|
|
7
|
-
export const OrderEndpoints = {
|
|
8
|
-
create: {
|
|
9
|
-
method: "POST",
|
|
10
|
-
path: "/orders",
|
|
11
|
-
request: OrderCreateRequestSchema,
|
|
12
|
-
response: OrderCreateResponseSchema,
|
|
13
|
-
},
|
|
14
|
-
list: {
|
|
15
|
-
method: "GET",
|
|
16
|
-
path: "/orders",
|
|
17
|
-
request: OrdersListQuerySchema,
|
|
18
|
-
response: z.array(OrderReadResponseSchema),
|
|
19
|
-
},
|
|
20
|
-
getById: {
|
|
21
|
-
method: "GET",
|
|
22
|
-
path: "/orders/:id",
|
|
23
|
-
request: z.object({
|
|
24
|
-
id: z.coerce.number().positive(),
|
|
25
|
-
}),
|
|
26
|
-
response: OrderReadResponseSchema,
|
|
27
|
-
},
|
|
28
|
-
getUserOrders: {
|
|
29
|
-
method: "GET",
|
|
30
|
-
path: "/orders/user",
|
|
31
|
-
request: OrdersListQuerySchema,
|
|
32
|
-
response: z.array(OrderReadResponseSchema),
|
|
33
|
-
},
|
|
34
|
-
getUserOrderById: {
|
|
35
|
-
method: "GET",
|
|
36
|
-
path: "/orders/user/:userId/:orderId",
|
|
37
|
-
request: z.object({
|
|
38
|
-
userId: z.coerce.number().positive(),
|
|
39
|
-
orderId: z.coerce.number().positive(),
|
|
40
|
-
}),
|
|
41
|
-
response: OrderReadResponseSchema,
|
|
42
|
-
},
|
|
43
|
-
} satisfies Record<string, EndpointContract>;
|
|
44
|
-
|
|
45
|
-
export type OrderEndpointKey = keyof typeof OrderEndpoints;
|
|
46
|
-
|
|
47
|
-
export type GetOrderRequest<K extends OrderEndpointKey> =
|
|
48
|
-
z.infer<typeof OrderEndpoints[K]["request"]>;
|
|
49
|
-
|
|
50
|
-
export type GetOrderResponse<K extends OrderEndpointKey> =
|
|
51
|
-
z.infer<typeof OrderEndpoints[K]["response"]>;
|
package/commands/orders/enums.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
|
|
3
|
-
export const OrderType = z.enum(["MAIN", "WEBAPP"]);
|
|
4
|
-
export type OrderType = z.infer<typeof OrderType>;
|
|
5
|
-
|
|
6
|
-
export const OrderStatus = z.enum([
|
|
7
|
-
"PENDING",
|
|
8
|
-
"AWAITING_PAYMENT",
|
|
9
|
-
"PAID",
|
|
10
|
-
"PROCESSING",
|
|
11
|
-
"SUCCESS",
|
|
12
|
-
"FAILED",
|
|
13
|
-
"REFUNDED",
|
|
14
|
-
"CANCELLED",
|
|
15
|
-
]);
|
|
16
|
-
export type OrderStatus = z.infer<typeof OrderStatus>;
|
|
17
|
-
|
|
18
|
-
export const OrderItemStatus = z.enum([
|
|
19
|
-
"PENDING",
|
|
20
|
-
"PROCESSING",
|
|
21
|
-
"DELIVERED",
|
|
22
|
-
"FAILED",
|
|
23
|
-
"REFUNDED",
|
|
24
|
-
]);
|
|
25
|
-
export type OrderItemStatus = z.infer<typeof OrderItemStatus>;
|
package/commands/orders/index.ts
DELETED
package/commands/orders/query.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
import { PaginationQuery } from "../pagination";
|
|
3
|
-
import { OrderStatus } from "./enums";
|
|
4
|
-
|
|
5
|
-
/** Фильтр по периоду (базовая схема без refinements для merge) */
|
|
6
|
-
const OrdersPeriodBase = z.object({
|
|
7
|
-
/** Предустановленный период: day, week, month, year, custom */
|
|
8
|
-
period: z.enum(["day", "week", "month", "year", "custom"]).optional(),
|
|
9
|
-
/** Начало периода (ISO datetime, обязателен при period=custom) */
|
|
10
|
-
start: z.string().datetime().optional(),
|
|
11
|
-
/** Конец периода (ISO datetime, обязателен при period=custom) */
|
|
12
|
-
end: z.string().datetime().optional(),
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
/** Фильтр по периоду с валидацией custom-диапазона */
|
|
16
|
-
export const OrdersPeriodSchema = OrdersPeriodBase
|
|
17
|
-
.refine(v => v.period !== "custom" || (v.start && v.end), {
|
|
18
|
-
message: "start/end обязательны при period=custom",
|
|
19
|
-
})
|
|
20
|
-
.refine(v => v.period !== "custom" || new Date(v.start!) < new Date(v.end!), {
|
|
21
|
-
message: "start должен быть раньше end",
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
/** Фильтры списка заказов */
|
|
25
|
-
export const OrdersFiltersSchema = z.object({
|
|
26
|
-
/** Фильтр по email покупателя (частичное совпадение) */
|
|
27
|
-
email: z.string().optional(),
|
|
28
|
-
/** Фильтр по статусу заказа */
|
|
29
|
-
status: OrderStatus.optional(),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
/** Сортировка списка заказов */
|
|
33
|
-
export const OrdersSortSchema = z.object({
|
|
34
|
-
/** Поле для сортировки: createdAt, updatedAt, total, subtotal */
|
|
35
|
-
sortBy: z.enum(["createdAt", "updatedAt", "total", "subtotal"]).default("createdAt"),
|
|
36
|
-
/** Направление сортировки */
|
|
37
|
-
sortDir: z.enum(["asc", "desc"]).default("desc"),
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
/** Объединённая схема запроса списка заказов */
|
|
41
|
-
export const OrdersListQuerySchema = PaginationQuery
|
|
42
|
-
.merge(OrdersFiltersSchema)
|
|
43
|
-
.merge(OrdersSortSchema)
|
|
44
|
-
.merge(OrdersPeriodBase);
|
|
45
|
-
|
|
46
|
-
export type OrdersListQuery = z.infer<typeof OrdersListQuerySchema>;
|
package/commands/orders/read.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { OrderType, OrderStatus, OrderItemStatus } from "./enums";
|
|
3
|
-
|
|
4
|
-
/** Элемент заказа в ответе */
|
|
5
|
-
export const OrderItemResponseSchema = z.object({
|
|
6
|
-
/** ID элемента заказа */
|
|
7
|
-
id: z.number(),
|
|
8
|
-
/** ID товара */
|
|
9
|
-
productId: z.number(),
|
|
10
|
-
/** ID варианта товара */
|
|
11
|
-
variantId: z.number(),
|
|
12
|
-
/** Количество */
|
|
13
|
-
quantity: z.number(),
|
|
14
|
-
/** Цена на момент покупки (строка, Decimal) */
|
|
15
|
-
price: z.string(),
|
|
16
|
-
/** Игровой логин для доставки */
|
|
17
|
-
gameUsername: z.string().nullable(),
|
|
18
|
-
/** Тип игрового логина */
|
|
19
|
-
gameUsernameType: z.string().nullable(),
|
|
20
|
-
/** Выданный ключ (если автоматическая доставка) */
|
|
21
|
-
deliveredKey: z.string().nullable(),
|
|
22
|
-
/** Дата доставки */
|
|
23
|
-
deliveredAt: z.coerce.date().nullable(),
|
|
24
|
-
/** Статус элемента заказа */
|
|
25
|
-
status: OrderItemStatus,
|
|
26
|
-
/** Название товара */
|
|
27
|
-
productTitle: z.string().optional(),
|
|
28
|
-
/** Название варианта */
|
|
29
|
-
variantName: z.string().optional(),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
/** Полная информация о заказе */
|
|
33
|
-
export const OrderReadResponseSchema = z.object({
|
|
34
|
-
/** ID заказа */
|
|
35
|
-
id: z.coerce.number().positive(),
|
|
36
|
-
/** ID пользователя (null для гостевых заказов) */
|
|
37
|
-
userId: z.coerce.number().positive().nullable().optional(),
|
|
38
|
-
/** ID промокода */
|
|
39
|
-
promocodeId: z.coerce.number().nonnegative().nullable().optional(),
|
|
40
|
-
/** ID способа оплаты */
|
|
41
|
-
paymentMethodId: z.coerce.number().nonnegative().nullable().optional(),
|
|
42
|
-
/** Email покупателя */
|
|
43
|
-
email: z.string(),
|
|
44
|
-
/** Статус заказа */
|
|
45
|
-
status: OrderStatus,
|
|
46
|
-
/** Тип заказа */
|
|
47
|
-
type: OrderType,
|
|
48
|
-
/** Сумма товаров до скидки и комиссий (строка, Decimal) */
|
|
49
|
-
subtotal: z.string(),
|
|
50
|
-
/** Сумма скидки (строка, Decimal) */
|
|
51
|
-
discount: z.string(),
|
|
52
|
-
/** Комиссия эквайринга (строка, Decimal) */
|
|
53
|
-
commission: z.string(),
|
|
54
|
-
/** Комиссия сервиса (строка, Decimal) */
|
|
55
|
-
serviceCommission: z.string(),
|
|
56
|
-
/** Итого к оплате (строка, Decimal) */
|
|
57
|
-
total: z.string(),
|
|
58
|
-
/** IP-адрес покупателя */
|
|
59
|
-
ipAddress: z.string().nullable().optional(),
|
|
60
|
-
/** UTM-метка источника трафика */
|
|
61
|
-
utmSource: z.string().nullable(),
|
|
62
|
-
/** Тип дизайна формы оплаты */
|
|
63
|
-
designType: z.string().nullable(),
|
|
64
|
-
/** Название способа оплаты */
|
|
65
|
-
paymentMethodName: z.string().nullable(),
|
|
66
|
-
/** Значение промокода */
|
|
67
|
-
promocodeValue: z.string().nullable(),
|
|
68
|
-
/** Скидка промокода в процентах (строка, Decimal) */
|
|
69
|
-
promocodeDiscount: z.string().nullable(),
|
|
70
|
-
/** Процент комиссии сервиса (serviceComission + secretComission) */
|
|
71
|
-
serviceCommissionPercent: z.coerce.number().nonnegative().optional(),
|
|
72
|
-
/** Процент комиссии эквайринга */
|
|
73
|
-
acquiringCommissionPercent: z.coerce.number().nonnegative().optional(),
|
|
74
|
-
/** Элементы заказа */
|
|
75
|
-
items: z.array(OrderItemResponseSchema).optional(),
|
|
76
|
-
/** Дата создания */
|
|
77
|
-
createdAt: z.coerce.date().default(() => new Date()),
|
|
78
|
-
/** Дата обновления */
|
|
79
|
-
updatedAt: z.coerce.date().default(() => new Date()),
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
export type OrderItemResponse = z.infer<typeof OrderItemResponseSchema>;
|
|
83
|
-
export type OrderReadResponse = z.infer<typeof OrderReadResponseSchema>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { OrderStatus } from "./enums";
|
|
3
|
-
|
|
4
|
-
/** Запрос на обновление заказа (администратором) */
|
|
5
|
-
export const OrderUpdateRequestSchema = z.object({
|
|
6
|
-
/** Новый статус заказа */
|
|
7
|
-
status: OrderStatus.optional(),
|
|
8
|
-
/** Email покупателя */
|
|
9
|
-
email: z.string().email().optional(),
|
|
10
|
-
/** ID способа оплаты */
|
|
11
|
-
paymentMethodId: z.coerce.number().positive().optional(),
|
|
12
|
-
/** ID промокода */
|
|
13
|
-
promocodeId: z.coerce.number().positive().optional(),
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export type OrderUpdateRequest = z.infer<typeof OrderUpdateRequestSchema>;
|
package/commands/pagination.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
|
|
3
|
-
export const PaymentMethodsCreateRequestSchema = z.object({
|
|
4
|
-
name: z.string(),
|
|
5
|
-
image: z.string(),
|
|
6
|
-
key: z.string(),
|
|
7
|
-
uniqueKey: z.string(),
|
|
8
|
-
isActive: z.boolean().default(true),
|
|
9
|
-
type: z.string(),
|
|
10
|
-
maxAmount: z.coerce.number().nonnegative(),
|
|
11
|
-
minAmount: z.coerce.number().nonnegative(),
|
|
12
|
-
comission: z.coerce.number().nonnegative(),
|
|
13
|
-
secretComission: z.coerce.number().nonnegative(),
|
|
14
|
-
serviceComission: z.coerce.number().nonnegative(),
|
|
15
|
-
cryptoToken: z.string().optional(),
|
|
16
|
-
cryptoTokenSecret: z.string().optional(),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export type PaymentMethodsCreateRequest = z.infer<typeof PaymentMethodsCreateRequestSchema>;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
import { CourseReadResponseSchema, PaymentMethodReadResponseSchema } from "./read";
|
|
3
|
-
import { EndpointContract } from "../../types";
|
|
4
|
-
import { PaymentMethodUpdateRequestSchema } from "./update";
|
|
5
|
-
import { PaymentMethodsCreateRequestSchema } from "./create";
|
|
6
|
-
|
|
7
|
-
export const PaymentMethodEndpoints = {
|
|
8
|
-
course: {
|
|
9
|
-
method: "GET",
|
|
10
|
-
path: "/course",
|
|
11
|
-
request: z.object({}),
|
|
12
|
-
response: CourseReadResponseSchema,
|
|
13
|
-
},
|
|
14
|
-
create: {
|
|
15
|
-
method: "POST",
|
|
16
|
-
path: "/payment-methods",
|
|
17
|
-
request: z.object({
|
|
18
|
-
data: PaymentMethodsCreateRequestSchema,
|
|
19
|
-
}),
|
|
20
|
-
response: PaymentMethodReadResponseSchema,
|
|
21
|
-
},
|
|
22
|
-
update: {
|
|
23
|
-
method: "PUT",
|
|
24
|
-
path: "/payment-methods/:id",
|
|
25
|
-
request: z.object({
|
|
26
|
-
id: z.coerce.number().positive(),
|
|
27
|
-
data: PaymentMethodUpdateRequestSchema,
|
|
28
|
-
}),
|
|
29
|
-
response: PaymentMethodReadResponseSchema,
|
|
30
|
-
},
|
|
31
|
-
list: {
|
|
32
|
-
method: "GET",
|
|
33
|
-
path: "/payment-methods",
|
|
34
|
-
request: z.object({}),
|
|
35
|
-
response: z.array(PaymentMethodReadResponseSchema),
|
|
36
|
-
},
|
|
37
|
-
listAdmin: {
|
|
38
|
-
method: "GET",
|
|
39
|
-
path: "/payment-methods/admin",
|
|
40
|
-
request: z.object({}),
|
|
41
|
-
response: z.array(PaymentMethodReadResponseSchema),
|
|
42
|
-
},
|
|
43
|
-
getById: {
|
|
44
|
-
method: "GET",
|
|
45
|
-
path: "/payment-methods/:id",
|
|
46
|
-
request: z.object({
|
|
47
|
-
id: z.coerce.number().positive(),
|
|
48
|
-
}),
|
|
49
|
-
response: PaymentMethodReadResponseSchema,
|
|
50
|
-
},
|
|
51
|
-
getByIdAdmin: {
|
|
52
|
-
method: "GET",
|
|
53
|
-
path: "/payment-methods/admin/:id",
|
|
54
|
-
request: z.object({
|
|
55
|
-
id: z.coerce.number().positive(),
|
|
56
|
-
}),
|
|
57
|
-
response: PaymentMethodReadResponseSchema,
|
|
58
|
-
},
|
|
59
|
-
} satisfies Record<string, EndpointContract>;
|
|
60
|
-
|
|
61
|
-
export type PaymentMethodEndpointKey = keyof typeof PaymentMethodEndpoints;
|
|
62
|
-
|
|
63
|
-
export type GetPaymentMethodRequest<K extends PaymentMethodEndpointKey> =
|
|
64
|
-
z.infer<typeof PaymentMethodEndpoints[K]["request"]>;
|
|
65
|
-
|
|
66
|
-
export type GetPaymentMethodResponse<K extends PaymentMethodEndpointKey> =
|
|
67
|
-
z.infer<typeof PaymentMethodEndpoints[K]["response"]>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export const CourseReadResponseSchema = z.object({
|
|
4
|
-
USD_RUB: z.string(),
|
|
5
|
-
RUB_KZT: z.string(),
|
|
6
|
-
USD_KZT: z.string(),
|
|
7
|
-
KZT_RUB: z.string(),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export const PaymentMethodReadResponseSchema = z.object({
|
|
11
|
-
id: z.coerce.number().positive(),
|
|
12
|
-
name: z.string(),
|
|
13
|
-
image: z.string(),
|
|
14
|
-
key: z.string(),
|
|
15
|
-
uniqueKey: z.string(),
|
|
16
|
-
isActive: z.boolean(),
|
|
17
|
-
type: z.string(),
|
|
18
|
-
maxAmount: z.coerce.number().nonnegative(),
|
|
19
|
-
minAmount: z.coerce.number().nonnegative(),
|
|
20
|
-
comission: z.coerce.number().nonnegative(),
|
|
21
|
-
secretComission: z.coerce.number().nonnegative().optional(),
|
|
22
|
-
serviceComission: z.coerce.number().nonnegative(),
|
|
23
|
-
cryptoToken: z.string().nullable(),
|
|
24
|
-
cryptoNetwork: z.string().nullable(),
|
|
25
|
-
updatedAt: z.coerce.date(),
|
|
26
|
-
createdAt: z.coerce.date(),
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export type CourseReadResponse = z.infer<typeof CourseReadResponseSchema>;
|
|
30
|
-
export type PaymentMethodReadResponse = z.infer<typeof PaymentMethodReadResponseSchema>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export const PaymentMethodUpdateRequestSchema = z.object({
|
|
4
|
-
name: z.string().optional(),
|
|
5
|
-
image: z.string().optional(),
|
|
6
|
-
key: z.string().optional(),
|
|
7
|
-
uniqueKey: z.string().optional(),
|
|
8
|
-
isActive: z.boolean().optional(),
|
|
9
|
-
type: z.string().optional(),
|
|
10
|
-
maxAmount: z.coerce.number().nonnegative().optional(),
|
|
11
|
-
minAmount: z.coerce.number().nonnegative().optional(),
|
|
12
|
-
comission: z.coerce.number().nonnegative().optional(),
|
|
13
|
-
secretComission: z.coerce.number().nonnegative().optional(),
|
|
14
|
-
serviceComission: z.coerce.number().nonnegative().optional(),
|
|
15
|
-
cryptoToken: z.string().nullable().optional(),
|
|
16
|
-
cryptoTokenSecret: z.string().nullable().optional(),
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
export type PaymentMethodUpdateRequest = z.infer<typeof PaymentMethodUpdateRequestSchema>
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
import { ProductType, DeliveryType, MediaType, SystemRequirementType } from "./enums";
|
|
3
|
-
|
|
4
|
-
/** Запрос на создание продукта */
|
|
5
|
-
export const ProductCreateRequestSchema = z.object({
|
|
6
|
-
/** URL-friendly идентификатор */
|
|
7
|
-
slug: z.string().min(1),
|
|
8
|
-
/** Название продукта */
|
|
9
|
-
title: z.string().min(1),
|
|
10
|
-
/** Оригинальное название (на языке оригинала) */
|
|
11
|
-
originalTitle: z.string().optional(),
|
|
12
|
-
/** Тип продукта */
|
|
13
|
-
type: ProductType,
|
|
14
|
-
/** ID категории */
|
|
15
|
-
categoryId: z.number().int().positive(),
|
|
16
|
-
/** ID родительского продукта (для DLC) */
|
|
17
|
-
parentProductId: z.number().int().positive().optional(),
|
|
18
|
-
/** Полное описание */
|
|
19
|
-
description: z.string().optional(),
|
|
20
|
-
/** Кастомное описание */
|
|
21
|
-
customDescription: z.string().optional(),
|
|
22
|
-
/** Краткое описание */
|
|
23
|
-
shortDescription: z.string().optional(),
|
|
24
|
-
/** URL обложки */
|
|
25
|
-
coverImageUrl: z.string().url().optional(),
|
|
26
|
-
/** Разработчик */
|
|
27
|
-
developer: z.string().optional(),
|
|
28
|
-
/** Издатель */
|
|
29
|
-
publisher: z.string().optional(),
|
|
30
|
-
/** Дата выхода (ISO datetime) */
|
|
31
|
-
releaseDate: z.string().datetime().optional(),
|
|
32
|
-
/** Steam App ID */
|
|
33
|
-
steamAppId: z.number().int().optional(),
|
|
34
|
-
/** Мультиплеер */
|
|
35
|
-
hasMultiplayer: z.boolean().default(false),
|
|
36
|
-
/** Кооператив */
|
|
37
|
-
hasCoop: z.boolean().default(false),
|
|
38
|
-
/** Одиночная игра */
|
|
39
|
-
hasSinglePlayer: z.boolean().default(true),
|
|
40
|
-
/** SEO: заголовок */
|
|
41
|
-
metaTitle: z.string().optional(),
|
|
42
|
-
/** SEO: описание */
|
|
43
|
-
metaDescription: z.string().optional(),
|
|
44
|
-
/** ID жанров для привязки */
|
|
45
|
-
genreIds: z.array(z.number().int().positive()).optional(),
|
|
46
|
-
/** ID тегов для привязки */
|
|
47
|
-
tagIds: z.array(z.number().int().positive()).optional(),
|
|
48
|
-
/** ID регионов для привязки */
|
|
49
|
-
regionIds: z.array(z.number().int().positive()).optional(),
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
export type ProductCreateRequest = z.infer<typeof ProductCreateRequestSchema>;
|
|
53
|
-
|
|
54
|
-
/** Запрос на создание варианта продукта */
|
|
55
|
-
export const VariantCreateRequestSchema = z.object({
|
|
56
|
-
/** Название варианта */
|
|
57
|
-
name: z.string().min(1),
|
|
58
|
-
/** Артикул */
|
|
59
|
-
sku: z.string().min(1),
|
|
60
|
-
/** Цена */
|
|
61
|
-
price: z.number().positive(),
|
|
62
|
-
/** Цена до скидки */
|
|
63
|
-
originalPrice: z.number().positive().optional(),
|
|
64
|
-
/** Себестоимость */
|
|
65
|
-
costPrice: z.number().positive().optional(),
|
|
66
|
-
/** Сумма пополнения (для TOPUP) */
|
|
67
|
-
topupAmount: z.number().positive().optional(),
|
|
68
|
-
/** Валюта */
|
|
69
|
-
currency: z.string().optional(),
|
|
70
|
-
/** Длительность подписки (дни) */
|
|
71
|
-
durationDays: z.number().int().positive().optional(),
|
|
72
|
-
/** Платформа (Steam, Epic Games, ...) */
|
|
73
|
-
platform: z.string().optional(),
|
|
74
|
-
/** Код региона */
|
|
75
|
-
regionCode: z.string().optional(),
|
|
76
|
-
/** Тип доставки */
|
|
77
|
-
deliveryType: DeliveryType.default("AUTOMATIC"),
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
export type VariantCreateRequest = z.infer<typeof VariantCreateRequestSchema>;
|
|
81
|
-
|
|
82
|
-
/** Запрос на импорт ключей */
|
|
83
|
-
export const KeysImportRequestSchema = z.object({
|
|
84
|
-
/** Массив ключей для импорта */
|
|
85
|
-
keys: z.array(z.string().min(1)).min(1),
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
export type KeysImportRequest = z.infer<typeof KeysImportRequestSchema>;
|
|
89
|
-
|
|
90
|
-
/** Ответ на импорт ключей */
|
|
91
|
-
export const KeysImportResponseSchema = z.object({
|
|
92
|
-
/** Количество импортированных ключей */
|
|
93
|
-
imported: z.number(),
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
export type KeysImportResponse = z.infer<typeof KeysImportResponseSchema>;
|
|
97
|
-
|
|
98
|
-
/** Запрос на добавление медиа */
|
|
99
|
-
export const MediaCreateRequestSchema = z.object({
|
|
100
|
-
/** Тип медиа */
|
|
101
|
-
type: MediaType,
|
|
102
|
-
/** URL медиа */
|
|
103
|
-
url: z.string().url(),
|
|
104
|
-
/** Alt-текст */
|
|
105
|
-
alt: z.string().optional(),
|
|
106
|
-
/** Порядок сортировки */
|
|
107
|
-
sortOrder: z.number().int().default(0),
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
export type MediaCreateRequest = z.infer<typeof MediaCreateRequestSchema>;
|
|
111
|
-
|
|
112
|
-
/** Запрос на upsert системных требований */
|
|
113
|
-
export const SystemRequirementsRequestSchema = z.object({
|
|
114
|
-
/** Тип: минимальные / рекомендуемые */
|
|
115
|
-
type: SystemRequirementType,
|
|
116
|
-
/** Операционная система */
|
|
117
|
-
os: z.string().optional(),
|
|
118
|
-
/** Процессор */
|
|
119
|
-
processor: z.string().optional(),
|
|
120
|
-
/** Оперативная память */
|
|
121
|
-
memory: z.string().optional(),
|
|
122
|
-
/** Видеокарта */
|
|
123
|
-
graphics: z.string().optional(),
|
|
124
|
-
/** Место на диске */
|
|
125
|
-
storage: z.string().optional(),
|
|
126
|
-
/** DirectX */
|
|
127
|
-
directx: z.string().optional(),
|
|
128
|
-
/** Сеть */
|
|
129
|
-
network: z.string().optional(),
|
|
130
|
-
/** Дополнительно */
|
|
131
|
-
additional: z.string().optional(),
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
export type SystemRequirementsRequest = z.infer<typeof SystemRequirementsRequestSchema>;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
import { EndpointContract } from "../../types";
|
|
3
|
-
import { ProductFilterSchema } from "./query";
|
|
4
|
-
import { ProductCreateRequestSchema, VariantCreateRequestSchema, KeysImportRequestSchema, KeysImportResponseSchema, MediaCreateRequestSchema, SystemRequirementsRequestSchema } from "./create";
|
|
5
|
-
import { ProductUpdateRequestSchema } from "./update";
|
|
6
|
-
import { ProductCatalogResponseSchema, ProductDetailResponseSchema, CategoryResponseSchema, GenreResponseSchema, RegionResponseSchema, KeysCountResponseSchema } from "./read";
|
|
7
|
-
|
|
8
|
-
export const ProductEndpoints = {
|
|
9
|
-
// === Публичные ===
|
|
10
|
-
catalog: {
|
|
11
|
-
method: "GET",
|
|
12
|
-
path: "/products",
|
|
13
|
-
request: ProductFilterSchema,
|
|
14
|
-
response: z.object({
|
|
15
|
-
items: z.array(ProductCatalogResponseSchema),
|
|
16
|
-
total: z.number(),
|
|
17
|
-
skip: z.number(),
|
|
18
|
-
take: z.number(),
|
|
19
|
-
}),
|
|
20
|
-
},
|
|
21
|
-
categories: {
|
|
22
|
-
method: "GET",
|
|
23
|
-
path: "/products/categories",
|
|
24
|
-
response: z.array(CategoryResponseSchema),
|
|
25
|
-
},
|
|
26
|
-
genres: {
|
|
27
|
-
method: "GET",
|
|
28
|
-
path: "/products/genres",
|
|
29
|
-
response: z.array(GenreResponseSchema),
|
|
30
|
-
},
|
|
31
|
-
regions: {
|
|
32
|
-
method: "GET",
|
|
33
|
-
path: "/products/regions",
|
|
34
|
-
response: z.array(RegionResponseSchema),
|
|
35
|
-
},
|
|
36
|
-
getBySlug: {
|
|
37
|
-
method: "GET",
|
|
38
|
-
path: "/products/:slug",
|
|
39
|
-
request: z.object({ slug: z.string() }),
|
|
40
|
-
response: ProductDetailResponseSchema,
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
// === Администрирование ===
|
|
44
|
-
create: {
|
|
45
|
-
method: "POST",
|
|
46
|
-
path: "/products/admin",
|
|
47
|
-
request: ProductCreateRequestSchema,
|
|
48
|
-
response: ProductDetailResponseSchema,
|
|
49
|
-
},
|
|
50
|
-
update: {
|
|
51
|
-
method: "PUT",
|
|
52
|
-
path: "/products/admin/:id",
|
|
53
|
-
request: ProductUpdateRequestSchema,
|
|
54
|
-
response: ProductDetailResponseSchema,
|
|
55
|
-
},
|
|
56
|
-
archive: {
|
|
57
|
-
method: "DELETE",
|
|
58
|
-
path: "/products/admin/:id",
|
|
59
|
-
response: z.object({ status: z.string() }),
|
|
60
|
-
},
|
|
61
|
-
createVariant: {
|
|
62
|
-
method: "POST",
|
|
63
|
-
path: "/products/admin/:productId/variants",
|
|
64
|
-
request: VariantCreateRequestSchema,
|
|
65
|
-
},
|
|
66
|
-
updateVariant: {
|
|
67
|
-
method: "PUT",
|
|
68
|
-
path: "/products/admin/variants/:variantId",
|
|
69
|
-
request: VariantCreateRequestSchema,
|
|
70
|
-
},
|
|
71
|
-
importKeys: {
|
|
72
|
-
method: "POST",
|
|
73
|
-
path: "/products/admin/variants/:variantId/keys",
|
|
74
|
-
request: KeysImportRequestSchema,
|
|
75
|
-
response: KeysImportResponseSchema,
|
|
76
|
-
},
|
|
77
|
-
getKeysCount: {
|
|
78
|
-
method: "GET",
|
|
79
|
-
path: "/products/admin/variants/:variantId/keys/count",
|
|
80
|
-
response: KeysCountResponseSchema,
|
|
81
|
-
},
|
|
82
|
-
addMedia: {
|
|
83
|
-
method: "POST",
|
|
84
|
-
path: "/products/admin/:productId/media",
|
|
85
|
-
request: MediaCreateRequestSchema,
|
|
86
|
-
},
|
|
87
|
-
removeMedia: {
|
|
88
|
-
method: "DELETE",
|
|
89
|
-
path: "/products/admin/media/:mediaId",
|
|
90
|
-
},
|
|
91
|
-
upsertSystemRequirements: {
|
|
92
|
-
method: "POST",
|
|
93
|
-
path: "/products/admin/:productId/system-requirements",
|
|
94
|
-
request: SystemRequirementsRequestSchema,
|
|
95
|
-
},
|
|
96
|
-
} satisfies Record<string, EndpointContract>;
|
|
97
|
-
|
|
98
|
-
export type ProductEndpointKey = keyof typeof ProductEndpoints;
|
|
99
|
-
|
|
100
|
-
export type GetProductRequest<K extends ProductEndpointKey> =
|
|
101
|
-
typeof ProductEndpoints[K] extends { request: z.ZodTypeAny }
|
|
102
|
-
? z.infer<typeof ProductEndpoints[K]["request"]>
|
|
103
|
-
: never;
|
|
104
|
-
|
|
105
|
-
export type GetProductResponse<K extends ProductEndpointKey> =
|
|
106
|
-
typeof ProductEndpoints[K] extends { response: z.ZodTypeAny }
|
|
107
|
-
? z.infer<typeof ProductEndpoints[K]["response"]>
|
|
108
|
-
: never;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
|
|
3
|
-
/** Тип продукта */
|
|
4
|
-
export const ProductType = z.enum([
|
|
5
|
-
"GAME_KEY",
|
|
6
|
-
"GAME_GIFT",
|
|
7
|
-
"TOPUP",
|
|
8
|
-
"SUBSCRIPTION",
|
|
9
|
-
"IN_GAME_ITEM",
|
|
10
|
-
"DLC",
|
|
11
|
-
"CURRENCY",
|
|
12
|
-
]);
|
|
13
|
-
export type ProductType = z.infer<typeof ProductType>;
|
|
14
|
-
|
|
15
|
-
/** Статус продукта */
|
|
16
|
-
export const ProductStatus = z.enum(["DRAFT", "ACTIVE", "OUT_OF_STOCK", "ARCHIVED"]);
|
|
17
|
-
export type ProductStatus = z.infer<typeof ProductStatus>;
|
|
18
|
-
|
|
19
|
-
/** Тип доставки варианта */
|
|
20
|
-
export const DeliveryType = z.enum(["AUTOMATIC", "MANUAL", "BOT"]);
|
|
21
|
-
export type DeliveryType = z.infer<typeof DeliveryType>;
|
|
22
|
-
|
|
23
|
-
/** Тип медиа-контента */
|
|
24
|
-
export const MediaType = z.enum(["SCREENSHOT", "SLIDER", "VIDEO", "TRAILER"]);
|
|
25
|
-
export type MediaType = z.infer<typeof MediaType>;
|
|
26
|
-
|
|
27
|
-
/** Статус ключа */
|
|
28
|
-
export const KeyStatus = z.enum(["AVAILABLE", "RESERVED", "SOLD"]);
|
|
29
|
-
export type KeyStatus = z.infer<typeof KeyStatus>;
|
|
30
|
-
|
|
31
|
-
/** Тип системных требований */
|
|
32
|
-
export const SystemRequirementType = z.enum(["minimum", "recommended"]);
|
|
33
|
-
export type SystemRequirementType = z.infer<typeof SystemRequirementType>;
|