@dascompany/product 3.4.2 → 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 +2 -2
- package/dist/reader/AdminReader.d.ts +1 -1
- package/dist/reader/AdminReader.js +1 -1
- package/dist/reader/ClientAccountReader.d.ts +1 -1
- package/dist/reader/ClientAccountReader.js +1 -1
- package/dist/reader/CompanyDataReader.js +0 -1
- package/dist/reader/FilesReader.d.ts +1 -1
- package/dist/reader/FilesReader.js +1 -1
- package/dist/reader/OrderProductsReader.js +1 -0
- package/dist/reader/OrderReader.js +1 -1
- package/dist/reader/ProductReader.d.ts +1 -1
- package/dist/reader/ProductReader.js +2 -2
- package/dist/repo/AdminRepo.d.ts +1 -1
- package/dist/repo/OrderProductsRepo.js +1 -1
- package/dist/stockObjects/DeliveryDetails.d.ts +8 -8
- package/dist/stockObjects/DeliveryStatus.d.ts +7 -7
- package/dist/stockObjects/FileConnection.d.ts +5 -5
- package/dist/stockObjects/OrderProduct.d.ts +3 -1
- package/dist/stockObjects/OrderProduct.js +6 -1
- package/dist/stockObjects/Status.d.ts +5 -5
- package/dist/tables/clients/ClientAccountsTable.d.ts +1 -1
- package/dist/tables/files/FilesTable.d.ts +2 -2
- package/dist/tables/orders/OrdersProductsTable.js +1 -0
- package/dist/tables/personalInformation/AddressesTable.d.ts +1 -1
- package/dist/tables/public/AdminAccountsTable.d.ts +2 -2
- package/dist/tables/public/ProductsTable.d.ts +2 -2
- package/dist/types/OrderProductI.d.ts +1 -0
- package/dist/types/rows/OrderProductRow.d.ts +1 -0
- package/package.json +1 -1
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<
|
|
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;
|
|
@@ -13,7 +13,7 @@ export default class AdminReader {
|
|
|
13
13
|
}
|
|
14
14
|
static async getQuantity(queryOptions) {
|
|
15
15
|
const quantity = await DatabaseConnection.getInstance().adminAccounts.count(queryOptions);
|
|
16
|
-
return quantity;
|
|
16
|
+
return Number(quantity);
|
|
17
17
|
}
|
|
18
18
|
static correctAdmins(admins) {
|
|
19
19
|
const 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<
|
|
7
|
+
static getId(queryOptions: QueryOptions): Promise<string | null>;
|
|
8
8
|
private static correctClientsFromRows;
|
|
9
9
|
private static correctData;
|
|
10
10
|
}
|
|
@@ -10,7 +10,7 @@ export default class ClientAccountReader {
|
|
|
10
10
|
}
|
|
11
11
|
static async getQuantity(queryOptions) {
|
|
12
12
|
const quantity = await DatabaseConnection.getInstance().clientAccounts.count(queryOptions);
|
|
13
|
-
return quantity;
|
|
13
|
+
return Number(quantity);
|
|
14
14
|
}
|
|
15
15
|
static async getId(queryOptions) {
|
|
16
16
|
const accountId = await DatabaseConnection.getInstance().clientAccounts.selectId(queryOptions);
|
|
@@ -4,7 +4,6 @@ import createQueryOptionsForId from "../utils/createQueryOptionsForId";
|
|
|
4
4
|
export default class CompanyDataReader {
|
|
5
5
|
static async get() {
|
|
6
6
|
const companyData = await DatabaseConnection.getInstance().companyData.select();
|
|
7
|
-
console.log('companyData', companyData);
|
|
8
7
|
if (companyData) {
|
|
9
8
|
const address = companyData?.address_id ? await AddressesReader.get(createQueryOptionsForId(companyData.address_id)) : null;
|
|
10
9
|
return {
|
|
@@ -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<
|
|
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;
|
|
@@ -14,7 +14,7 @@ export default class FilesReader {
|
|
|
14
14
|
}
|
|
15
15
|
static async getQuantity(queryOptions) {
|
|
16
16
|
const quantity = await DatabaseConnection.getInstance().files.count(queryOptions);
|
|
17
|
-
return quantity;
|
|
17
|
+
return Number(quantity);
|
|
18
18
|
}
|
|
19
19
|
static async getForConnection(queryOptions) {
|
|
20
20
|
const files = await DatabaseConnection.getInstance().files.selectForConnection(queryOptions);
|
|
@@ -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,
|
|
@@ -22,7 +22,7 @@ export default class OrderReader {
|
|
|
22
22
|
}
|
|
23
23
|
static async getQuantity(queryOptions) {
|
|
24
24
|
const quantity = await DatabaseConnection.getInstance().orders.count(queryOptions);
|
|
25
|
-
return quantity;
|
|
25
|
+
return Number(quantity);
|
|
26
26
|
}
|
|
27
27
|
static async correctOrders(orderRows) {
|
|
28
28
|
const orders = [];
|
|
@@ -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<
|
|
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;
|
|
@@ -23,11 +23,11 @@ export default class ProductReader {
|
|
|
23
23
|
}
|
|
24
24
|
static async getQuantity(queryOptions) {
|
|
25
25
|
const quantity = await DatabaseConnection.getInstance().products.count(queryOptions);
|
|
26
|
-
return quantity;
|
|
26
|
+
return Number(quantity);
|
|
27
27
|
}
|
|
28
28
|
static async getMaxPrice(queryOptions) {
|
|
29
29
|
const price = await DatabaseConnection.getInstance().products.selectMaxPrice(queryOptions);
|
|
30
|
-
return price;
|
|
30
|
+
return Number(price);
|
|
31
31
|
}
|
|
32
32
|
static async correctProducts(products) {
|
|
33
33
|
const correctProducts = [];
|
package/dist/repo/AdminRepo.d.ts
CHANGED
|
@@ -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<
|
|
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:
|
|
7
|
-
getPersonalDataId():
|
|
8
|
-
getAddressId():
|
|
9
|
-
getDeliveryMethodId():
|
|
10
|
-
setAddressId(addressId:
|
|
11
|
-
setPersonalDataId(personalDataId:
|
|
12
|
-
setDeliveryDetailsId(deliveryMethodId:
|
|
13
|
-
setDeliveryMethodId(deliveryMethodId:
|
|
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:
|
|
8
|
-
getDeliveryDetailsId():
|
|
9
|
-
getDeliveryStatusTypeId():
|
|
10
|
-
getUserId():
|
|
7
|
+
constructor(deliveryDetailsId: string, typeId: string, userId: string);
|
|
8
|
+
getDeliveryDetailsId(): string;
|
|
9
|
+
getDeliveryStatusTypeId(): string;
|
|
10
|
+
getUserId(): string;
|
|
11
11
|
getCreatedAt(): string;
|
|
12
|
-
setDeliveryDetailsId(deliveryDetailsId:
|
|
13
|
-
setDeliveryStatusTypeId(typeId:
|
|
14
|
-
setUserId(userId:
|
|
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:
|
|
8
|
-
getFileId():
|
|
7
|
+
constructor(fileId: string, connectionType: string, connectionId: string, sequence: number);
|
|
8
|
+
getFileId(): string;
|
|
9
9
|
getConnectionType(): string;
|
|
10
|
-
getConnectionId():
|
|
10
|
+
getConnectionId(): string;
|
|
11
11
|
getSequence(): number;
|
|
12
|
-
setFileId(fileId:
|
|
12
|
+
setFileId(fileId: string): void;
|
|
13
13
|
setConnectionType(connectionType: string): void;
|
|
14
|
-
setConnectionId(connectionId:
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
8
|
-
getOrderId():
|
|
7
|
+
constructor(orderId: string, userId: string, type: number, createdAt?: string | null);
|
|
8
|
+
getOrderId(): string;
|
|
9
9
|
getCreatedAt(): string | null;
|
|
10
|
-
getUserId():
|
|
10
|
+
getUserId(): string;
|
|
11
11
|
getType(): number;
|
|
12
|
-
setOrderId(orderId:
|
|
12
|
+
setOrderId(orderId: string): void;
|
|
13
13
|
setCreatedAt(createdAt: string): void;
|
|
14
|
-
setUserId(userId:
|
|
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<
|
|
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<
|
|
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:
|
|
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:
|
|
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<
|
|
7
|
+
selectId(queryOptions: QueryOptions): Promise<string>;
|
|
8
8
|
count(queryOptions: QueryOptions): Promise<number>;
|
|
9
|
-
insert(admin: Admin): Promise<
|
|
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<
|
|
8
|
-
insert(productData: Product): Promise<
|
|
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>;
|