@dascompany/product 3.5.2 → 3.5.4

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
  }
@@ -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
  }
@@ -7,7 +7,7 @@ export default class ClientAccountsTable extends Table {
7
7
  selectId(queryOptions: QueryOptions): Promise<string | null>;
8
8
  count(queryOptions: QueryOptions): Promise<number>;
9
9
  update(clientData: Client): Promise<void>;
10
- delete(accountId: number): Promise<number>;
10
+ delete(accountId: string): Promise<number>;
11
11
  private bindParameters;
12
12
  insert(clientAccount: Client): Promise<void>;
13
13
  private selectNextId;
@@ -4,7 +4,7 @@ import OrderProduct from '../../stockObjects/OrderProduct';
4
4
  export default class OrdersProductsTable extends Table {
5
5
  selectAll(queryOptions?: QueryOptions): Promise<OrderProductRow[]>;
6
6
  insert(orderProduct: OrderProduct): Promise<boolean>;
7
- delete(id: number): Promise<boolean>;
7
+ delete(id: string): Promise<boolean>;
8
8
  private selectNextId;
9
9
  private bindParams;
10
10
  }
@@ -5,7 +5,7 @@ export default class CompanyDetailsTable extends Table {
5
5
  select(queryOptions: QueryOptions): Promise<CompanyDetailsRow>;
6
6
  update(companyDetails: CompanyDetails): Promise<void>;
7
7
  insert(companyDetails: CompanyDetails): Promise<void>;
8
- delete(id: number): Promise<void>;
8
+ delete(id: string): Promise<void>;
9
9
  private selectNextId;
10
10
  private bindParameters;
11
11
  }
@@ -5,7 +5,7 @@ export default class DeliveryDetailsTable extends Table {
5
5
  select(queryOptions: QueryOptions): Promise<DeliveryDetailsRow>;
6
6
  insert(deliveryDetails: DeliveryDetails): Promise<void>;
7
7
  update(deliveryDetails: DeliveryDetails): Promise<void>;
8
- delete(id: number): Promise<void>;
8
+ delete(id: string): Promise<void>;
9
9
  private selectNextId;
10
10
  private bindParameters;
11
11
  }
@@ -6,6 +6,6 @@ export default class PersonalDataTable extends Table {
6
6
  insert(personalData: PersonalData): Promise<void>;
7
7
  update(personalData: PersonalData): Promise<void>;
8
8
  private selectNextId;
9
- delete(id: number): Promise<void>;
9
+ delete(id: string): Promise<void>;
10
10
  private bindParameters;
11
11
  }
@@ -8,7 +8,7 @@ export default class AdminAccountsTable extends Table {
8
8
  count(queryOptions: QueryOptions): Promise<number>;
9
9
  insert(admin: Admin): Promise<string>;
10
10
  update(admin: Admin): Promise<boolean>;
11
- delete(accountId: number): Promise<number>;
11
+ delete(accountId: string): Promise<number>;
12
12
  private bindParameters;
13
13
  private selectNextId;
14
14
  }
@@ -7,7 +7,7 @@ export default class ProductsTable extends Table {
7
7
  selectId(queryOptions: QueryOptions): Promise<string>;
8
8
  insert(productData: Product): Promise<string>;
9
9
  update(product: Product): Promise<boolean>;
10
- delete(productId: number): Promise<number>;
10
+ delete(productId: string): Promise<number>;
11
11
  selectMaxPrice(queryOption: QueryOptions): Promise<number>;
12
12
  count(queryOption: QueryOptions): Promise<number>;
13
13
  private selectNextId;
@@ -1,10 +1,10 @@
1
1
  export default interface ClientAccountRow {
2
- id: number;
2
+ id: string;
3
3
  email: string;
4
4
  created_at: string;
5
5
  activated: boolean;
6
6
  deleted: boolean;
7
- personal_data_id: number;
8
- delivery_details_id: number;
9
- company_details_id: number;
7
+ personal_data_id: string;
8
+ delivery_details_id: string;
9
+ company_details_id: string;
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dascompany/product",
3
- "version": "3.5.2",
3
+ "version": "3.5.4",
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.5",
24
24
  "@types/pg": "^8.11.11",
25
25
  "pg": "^8.13.3"
26
26
  }