@floristcloud/api-lib 1.2.64 → 1.2.66
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/build/commands/report/export-sales-revenue.query.js +4 -7
- package/build/commands/report/get-sales-summary.query.js +54 -0
- package/build/commands/report/index.js +1 -0
- package/commands/report/export-sales-revenue.query.ts +4 -9
- package/commands/report/get-sales-summary.query.ts +61 -0
- package/commands/report/index.ts +1 -0
- package/package.json +1 -1
|
@@ -21,13 +21,10 @@ const ExportSalesRevenueRequestSchema = zod_1.z
|
|
|
21
21
|
path: ['endDate', 'startDate'],
|
|
22
22
|
});
|
|
23
23
|
const ExportSalesRevenueResponseSchema = zod_1.z.object({
|
|
24
|
-
data: zod_1.z.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
units: zod_1.z.number(),
|
|
29
|
-
avgCheck: zod_1.z.number(),
|
|
30
|
-
})),
|
|
24
|
+
data: zod_1.z.object({
|
|
25
|
+
fileUrl: zod_1.z.string(),
|
|
26
|
+
fileKey: zod_1.z.string(),
|
|
27
|
+
}),
|
|
31
28
|
});
|
|
32
29
|
var ExportSalesRevenueContractQuery;
|
|
33
30
|
(function (ExportSalesRevenueContractQuery) {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetSalesSummaryContractQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const date_helper_1 = require("../../helpers/date.helper");
|
|
6
|
+
const report_period_type_enum_1 = require("../../enum/report-period-type.enum");
|
|
7
|
+
const GetSalesSummaryRequestSchema = zod_1.z
|
|
8
|
+
.object({
|
|
9
|
+
startDate: zod_1.z.coerce.date().optional(),
|
|
10
|
+
endDate: zod_1.z.coerce.date().optional(),
|
|
11
|
+
periodType: zod_1.z.nativeEnum(report_period_type_enum_1.ReportPeriodTypeEnum).default(report_period_type_enum_1.ReportPeriodTypeEnum.DAY),
|
|
12
|
+
})
|
|
13
|
+
.refine(value => {
|
|
14
|
+
const { startDate, endDate } = value;
|
|
15
|
+
if (startDate && endDate) {
|
|
16
|
+
return (0, date_helper_1.dateRangeCheck)(startDate, endDate);
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}, {
|
|
20
|
+
message: 'End date must be greater than start date',
|
|
21
|
+
path: ['endDate', 'startDate'],
|
|
22
|
+
});
|
|
23
|
+
const SalesSummaryTotalsSchema = zod_1.z.object({
|
|
24
|
+
totalRevenue: zod_1.z.number(),
|
|
25
|
+
totalRevenueWithDelivery: zod_1.z.number(),
|
|
26
|
+
totalOrders: zod_1.z.number(),
|
|
27
|
+
uniqueClients: zod_1.z.number(),
|
|
28
|
+
soldUnits: zod_1.z.number(),
|
|
29
|
+
avgCheck: zod_1.z.number(),
|
|
30
|
+
totalVatAmount: zod_1.z.number(),
|
|
31
|
+
totalCost: zod_1.z.number(),
|
|
32
|
+
totalDeliveryCost: zod_1.z.number(),
|
|
33
|
+
totalDiscountAmount: zod_1.z.number(),
|
|
34
|
+
grossProfit: zod_1.z.number(),
|
|
35
|
+
marginality: zod_1.z.number(),
|
|
36
|
+
});
|
|
37
|
+
const SalesSummarySeriesItemSchema = zod_1.z.object({
|
|
38
|
+
period: zod_1.z.string(),
|
|
39
|
+
revenue: zod_1.z.number(),
|
|
40
|
+
orders: zod_1.z.number(),
|
|
41
|
+
units: zod_1.z.number(),
|
|
42
|
+
avgCheck: zod_1.z.number(),
|
|
43
|
+
});
|
|
44
|
+
const GetSalesSummaryResponseSchema = zod_1.z.object({
|
|
45
|
+
data: zod_1.z.object({
|
|
46
|
+
totals: SalesSummaryTotalsSchema,
|
|
47
|
+
series: zod_1.z.array(SalesSummarySeriesItemSchema),
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
var GetSalesSummaryContractQuery;
|
|
51
|
+
(function (GetSalesSummaryContractQuery) {
|
|
52
|
+
GetSalesSummaryContractQuery.RequestSchema = GetSalesSummaryRequestSchema;
|
|
53
|
+
GetSalesSummaryContractQuery.ResponseSchema = GetSalesSummaryResponseSchema;
|
|
54
|
+
})(GetSalesSummaryContractQuery || (exports.GetSalesSummaryContractQuery = GetSalesSummaryContractQuery = {}));
|
|
@@ -18,6 +18,7 @@ __exportStar(require("./get-report-for-period.query"), exports);
|
|
|
18
18
|
__exportStar(require("./get-report-group-by-client.query"), exports);
|
|
19
19
|
__exportStar(require("./get-report-group-by-position.query"), exports);
|
|
20
20
|
__exportStar(require("./export-sales-revenue.query"), exports);
|
|
21
|
+
__exportStar(require("./get-sales-summary.query"), exports);
|
|
21
22
|
__exportStar(require("./export-sales-by-client.query"), exports);
|
|
22
23
|
__exportStar(require("./export-sales-by-position.query"), exports);
|
|
23
24
|
__exportStar(require("./export-inventory-stock.query"), exports);
|
|
@@ -23,15 +23,10 @@ const ExportSalesRevenueRequestSchema = z
|
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
const ExportSalesRevenueResponseSchema = z.object({
|
|
26
|
-
data: z.
|
|
27
|
-
z.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
orders: z.number(),
|
|
31
|
-
units: z.number(),
|
|
32
|
-
avgCheck: z.number(),
|
|
33
|
-
}),
|
|
34
|
-
),
|
|
26
|
+
data: z.object({
|
|
27
|
+
fileUrl: z.string(),
|
|
28
|
+
fileKey: z.string(),
|
|
29
|
+
}),
|
|
35
30
|
});
|
|
36
31
|
|
|
37
32
|
export namespace ExportSalesRevenueContractQuery {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { dateRangeCheck } from '../../helpers/date.helper';
|
|
3
|
+
import { ReportPeriodTypeEnum } from '../../enum/report-period-type.enum';
|
|
4
|
+
|
|
5
|
+
const GetSalesSummaryRequestSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
startDate: z.coerce.date().optional(),
|
|
8
|
+
endDate: z.coerce.date().optional(),
|
|
9
|
+
periodType: z.nativeEnum(ReportPeriodTypeEnum).default(ReportPeriodTypeEnum.DAY),
|
|
10
|
+
})
|
|
11
|
+
.refine(
|
|
12
|
+
value => {
|
|
13
|
+
const { startDate, endDate } = value;
|
|
14
|
+
if (startDate && endDate) {
|
|
15
|
+
return dateRangeCheck(startDate, endDate);
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
message: 'End date must be greater than start date',
|
|
21
|
+
path: ['endDate', 'startDate'],
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const SalesSummaryTotalsSchema = z.object({
|
|
26
|
+
totalRevenue: z.number(),
|
|
27
|
+
totalRevenueWithDelivery: z.number(),
|
|
28
|
+
totalOrders: z.number(),
|
|
29
|
+
uniqueClients: z.number(),
|
|
30
|
+
soldUnits: z.number(),
|
|
31
|
+
avgCheck: z.number(),
|
|
32
|
+
totalVatAmount: z.number(),
|
|
33
|
+
totalCost: z.number(),
|
|
34
|
+
totalDeliveryCost: z.number(),
|
|
35
|
+
totalDiscountAmount: z.number(),
|
|
36
|
+
grossProfit: z.number(),
|
|
37
|
+
marginality: z.number(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const SalesSummarySeriesItemSchema = z.object({
|
|
41
|
+
period: z.string(),
|
|
42
|
+
revenue: z.number(),
|
|
43
|
+
orders: z.number(),
|
|
44
|
+
units: z.number(),
|
|
45
|
+
avgCheck: z.number(),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const GetSalesSummaryResponseSchema = z.object({
|
|
49
|
+
data: z.object({
|
|
50
|
+
totals: SalesSummaryTotalsSchema,
|
|
51
|
+
series: z.array(SalesSummarySeriesItemSchema),
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export namespace GetSalesSummaryContractQuery {
|
|
56
|
+
export const RequestSchema = GetSalesSummaryRequestSchema;
|
|
57
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
58
|
+
|
|
59
|
+
export const ResponseSchema = GetSalesSummaryResponseSchema;
|
|
60
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
61
|
+
}
|
package/commands/report/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './get-report-for-period.query';
|
|
|
2
2
|
export * from './get-report-group-by-client.query';
|
|
3
3
|
export * from './get-report-group-by-position.query';
|
|
4
4
|
export * from './export-sales-revenue.query';
|
|
5
|
+
export * from './get-sales-summary.query';
|
|
5
6
|
export * from './export-sales-by-client.query';
|
|
6
7
|
export * from './export-sales-by-position.query';
|
|
7
8
|
export * from './export-inventory-stock.query';
|