@floristcloud/api-lib 1.2.62 → 1.2.64
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/delivery-route/get-delivery-route-invoices.query.js +20 -0
- package/build/commands/delivery-route/index.js +1 -0
- package/build/constant/error.js +41 -6
- package/build/enum/consignment-status.enum.js +1 -0
- package/build/helpers/date.helper.js +2 -1
- package/commands/delivery-route/get-delivery-route-invoices.query.ts +20 -0
- package/commands/delivery-route/index.ts +1 -0
- package/constant/error.ts +41 -6
- package/enum/consignment-status.enum.ts +1 -0
- package/helpers/date.helper.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetDeliveryRouteInvoicesContractQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const DeliveryRouteInvoiceFileSchema = zod_1.z.object({
|
|
6
|
+
file_key: zod_1.z.string(),
|
|
7
|
+
name: zod_1.z.string(),
|
|
8
|
+
});
|
|
9
|
+
const GetDeliveryRouteInvoicesResponseSchema = zod_1.z.object({
|
|
10
|
+
message: zod_1.z.string().optional(),
|
|
11
|
+
data: zod_1.z
|
|
12
|
+
.object({
|
|
13
|
+
files: zod_1.z.array(DeliveryRouteInvoiceFileSchema),
|
|
14
|
+
})
|
|
15
|
+
.nullable(),
|
|
16
|
+
});
|
|
17
|
+
var GetDeliveryRouteInvoicesContractQuery;
|
|
18
|
+
(function (GetDeliveryRouteInvoicesContractQuery) {
|
|
19
|
+
GetDeliveryRouteInvoicesContractQuery.ResponseSchema = GetDeliveryRouteInvoicesResponseSchema;
|
|
20
|
+
})(GetDeliveryRouteInvoicesContractQuery || (exports.GetDeliveryRouteInvoicesContractQuery = GetDeliveryRouteInvoicesContractQuery = {}));
|
|
@@ -19,5 +19,6 @@ __exportStar(require("./update-delivery-route.command"), exports);
|
|
|
19
19
|
__exportStar(require("./delete-delivery-route.command"), exports);
|
|
20
20
|
__exportStar(require("./get-delivery-route-list.query"), exports);
|
|
21
21
|
__exportStar(require("./get-delivery-route.query"), exports);
|
|
22
|
+
__exportStar(require("./get-delivery-route-invoices.query"), exports);
|
|
22
23
|
__exportStar(require("./attach-order-list-to-delivery-route.command"), exports);
|
|
23
24
|
__exportStar(require("./detach-order-list-to-delivery-route.command"), exports);
|
package/build/constant/error.js
CHANGED
|
@@ -451,6 +451,11 @@ exports.ERRORS = {
|
|
|
451
451
|
message: 'Another bulk-move operation on this pair of orders is in progress, retry later',
|
|
452
452
|
httpCode: 409,
|
|
453
453
|
},
|
|
454
|
+
ORDER_PRODUCT_CONSIGNMENT_DRAFT: {
|
|
455
|
+
code: 'OP021',
|
|
456
|
+
message: 'Product consignment is in draft and not available for orders',
|
|
457
|
+
httpCode: 409,
|
|
458
|
+
},
|
|
454
459
|
//TRANSACTION
|
|
455
460
|
TRANSACTION_NOT_CREATED: { code: 'TR001', message: 'Failed to transaction product', httpCode: 500 },
|
|
456
461
|
TRANSACTION_FETCH_FAILED: { code: 'TR002', message: 'Error when retrieving a transaction', httpCode: 500 },
|
|
@@ -955,6 +960,12 @@ exports.ERRORS = {
|
|
|
955
960
|
DELIVERY_ROUTE_NOT_DELETED: { code: 'DLR003', message: 'Failed to delete delivery route', httpCode: 500 },
|
|
956
961
|
DELIVERY_ROUTE_NOT_UPDATED: { code: 'DLR004', message: 'Failed to update delivery route', httpCode: 500 },
|
|
957
962
|
DELIVERY_ROUTE_FETCH_FAILED: { code: 'DLR005', message: 'Error when retrieving delivery routes', httpCode: 500 },
|
|
963
|
+
DELIVERY_ROUTE_TOO_MANY_ORDERS: { code: 'DLR006', message: 'Too many orders in the delivery route to export invoices', httpCode: 400 },
|
|
964
|
+
DELIVERY_ROUTE_INVOICE_EXPORT_IN_PROGRESS: {
|
|
965
|
+
code: 'DLR007',
|
|
966
|
+
message: 'Invoice export for this company is already in progress',
|
|
967
|
+
httpCode: 409,
|
|
968
|
+
},
|
|
958
969
|
FAILED_TO_CREATE: {
|
|
959
970
|
code: 'FAILED_TO_CREATE',
|
|
960
971
|
message: 'Failed to create entity',
|
|
@@ -1135,13 +1146,37 @@ exports.ERRORS = {
|
|
|
1135
1146
|
CONSIGNMENT_TRANSFER_NOT_FOUND: { code: 'CTR002', message: 'Consignment transfer request not found', httpCode: 404 },
|
|
1136
1147
|
CONSIGNMENT_TRANSFER_FETCH_FAILED: { code: 'CTR003', message: 'Failed to fetch consignment transfer requests', httpCode: 500 },
|
|
1137
1148
|
CONSIGNMENT_TRANSFER_RECEIVER_NOT_FOUND: { code: 'CTR004', message: 'Receiver company not found or inactive', httpCode: 404 },
|
|
1138
|
-
CONSIGNMENT_TRANSFER_RECEIVER_IS_SENDER: {
|
|
1139
|
-
|
|
1140
|
-
|
|
1149
|
+
CONSIGNMENT_TRANSFER_RECEIVER_IS_SENDER: {
|
|
1150
|
+
code: 'CTR005',
|
|
1151
|
+
message: 'Cannot transfer a consignment to your own company',
|
|
1152
|
+
httpCode: 400,
|
|
1153
|
+
},
|
|
1154
|
+
CONSIGNMENT_TRANSFER_PRODUCT_NOT_FOUND: {
|
|
1155
|
+
code: 'CTR006',
|
|
1156
|
+
message: 'Transfer position not found in the source consignment',
|
|
1157
|
+
httpCode: 404,
|
|
1158
|
+
},
|
|
1159
|
+
CONSIGNMENT_TRANSFER_QUANTITY_EXCEEDS_BALANCE: {
|
|
1160
|
+
code: 'CTR007',
|
|
1161
|
+
message: 'Requested quantity exceeds the available product balance',
|
|
1162
|
+
httpCode: 400,
|
|
1163
|
+
},
|
|
1141
1164
|
CONSIGNMENT_TRANSFER_NOT_PENDING: { code: 'CTR008', message: 'Consignment transfer request is not pending', httpCode: 409 },
|
|
1142
1165
|
CONSIGNMENT_TRANSFER_NOT_UPDATED: { code: 'CTR009', message: 'Failed to update consignment transfer request', httpCode: 500 },
|
|
1143
|
-
CONSIGNMENT_TRANSFER_ITEMS_MISMATCH: {
|
|
1144
|
-
|
|
1145
|
-
|
|
1166
|
+
CONSIGNMENT_TRANSFER_ITEMS_MISMATCH: {
|
|
1167
|
+
code: 'CTR010',
|
|
1168
|
+
message: 'Accept payload must map every transfer position exactly once',
|
|
1169
|
+
httpCode: 400,
|
|
1170
|
+
},
|
|
1171
|
+
CONSIGNMENT_TRANSFER_CATEGORY_NOT_FOUND: {
|
|
1172
|
+
code: 'CTR011',
|
|
1173
|
+
message: 'Mapped category not found in the receiver company',
|
|
1174
|
+
httpCode: 404,
|
|
1175
|
+
},
|
|
1176
|
+
CONSIGNMENT_TRANSFER_TARGET_CONSIGNMENT_NOT_FOUND: {
|
|
1177
|
+
code: 'CTR012',
|
|
1178
|
+
message: 'Target consignment not found in the receiver company',
|
|
1179
|
+
httpCode: 404,
|
|
1180
|
+
},
|
|
1146
1181
|
CONSIGNMENT_TRANSFER_ACCEPT_FAILED: { code: 'CTR013', message: 'Failed to accept consignment transfer request', httpCode: 500 },
|
|
1147
1182
|
};
|
|
@@ -6,4 +6,5 @@ var ConsignmentStatusEnum;
|
|
|
6
6
|
ConsignmentStatusEnum["ACTIVE"] = "ACTIVE";
|
|
7
7
|
ConsignmentStatusEnum["AVAILABLE"] = "AVAILABLE";
|
|
8
8
|
ConsignmentStatusEnum["LIMITED"] = "LIMITED";
|
|
9
|
+
ConsignmentStatusEnum["DRAFT"] = "DRAFT";
|
|
9
10
|
})(ConsignmentStatusEnum || (exports.ConsignmentStatusEnum = ConsignmentStatusEnum = {}));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setEndDay = exports.setStartDay = exports.isStatementPeriodWithinLimit = exports.STATEMENT_MAX_PERIOD_DAYS = exports.dateRangeCheck = void 0;
|
|
4
|
+
// Allows a single-day range (startDate === endDate); callers expand bounds to start/end-of-day downstream.
|
|
4
5
|
const dateRangeCheck = (startDate, endDate) => {
|
|
5
|
-
return endDate
|
|
6
|
+
return endDate >= startDate;
|
|
6
7
|
};
|
|
7
8
|
exports.dateRangeCheck = dateRangeCheck;
|
|
8
9
|
// 1 year + 1 day to tolerate leap years.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const DeliveryRouteInvoiceFileSchema = z.object({
|
|
4
|
+
file_key: z.string(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const GetDeliveryRouteInvoicesResponseSchema = z.object({
|
|
9
|
+
message: z.string().optional(),
|
|
10
|
+
data: z
|
|
11
|
+
.object({
|
|
12
|
+
files: z.array(DeliveryRouteInvoiceFileSchema),
|
|
13
|
+
})
|
|
14
|
+
.nullable(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export namespace GetDeliveryRouteInvoicesContractQuery {
|
|
18
|
+
export const ResponseSchema = GetDeliveryRouteInvoicesResponseSchema;
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -3,5 +3,6 @@ export * from './update-delivery-route.command';
|
|
|
3
3
|
export * from './delete-delivery-route.command';
|
|
4
4
|
export * from './get-delivery-route-list.query';
|
|
5
5
|
export * from './get-delivery-route.query';
|
|
6
|
+
export * from './get-delivery-route-invoices.query';
|
|
6
7
|
export * from './attach-order-list-to-delivery-route.command';
|
|
7
8
|
export * from './detach-order-list-to-delivery-route.command';
|
package/constant/error.ts
CHANGED
|
@@ -467,6 +467,11 @@ export const ERRORS = {
|
|
|
467
467
|
message: 'Another bulk-move operation on this pair of orders is in progress, retry later',
|
|
468
468
|
httpCode: 409,
|
|
469
469
|
},
|
|
470
|
+
ORDER_PRODUCT_CONSIGNMENT_DRAFT: {
|
|
471
|
+
code: 'OP021',
|
|
472
|
+
message: 'Product consignment is in draft and not available for orders',
|
|
473
|
+
httpCode: 409,
|
|
474
|
+
},
|
|
470
475
|
|
|
471
476
|
//TRANSACTION
|
|
472
477
|
TRANSACTION_NOT_CREATED: { code: 'TR001', message: 'Failed to transaction product', httpCode: 500 },
|
|
@@ -1003,6 +1008,12 @@ export const ERRORS = {
|
|
|
1003
1008
|
DELIVERY_ROUTE_NOT_DELETED: { code: 'DLR003', message: 'Failed to delete delivery route', httpCode: 500 },
|
|
1004
1009
|
DELIVERY_ROUTE_NOT_UPDATED: { code: 'DLR004', message: 'Failed to update delivery route', httpCode: 500 },
|
|
1005
1010
|
DELIVERY_ROUTE_FETCH_FAILED: { code: 'DLR005', message: 'Error when retrieving delivery routes', httpCode: 500 },
|
|
1011
|
+
DELIVERY_ROUTE_TOO_MANY_ORDERS: { code: 'DLR006', message: 'Too many orders in the delivery route to export invoices', httpCode: 400 },
|
|
1012
|
+
DELIVERY_ROUTE_INVOICE_EXPORT_IN_PROGRESS: {
|
|
1013
|
+
code: 'DLR007',
|
|
1014
|
+
message: 'Invoice export for this company is already in progress',
|
|
1015
|
+
httpCode: 409,
|
|
1016
|
+
},
|
|
1006
1017
|
|
|
1007
1018
|
FAILED_TO_CREATE: {
|
|
1008
1019
|
code: 'FAILED_TO_CREATE',
|
|
@@ -1198,13 +1209,37 @@ export const ERRORS = {
|
|
|
1198
1209
|
CONSIGNMENT_TRANSFER_NOT_FOUND: { code: 'CTR002', message: 'Consignment transfer request not found', httpCode: 404 },
|
|
1199
1210
|
CONSIGNMENT_TRANSFER_FETCH_FAILED: { code: 'CTR003', message: 'Failed to fetch consignment transfer requests', httpCode: 500 },
|
|
1200
1211
|
CONSIGNMENT_TRANSFER_RECEIVER_NOT_FOUND: { code: 'CTR004', message: 'Receiver company not found or inactive', httpCode: 404 },
|
|
1201
|
-
CONSIGNMENT_TRANSFER_RECEIVER_IS_SENDER: {
|
|
1202
|
-
|
|
1203
|
-
|
|
1212
|
+
CONSIGNMENT_TRANSFER_RECEIVER_IS_SENDER: {
|
|
1213
|
+
code: 'CTR005',
|
|
1214
|
+
message: 'Cannot transfer a consignment to your own company',
|
|
1215
|
+
httpCode: 400,
|
|
1216
|
+
},
|
|
1217
|
+
CONSIGNMENT_TRANSFER_PRODUCT_NOT_FOUND: {
|
|
1218
|
+
code: 'CTR006',
|
|
1219
|
+
message: 'Transfer position not found in the source consignment',
|
|
1220
|
+
httpCode: 404,
|
|
1221
|
+
},
|
|
1222
|
+
CONSIGNMENT_TRANSFER_QUANTITY_EXCEEDS_BALANCE: {
|
|
1223
|
+
code: 'CTR007',
|
|
1224
|
+
message: 'Requested quantity exceeds the available product balance',
|
|
1225
|
+
httpCode: 400,
|
|
1226
|
+
},
|
|
1204
1227
|
CONSIGNMENT_TRANSFER_NOT_PENDING: { code: 'CTR008', message: 'Consignment transfer request is not pending', httpCode: 409 },
|
|
1205
1228
|
CONSIGNMENT_TRANSFER_NOT_UPDATED: { code: 'CTR009', message: 'Failed to update consignment transfer request', httpCode: 500 },
|
|
1206
|
-
CONSIGNMENT_TRANSFER_ITEMS_MISMATCH: {
|
|
1207
|
-
|
|
1208
|
-
|
|
1229
|
+
CONSIGNMENT_TRANSFER_ITEMS_MISMATCH: {
|
|
1230
|
+
code: 'CTR010',
|
|
1231
|
+
message: 'Accept payload must map every transfer position exactly once',
|
|
1232
|
+
httpCode: 400,
|
|
1233
|
+
},
|
|
1234
|
+
CONSIGNMENT_TRANSFER_CATEGORY_NOT_FOUND: {
|
|
1235
|
+
code: 'CTR011',
|
|
1236
|
+
message: 'Mapped category not found in the receiver company',
|
|
1237
|
+
httpCode: 404,
|
|
1238
|
+
},
|
|
1239
|
+
CONSIGNMENT_TRANSFER_TARGET_CONSIGNMENT_NOT_FOUND: {
|
|
1240
|
+
code: 'CTR012',
|
|
1241
|
+
message: 'Target consignment not found in the receiver company',
|
|
1242
|
+
httpCode: 404,
|
|
1243
|
+
},
|
|
1209
1244
|
CONSIGNMENT_TRANSFER_ACCEPT_FAILED: { code: 'CTR013', message: 'Failed to accept consignment transfer request', httpCode: 500 },
|
|
1210
1245
|
} as const;
|
package/helpers/date.helper.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
// Allows a single-day range (startDate === endDate); callers expand bounds to start/end-of-day downstream.
|
|
1
2
|
export const dateRangeCheck = (startDate: Date, endDate: Date) => {
|
|
2
|
-
return endDate
|
|
3
|
+
return endDate >= startDate;
|
|
3
4
|
};
|
|
4
5
|
|
|
5
6
|
// 1 year + 1 day to tolerate leap years.
|