@dascompany/product 2.1.3 → 2.1.5
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.
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ParameterType, QueryOptions } from "@dascompany/database";
|
|
1
2
|
import DatabaseConnection from "../DatabaseConnection";
|
|
3
|
+
import OrderStatusReader from "./OrderStatusReader";
|
|
2
4
|
export default class OrderReader {
|
|
3
5
|
static async get(queryOptions) {
|
|
4
6
|
const orderData = await DatabaseConnection.getInstance().orders.select(queryOptions);
|
|
@@ -31,6 +33,9 @@ export default class OrderReader {
|
|
|
31
33
|
return orders;
|
|
32
34
|
}
|
|
33
35
|
static async correctOrder(order) {
|
|
36
|
+
const queryOptions = new QueryOptions();
|
|
37
|
+
queryOptions.setWhere([{ name: 'order_id', type: ParameterType.bigint, value: order.id }]);
|
|
38
|
+
const status = await OrderStatusReader.get(queryOptions);
|
|
34
39
|
const correctOrder = {
|
|
35
40
|
id: order.id,
|
|
36
41
|
email: order.email,
|
|
@@ -41,7 +46,8 @@ export default class OrderReader {
|
|
|
41
46
|
deliveryDetailsId: order.delivery_details_id,
|
|
42
47
|
invoiceDetailsId: order.invoice_details_id,
|
|
43
48
|
paymentDetailsId: order.payment_details_id,
|
|
44
|
-
zsiId: order.zsi_id
|
|
49
|
+
zsiId: order.zsi_id,
|
|
50
|
+
status
|
|
45
51
|
};
|
|
46
52
|
return correctOrder;
|
|
47
53
|
}
|
|
@@ -5,12 +5,13 @@ import FileConnectionTypeE from "../types/FileConnectionTypeE";
|
|
|
5
5
|
import PriceConverter from "../utils/PriceConverter";
|
|
6
6
|
export default class ProductReader {
|
|
7
7
|
static async get(queryOption) {
|
|
8
|
-
const
|
|
8
|
+
const productRow = await DatabaseConnection.getInstance().products.select(queryOption);
|
|
9
9
|
const queryOptionsFiles = new QueryOptions();
|
|
10
|
-
queryOptionsFiles.setWhere([{ name: 'connection_id', type: ParameterType.bigint, value:
|
|
10
|
+
queryOptionsFiles.setWhere([{ name: 'connection_id', type: ParameterType.bigint, value: productRow.id }, { name: 'connection_type', type: ParameterType.string, value: FileConnectionTypeE.product }]);
|
|
11
11
|
queryOptionsFiles.setOrderBy([{ key: 'sequence', order: 'asc' }]);
|
|
12
12
|
const files = await FilesReader.getForConnection(queryOptionsFiles);
|
|
13
|
-
|
|
13
|
+
const product = await this.correctProduct(productRow);
|
|
14
|
+
return { ...product, files };
|
|
14
15
|
}
|
|
15
16
|
static async getAll(queryOption) {
|
|
16
17
|
const products = await DatabaseConnection.getInstance().products.selectAll(queryOption);
|
package/dist/types/OrderI.d.ts
CHANGED