@dascompany/product 3.4.3 → 3.5.0

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.
package/dist/SQL.json CHANGED
@@ -73,8 +73,8 @@
73
73
  "selectNextId": "SELECT nextval('orders.orders_id'::regclass)"
74
74
  },
75
75
  "ordersProducts": {
76
- "selectAll": "SELECT op.id, order_id, product_id, title, sku, vat, p.file_id, op.net_price FROM orders.orders_products as op JOIN products as p ON op.product_id = p.id",
77
- "insert": "INSERT INTO orders.orders_products( id, order_id, product_id, net_price ) VALUES ( $id::BIGINT , $order_id::BIGINT, $product_id::BIGINT, $net_price::DOUBLE PRECISION )",
76
+ "selectAll": "SELECT op.id, order_id, product_id, title, sku, vat, p.file_id, op.net_price, op.installation_price FROM orders.orders_products as op JOIN products as p ON op.product_id = p.id",
77
+ "insert": "INSERT INTO orders.orders_products( id, order_id, product_id, net_price, installation_price ) VALUES ( $id::BIGINT , $order_id::BIGINT, $product_id::BIGINT, $net_price::DOUBLE PRECISION, $installation_price::DOUBLE PRECISION)",
78
78
  "selectNextId": "SELECT nextval('orders.orders_products_id'::regclass)",
79
79
  "delete": "UPDATE orders.orders_products SET in_order = false WHERE id = $id::BIGINT"
80
80
  },
@@ -2,7 +2,7 @@ import { QueryOptions } from "@dascompany/database";
2
2
  import AdminI from "../types/AdminI";
3
3
  export default class AdminReader {
4
4
  static get(queryOptions: QueryOptions): Promise<AdminI>;
5
- static getId(queryOptions: QueryOptions): Promise<number>;
5
+ static getId(queryOptions: QueryOptions): Promise<string>;
6
6
  static getAll(queryOptions?: QueryOptions): Promise<AdminI[]>;
7
7
  static getQuantity(queryOptions: QueryOptions): Promise<number>;
8
8
  private static correctAdmins;
@@ -4,7 +4,7 @@ export default class ClientAccountReader {
4
4
  static get(queryOptions: QueryOptions): Promise<ClientAccountI>;
5
5
  static getAll(queryOptions?: QueryOptions): Promise<ClientAccountI[]>;
6
6
  static getQuantity(queryOptions: QueryOptions): Promise<number>;
7
- static getId(queryOptions: QueryOptions): Promise<number | null>;
7
+ static getId(queryOptions: QueryOptions): Promise<string | null>;
8
8
  private static correctClientsFromRows;
9
9
  private static correctData;
10
10
  }
@@ -3,7 +3,7 @@ import FileI from "../types/FileI";
3
3
  export default class FilesReader {
4
4
  static get(queryOptions: QueryOptions): Promise<FileI>;
5
5
  static getAll(queryOptions?: QueryOptions): Promise<FileI[]>;
6
- static getId(queryOptions: QueryOptions): Promise<number>;
6
+ static getId(queryOptions: QueryOptions): Promise<string>;
7
7
  static getQuantity(queryOptions: any): Promise<number>;
8
8
  static getForConnection(queryOptions: QueryOptions): Promise<FileI[]>;
9
9
  private static correctFiles;
@@ -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
+ installationPrice: Number(orderProduct.installation_price),
27
28
  grossPrice: PriceConverter.netToGrossPrice(Number(orderProduct.net_price), Number(orderProduct.vat)),
28
29
  vat: Number(orderProduct.vat),
29
30
  thumbnail,
@@ -3,7 +3,7 @@ import ProductI from "../types/ProductI";
3
3
  export default class ProductReader {
4
4
  static get(queryOption: QueryOptions): Promise<ProductI>;
5
5
  static getAll(queryOption: QueryOptions): Promise<ProductI[]>;
6
- static getId(queryOptions: QueryOptions): Promise<number>;
6
+ static getId(queryOptions: QueryOptions): Promise<string>;
7
7
  static getQuantity(queryOptions: QueryOptions): Promise<number>;
8
8
  static getMaxPrice(queryOptions: QueryOptions): Promise<number>;
9
9
  private static correctProducts;
@@ -2,7 +2,7 @@ import { QueryOptions } from "@dascompany/database";
2
2
  import Admin from "../stockObjects/Admin";
3
3
  export default class AdminRepo {
4
4
  static get(queryOptions: QueryOptions): Promise<Admin>;
5
- static getId(queryOptions: QueryOptions): Promise<number>;
5
+ static getId(queryOptions: QueryOptions): Promise<string>;
6
6
  static getQuantity(queryOptions: QueryOptions): Promise<number>;
7
7
  private static createAdminFromRow;
8
8
  }
@@ -14,7 +14,7 @@ export default class OrderProductsRepo {
14
14
  return products;
15
15
  }
16
16
  static async createOrdersProductFromRow(dataRow) {
17
- const orderProduct = new OrderProduct(dataRow.order_id, dataRow.product_id, dataRow.net_price, dataRow.in_order);
17
+ const orderProduct = new OrderProduct(dataRow.order_id, dataRow.product_id, dataRow.net_price, dataRow.installation_price, dataRow.in_order);
18
18
  orderProduct.setId(dataRow.id);
19
19
  return orderProduct;
20
20
  }
@@ -3,13 +3,13 @@ export default class DeliveryDetails extends StockObject {
3
3
  private personalDataId;
4
4
  private addressId;
5
5
  private deliveryMethodId;
6
- constructor(personalDataId: number, addressId: number, deliveryMethodId: number | null);
7
- getPersonalDataId(): number;
8
- getAddressId(): number;
9
- getDeliveryMethodId(): number | null;
10
- setAddressId(addressId: number): number;
11
- setPersonalDataId(personalDataId: number): number;
12
- setDeliveryDetailsId(deliveryMethodId: number): number;
13
- setDeliveryMethodId(deliveryMethodId: number): number;
6
+ constructor(personalDataId: string, addressId: string, deliveryMethodId: string | null);
7
+ getPersonalDataId(): string;
8
+ getAddressId(): string;
9
+ getDeliveryMethodId(): string | null;
10
+ setAddressId(addressId: string): string;
11
+ setPersonalDataId(personalDataId: string): string;
12
+ setDeliveryDetailsId(deliveryMethodId: string): string;
13
+ setDeliveryMethodId(deliveryMethodId: string): string;
14
14
  protected getMapper(): StockObjectMapper;
15
15
  }
@@ -4,14 +4,14 @@ export default class DeliveryStatus extends StockObject {
4
4
  private typeId;
5
5
  private userId;
6
6
  private createdAt;
7
- constructor(deliveryDetailsId: number, typeId: number, userId: number);
8
- getDeliveryDetailsId(): number;
9
- getDeliveryStatusTypeId(): number;
10
- getUserId(): number;
7
+ constructor(deliveryDetailsId: string, typeId: string, userId: string);
8
+ getDeliveryDetailsId(): string;
9
+ getDeliveryStatusTypeId(): string;
10
+ getUserId(): string;
11
11
  getCreatedAt(): string;
12
- setDeliveryDetailsId(deliveryDetailsId: number): number;
13
- setDeliveryStatusTypeId(typeId: number): number;
14
- setUserId(userId: number): number;
12
+ setDeliveryDetailsId(deliveryDetailsId: string): string;
13
+ setDeliveryStatusTypeId(typeId: string): string;
14
+ setUserId(userId: string): string;
15
15
  setCreatedAt(createdAt: string): void;
16
16
  protected getMapper(): StockObjectMapper;
17
17
  }
@@ -4,14 +4,14 @@ export default class FileConnection extends StockObject {
4
4
  private connectionType;
5
5
  private connectionId;
6
6
  private sequence;
7
- constructor(fileId: number, connectionType: string, connectionId: number, sequence: number);
8
- getFileId(): number;
7
+ constructor(fileId: string, connectionType: string, connectionId: string, sequence: number);
8
+ getFileId(): string;
9
9
  getConnectionType(): string;
10
- getConnectionId(): number;
10
+ getConnectionId(): string;
11
11
  getSequence(): number;
12
- setFileId(fileId: number): void;
12
+ setFileId(fileId: string): void;
13
13
  setConnectionType(connectionType: string): void;
14
- setConnectionId(connectionId: number): void;
14
+ setConnectionId(connectionId: string): void;
15
15
  setSequence(sequence: number): void;
16
16
  protected getMapper(): StockObjectMapper;
17
17
  }
@@ -4,11 +4,13 @@ export default class OrderProduct extends StockObject {
4
4
  private productId;
5
5
  private netPrice;
6
6
  private inOrder;
7
- constructor(orderId: number, productId: number, netPrice: number, inOrder: boolean);
7
+ private installationPrice;
8
+ constructor(orderId: number, productId: number, netPrice: number, inOrder: boolean, installationPrice: number);
8
9
  getOrderId(): number;
9
10
  getProductId(): number;
10
11
  getNetPrice(): number;
11
12
  getInOrder(): boolean;
13
+ getInstallationPrice(): number;
12
14
  setInOrder(inOrder: boolean): void;
13
15
  protected getMapper(): StockObjectMapper;
14
16
  }
@@ -5,12 +5,14 @@ export default class OrderProduct extends StockObject {
5
5
  productId;
6
6
  netPrice;
7
7
  inOrder;
8
- constructor(orderId, productId, netPrice, inOrder) {
8
+ installationPrice;
9
+ constructor(orderId, productId, netPrice, inOrder, installationPrice) {
9
10
  super();
10
11
  this.orderId = orderId;
11
12
  this.productId = productId;
12
13
  this.netPrice = netPrice;
13
14
  this.inOrder = inOrder;
15
+ this.installationPrice = installationPrice;
14
16
  }
15
17
  getOrderId() {
16
18
  return this.orderId;
@@ -24,6 +26,9 @@ export default class OrderProduct extends StockObject {
24
26
  getInOrder() {
25
27
  return this.inOrder;
26
28
  }
29
+ getInstallationPrice() {
30
+ return this.installationPrice;
31
+ }
27
32
  setInOrder(inOrder) {
28
33
  this.inOrder = inOrder;
29
34
  }
@@ -4,14 +4,14 @@ export default class Status extends StockObject {
4
4
  private userId;
5
5
  private type;
6
6
  private createdAt;
7
- constructor(orderId: number, userId: number, type: number, createdAt?: string | null);
8
- getOrderId(): number;
7
+ constructor(orderId: string, userId: string, type: number, createdAt?: string | null);
8
+ getOrderId(): string;
9
9
  getCreatedAt(): string | null;
10
- getUserId(): number;
10
+ getUserId(): string;
11
11
  getType(): number;
12
- setOrderId(orderId: number): void;
12
+ setOrderId(orderId: string): void;
13
13
  setCreatedAt(createdAt: string): void;
14
- setUserId(userId: number): void;
14
+ setUserId(userId: string): void;
15
15
  setType(type: number): void;
16
16
  protected getMapper(): StockObjectMapper;
17
17
  }
@@ -4,7 +4,7 @@ import Client from '../../stockObjects/Client';
4
4
  export default class ClientAccountsTable extends Table {
5
5
  select(queryOptions: QueryOptions): Promise<ClientAccountRow>;
6
6
  selectAll(queryOptions?: QueryOptions): Promise<ClientAccountRow[]>;
7
- selectId(queryOptions: QueryOptions): Promise<number | null>;
7
+ selectId(queryOptions: QueryOptions): Promise<string | null>;
8
8
  count(queryOptions: QueryOptions): Promise<number>;
9
9
  update(clientData: Client): Promise<void>;
10
10
  delete(accountId: number): Promise<number>;
@@ -4,12 +4,12 @@ import File from '../../stockObjects/File';
4
4
  export default class FilesTable extends Table {
5
5
  select(queryOptions: QueryOptions): Promise<FileRow>;
6
6
  selectAll(queryOptions?: QueryOptions): Promise<FileRow[]>;
7
- selectId(queryOptions: QueryOptions): Promise<number>;
7
+ selectId(queryOptions: QueryOptions): Promise<string>;
8
8
  selectForConnection(queryOptions: QueryOptions): Promise<FileRow[]>;
9
9
  insert(file: File): Promise<boolean>;
10
10
  update(fileData: File): Promise<boolean>;
11
11
  count(queryOptions: QueryOptions): Promise<number>;
12
12
  private bindParameters;
13
- delete(fileId: number): Promise<number>;
13
+ delete(fileId: string): Promise<number>;
14
14
  private selectNextId;
15
15
  }
@@ -31,5 +31,6 @@ export default class OrdersProductsTable extends Table {
31
31
  query.bindParameter('product_id', orderProduct.getProductId());
32
32
  query.bindParameter('net_price', orderProduct.getNetPrice());
33
33
  query.bindParameter('in_order', orderProduct.getInOrder());
34
+ query.bindParameter('installation_price', orderProduct.getInstallationPrice());
34
35
  }
35
36
  }
@@ -6,6 +6,6 @@ export default class AddressesTable extends Table {
6
6
  update(addressData: Address): Promise<void>;
7
7
  insert(address: Address): Promise<void>;
8
8
  private selectNextId;
9
- delete(id: number): Promise<void>;
9
+ delete(id: string): Promise<void>;
10
10
  private bindParameters;
11
11
  }
@@ -4,9 +4,9 @@ import Admin from "../../stockObjects/Admin";
4
4
  export default class AdminAccountsTable extends Table {
5
5
  select(queryOptions: QueryOptions): Promise<AdminRow>;
6
6
  selectAll(queryOptions?: QueryOptions): Promise<AdminRow[]>;
7
- selectId(queryOptions: QueryOptions): Promise<number>;
7
+ selectId(queryOptions: QueryOptions): Promise<string>;
8
8
  count(queryOptions: QueryOptions): Promise<number>;
9
- insert(admin: Admin): Promise<number>;
9
+ insert(admin: Admin): Promise<string>;
10
10
  update(admin: Admin): Promise<boolean>;
11
11
  delete(accountId: number): Promise<number>;
12
12
  private bindParameters;
@@ -4,8 +4,8 @@ import ProductRow from '../../types/rows/ProductRow';
4
4
  export default class ProductsTable extends Table {
5
5
  select(queryOptions: QueryOptions): Promise<ProductRow>;
6
6
  selectAll(queryOptions?: QueryOptions): Promise<ProductRow[]>;
7
- selectId(queryOptions: QueryOptions): Promise<number>;
8
- insert(productData: Product): Promise<number>;
7
+ selectId(queryOptions: QueryOptions): Promise<string>;
8
+ insert(productData: Product): Promise<string>;
9
9
  update(product: Product): Promise<boolean>;
10
10
  delete(productId: number): Promise<number>;
11
11
  selectMaxPrice(queryOption: QueryOptions): Promise<number>;
@@ -5,6 +5,7 @@ export default interface OrderProductI {
5
5
  sku: string;
6
6
  title: string;
7
7
  netPrice: number;
8
+ installationPrice: number;
8
9
  grossPrice: number;
9
10
  vat: number;
10
11
  thumbnail: FileI;
@@ -3,6 +3,7 @@ export default interface OrderProductRow {
3
3
  order_id: string;
4
4
  product_id: string;
5
5
  net_price: string;
6
+ installation_price: string;
6
7
  title: string;
7
8
  sku: string;
8
9
  vat: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dascompany/product",
3
- "version": "3.4.3",
3
+ "version": "3.5.0",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "vitest",