@gigapay-dev/contracts 1.8.6 → 3.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/domains/admin/index.d.ts +150 -0
- package/build/domains/admin/index.d.ts.map +1 -0
- package/build/domains/admin/index.js +72 -0
- package/build/domains/admin/index.js.map +1 -0
- package/build/domains/auth/commands.d.ts +294 -0
- package/build/domains/auth/commands.d.ts.map +1 -0
- package/build/domains/auth/commands.js +116 -0
- package/build/domains/auth/commands.js.map +1 -0
- package/build/domains/auth/dtos.d.ts +37 -0
- package/build/domains/auth/dtos.d.ts.map +1 -0
- package/build/domains/auth/dtos.js +26 -0
- package/build/domains/auth/dtos.js.map +1 -0
- package/build/domains/auth/events.d.ts +35 -0
- package/build/domains/auth/events.d.ts.map +1 -0
- package/build/domains/auth/events.js +24 -0
- package/build/domains/auth/events.js.map +1 -0
- package/build/domains/auth/index.d.ts +165 -0
- package/build/domains/auth/index.d.ts.map +1 -0
- package/build/{commands/products → domains/auth}/index.js +12 -6
- package/build/domains/auth/index.js.map +1 -0
- package/build/domains/auth/queries.d.ts +75 -0
- package/build/domains/auth/queries.d.ts.map +1 -0
- package/build/domains/auth/queries.js +25 -0
- package/build/domains/auth/queries.js.map +1 -0
- package/build/domains/catalog/commands.d.ts +255 -0
- package/build/domains/catalog/commands.d.ts.map +1 -0
- package/build/domains/catalog/commands.js +82 -0
- package/build/domains/catalog/commands.js.map +1 -0
- package/build/domains/catalog/dtos.d.ts +89 -0
- package/build/domains/catalog/dtos.d.ts.map +1 -0
- package/build/domains/catalog/dtos.js +43 -0
- package/build/domains/catalog/dtos.js.map +1 -0
- package/build/domains/catalog/index.d.ts +194 -0
- package/build/domains/catalog/index.d.ts.map +1 -0
- package/build/{commands/payment-methods → domains/catalog}/index.js +11 -4
- package/build/domains/catalog/index.js.map +1 -0
- package/build/domains/catalog/queries.d.ts +168 -0
- package/build/domains/catalog/queries.d.ts.map +1 -0
- package/build/domains/catalog/queries.js +29 -0
- package/build/domains/catalog/queries.js.map +1 -0
- package/build/domains/config/index.d.ts +40 -0
- package/build/domains/config/index.d.ts.map +1 -0
- package/build/domains/config/index.js +18 -0
- package/build/domains/config/index.js.map +1 -0
- package/build/domains/orders/commands.d.ts +262 -0
- package/build/domains/orders/commands.d.ts.map +1 -0
- package/build/domains/orders/commands.js +47 -0
- package/build/domains/orders/commands.js.map +1 -0
- package/build/domains/orders/dtos.d.ts +112 -0
- package/build/domains/orders/dtos.d.ts.map +1 -0
- package/build/domains/orders/dtos.js +44 -0
- package/build/domains/orders/dtos.js.map +1 -0
- package/build/domains/orders/events.d.ts +21 -0
- package/build/domains/orders/events.d.ts.map +1 -0
- package/build/domains/orders/events.js +19 -0
- package/build/domains/orders/events.js.map +1 -0
- package/build/domains/orders/index.d.ts +381 -0
- package/build/domains/orders/index.d.ts.map +1 -0
- package/build/domains/orders/index.js +28 -0
- package/build/domains/orders/index.js.map +1 -0
- package/build/domains/orders/queries.d.ts +532 -0
- package/build/domains/orders/queries.d.ts.map +1 -0
- package/build/domains/orders/queries.js +40 -0
- package/build/domains/orders/queries.js.map +1 -0
- package/build/domains/payments/index.d.ts +96 -0
- package/build/domains/payments/index.d.ts.map +1 -0
- package/build/domains/payments/index.js +34 -0
- package/build/domains/payments/index.js.map +1 -0
- package/build/domains/products/commands.d.ts +302 -0
- package/build/domains/products/commands.d.ts.map +1 -0
- package/build/domains/products/commands.js +101 -0
- package/build/domains/products/commands.js.map +1 -0
- package/build/domains/products/dtos.d.ts +122 -0
- package/build/domains/products/dtos.d.ts.map +1 -0
- package/build/domains/products/dtos.js +54 -0
- package/build/domains/products/dtos.js.map +1 -0
- package/build/domains/products/index.d.ts +276 -0
- package/build/domains/products/index.d.ts.map +1 -0
- package/build/{commands/auth → domains/products}/index.js +11 -5
- package/build/domains/products/index.js.map +1 -0
- package/build/domains/products/queries.d.ts +334 -0
- package/build/domains/products/queries.d.ts.map +1 -0
- package/build/domains/products/queries.js +41 -0
- package/build/domains/products/queries.js.map +1 -0
- package/build/domains/promo-codes/index.d.ts +92 -0
- package/build/domains/promo-codes/index.d.ts.map +1 -0
- package/build/domains/promo-codes/index.js +40 -0
- package/build/domains/promo-codes/index.js.map +1 -0
- package/build/domains/stats/index.d.ts +274 -0
- package/build/domains/stats/index.d.ts.map +1 -0
- package/build/domains/stats/index.js +76 -0
- package/build/domains/stats/index.js.map +1 -0
- package/build/domains/users/dtos.d.ts +9 -0
- package/build/domains/users/dtos.d.ts.map +1 -0
- package/build/domains/users/dtos.js +11 -0
- package/build/domains/users/dtos.js.map +1 -0
- package/build/domains/users/index.d.ts +101 -0
- package/build/domains/users/index.d.ts.map +1 -0
- package/build/domains/users/index.js +52 -0
- package/build/domains/users/index.js.map +1 -0
- package/build/index.d.ts +1310 -1
- package/build/index.d.ts.map +1 -0
- package/build/index.js +35 -1
- package/build/index.js.map +1 -0
- package/build/shared/api-response.d.ts +17 -0
- package/build/shared/api-response.d.ts.map +1 -0
- package/build/shared/api-response.js +22 -0
- package/build/shared/api-response.js.map +1 -0
- package/build/shared/common.d.ts +14 -0
- package/build/shared/common.d.ts.map +1 -0
- package/build/shared/common.js +8 -0
- package/build/shared/common.js.map +1 -0
- package/build/shared/errors.d.ts +34 -0
- package/build/shared/errors.d.ts.map +1 -0
- package/build/shared/errors.js +36 -0
- package/build/shared/errors.js.map +1 -0
- package/build/shared/index.d.ts +7 -0
- package/build/shared/index.d.ts.map +1 -0
- package/build/{commands/orders → shared}/index.js +7 -6
- package/build/shared/index.js.map +1 -0
- package/build/shared/money.d.ts +32 -0
- package/build/shared/money.d.ts.map +1 -0
- package/build/shared/money.js +20 -0
- package/build/shared/money.js.map +1 -0
- package/build/shared/pagination.d.ts +27 -0
- package/build/shared/pagination.d.ts.map +1 -0
- package/build/shared/pagination.js +22 -0
- package/build/shared/pagination.js.map +1 -0
- package/build/shared/types.d.ts +20 -0
- package/build/shared/types.d.ts.map +1 -0
- package/build/{types.js → shared/types.js} +1 -0
- package/build/shared/types.js.map +1 -0
- package/package.json +41 -15
- package/build/commands/api-response.d.ts +0 -18
- package/build/commands/api-response.js +0 -13
- package/build/commands/auth/confirm.d.ts +0 -11
- package/build/commands/auth/confirm.js +0 -11
- package/build/commands/auth/endpoints.d.ts +0 -114
- package/build/commands/auth/endpoints.js +0 -50
- package/build/commands/auth/index.d.ts +0 -5
- package/build/commands/auth/login.d.ts +0 -20
- package/build/commands/auth/login.js +0 -11
- package/build/commands/auth/profile.d.ts +0 -18
- package/build/commands/auth/profile.js +0 -10
- package/build/commands/auth/register.d.ts +0 -12
- package/build/commands/auth/register.js +0 -11
- package/build/commands/auth/reset.d.ts +0 -12
- package/build/commands/auth/reset.js +0 -9
- package/build/commands/consts.d.ts +0 -1
- package/build/commands/consts.js +0 -4
- package/build/commands/index.d.ts +0 -13
- package/build/commands/index.js +0 -29
- package/build/commands/orders/create.d.ts +0 -95
- package/build/commands/orders/create.js +0 -40
- package/build/commands/orders/endpoints.d.ts +0 -726
- package/build/commands/orders/endpoints.js +0 -47
- package/build/commands/orders/enums.d.ts +0 -7
- package/build/commands/orders/enums.js +0 -25
- package/build/commands/orders/index.d.ts +0 -6
- package/build/commands/orders/query.d.ts +0 -103
- package/build/commands/orders/query.js +0 -45
- package/build/commands/orders/read.d.ts +0 -230
- package/build/commands/orders/read.js +0 -81
- package/build/commands/orders/update.d.ts +0 -23
- package/build/commands/orders/update.js +0 -16
- package/build/commands/pagination.d.ts +0 -12
- package/build/commands/pagination.js +0 -11
- package/build/commands/payment-methods/create.d.ts +0 -45
- package/build/commands/payment-methods/create.js +0 -22
- package/build/commands/payment-methods/endpoints.d.ts +0 -536
- package/build/commands/payment-methods/endpoints.js +0 -63
- package/build/commands/payment-methods/index.d.ts +0 -4
- package/build/commands/payment-methods/read.d.ts +0 -71
- package/build/commands/payment-methods/read.js +0 -28
- package/build/commands/payment-methods/update.d.ts +0 -45
- package/build/commands/payment-methods/update.js +0 -19
- package/build/commands/products/create.d.ts +0 -229
- package/build/commands/products/create.js +0 -122
- package/build/commands/products/endpoints.d.ts +0 -1881
- package/build/commands/products/endpoints.js +0 -99
- package/build/commands/products/enums.d.ts +0 -19
- package/build/commands/products/enums.js +0 -27
- package/build/commands/products/index.d.ts +0 -6
- package/build/commands/products/query.d.ts +0 -79
- package/build/commands/products/query.js +0 -55
- package/build/commands/products/read.d.ts +0 -1178
- package/build/commands/products/read.js +0 -231
- package/build/commands/products/update.d.ts +0 -78
- package/build/commands/products/update.js +0 -10
- package/build/commands/promocode-activations/create.d.ts +0 -18
- package/build/commands/promocode-activations/create.js +0 -10
- package/build/commands/promocode-activations/index.d.ts +0 -3
- package/build/commands/promocode-activations/index.js +0 -19
- package/build/commands/promocode-activations/read.d.ts +0 -21
- package/build/commands/promocode-activations/read.js +0 -14
- package/build/commands/promocode-activations/update.d.ts +0 -18
- package/build/commands/promocode-activations/update.js +0 -10
- package/build/commands/promocodes/create.d.ts +0 -39
- package/build/commands/promocodes/create.js +0 -18
- package/build/commands/promocodes/endpoints.d.ts +0 -353
- package/build/commands/promocodes/endpoints.js +0 -46
- package/build/commands/promocodes/enums.d.ts +0 -5
- package/build/commands/promocodes/enums.js +0 -9
- package/build/commands/promocodes/index.d.ts +0 -5
- package/build/commands/promocodes/index.js +0 -21
- package/build/commands/promocodes/read.d.ts +0 -45
- package/build/commands/promocodes/read.js +0 -23
- package/build/commands/promocodes/update.d.ts +0 -33
- package/build/commands/promocodes/update.js +0 -16
- package/build/commands/refresh-sessions/create.d.ts +0 -24
- package/build/commands/refresh-sessions/create.js +0 -13
- package/build/commands/refresh-sessions/enums.d.ts +0 -3
- package/build/commands/refresh-sessions/enums.js +0 -8
- package/build/commands/refresh-sessions/index.d.ts +0 -4
- package/build/commands/refresh-sessions/index.js +0 -20
- package/build/commands/refresh-sessions/read.d.ts +0 -27
- package/build/commands/refresh-sessions/read.js +0 -17
- package/build/commands/refresh-sessions/update.d.ts +0 -24
- package/build/commands/refresh-sessions/update.js +0 -16
- package/build/commands/settings/endpoints.d.ts +0 -108
- package/build/commands/settings/endpoints.js +0 -43
- package/build/commands/settings/index.d.ts +0 -3
- package/build/commands/settings/index.js +0 -19
- package/build/commands/settings/read.d.ts +0 -18
- package/build/commands/settings/read.js +0 -10
- package/build/commands/settings/update.d.ts +0 -18
- package/build/commands/settings/update.js +0 -10
- package/build/commands/stats/endpoints.d.ts +0 -67
- package/build/commands/stats/endpoints.js +0 -13
- package/build/commands/stats/index.d.ts +0 -3
- package/build/commands/stats/index.js +0 -19
- package/build/commands/stats/query.d.ts +0 -31
- package/build/commands/stats/query.js +0 -15
- package/build/commands/stats/read.d.ts +0 -30
- package/build/commands/stats/read.js +0 -17
- package/build/commands/users/create.d.ts +0 -42
- package/build/commands/users/create.js +0 -19
- package/build/commands/users/endpoints.d.ts +0 -403
- package/build/commands/users/endpoints.js +0 -39
- package/build/commands/users/enums.d.ts +0 -6
- package/build/commands/users/enums.js +0 -10
- package/build/commands/users/index.d.ts +0 -6
- package/build/commands/users/index.js +0 -22
- package/build/commands/users/query.d.ts +0 -52
- package/build/commands/users/query.js +0 -21
- package/build/commands/users/read.d.ts +0 -60
- package/build/commands/users/read.js +0 -28
- package/build/commands/users/update.d.ts +0 -42
- package/build/commands/users/update.js +0 -19
- package/build/types.d.ts +0 -8
- 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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductQueries = exports.GetVariantStockEndpoint = exports.GetProductBySlugEndpoint = exports.GetProductBySlugQuerySchema = exports.ListProductsEndpoint = exports.ListProductsQuerySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("../../shared/common");
|
|
6
|
+
const pagination_1 = require("../../shared/pagination");
|
|
7
|
+
const money_1 = require("../../shared/money");
|
|
8
|
+
const dtos_1 = require("./dtos");
|
|
9
|
+
exports.ListProductsQuerySchema = pagination_1.PaginationQuerySchema.extend({
|
|
10
|
+
showcaseId: zod_1.z.coerce.number().int().positive().optional(),
|
|
11
|
+
subShowcaseId: zod_1.z.coerce.number().int().positive().optional(),
|
|
12
|
+
categoryId: zod_1.z.coerce.number().int().positive().optional(),
|
|
13
|
+
search: zod_1.z.string().max(64).optional(),
|
|
14
|
+
currency: money_1.CurrencySchema.default("RUB"),
|
|
15
|
+
});
|
|
16
|
+
exports.ListProductsEndpoint = {
|
|
17
|
+
method: "GET",
|
|
18
|
+
path: "/api/products",
|
|
19
|
+
query: exports.ListProductsQuerySchema,
|
|
20
|
+
response: (0, pagination_1.PaginatedResponseSchema)(dtos_1.ProductSchema),
|
|
21
|
+
};
|
|
22
|
+
exports.GetProductBySlugQuerySchema = zod_1.z.object({ currency: money_1.CurrencySchema.default("RUB") });
|
|
23
|
+
exports.GetProductBySlugEndpoint = {
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: "/api/products/:slug",
|
|
26
|
+
params: common_1.SlugParamSchema,
|
|
27
|
+
query: exports.GetProductBySlugQuerySchema,
|
|
28
|
+
response: dtos_1.ProductSchema,
|
|
29
|
+
};
|
|
30
|
+
exports.GetVariantStockEndpoint = {
|
|
31
|
+
method: "GET",
|
|
32
|
+
path: "/api/products/variant/:id/stock",
|
|
33
|
+
params: common_1.IdParamSchema,
|
|
34
|
+
response: dtos_1.VariantStockSchema,
|
|
35
|
+
};
|
|
36
|
+
exports.ProductQueries = {
|
|
37
|
+
list: exports.ListProductsEndpoint,
|
|
38
|
+
getBySlug: exports.GetProductBySlugEndpoint,
|
|
39
|
+
getVariantStock: exports.GetVariantStockEndpoint,
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/domains/products/queries.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,gDAAqE;AACrE,wDAAyF;AACzF,8CAAoD;AACpD,iCAA2D;AAE9C,QAAA,uBAAuB,GAAG,kCAAqB,CAAC,MAAM,CAAC;IACnE,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACzD,aAAa,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5D,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACzD,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrC,QAAQ,EAAE,sBAAc,CAAC,OAAO,CAAC,KAAK,CAAC;CACvC,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG;IACnC,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,+BAAuB;IAC9B,QAAQ,EAAE,IAAA,oCAAuB,EAAC,oBAAa,CAAC;CACZ,CAAC;AAEzB,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,sBAAc,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACpF,QAAA,wBAAwB,GAAG;IACvC,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,qBAAqB;IAC3B,MAAM,EAAE,wBAAe;IACvB,KAAK,EAAE,mCAA2B;IAClC,QAAQ,EAAE,oBAAa;CACa,CAAC;AAEzB,QAAA,uBAAuB,GAAG;IACtC,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,iCAAiC;IACvC,MAAM,EAAE,sBAAa;IACrB,QAAQ,EAAE,yBAAkB;CACQ,CAAC;AAEzB,QAAA,cAAc,GAAG;IAC7B,IAAI,EAAE,4BAAoB;IAC1B,SAAS,EAAE,gCAAwB;IACnC,eAAe,EAAE,+BAAuB;CAC/B,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PromoCodeTypeSchema: z.ZodEnum<{
|
|
3
|
+
USER: "USER";
|
|
4
|
+
AD: "AD";
|
|
5
|
+
SYSTEM: "SYSTEM";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const PromoCodeStatusSchema: z.ZodEnum<{
|
|
8
|
+
ACTIVE: "ACTIVE";
|
|
9
|
+
INACTIVE: "INACTIVE";
|
|
10
|
+
LIMITED: "LIMITED";
|
|
11
|
+
EXPIRED: "EXPIRED";
|
|
12
|
+
DELETED: "DELETED";
|
|
13
|
+
}>;
|
|
14
|
+
export declare const PromoDiscountTypeSchema: z.ZodEnum<{
|
|
15
|
+
PERCENT: "PERCENT";
|
|
16
|
+
FIXED_USD: "FIXED_USD";
|
|
17
|
+
}>;
|
|
18
|
+
export declare const PromoCodeRecordSchema: z.ZodObject<{
|
|
19
|
+
id: z.ZodNumber;
|
|
20
|
+
value: z.ZodString;
|
|
21
|
+
type: z.ZodEnum<{
|
|
22
|
+
USER: "USER";
|
|
23
|
+
AD: "AD";
|
|
24
|
+
SYSTEM: "SYSTEM";
|
|
25
|
+
}>;
|
|
26
|
+
status: z.ZodEnum<{
|
|
27
|
+
ACTIVE: "ACTIVE";
|
|
28
|
+
INACTIVE: "INACTIVE";
|
|
29
|
+
LIMITED: "LIMITED";
|
|
30
|
+
EXPIRED: "EXPIRED";
|
|
31
|
+
DELETED: "DELETED";
|
|
32
|
+
}>;
|
|
33
|
+
discountType: z.ZodEnum<{
|
|
34
|
+
PERCENT: "PERCENT";
|
|
35
|
+
FIXED_USD: "FIXED_USD";
|
|
36
|
+
}>;
|
|
37
|
+
discountValue: z.ZodString;
|
|
38
|
+
budgetUsd: z.ZodNullable<z.ZodString>;
|
|
39
|
+
spentUsd: z.ZodString;
|
|
40
|
+
activationLimit: z.ZodNullable<z.ZodNumber>;
|
|
41
|
+
activationPerUserLimit: z.ZodNullable<z.ZodNumber>;
|
|
42
|
+
startedAt: z.ZodNullable<z.ZodString>;
|
|
43
|
+
expiredAt: z.ZodNullable<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export type PromoCodeRecord = z.infer<typeof PromoCodeRecordSchema>;
|
|
46
|
+
export declare const ValidatePromoQuerySchema: z.ZodObject<{
|
|
47
|
+
value: z.ZodString;
|
|
48
|
+
subtotalUsd: z.ZodString;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export declare const ValidatePromoResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
51
|
+
ok: z.ZodLiteral<true>;
|
|
52
|
+
promoId: z.ZodNumber;
|
|
53
|
+
discountUsd: z.ZodString;
|
|
54
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
55
|
+
ok: z.ZodLiteral<false>;
|
|
56
|
+
reason: z.ZodString;
|
|
57
|
+
}, z.core.$strip>], "ok">;
|
|
58
|
+
export declare const ValidatePromoEndpoint: {
|
|
59
|
+
readonly method: "GET";
|
|
60
|
+
readonly path: "/api/promo-codes/validate";
|
|
61
|
+
readonly query: z.ZodObject<{
|
|
62
|
+
value: z.ZodString;
|
|
63
|
+
subtotalUsd: z.ZodString;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
readonly response: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
66
|
+
ok: z.ZodLiteral<true>;
|
|
67
|
+
promoId: z.ZodNumber;
|
|
68
|
+
discountUsd: z.ZodString;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
ok: z.ZodLiteral<false>;
|
|
71
|
+
reason: z.ZodString;
|
|
72
|
+
}, z.core.$strip>], "ok">;
|
|
73
|
+
};
|
|
74
|
+
export declare const PromoCodeEndpoints: {
|
|
75
|
+
readonly validate: {
|
|
76
|
+
readonly method: "GET";
|
|
77
|
+
readonly path: "/api/promo-codes/validate";
|
|
78
|
+
readonly query: z.ZodObject<{
|
|
79
|
+
value: z.ZodString;
|
|
80
|
+
subtotalUsd: z.ZodString;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
readonly response: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
83
|
+
ok: z.ZodLiteral<true>;
|
|
84
|
+
promoId: z.ZodNumber;
|
|
85
|
+
discountUsd: z.ZodString;
|
|
86
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
87
|
+
ok: z.ZodLiteral<false>;
|
|
88
|
+
reason: z.ZodString;
|
|
89
|
+
}, z.core.$strip>], "ok">;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domains/promo-codes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,mBAAmB;;;;EAAmC,CAAC;AACpE,eAAO,MAAM,qBAAqB;;;;;;EAAkE,CAAC;AACrG,eAAO,MAAM,uBAAuB;;;EAAmC,CAAC;AAExE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAahC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,wBAAwB;;;iBAGnC,CAAC;AACH,eAAO,MAAM,2BAA2B;;;;;;;yBAGtC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;CAKG,CAAC;AAEtC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;CAErB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PromoCodeEndpoints = exports.ValidatePromoEndpoint = exports.ValidatePromoResponseSchema = exports.ValidatePromoQuerySchema = exports.PromoCodeRecordSchema = exports.PromoDiscountTypeSchema = exports.PromoCodeStatusSchema = exports.PromoCodeTypeSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const money_1 = require("../../shared/money");
|
|
6
|
+
exports.PromoCodeTypeSchema = zod_1.z.enum(["USER", "AD", "SYSTEM"]);
|
|
7
|
+
exports.PromoCodeStatusSchema = zod_1.z.enum(["ACTIVE", "INACTIVE", "LIMITED", "EXPIRED", "DELETED"]);
|
|
8
|
+
exports.PromoDiscountTypeSchema = zod_1.z.enum(["PERCENT", "FIXED_USD"]);
|
|
9
|
+
exports.PromoCodeRecordSchema = zod_1.z.object({
|
|
10
|
+
id: zod_1.z.number().int().positive(),
|
|
11
|
+
value: zod_1.z.string(),
|
|
12
|
+
type: exports.PromoCodeTypeSchema,
|
|
13
|
+
status: exports.PromoCodeStatusSchema,
|
|
14
|
+
discountType: exports.PromoDiscountTypeSchema,
|
|
15
|
+
discountValue: money_1.MoneyAmountSchema,
|
|
16
|
+
budgetUsd: money_1.MoneyAmountSchema.nullable(),
|
|
17
|
+
spentUsd: money_1.MoneyAmountSchema,
|
|
18
|
+
activationLimit: zod_1.z.number().int().positive().nullable(),
|
|
19
|
+
activationPerUserLimit: zod_1.z.number().int().positive().nullable(),
|
|
20
|
+
startedAt: zod_1.z.string().nullable(),
|
|
21
|
+
expiredAt: zod_1.z.string().nullable(),
|
|
22
|
+
});
|
|
23
|
+
exports.ValidatePromoQuerySchema = zod_1.z.object({
|
|
24
|
+
value: zod_1.z.string().min(1).max(32),
|
|
25
|
+
subtotalUsd: money_1.MoneyAmountSchema,
|
|
26
|
+
});
|
|
27
|
+
exports.ValidatePromoResponseSchema = zod_1.z.discriminatedUnion("ok", [
|
|
28
|
+
zod_1.z.object({ ok: zod_1.z.literal(true), promoId: zod_1.z.number().int().positive(), discountUsd: money_1.MoneyAmountSchema }),
|
|
29
|
+
zod_1.z.object({ ok: zod_1.z.literal(false), reason: zod_1.z.string() }),
|
|
30
|
+
]);
|
|
31
|
+
exports.ValidatePromoEndpoint = {
|
|
32
|
+
method: "GET",
|
|
33
|
+
path: "/api/promo-codes/validate",
|
|
34
|
+
query: exports.ValidatePromoQuerySchema,
|
|
35
|
+
response: exports.ValidatePromoResponseSchema,
|
|
36
|
+
};
|
|
37
|
+
exports.PromoCodeEndpoints = {
|
|
38
|
+
validate: exports.ValidatePromoEndpoint,
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domains/promo-codes/index.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,8CAAuD;AAE1C,QAAA,mBAAmB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AACvD,QAAA,qBAAqB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AACxF,QAAA,uBAAuB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;AAE3D,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,2BAAmB;IACzB,MAAM,EAAE,6BAAqB;IAC7B,YAAY,EAAE,+BAAuB;IACrC,aAAa,EAAE,yBAAiB;IAChC,SAAS,EAAE,yBAAiB,CAAC,QAAQ,EAAE;IACvC,QAAQ,EAAE,yBAAiB;IAC3B,eAAe,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACvD,sBAAsB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC9D,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAGU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IAChC,WAAW,EAAE,yBAAiB;CAC9B,CAAC,CAAC;AACU,QAAA,2BAA2B,GAAG,OAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE;IACrE,OAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,OAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,yBAAiB,EAAE,CAAC;IACvG,OAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC;CACtD,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG;IACpC,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,2BAA2B;IACjC,KAAK,EAAE,gCAAwB;IAC/B,QAAQ,EAAE,mCAA2B;CACD,CAAC;AAEzB,QAAA,kBAAkB,GAAG;IACjC,QAAQ,EAAE,6BAAqB;CACtB,CAAC"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const StatsPeriodSchema: z.ZodEnum<{
|
|
3
|
+
custom: "custom";
|
|
4
|
+
day: "day";
|
|
5
|
+
week: "week";
|
|
6
|
+
month: "month";
|
|
7
|
+
year: "year";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const StatsQuerySchema: z.ZodObject<{
|
|
10
|
+
period: z.ZodOptional<z.ZodEnum<{
|
|
11
|
+
custom: "custom";
|
|
12
|
+
day: "day";
|
|
13
|
+
week: "week";
|
|
14
|
+
month: "month";
|
|
15
|
+
year: "year";
|
|
16
|
+
}>>;
|
|
17
|
+
start: z.ZodOptional<z.ZodString>;
|
|
18
|
+
end: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const StatsOverviewResponseSchema: z.ZodObject<{
|
|
21
|
+
period: z.ZodObject<{
|
|
22
|
+
start: z.ZodString;
|
|
23
|
+
end: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
usersCount: z.ZodNumber;
|
|
26
|
+
ordersCount: z.ZodNumber;
|
|
27
|
+
gmv: z.ZodObject<{
|
|
28
|
+
usd: z.ZodString;
|
|
29
|
+
rub: z.ZodString;
|
|
30
|
+
uah: z.ZodString;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
totalRevenue: z.ZodObject<{
|
|
33
|
+
usd: z.ZodString;
|
|
34
|
+
rub: z.ZodString;
|
|
35
|
+
uah: z.ZodString;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
acquiringFee: z.ZodObject<{
|
|
38
|
+
usd: z.ZodString;
|
|
39
|
+
rub: z.ZodString;
|
|
40
|
+
uah: z.ZodString;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
serviceFee: z.ZodObject<{
|
|
43
|
+
usd: z.ZodString;
|
|
44
|
+
rub: z.ZodString;
|
|
45
|
+
uah: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
discountsGranted: z.ZodObject<{
|
|
48
|
+
usd: z.ZodString;
|
|
49
|
+
rub: z.ZodString;
|
|
50
|
+
uah: z.ZodString;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
aov: z.ZodString;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type StatsOverviewResponse = z.infer<typeof StatsOverviewResponseSchema>;
|
|
55
|
+
export declare const StatsSalesRowSchema: z.ZodObject<{
|
|
56
|
+
day: z.ZodString;
|
|
57
|
+
orders: z.ZodNumber;
|
|
58
|
+
revenueUsd: z.ZodString;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export declare const StatsPromoResponseSchema: z.ZodNullable<z.ZodObject<{
|
|
61
|
+
promoId: z.ZodNumber;
|
|
62
|
+
value: z.ZodString;
|
|
63
|
+
status: z.ZodString;
|
|
64
|
+
budgetUsd: z.ZodNullable<z.ZodString>;
|
|
65
|
+
spentUsd: z.ZodString;
|
|
66
|
+
activations: z.ZodNumber;
|
|
67
|
+
ordersSucceeded: z.ZodNumber;
|
|
68
|
+
discountUsd: z.ZodString;
|
|
69
|
+
adSpendUsd: z.ZodString;
|
|
70
|
+
revenueUsd: z.ZodString;
|
|
71
|
+
netRevenueUsd: z.ZodString;
|
|
72
|
+
roas: z.ZodNullable<z.ZodString>;
|
|
73
|
+
roi: z.ZodNullable<z.ZodString>;
|
|
74
|
+
cac: z.ZodNullable<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
export declare const GetStatsOverviewEndpoint: {
|
|
77
|
+
readonly method: "GET";
|
|
78
|
+
readonly path: "/api/admin/stats/overview";
|
|
79
|
+
readonly query: z.ZodObject<{
|
|
80
|
+
period: z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
custom: "custom";
|
|
82
|
+
day: "day";
|
|
83
|
+
week: "week";
|
|
84
|
+
month: "month";
|
|
85
|
+
year: "year";
|
|
86
|
+
}>>;
|
|
87
|
+
start: z.ZodOptional<z.ZodString>;
|
|
88
|
+
end: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
readonly response: z.ZodObject<{
|
|
91
|
+
period: z.ZodObject<{
|
|
92
|
+
start: z.ZodString;
|
|
93
|
+
end: z.ZodString;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
usersCount: z.ZodNumber;
|
|
96
|
+
ordersCount: z.ZodNumber;
|
|
97
|
+
gmv: z.ZodObject<{
|
|
98
|
+
usd: z.ZodString;
|
|
99
|
+
rub: z.ZodString;
|
|
100
|
+
uah: z.ZodString;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
totalRevenue: z.ZodObject<{
|
|
103
|
+
usd: z.ZodString;
|
|
104
|
+
rub: z.ZodString;
|
|
105
|
+
uah: z.ZodString;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
acquiringFee: z.ZodObject<{
|
|
108
|
+
usd: z.ZodString;
|
|
109
|
+
rub: z.ZodString;
|
|
110
|
+
uah: z.ZodString;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
serviceFee: z.ZodObject<{
|
|
113
|
+
usd: z.ZodString;
|
|
114
|
+
rub: z.ZodString;
|
|
115
|
+
uah: z.ZodString;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
discountsGranted: z.ZodObject<{
|
|
118
|
+
usd: z.ZodString;
|
|
119
|
+
rub: z.ZodString;
|
|
120
|
+
uah: z.ZodString;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
aov: z.ZodString;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
readonly requiresAuth: true;
|
|
125
|
+
readonly requiresAdmin: true;
|
|
126
|
+
};
|
|
127
|
+
export declare const GetStatsSalesEndpoint: {
|
|
128
|
+
readonly method: "GET";
|
|
129
|
+
readonly path: "/api/admin/stats/sales";
|
|
130
|
+
readonly query: z.ZodObject<{
|
|
131
|
+
period: z.ZodOptional<z.ZodEnum<{
|
|
132
|
+
custom: "custom";
|
|
133
|
+
day: "day";
|
|
134
|
+
week: "week";
|
|
135
|
+
month: "month";
|
|
136
|
+
year: "year";
|
|
137
|
+
}>>;
|
|
138
|
+
start: z.ZodOptional<z.ZodString>;
|
|
139
|
+
end: z.ZodOptional<z.ZodString>;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
readonly response: z.ZodArray<z.ZodObject<{
|
|
142
|
+
day: z.ZodString;
|
|
143
|
+
orders: z.ZodNumber;
|
|
144
|
+
revenueUsd: z.ZodString;
|
|
145
|
+
}, z.core.$strip>>;
|
|
146
|
+
readonly requiresAuth: true;
|
|
147
|
+
readonly requiresAdmin: true;
|
|
148
|
+
};
|
|
149
|
+
export declare const GetStatsPromoEndpoint: {
|
|
150
|
+
readonly method: "GET";
|
|
151
|
+
readonly path: "/api/admin/stats/promo-codes/:id";
|
|
152
|
+
readonly params: z.ZodObject<{
|
|
153
|
+
id: z.ZodCoercedNumber<unknown>;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
readonly response: z.ZodNullable<z.ZodObject<{
|
|
156
|
+
promoId: z.ZodNumber;
|
|
157
|
+
value: z.ZodString;
|
|
158
|
+
status: z.ZodString;
|
|
159
|
+
budgetUsd: z.ZodNullable<z.ZodString>;
|
|
160
|
+
spentUsd: z.ZodString;
|
|
161
|
+
activations: z.ZodNumber;
|
|
162
|
+
ordersSucceeded: z.ZodNumber;
|
|
163
|
+
discountUsd: z.ZodString;
|
|
164
|
+
adSpendUsd: z.ZodString;
|
|
165
|
+
revenueUsd: z.ZodString;
|
|
166
|
+
netRevenueUsd: z.ZodString;
|
|
167
|
+
roas: z.ZodNullable<z.ZodString>;
|
|
168
|
+
roi: z.ZodNullable<z.ZodString>;
|
|
169
|
+
cac: z.ZodNullable<z.ZodString>;
|
|
170
|
+
}, z.core.$strip>>;
|
|
171
|
+
readonly requiresAuth: true;
|
|
172
|
+
readonly requiresAdmin: true;
|
|
173
|
+
};
|
|
174
|
+
export declare const StatsEndpoints: {
|
|
175
|
+
readonly overview: {
|
|
176
|
+
readonly method: "GET";
|
|
177
|
+
readonly path: "/api/admin/stats/overview";
|
|
178
|
+
readonly query: z.ZodObject<{
|
|
179
|
+
period: z.ZodOptional<z.ZodEnum<{
|
|
180
|
+
custom: "custom";
|
|
181
|
+
day: "day";
|
|
182
|
+
week: "week";
|
|
183
|
+
month: "month";
|
|
184
|
+
year: "year";
|
|
185
|
+
}>>;
|
|
186
|
+
start: z.ZodOptional<z.ZodString>;
|
|
187
|
+
end: z.ZodOptional<z.ZodString>;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
readonly response: z.ZodObject<{
|
|
190
|
+
period: z.ZodObject<{
|
|
191
|
+
start: z.ZodString;
|
|
192
|
+
end: z.ZodString;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
usersCount: z.ZodNumber;
|
|
195
|
+
ordersCount: z.ZodNumber;
|
|
196
|
+
gmv: z.ZodObject<{
|
|
197
|
+
usd: z.ZodString;
|
|
198
|
+
rub: z.ZodString;
|
|
199
|
+
uah: z.ZodString;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
totalRevenue: z.ZodObject<{
|
|
202
|
+
usd: z.ZodString;
|
|
203
|
+
rub: z.ZodString;
|
|
204
|
+
uah: z.ZodString;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
acquiringFee: z.ZodObject<{
|
|
207
|
+
usd: z.ZodString;
|
|
208
|
+
rub: z.ZodString;
|
|
209
|
+
uah: z.ZodString;
|
|
210
|
+
}, z.core.$strip>;
|
|
211
|
+
serviceFee: z.ZodObject<{
|
|
212
|
+
usd: z.ZodString;
|
|
213
|
+
rub: z.ZodString;
|
|
214
|
+
uah: z.ZodString;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
discountsGranted: z.ZodObject<{
|
|
217
|
+
usd: z.ZodString;
|
|
218
|
+
rub: z.ZodString;
|
|
219
|
+
uah: z.ZodString;
|
|
220
|
+
}, z.core.$strip>;
|
|
221
|
+
aov: z.ZodString;
|
|
222
|
+
}, z.core.$strip>;
|
|
223
|
+
readonly requiresAuth: true;
|
|
224
|
+
readonly requiresAdmin: true;
|
|
225
|
+
};
|
|
226
|
+
readonly sales: {
|
|
227
|
+
readonly method: "GET";
|
|
228
|
+
readonly path: "/api/admin/stats/sales";
|
|
229
|
+
readonly query: z.ZodObject<{
|
|
230
|
+
period: z.ZodOptional<z.ZodEnum<{
|
|
231
|
+
custom: "custom";
|
|
232
|
+
day: "day";
|
|
233
|
+
week: "week";
|
|
234
|
+
month: "month";
|
|
235
|
+
year: "year";
|
|
236
|
+
}>>;
|
|
237
|
+
start: z.ZodOptional<z.ZodString>;
|
|
238
|
+
end: z.ZodOptional<z.ZodString>;
|
|
239
|
+
}, z.core.$strip>;
|
|
240
|
+
readonly response: z.ZodArray<z.ZodObject<{
|
|
241
|
+
day: z.ZodString;
|
|
242
|
+
orders: z.ZodNumber;
|
|
243
|
+
revenueUsd: z.ZodString;
|
|
244
|
+
}, z.core.$strip>>;
|
|
245
|
+
readonly requiresAuth: true;
|
|
246
|
+
readonly requiresAdmin: true;
|
|
247
|
+
};
|
|
248
|
+
readonly promoCard: {
|
|
249
|
+
readonly method: "GET";
|
|
250
|
+
readonly path: "/api/admin/stats/promo-codes/:id";
|
|
251
|
+
readonly params: z.ZodObject<{
|
|
252
|
+
id: z.ZodCoercedNumber<unknown>;
|
|
253
|
+
}, z.core.$strip>;
|
|
254
|
+
readonly response: z.ZodNullable<z.ZodObject<{
|
|
255
|
+
promoId: z.ZodNumber;
|
|
256
|
+
value: z.ZodString;
|
|
257
|
+
status: z.ZodString;
|
|
258
|
+
budgetUsd: z.ZodNullable<z.ZodString>;
|
|
259
|
+
spentUsd: z.ZodString;
|
|
260
|
+
activations: z.ZodNumber;
|
|
261
|
+
ordersSucceeded: z.ZodNumber;
|
|
262
|
+
discountUsd: z.ZodString;
|
|
263
|
+
adSpendUsd: z.ZodString;
|
|
264
|
+
revenueUsd: z.ZodString;
|
|
265
|
+
netRevenueUsd: z.ZodString;
|
|
266
|
+
roas: z.ZodNullable<z.ZodString>;
|
|
267
|
+
roi: z.ZodNullable<z.ZodString>;
|
|
268
|
+
cac: z.ZodNullable<z.ZodString>;
|
|
269
|
+
}, z.core.$strip>>;
|
|
270
|
+
readonly requiresAuth: true;
|
|
271
|
+
readonly requiresAdmin: true;
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domains/stats/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,iBAAiB;;;;;;EAAqD,CAAC;AACpF,eAAO,MAAM,gBAAgB;;;;;;;;;;iBAI3B,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;kBAiBzB,CAAC;AAEb,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOA,CAAC;AAEtC,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;CAOG,CAAC;AAEtC,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;CAOG,CAAC;AAEtC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIjB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatsEndpoints = exports.GetStatsPromoEndpoint = exports.GetStatsSalesEndpoint = exports.GetStatsOverviewEndpoint = exports.StatsPromoResponseSchema = exports.StatsSalesRowSchema = exports.StatsOverviewResponseSchema = exports.StatsQuerySchema = exports.StatsPeriodSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("../../shared/common");
|
|
6
|
+
const money_1 = require("../../shared/money");
|
|
7
|
+
exports.StatsPeriodSchema = zod_1.z.enum(["day", "week", "month", "year", "custom"]);
|
|
8
|
+
exports.StatsQuerySchema = zod_1.z.object({
|
|
9
|
+
period: exports.StatsPeriodSchema.optional(),
|
|
10
|
+
start: zod_1.z.string().optional(),
|
|
11
|
+
end: zod_1.z.string().optional(),
|
|
12
|
+
});
|
|
13
|
+
exports.StatsOverviewResponseSchema = zod_1.z.object({
|
|
14
|
+
period: zod_1.z.object({ start: zod_1.z.string(), end: zod_1.z.string() }),
|
|
15
|
+
usersCount: zod_1.z.number().int().nonnegative(),
|
|
16
|
+
ordersCount: zod_1.z.number().int().nonnegative(),
|
|
17
|
+
gmv: money_1.MoneyTripletSchema,
|
|
18
|
+
totalRevenue: money_1.MoneyTripletSchema,
|
|
19
|
+
acquiringFee: money_1.MoneyTripletSchema,
|
|
20
|
+
serviceFee: money_1.MoneyTripletSchema,
|
|
21
|
+
discountsGranted: money_1.MoneyTripletSchema,
|
|
22
|
+
aov: money_1.MoneyAmountSchema,
|
|
23
|
+
});
|
|
24
|
+
exports.StatsSalesRowSchema = zod_1.z.object({
|
|
25
|
+
day: zod_1.z.string(),
|
|
26
|
+
orders: zod_1.z.number().int().nonnegative(),
|
|
27
|
+
revenueUsd: money_1.MoneyAmountSchema,
|
|
28
|
+
});
|
|
29
|
+
exports.StatsPromoResponseSchema = zod_1.z
|
|
30
|
+
.object({
|
|
31
|
+
promoId: zod_1.z.number().int().positive(),
|
|
32
|
+
value: zod_1.z.string(),
|
|
33
|
+
status: zod_1.z.string(),
|
|
34
|
+
budgetUsd: money_1.MoneyAmountSchema.nullable(),
|
|
35
|
+
spentUsd: money_1.MoneyAmountSchema,
|
|
36
|
+
activations: zod_1.z.number().int().nonnegative(),
|
|
37
|
+
ordersSucceeded: zod_1.z.number().int().nonnegative(),
|
|
38
|
+
discountUsd: money_1.MoneyAmountSchema,
|
|
39
|
+
adSpendUsd: money_1.MoneyAmountSchema,
|
|
40
|
+
revenueUsd: money_1.MoneyAmountSchema,
|
|
41
|
+
netRevenueUsd: money_1.MoneyAmountSchema,
|
|
42
|
+
roas: zod_1.z.string().nullable(),
|
|
43
|
+
roi: zod_1.z.string().nullable(),
|
|
44
|
+
cac: zod_1.z.string().nullable(),
|
|
45
|
+
})
|
|
46
|
+
.nullable();
|
|
47
|
+
exports.GetStatsOverviewEndpoint = {
|
|
48
|
+
method: "GET",
|
|
49
|
+
path: "/api/admin/stats/overview",
|
|
50
|
+
query: exports.StatsQuerySchema,
|
|
51
|
+
response: exports.StatsOverviewResponseSchema,
|
|
52
|
+
requiresAuth: true,
|
|
53
|
+
requiresAdmin: true,
|
|
54
|
+
};
|
|
55
|
+
exports.GetStatsSalesEndpoint = {
|
|
56
|
+
method: "GET",
|
|
57
|
+
path: "/api/admin/stats/sales",
|
|
58
|
+
query: exports.StatsQuerySchema,
|
|
59
|
+
response: zod_1.z.array(exports.StatsSalesRowSchema),
|
|
60
|
+
requiresAuth: true,
|
|
61
|
+
requiresAdmin: true,
|
|
62
|
+
};
|
|
63
|
+
exports.GetStatsPromoEndpoint = {
|
|
64
|
+
method: "GET",
|
|
65
|
+
path: "/api/admin/stats/promo-codes/:id",
|
|
66
|
+
params: common_1.IdParamSchema,
|
|
67
|
+
response: exports.StatsPromoResponseSchema,
|
|
68
|
+
requiresAuth: true,
|
|
69
|
+
requiresAdmin: true,
|
|
70
|
+
};
|
|
71
|
+
exports.StatsEndpoints = {
|
|
72
|
+
overview: exports.GetStatsOverviewEndpoint,
|
|
73
|
+
sales: exports.GetStatsSalesEndpoint,
|
|
74
|
+
promoCard: exports.GetStatsPromoEndpoint,
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domains/stats/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const UserSummarySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodNumber;
|
|
4
|
+
email: z.ZodString;
|
|
5
|
+
username: z.ZodNullable<z.ZodString>;
|
|
6
|
+
createdAt: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type UserSummary = z.infer<typeof UserSummarySchema>;
|
|
9
|
+
//# sourceMappingURL=dtos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dtos.d.ts","sourceRoot":"","sources":["../../../src/domains/users/dtos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iBAAiB;;;;;iBAK5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserSummarySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.UserSummarySchema = zod_1.z.object({
|
|
6
|
+
id: zod_1.z.number().int().positive(),
|
|
7
|
+
email: zod_1.z.string().email(),
|
|
8
|
+
username: zod_1.z.string().nullable(),
|
|
9
|
+
createdAt: zod_1.z.string(),
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=dtos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dtos.js","sourceRoot":"","sources":["../../../src/domains/users/dtos.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IACzB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC"}
|