@dascompany/product 4.0.2 → 4.0.5
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/DatabaseConnection.d.ts +0 -2
- package/dist/DatabaseConnection.js +0 -6
- package/dist/SQL.json +2 -7
- package/dist/reader/OrderProductsReader.js +3 -3
- package/dist/reader/OrderReader.js +1 -2
- package/dist/reader/ProductReader.js +4 -5
- package/dist/repo/ProductRepo.js +1 -1
- package/dist/stockObjects/Address.d.ts +1 -1
- package/dist/stockObjects/Order.d.ts +1 -1
- package/dist/stockObjects/Product.d.ts +2 -5
- package/dist/stockObjects/Product.js +1 -9
- package/dist/tables/TableNames.d.ts +0 -1
- package/dist/tables/TableNames.js +0 -1
- package/dist/tables/public/ProductsTable.js +0 -1
- package/dist/types/rows/OrderProductRow.d.ts +3 -3
- package/dist/types/rows/ProductRow.d.ts +0 -1
- package/dist/utils/PriceConverter.d.ts +1 -2
- package/dist/utils/PriceConverter.js +3 -5
- package/package.json +2 -2
- package/dist/reader/AccountCartReader.d.ts +0 -5
- package/dist/reader/AccountCartReader.js +0 -17
- package/dist/tables/clients/AccountCartTable.d.ts +0 -8
- package/dist/tables/clients/AccountCartTable.js +0 -25
- package/dist/types/AccountDeliveryDetailsI.d.ts +0 -7
- package/dist/types/AccountDeliveryDetailsI.js +0 -1
- package/dist/types/rows/AccountCartRow.d.ts +0 -4
- package/dist/types/rows/AccountCartRow.js +0 -1
- package/dist/utils/AccountCart.d.ts +0 -4
- package/dist/utils/AccountCart.js +0 -11
|
@@ -21,7 +21,6 @@ import FileConnectionsTable from './tables/files/FileConnectionsTable';
|
|
|
21
21
|
import AdminAccountsTable from './tables/public/AdminAccountsTable';
|
|
22
22
|
import AccountCompanyDetailsTable from './tables/clients/AccountCompanyDetailsTable';
|
|
23
23
|
import AccountDeliveryDetailsTable from './tables/clients/AccountDeliveryDetailsTable';
|
|
24
|
-
import AccountCartTable from './tables/clients/AccountCartTable';
|
|
25
24
|
export default class DatabaseConnection {
|
|
26
25
|
static instance: DatabaseConnection;
|
|
27
26
|
private tables;
|
|
@@ -36,7 +35,6 @@ export default class DatabaseConnection {
|
|
|
36
35
|
get addresses(): AddressesTable;
|
|
37
36
|
get clientAccounts(): ClientAccountsTable;
|
|
38
37
|
get accountCompanyDetails(): AccountCompanyDetailsTable;
|
|
39
|
-
get accountCart(): AccountCartTable;
|
|
40
38
|
get accountDeliveryDetails(): AccountDeliveryDetailsTable;
|
|
41
39
|
get adminAccounts(): AdminAccountsTable;
|
|
42
40
|
get companyDetails(): CompanyDetailsTable;
|
|
@@ -23,7 +23,6 @@ import FileConnectionsTable from './tables/files/FileConnectionsTable';
|
|
|
23
23
|
import AdminAccountsTable from './tables/public/AdminAccountsTable';
|
|
24
24
|
import AccountCompanyDetailsTable from './tables/clients/AccountCompanyDetailsTable';
|
|
25
25
|
import AccountDeliveryDetailsTable from './tables/clients/AccountDeliveryDetailsTable';
|
|
26
|
-
import AccountCartTable from './tables/clients/AccountCartTable';
|
|
27
26
|
export default class DatabaseConnection {
|
|
28
27
|
static instance;
|
|
29
28
|
tables = new Map();
|
|
@@ -76,11 +75,6 @@ export default class DatabaseConnection {
|
|
|
76
75
|
this.tables.set(TableNames.accountCompanyDetails, new AccountCompanyDetailsTable(this.connection));
|
|
77
76
|
return this.tables.get(TableNames.accountCompanyDetails);
|
|
78
77
|
}
|
|
79
|
-
get accountCart() {
|
|
80
|
-
if (!this.tables.get(TableNames.accountCart))
|
|
81
|
-
this.tables.set(TableNames.accountCart, new AccountCartTable(this.connection));
|
|
82
|
-
return this.tables.get(TableNames.accountCart);
|
|
83
|
-
}
|
|
84
78
|
get accountDeliveryDetails() {
|
|
85
79
|
if (!this.tables.get(TableNames.accountDeliveryDetails))
|
|
86
80
|
this.tables.set(TableNames.accountDeliveryDetails, new AccountDeliveryDetailsTable(this.connection));
|
package/dist/SQL.json
CHANGED
|
@@ -17,11 +17,6 @@
|
|
|
17
17
|
"count": "SELECT COUNT(*) AS total_rows FROM clients.accounts",
|
|
18
18
|
"selectNextId": "SELECT nextval('clients.accounts_id'::regclass)"
|
|
19
19
|
},
|
|
20
|
-
"accountCart": {
|
|
21
|
-
"select": "SELECT * FROM clients.account_cart WHERE account_id = $account_id::BIGINT AND product_id = $product_id::BIGINT",
|
|
22
|
-
"insert": "INSERT INTO clients.account_cart(account_id, product_id) VALUES ($account_id::BIGINT, $product_id::BIGINT)",
|
|
23
|
-
"delete": "DELETE FROM clients.account_cart WHERE product_id = $product_id::BIGINT AND account_id = $account_id::BIGINT"
|
|
24
|
-
},
|
|
25
20
|
"accountDeliveryDetails": {
|
|
26
21
|
"select": "SELECT * FROM clients.account_delivery_details WHERE account_id = $account_id::BIGINT",
|
|
27
22
|
"insert": "INSERT INTO clients.account_delivery_details(account_id, delivery_details_id) VALUES ($account_id::BIGINT, $delivery_details_id::BIGINT)",
|
|
@@ -63,8 +58,8 @@
|
|
|
63
58
|
"products": {
|
|
64
59
|
"select": "SELECT * FROM products",
|
|
65
60
|
"selectId": "SELECT id FROM products",
|
|
66
|
-
"insert": "INSERT INTO products( id, sku, article_number, url, title,
|
|
67
|
-
"update": "UPDATE products SET url = $url::TEXT, article_number = $article_number::TEXT, title = $title::TEXT,
|
|
61
|
+
"insert": "INSERT INTO products( id, sku, article_number, url, title, description, net_price, promotional_net_price, vat, color, quantity, width, length, height, file_id, json_data, deleted) VALUES ($id::BIGINT, $sku::TEXT, $article_number::TEXT, $url::TEXT, $title::TEXT, $description::TEXT, $net_price::DOUBLE PRECISION, $promotional_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)",
|
|
62
|
+
"update": "UPDATE products SET url = $url::TEXT, article_number = $article_number::TEXT, title = $title::TEXT, description = $description::TEXT , net_price = $net_price::DOUBLE PRECISION, promotional_net_price = $promotional_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",
|
|
68
63
|
"delete": "UPDATE products SET deleted = true WHERE id = $id::BIGINT",
|
|
69
64
|
"maxPrice": "SELECT MAX(net_price) FROM products",
|
|
70
65
|
"count": "SELECT COUNT(*) AS total_rows FROM products",
|
|
@@ -23,11 +23,11 @@ export default class OrderProductsReader {
|
|
|
23
23
|
productId: orderProduct.product_id,
|
|
24
24
|
sku: orderProduct.sku,
|
|
25
25
|
title: orderProduct.title,
|
|
26
|
-
netPrice:
|
|
26
|
+
netPrice: Number(orderProduct.net_price),
|
|
27
27
|
installation: orderProduct.installation_price ? true : false,
|
|
28
|
-
installationPrice:
|
|
28
|
+
installationPrice: Number(orderProduct.installation_price),
|
|
29
29
|
grossPrice: PriceConverter.netToGrossPrice(Number(orderProduct.net_price), Number(orderProduct.vat)),
|
|
30
|
-
vat: orderProduct.vat,
|
|
30
|
+
vat: Number(orderProduct.vat),
|
|
31
31
|
thumbnail,
|
|
32
32
|
};
|
|
33
33
|
return correctProduct;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ParameterType, QueryOptions } from "@dascompany/database";
|
|
2
2
|
import DatabaseConnection from "../DatabaseConnection";
|
|
3
3
|
import OrderStatusReader from "./OrderStatusReader";
|
|
4
|
-
import PriceConverter from "../utils/PriceConverter";
|
|
5
4
|
export default class OrderReader {
|
|
6
5
|
static async get(queryOptions) {
|
|
7
6
|
const orderData = await DatabaseConnection.getInstance().orders.select(queryOptions);
|
|
@@ -40,7 +39,7 @@ export default class OrderReader {
|
|
|
40
39
|
const correctOrder = {
|
|
41
40
|
id: order.id,
|
|
42
41
|
email: order.email,
|
|
43
|
-
price:
|
|
42
|
+
price: Number(order.price),
|
|
44
43
|
createdAt: order.created_at,
|
|
45
44
|
clientId: order.client_id,
|
|
46
45
|
deliveryDetailsId: order.delivery_details_id,
|
|
@@ -45,13 +45,12 @@ export default class ProductReader {
|
|
|
45
45
|
articleNumber: product.article_number,
|
|
46
46
|
url: product.url,
|
|
47
47
|
title: product.title,
|
|
48
|
-
subtitle: product.subtitle,
|
|
49
48
|
description: product.description,
|
|
50
|
-
netPrice:
|
|
51
|
-
promotionalNetPrice:
|
|
52
|
-
vat: product.vat,
|
|
49
|
+
netPrice: Number(product.net_price),
|
|
50
|
+
promotionalNetPrice: Number(product.promotional_net_price),
|
|
51
|
+
vat: Number(product.vat),
|
|
53
52
|
color: product.color,
|
|
54
|
-
quantity: product.quantity,
|
|
53
|
+
quantity: Number(product.quantity),
|
|
55
54
|
width: product.width,
|
|
56
55
|
height: product.height,
|
|
57
56
|
length: product.length,
|
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.article_number, productRow.title, productRow.
|
|
9
|
+
const product = new Product(productRow.sku, productRow.url, productRow.article_number, productRow.title, productRow.description, productRow.net_price, productRow.promotional_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;
|
|
@@ -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:
|
|
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:
|
|
13
|
+
id: number | null;
|
|
14
14
|
email: string;
|
|
15
15
|
price: number;
|
|
16
16
|
invoice: boolean;
|
|
@@ -5,7 +5,6 @@ export default class Product extends StockObject {
|
|
|
5
5
|
private url;
|
|
6
6
|
private articleNumber;
|
|
7
7
|
private title;
|
|
8
|
-
private subtitle;
|
|
9
8
|
private description;
|
|
10
9
|
private netPrice;
|
|
11
10
|
private promotionalNetPrice;
|
|
@@ -21,12 +20,11 @@ export default class Product extends StockObject {
|
|
|
21
20
|
private file;
|
|
22
21
|
private jsonData;
|
|
23
22
|
private files;
|
|
24
|
-
constructor(sku: string, url: string, articleNumber: string, title: string,
|
|
23
|
+
constructor(sku: string, url: string, articleNumber: string, title: string, description: string, netPrice: number, promotionalNetPrice: number | null, vat: number, color: string, quantity: number, width: number, length: number, height: number, fileId: number, jsonData: any, deleted?: boolean);
|
|
25
24
|
getSku(): string;
|
|
26
25
|
getUrl(): string;
|
|
27
26
|
getArticleNumber(): string;
|
|
28
27
|
getTitle(): string;
|
|
29
|
-
getSubtitle(): string;
|
|
30
28
|
getDescription(): string;
|
|
31
29
|
getNetPrice(): number;
|
|
32
30
|
getPromotionalNetPrice(): number | null;
|
|
@@ -43,7 +41,7 @@ export default class Product extends StockObject {
|
|
|
43
41
|
getFile(): Promise<FileI | null>;
|
|
44
42
|
getFiles(): Promise<FileI[] | null>;
|
|
45
43
|
getData(): {
|
|
46
|
-
id:
|
|
44
|
+
id: number | null;
|
|
47
45
|
sku: string;
|
|
48
46
|
url: string;
|
|
49
47
|
title: string;
|
|
@@ -64,7 +62,6 @@ export default class Product extends StockObject {
|
|
|
64
62
|
setUrl(url: string): string;
|
|
65
63
|
setArticleNumber(articleNumber: string): string;
|
|
66
64
|
setTitle(title: string): string;
|
|
67
|
-
setSubtitle(subtitle: string): string;
|
|
68
65
|
setDescription(description: string): string;
|
|
69
66
|
setNetPrice(netPrice: number): number;
|
|
70
67
|
setPromotionalNetPrice(promotionalNetPrice: number | null): number | null;
|
|
@@ -8,7 +8,6 @@ export default class Product extends StockObject {
|
|
|
8
8
|
url;
|
|
9
9
|
articleNumber;
|
|
10
10
|
title;
|
|
11
|
-
subtitle;
|
|
12
11
|
description;
|
|
13
12
|
netPrice;
|
|
14
13
|
promotionalNetPrice;
|
|
@@ -24,13 +23,12 @@ export default class Product extends StockObject {
|
|
|
24
23
|
file;
|
|
25
24
|
jsonData;
|
|
26
25
|
files;
|
|
27
|
-
constructor(sku, url, articleNumber, title,
|
|
26
|
+
constructor(sku, url, articleNumber, title, description, netPrice, promotionalNetPrice, vat, color, quantity, width, length, height, fileId, jsonData, deleted = false) {
|
|
28
27
|
super();
|
|
29
28
|
this.sku = sku;
|
|
30
29
|
this.url = url;
|
|
31
30
|
this.articleNumber = articleNumber;
|
|
32
31
|
this.title = title;
|
|
33
|
-
this.subtitle = subtitle;
|
|
34
32
|
this.description = description;
|
|
35
33
|
this.netPrice = netPrice;
|
|
36
34
|
this.promotionalNetPrice = promotionalNetPrice;
|
|
@@ -59,9 +57,6 @@ export default class Product extends StockObject {
|
|
|
59
57
|
getTitle() {
|
|
60
58
|
return this.title;
|
|
61
59
|
}
|
|
62
|
-
getSubtitle() {
|
|
63
|
-
return this.subtitle;
|
|
64
|
-
}
|
|
65
60
|
getDescription() {
|
|
66
61
|
return this.description;
|
|
67
62
|
}
|
|
@@ -155,9 +150,6 @@ export default class Product extends StockObject {
|
|
|
155
150
|
setTitle(title) {
|
|
156
151
|
return this.title = title;
|
|
157
152
|
}
|
|
158
|
-
setSubtitle(subtitle) {
|
|
159
|
-
return this.subtitle = subtitle;
|
|
160
|
-
}
|
|
161
153
|
setDescription(description) {
|
|
162
154
|
return this.description = description;
|
|
163
155
|
}
|
|
@@ -2,7 +2,6 @@ declare enum TableNames {
|
|
|
2
2
|
adminAccounts = "adminAccountsTable",
|
|
3
3
|
clientAccounts = "clientAccountsTable",
|
|
4
4
|
accountDeliveryDetails = "accountDeliveryDetailsTable",
|
|
5
|
-
accountCart = "accountCartTable",
|
|
6
5
|
accountCompanyDetails = "accountCompanyDetailsTable",
|
|
7
6
|
fileConnections = "fileConnectionsTable",
|
|
8
7
|
files = "filesTable",
|
|
@@ -3,7 +3,6 @@ var TableNames;
|
|
|
3
3
|
TableNames["adminAccounts"] = "adminAccountsTable";
|
|
4
4
|
TableNames["clientAccounts"] = "clientAccountsTable";
|
|
5
5
|
TableNames["accountDeliveryDetails"] = "accountDeliveryDetailsTable";
|
|
6
|
-
TableNames["accountCart"] = "accountCartTable";
|
|
7
6
|
TableNames["accountCompanyDetails"] = "accountCompanyDetailsTable";
|
|
8
7
|
TableNames["fileConnections"] = "fileConnectionsTable";
|
|
9
8
|
TableNames["files"] = "filesTable";
|
|
@@ -67,7 +67,6 @@ export default class ProductsTable extends Table {
|
|
|
67
67
|
query.bindParameter('url', product.getUrl());
|
|
68
68
|
query.bindParameter('article_number', product.getArticleNumber());
|
|
69
69
|
query.bindParameter('title', product.getTitle());
|
|
70
|
-
query.bindParameter('subtitle', product.getSubtitle());
|
|
71
70
|
query.bindParameter('description', product.getDescription());
|
|
72
71
|
query.bindParameter('net_price', product.getNetPrice());
|
|
73
72
|
query.bindParameter('promotional_net_price', product.getPromotionalNetPrice());
|
|
@@ -2,10 +2,10 @@ export default interface OrderProductRow {
|
|
|
2
2
|
id: string;
|
|
3
3
|
order_id: string;
|
|
4
4
|
product_id: string;
|
|
5
|
-
net_price:
|
|
6
|
-
installation_price:
|
|
5
|
+
net_price: string;
|
|
6
|
+
installation_price: string;
|
|
7
7
|
title: string;
|
|
8
8
|
sku: string;
|
|
9
|
-
vat:
|
|
9
|
+
vat: string;
|
|
10
10
|
file_id: string;
|
|
11
11
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export default class PriceConverter {
|
|
2
2
|
static netToGrossPrice(netPrice: number, vatPercentage?: number): number;
|
|
3
|
-
static grossToNetPrice(grossPrice: number, vatPercentage?: number):
|
|
4
|
-
static priceToPenny(price: number): number;
|
|
3
|
+
static grossToNetPrice(grossPrice: number, vatPercentage?: number): number;
|
|
5
4
|
}
|
|
@@ -3,14 +3,12 @@ export default class PriceConverter {
|
|
|
3
3
|
const netPriceInPenny = Math.round(netPrice * 100);
|
|
4
4
|
const vatPriceInPenny = Math.round((netPriceInPenny * vatPercentage) / 100);
|
|
5
5
|
const grossPriceInPenny = netPriceInPenny + vatPriceInPenny;
|
|
6
|
-
|
|
6
|
+
const grossPrice = (grossPriceInPenny / 100).toFixed(2);
|
|
7
|
+
return Number(grossPrice);
|
|
7
8
|
}
|
|
8
9
|
static grossToNetPrice(grossPrice, vatPercentage = 23) {
|
|
9
10
|
const grossPriceInPenny = Math.round(grossPrice * 100);
|
|
10
11
|
const netPrice = ((grossPriceInPenny / (vatPercentage / 100 + 1)) / 100).toFixed(2);
|
|
11
|
-
return netPrice;
|
|
12
|
-
}
|
|
13
|
-
static priceToPenny(price) {
|
|
14
|
-
return Math.round(price * 100);
|
|
12
|
+
return Number(netPrice);
|
|
15
13
|
}
|
|
16
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dascompany/product",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
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": "
|
|
23
|
+
"@dascompany/database": "4.0.8",
|
|
24
24
|
"@types/pg": "^8.11.11",
|
|
25
25
|
"pg": "^8.13.3"
|
|
26
26
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
import createQueryOptionsForId from "../utils/createQueryOptionsForId";
|
|
3
|
-
import ProductReader from "./ProductReader";
|
|
4
|
-
export default class AccountCartReader {
|
|
5
|
-
static async getAll(accountId, productId) {
|
|
6
|
-
const accountCart = await DatabaseConnection.getInstance().accountCart.selectAll(accountId, productId);
|
|
7
|
-
return this.correctAccountCart(accountCart);
|
|
8
|
-
}
|
|
9
|
-
static async correctAccountCart(accountCart) {
|
|
10
|
-
const correctAccountCart = [];
|
|
11
|
-
for (let i = 0; i < accountCart.length; i++) {
|
|
12
|
-
const product = await ProductReader.get(createQueryOptionsForId(accountCart[i].product_id));
|
|
13
|
-
correctAccountCart.push(product);
|
|
14
|
-
}
|
|
15
|
-
return correctAccountCart;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Table } from '@dascompany/database';
|
|
2
|
-
import AccountCartRow from '../../types/rows/AccountCartRow';
|
|
3
|
-
export default class AccountCartTable extends Table {
|
|
4
|
-
selectAll(accountId: string, productId: string): Promise<AccountCartRow[]>;
|
|
5
|
-
delete(accountId: string, productId: string): Promise<void>;
|
|
6
|
-
insert(accountId: string, productId: string): Promise<void>;
|
|
7
|
-
private bindParams;
|
|
8
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Table } from '@dascompany/database';
|
|
2
|
-
import * as SQL from '../../SQL.json';
|
|
3
|
-
export default class AccountCartTable extends Table {
|
|
4
|
-
async selectAll(accountId, productId) {
|
|
5
|
-
const query = this.createQuery(SQL.accountCart.select);
|
|
6
|
-
this.bindParams(query, accountId, productId);
|
|
7
|
-
const result = await query.execute();
|
|
8
|
-
return result.getRows();
|
|
9
|
-
}
|
|
10
|
-
async delete(accountId, productId) {
|
|
11
|
-
const query = this.createQuery(SQL.accountCart.delete);
|
|
12
|
-
this.bindParams(query, accountId, productId);
|
|
13
|
-
await query.execute();
|
|
14
|
-
}
|
|
15
|
-
async insert(accountId, productId) {
|
|
16
|
-
const query = this.createQuery(SQL.accountCart.insert);
|
|
17
|
-
this.bindParams(query, accountId, productId);
|
|
18
|
-
await query.execute();
|
|
19
|
-
}
|
|
20
|
-
bindParams(query, accountId, productId) {
|
|
21
|
-
console.log(query, accountId, productId);
|
|
22
|
-
query.bindParameter('account_id', accountId);
|
|
23
|
-
query.bindParameter('product_id', productId);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class AccountCart {
|
|
3
|
-
static async delete(accountId, productId) {
|
|
4
|
-
await DatabaseConnection.getInstance().accountCart.delete(accountId, productId);
|
|
5
|
-
return true;
|
|
6
|
-
}
|
|
7
|
-
static async insert(accountId, productId) {
|
|
8
|
-
await DatabaseConnection.getInstance().accountCart.insert(accountId, productId);
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
}
|