@dascompany/product 2.1.4 → 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,6 +1,6 @@
1
+ import { ParameterType, QueryOptions } from "@dascompany/database";
1
2
  import DatabaseConnection from "../DatabaseConnection";
2
3
  import OrderStatusReader from "./OrderStatusReader";
3
- import createQueryOptionsForId from "../utils/createQueryOptionsForId";
4
4
  export default class OrderReader {
5
5
  static async get(queryOptions) {
6
6
  const orderData = await DatabaseConnection.getInstance().orders.select(queryOptions);
@@ -33,7 +33,9 @@ export default class OrderReader {
33
33
  return orders;
34
34
  }
35
35
  static async correctOrder(order) {
36
- const status = await OrderStatusReader.get(createQueryOptionsForId(order.id));
36
+ const queryOptions = new QueryOptions();
37
+ queryOptions.setWhere([{ name: 'order_id', type: ParameterType.bigint, value: order.id }]);
38
+ const status = await OrderStatusReader.get(queryOptions);
37
39
  const correctOrder = {
38
40
  id: order.id,
39
41
  email: order.email,
@@ -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 product = await DatabaseConnection.getInstance().products.select(queryOption);
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: product.id }, { name: 'connection_type', type: ParameterType.string, value: FileConnectionTypeE.product }]);
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
- return { ...this.correctProduct(product), files };
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dascompany/product",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "vitest",