@dascompany/product 3.5.2 → 3.5.3

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.
@@ -24,6 +24,7 @@ export default class OrderProductsReader {
24
24
  sku: orderProduct.sku,
25
25
  title: orderProduct.title,
26
26
  netPrice: Number(orderProduct.net_price),
27
+ installation: orderProduct.installation_price ? true : false,
27
28
  installationPrice: Number(orderProduct.installation_price),
28
29
  grossPrice: PriceConverter.netToGrossPrice(Number(orderProduct.net_price), Number(orderProduct.vat)),
29
30
  vat: Number(orderProduct.vat),
@@ -1,7 +1,6 @@
1
1
  import { QueryOptions } from "@dascompany/database";
2
- import StatusI from "../types/StatusI";
3
2
  export default class OrderStatusReader {
4
- static get(queryOptions: QueryOptions): Promise<StatusI>;
5
- static getAll(queryOptions?: QueryOptions): Promise<StatusI[]>;
3
+ static get(queryOptions: QueryOptions): Promise<any>;
4
+ static getAll(queryOptions?: QueryOptions): Promise<any[]>;
6
5
  private static correctStatus;
7
6
  }
@@ -1,4 +1,6 @@
1
1
  import DatabaseConnection from "../DatabaseConnection";
2
+ import StatusTypesReader from "./StatusTypesReader";
3
+ import createQueryOptionsForId from "../utils/createQueryOptionsForId";
2
4
  export default class OrderStatusReader {
3
5
  static async get(queryOptions) {
4
6
  const statusRow = await DatabaseConnection.getInstance().statuses.select(queryOptions);
@@ -8,18 +10,19 @@ export default class OrderStatusReader {
8
10
  const statuses = await DatabaseConnection.getInstance().statuses.selectAll(queryOptions);
9
11
  const correctStatuss = [];
10
12
  for (let i = 0; i < statuses.length; i++) {
11
- const correctStatus = this.correctStatus(statuses[i]);
13
+ const correctStatus = await this.correctStatus(statuses[i]);
12
14
  correctStatuss.push(correctStatus);
13
15
  }
14
16
  return correctStatuss;
15
17
  }
16
- static correctStatus(status) {
18
+ static async correctStatus(status) {
19
+ const statusName = await StatusTypesReader.get(createQueryOptionsForId(status.type));
17
20
  const correctStatus = {
18
21
  id: status.id,
19
22
  orderId: status.order_id,
20
23
  createdAt: status.created_at,
21
24
  userId: status.user_id,
22
- type: Number(status.type)
25
+ type: statusName
23
26
  };
24
27
  return correctStatus;
25
28
  }
@@ -8,7 +8,7 @@ export default class Address extends StockObject {
8
8
  private apartmentNumber;
9
9
  constructor(country: string, city: string, street: string, postalCode: string, houseNumber: string, apartmentNumber?: string | null);
10
10
  getData(): {
11
- id: string | null;
11
+ id: number | null;
12
12
  country: string;
13
13
  city: string;
14
14
  street: string;
@@ -10,7 +10,7 @@ export default class Order extends StockObject {
10
10
  private zsiId;
11
11
  constructor(email: string, price: number, clientId: string | null, deliveryDetailsId: string, companyDetailsId?: string | null, paymentDetailsId?: string | null, invoice?: boolean);
12
12
  getData(): Promise<{
13
- id: string | null;
13
+ id: number | null;
14
14
  email: string;
15
15
  price: number;
16
16
  invoice: boolean;
@@ -2,10 +2,10 @@ import { StockObject, StockObjectMapper } from "@dascompany/database";
2
2
  export default class PaymentDetails extends StockObject {
3
3
  private paymentMethodId;
4
4
  private paymentOrderId;
5
- constructor(paymentMethodId: number, paymentOrderId: string | null);
6
- getPaymentMethodId(): number | null;
5
+ constructor(paymentMethodId: string, paymentOrderId: string | null);
6
+ getPaymentMethodId(): string | null;
7
7
  getPaymentOrderId(): string | null;
8
- setPaymentMethodId(paymentMethodId: number): number;
8
+ setPaymentMethodId(paymentMethodId: string): string;
9
9
  setPaymentOrderId(paymentOrderId: string): string;
10
10
  protected getMapper(): StockObjectMapper;
11
11
  }
@@ -3,10 +3,10 @@ import PaymentStatusE from "../types/PaymentStatusE";
3
3
  export default class PaymentStatus extends StockObject {
4
4
  private paymentDetailsId;
5
5
  private typeId;
6
- constructor(paymentDetailsId: number, typeId: PaymentStatusE);
7
- getPaymentDetailsId(): number;
6
+ constructor(paymentDetailsId: string, typeId: PaymentStatusE);
7
+ getPaymentDetailsId(): string;
8
8
  getPaymentStatusTypeId(): number;
9
- setPaymentDetailsId(paymentDetailsId: number): void;
9
+ setPaymentDetailsId(paymentDetailsId: string): void;
10
10
  setPaymentStatusTypeId(typeId: number): void;
11
11
  protected getMapper(): StockObjectMapper;
12
12
  }
@@ -37,7 +37,7 @@ export default class Product extends StockObject {
37
37
  getFile(): Promise<FileI | null>;
38
38
  getFiles(): Promise<FileI[] | null>;
39
39
  getData(): {
40
- id: string | null;
40
+ id: number | null;
41
41
  sku: string;
42
42
  url: string;
43
43
  title: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dascompany/product",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "vitest",
@@ -20,7 +20,7 @@
20
20
  "vitest": "^3.0.6"
21
21
  },
22
22
  "peerDependencies": {
23
- "@dascompany/database": "^3.1.1",
23
+ "@dascompany/database": "^3.1.4",
24
24
  "@types/pg": "^8.11.11",
25
25
  "pg": "^8.13.3"
26
26
  }