@dascompany/product 4.0.6 → 4.0.8
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
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"selectNextId": "SELECT nextval('clients.accounts_id'::regclass)"
|
|
19
19
|
},
|
|
20
20
|
"accountCart": {
|
|
21
|
-
"select": "SELECT * FROM clients.account_cart WHERE account_id = $account_id::BIGINT
|
|
21
|
+
"select": "SELECT * FROM clients.account_cart WHERE account_id = $account_id::BIGINT",
|
|
22
22
|
"insert": "INSERT INTO clients.account_cart(account_id, product_id) VALUES ($account_id::BIGINT, $product_id::BIGINT)",
|
|
23
23
|
"delete": "DELETE FROM clients.account_cart WHERE product_id = $product_id::BIGINT AND account_id = $account_id::BIGINT"
|
|
24
24
|
},
|
|
@@ -2,8 +2,8 @@ import DatabaseConnection from "../DatabaseConnection";
|
|
|
2
2
|
import createQueryOptionsForId from "../utils/createQueryOptionsForId";
|
|
3
3
|
import ProductReader from "./ProductReader";
|
|
4
4
|
export default class AccountCartReader {
|
|
5
|
-
static async getAll(accountId
|
|
6
|
-
const accountCart = await DatabaseConnection.getInstance().accountCart.selectAll(accountId
|
|
5
|
+
static async getAll(accountId) {
|
|
6
|
+
const accountCart = await DatabaseConnection.getInstance().accountCart.selectAll(accountId);
|
|
7
7
|
return this.correctAccountCart(accountCart);
|
|
8
8
|
}
|
|
9
9
|
static async correctAccountCart(accountCart) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Table } from '@dascompany/database';
|
|
2
2
|
import AccountCartRow from '../../types/rows/AccountCartRow';
|
|
3
3
|
export default class AccountCartTable extends Table {
|
|
4
|
-
selectAll(accountId: string
|
|
4
|
+
selectAll(accountId: string): Promise<AccountCartRow[]>;
|
|
5
5
|
delete(accountId: string, productId: string): Promise<void>;
|
|
6
6
|
insert(accountId: string, productId: string): Promise<void>;
|
|
7
7
|
private bindParams;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Table } from '@dascompany/database';
|
|
2
2
|
import * as SQL from '../../SQL.json';
|
|
3
3
|
export default class AccountCartTable extends Table {
|
|
4
|
-
async selectAll(accountId
|
|
4
|
+
async selectAll(accountId) {
|
|
5
5
|
const query = this.createQuery(SQL.accountCart.select);
|
|
6
|
-
|
|
6
|
+
query.bindParameter('account_id', accountId);
|
|
7
7
|
const result = await query.execute();
|
|
8
8
|
return result.getRows();
|
|
9
9
|
}
|
|
@@ -18,7 +18,6 @@ export default class AccountCartTable extends Table {
|
|
|
18
18
|
await query.execute();
|
|
19
19
|
}
|
|
20
20
|
bindParams(query, accountId, productId) {
|
|
21
|
-
console.log(query, accountId, productId);
|
|
22
21
|
query.bindParameter('account_id', accountId);
|
|
23
22
|
query.bindParameter('product_id', productId);
|
|
24
23
|
}
|