@dascompany/product 4.2.18 → 4.2.20

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.
@@ -36,7 +36,8 @@ export default class OrderReader {
36
36
  static async correctOrder(order) {
37
37
  const queryOptions = new QueryOptions();
38
38
  queryOptions.setWhere([{ name: 'order_id', type: ParameterType.bigint, value: order.id }]);
39
- const status = await OrderStatusReader.get(queryOptions);
39
+ queryOptions.setOrderBy([{ key: 'created_at', order: 'DESC' }]);
40
+ const status = await OrderStatusReader.getNewest(queryOptions);
40
41
  const correctOrder = {
41
42
  id: order.id,
42
43
  email: order.email,
@@ -1,6 +1,6 @@
1
1
  import { QueryOptions } from "@dascompany/database";
2
2
  export default class OrderStatusReader {
3
- static get(queryOptions: QueryOptions): Promise<any>;
3
+ static getNewest(queryOptions: QueryOptions): Promise<any>;
4
4
  static getAll(queryOptions?: QueryOptions): Promise<any[]>;
5
5
  private static correctStatus;
6
6
  }
@@ -2,9 +2,9 @@ import DatabaseConnection from "../DatabaseConnection";
2
2
  import StatusTypesReader from "./StatusTypesReader";
3
3
  import createQueryOptionsForId from "../utils/createQueryOptionsForId";
4
4
  export default class OrderStatusReader {
5
- static async get(queryOptions) {
6
- const statusRow = await DatabaseConnection.getInstance().statuses.select(queryOptions);
7
- return this.correctStatus(statusRow);
5
+ static async getNewest(queryOptions) {
6
+ const statusRow = await DatabaseConnection.getInstance().statuses.selectAll(queryOptions);
7
+ return this.correctStatus(statusRow[0]);
8
8
  }
9
9
  static async getAll(queryOptions) {
10
10
  const statuses = await DatabaseConnection.getInstance().statuses.selectAll(queryOptions);
@@ -22,7 +22,7 @@ export default class OrderStatusReader {
22
22
  orderId: status.order_id,
23
23
  createdAt: status.created_at,
24
24
  userId: status.user_id,
25
- type: statusName.key
25
+ type: statusName
26
26
  };
27
27
  return correctStatus;
28
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dascompany/product",
3
- "version": "4.2.18",
3
+ "version": "4.2.20",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6