@dascompany/product 3.1.0 → 3.1.2
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 +2 -2
- package/dist/reader/ProductReader.js +0 -3
- package/dist/repo/ProductRepo.js +1 -1
- package/dist/stockObjects/Product.d.ts +1 -5
- package/dist/stockObjects/Product.js +1 -10
- package/dist/tables/public/ProductsTable.js +0 -1
- package/dist/types/rows/ProductRow.d.ts +0 -1
- package/package.json +1 -1
package/dist/SQL.json
CHANGED
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"products": {
|
|
63
63
|
"select": "SELECT * FROM products",
|
|
64
64
|
"selectId": "SELECT id FROM products",
|
|
65
|
-
"insert": "INSERT INTO products( id, sku, url, title, description, net_price,
|
|
66
|
-
"update": "UPDATE products SET url = $url::TEXT, title = $title::TEXT, description = $description::TEXT , net_price = $net_price::DOUBLE PRECISION,
|
|
65
|
+
"insert": "INSERT INTO products( id, sku, url, title, description, net_price, vat, color, quantity, width, length, height, file_id, json_data, deleted) VALUES ($id::BIGINT, $sku::TEXT, $url::TEXT, $title::TEXT, $description::TEXT, $net_price::DOUBLE PRECISION, $vat::INT, $color::TEXT, $quantity::INT, $width::INT, $length::INT, $height::DOUBLE PRECISION,$file_id::BIGINT , $json_data::JSON, false::BOOL)",
|
|
66
|
+
"update": "UPDATE products SET url = $url::TEXT, title = $title::TEXT, description = $description::TEXT , net_price = $net_price::DOUBLE PRECISION, vat = $vat::INT, color = $color::TEXT, quantity = $quantity::INT, width = $width::INT, length = $length::INT, height = $height::DOUBLE PRECISION, file_id = $file_id::BIGINT, json_data = $json_data::JSON WHERE id = $id::BIGINT",
|
|
67
67
|
"delete": "UPDATE products SET deleted = true WHERE id = $id::BIGINT",
|
|
68
68
|
"maxPrice": "SELECT MAX(net_price) FROM products",
|
|
69
69
|
"count": "SELECT COUNT(*) AS total_rows FROM products",
|
|
@@ -4,7 +4,6 @@ import DatabaseConnection from "../DatabaseConnection";
|
|
|
4
4
|
import FileConnectionTypeE from "../types/FileConnectionTypeE";
|
|
5
5
|
import PriceConverter from "../utils/PriceConverter";
|
|
6
6
|
import createQueryOptionsForId from "../utils/createQueryOptionsForId";
|
|
7
|
-
import getTentInstallationPrice from "../utils/getTentInstallationPrice";
|
|
8
7
|
export default class ProductReader {
|
|
9
8
|
static async get(queryOption) {
|
|
10
9
|
const productRow = await DatabaseConnection.getInstance().products.select(queryOption);
|
|
@@ -13,7 +12,6 @@ export default class ProductReader {
|
|
|
13
12
|
queryOptionsFiles.setOrderBy([{ key: 'sequence', order: 'asc' }]);
|
|
14
13
|
const files = await FilesReader.getForConnection(queryOptionsFiles);
|
|
15
14
|
const product = await this.correctProduct(productRow);
|
|
16
|
-
product.installationPrice = await getTentInstallationPrice(product);
|
|
17
15
|
return { ...product, files };
|
|
18
16
|
}
|
|
19
17
|
static async getAll(queryOption) {
|
|
@@ -48,7 +46,6 @@ export default class ProductReader {
|
|
|
48
46
|
title: product.title,
|
|
49
47
|
description: product.description,
|
|
50
48
|
netPrice: product.net_price,
|
|
51
|
-
installationPrice: product.installation_price,
|
|
52
49
|
vat: product.vat,
|
|
53
50
|
color: product.color,
|
|
54
51
|
quantity: product.quantity,
|
package/dist/repo/ProductRepo.js
CHANGED
|
@@ -6,7 +6,7 @@ export default class ProductRepo {
|
|
|
6
6
|
return this.createProductFromRow(product);
|
|
7
7
|
}
|
|
8
8
|
static createProductFromRow(productRow) {
|
|
9
|
-
const product = new Product(productRow.sku, productRow.url, productRow.title, productRow.description, productRow.net_price, productRow.
|
|
9
|
+
const product = new Product(productRow.sku, productRow.url, productRow.title, productRow.description, productRow.net_price, productRow.vat, productRow.color, productRow.quantity, productRow.width, productRow.length, productRow.height, productRow.file_id, productRow.deleted);
|
|
10
10
|
product.setId(productRow.id);
|
|
11
11
|
product.setCreatedAt(productRow.created_at);
|
|
12
12
|
return product;
|
|
@@ -6,7 +6,6 @@ export default class Product extends StockObject {
|
|
|
6
6
|
private title;
|
|
7
7
|
private description;
|
|
8
8
|
private netPrice;
|
|
9
|
-
private installationPrice;
|
|
10
9
|
private vat;
|
|
11
10
|
private color;
|
|
12
11
|
private quantity;
|
|
@@ -19,13 +18,12 @@ export default class Product extends StockObject {
|
|
|
19
18
|
private file;
|
|
20
19
|
private jsonData;
|
|
21
20
|
private files;
|
|
22
|
-
constructor(sku: string, url: string, title: string, description: string, netPrice: number,
|
|
21
|
+
constructor(sku: string, url: string, title: string, description: string, netPrice: number, vat: number, color: string, quantity: number, width: number, length: number, height: number, fileId: number, jsonData: any, deleted?: boolean);
|
|
23
22
|
getSku(): string;
|
|
24
23
|
getUrl(): string;
|
|
25
24
|
getTitle(): string;
|
|
26
25
|
getDescription(): string;
|
|
27
26
|
getNetPrice(): number;
|
|
28
|
-
getInstallationPrice(): number;
|
|
29
27
|
getGrossPrice(): number;
|
|
30
28
|
getVat(): number;
|
|
31
29
|
getColor(): string;
|
|
@@ -45,7 +43,6 @@ export default class Product extends StockObject {
|
|
|
45
43
|
title: string;
|
|
46
44
|
description: string;
|
|
47
45
|
netPrice: number;
|
|
48
|
-
installationPrice: number;
|
|
49
46
|
vat: number;
|
|
50
47
|
color: string;
|
|
51
48
|
quantity: number;
|
|
@@ -62,7 +59,6 @@ export default class Product extends StockObject {
|
|
|
62
59
|
setTitle(title: string): string;
|
|
63
60
|
setDescription(description: string): string;
|
|
64
61
|
setNetPrice(netPrice: number): number;
|
|
65
|
-
setInstallationPrice(installationPrice: number): number;
|
|
66
62
|
setVat(vat: number): number;
|
|
67
63
|
setColor(color: string): string;
|
|
68
64
|
setQuantity(quantity: number): number;
|
|
@@ -9,7 +9,6 @@ export default class Product extends StockObject {
|
|
|
9
9
|
title;
|
|
10
10
|
description;
|
|
11
11
|
netPrice;
|
|
12
|
-
installationPrice;
|
|
13
12
|
vat;
|
|
14
13
|
color;
|
|
15
14
|
quantity;
|
|
@@ -22,14 +21,13 @@ export default class Product extends StockObject {
|
|
|
22
21
|
file;
|
|
23
22
|
jsonData;
|
|
24
23
|
files;
|
|
25
|
-
constructor(sku, url, title, description, netPrice,
|
|
24
|
+
constructor(sku, url, title, description, netPrice, vat, color, quantity, width, length, height, fileId, jsonData, deleted = false) {
|
|
26
25
|
super();
|
|
27
26
|
this.sku = sku;
|
|
28
27
|
this.url = url;
|
|
29
28
|
this.title = title;
|
|
30
29
|
this.description = description;
|
|
31
30
|
this.netPrice = netPrice;
|
|
32
|
-
this.installationPrice = installationPrice;
|
|
33
31
|
this.vat = vat;
|
|
34
32
|
this.color = color;
|
|
35
33
|
this.quantity = quantity;
|
|
@@ -58,9 +56,6 @@ export default class Product extends StockObject {
|
|
|
58
56
|
getNetPrice() {
|
|
59
57
|
return PriceConverter.netToGrossPrice(this.netPrice, this.vat);
|
|
60
58
|
}
|
|
61
|
-
getInstallationPrice() {
|
|
62
|
-
return this.installationPrice;
|
|
63
|
-
}
|
|
64
59
|
getGrossPrice() {
|
|
65
60
|
return this.netPrice;
|
|
66
61
|
}
|
|
@@ -119,7 +114,6 @@ export default class Product extends StockObject {
|
|
|
119
114
|
title: this.title,
|
|
120
115
|
description: this.description,
|
|
121
116
|
netPrice: this.netPrice,
|
|
122
|
-
installationPrice: this.installationPrice,
|
|
123
117
|
vat: this.vat,
|
|
124
118
|
color: this.color,
|
|
125
119
|
quantity: this.quantity,
|
|
@@ -149,9 +143,6 @@ export default class Product extends StockObject {
|
|
|
149
143
|
setNetPrice(netPrice) {
|
|
150
144
|
return this.netPrice = netPrice;
|
|
151
145
|
}
|
|
152
|
-
setInstallationPrice(installationPrice) {
|
|
153
|
-
return this.installationPrice = installationPrice;
|
|
154
|
-
}
|
|
155
146
|
setVat(vat) {
|
|
156
147
|
return this.vat = vat;
|
|
157
148
|
}
|
|
@@ -68,7 +68,6 @@ export default class ProductsTable extends Table {
|
|
|
68
68
|
query.bindParameter('title', product.getTitle());
|
|
69
69
|
query.bindParameter('description', product.getDescription());
|
|
70
70
|
query.bindParameter('net_price', product.getNetPrice());
|
|
71
|
-
query.bindParameter('installation_price', product.getInstallationPrice());
|
|
72
71
|
query.bindParameter('vat', product.getVat());
|
|
73
72
|
query.bindParameter('color', product.getColor());
|
|
74
73
|
query.bindParameter('quantity', product.getQuantity());
|