@dascompany/product 4.2.6 → 4.2.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/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/lib/errors/CilentAccountExistWithThisEmail.d.ts +3 -0
- package/dist/lib/errors/CilentAccountExistWithThisEmail.js +5 -0
- package/dist/reader/OrderReader.js +2 -0
- package/dist/tables/clients/ClientAccountsTable.js +2 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -75,4 +75,5 @@ import CompanyDataI from "./types/CompanyDataI";
|
|
|
75
75
|
import MarketPlacesReader from "./reader/MarketPlacesReader";
|
|
76
76
|
import PriceConverter from "./utils/PriceConverter";
|
|
77
77
|
import createQueryOptionsForId from "./utils/createQueryOptionsForId";
|
|
78
|
-
|
|
78
|
+
import CilentAccountExistWithThisEmail from "./lib/errors/CilentAccountExistWithThisEmail";
|
|
79
|
+
export { Client, ClientAccountRepo, ClientAccountReader, AccountDeliveryDetailsReader, AccountCompanyDetailsReader, AccountCart, AccountCartReader, Admin, AdminRepo, AdminReader, Address, AddressI, AddressesRepo, AddressesReader, PersonalData, PersonalDataRepo, PersonalDataReader, PersonalDataI, CompanyDetails, CompanyDetailsRepo, CompanyDetailsReader, CompanyDetailsI, DeliveryDetails, DeliveryDetailsRepo, DeliveryDetailsReader, DeliveryDetailsI, DeliveryMethods, DeliveryMethodRepo, DeliveryMethodReader, DeliveryMethodI, DeliveryMethodTypeE, DeliveryStatus, DeliveryStatusReader, DeliveryStatusTypeE, PaymentDetails, PaymentDetailsRepo, PaymentDetailsReader, PaymentDetailsI, PaymentMethods, PaymentMethodRepo, PaymentMethodReader, PaymentMethodE, PaymentMethodI, PaymentStatus, PaymentStatusesReader, PaymentStatusE, Order, OrderRepo, OrderReader, OrderProduct, OrderProductsRepo, OrderProductsReader, OrderProductI, Status, OrderStatusReader, StatusI, OrderStatusTypeE, StatusTypesReader, ProductI, Product, ProductRepo, ProductReader, File, FilesRepo, FilesReader, FileI, FileConnection, FileConnectionsRepo, FileConnectionsReader, FileConnectionTypeE, CompanyData, CompanyDataRepo, CompanyDataReader, CompanyDataI, MarketPlacesReader, PriceConverter, createQueryOptionsForId, CilentAccountExistWithThisEmail };
|
package/dist/index.js
CHANGED
|
@@ -63,4 +63,5 @@ import CompanyDataReader from "./reader/CompanyDataReader";
|
|
|
63
63
|
import MarketPlacesReader from "./reader/MarketPlacesReader";
|
|
64
64
|
import PriceConverter from "./utils/PriceConverter";
|
|
65
65
|
import createQueryOptionsForId from "./utils/createQueryOptionsForId";
|
|
66
|
-
|
|
66
|
+
import CilentAccountExistWithThisEmail from "./lib/errors/CilentAccountExistWithThisEmail";
|
|
67
|
+
export { Client, ClientAccountRepo, ClientAccountReader, AccountDeliveryDetailsReader, AccountCompanyDetailsReader, AccountCart, AccountCartReader, Admin, AdminRepo, AdminReader, Address, AddressesRepo, AddressesReader, PersonalData, PersonalDataRepo, PersonalDataReader, CompanyDetails, CompanyDetailsRepo, CompanyDetailsReader, DeliveryDetails, DeliveryDetailsRepo, DeliveryDetailsReader, DeliveryMethods, DeliveryMethodRepo, DeliveryMethodReader, DeliveryMethodTypeE, DeliveryStatus, DeliveryStatusReader, DeliveryStatusTypeE, PaymentDetails, PaymentDetailsRepo, PaymentDetailsReader, PaymentMethods, PaymentMethodRepo, PaymentMethodReader, PaymentMethodE, PaymentStatus, PaymentStatusesReader, PaymentStatusE, Order, OrderRepo, OrderReader, OrderProduct, OrderProductsRepo, OrderProductsReader, Status, OrderStatusReader, OrderStatusTypeE, StatusTypesReader, Product, ProductRepo, ProductReader, File, FilesRepo, FilesReader, FileConnection, FileConnectionsRepo, FileConnectionsReader, FileConnectionTypeE, CompanyData, CompanyDataRepo, CompanyDataReader, MarketPlacesReader, PriceConverter, createQueryOptionsForId, CilentAccountExistWithThisEmail };
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
export default class OrderReader {
|
|
5
6
|
static async get(queryOptions) {
|
|
6
7
|
const orderData = await DatabaseConnection.getInstance().orders.select(queryOptions);
|
|
@@ -40,6 +41,7 @@ export default class OrderReader {
|
|
|
40
41
|
id: order.id,
|
|
41
42
|
email: order.email,
|
|
42
43
|
netPrice: order.net_price,
|
|
44
|
+
grossPrice: PriceConverter.netToGrossPrice(order.net_price, order.vat),
|
|
43
45
|
vat: order.vat,
|
|
44
46
|
createdAt: order.created_at,
|
|
45
47
|
clientId: order.client_id,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ParameterType, QueryOptions, Table } from '@dascompany/database';
|
|
2
2
|
import * as SQL from '../../SQL.json';
|
|
3
|
+
import CilentAccountExistWithThisEmail from '../../lib/errors/CilentAccountExistWithThisEmail';
|
|
3
4
|
export default class ClientAccountsTable extends Table {
|
|
4
5
|
async select(queryOptions) {
|
|
5
6
|
const query = this.createQuery(SQL.accounts.select, queryOptions);
|
|
@@ -46,7 +47,7 @@ export default class ClientAccountsTable extends Table {
|
|
|
46
47
|
queryOptions.setWhere([{ name: 'email', type: ParameterType.string, value: clientEmail }]);
|
|
47
48
|
let accountId = await this.selectId(queryOptions);
|
|
48
49
|
if (accountId)
|
|
49
|
-
throw new
|
|
50
|
+
throw new CilentAccountExistWithThisEmail(clientEmail);
|
|
50
51
|
else
|
|
51
52
|
accountId = await this.selectNextId();
|
|
52
53
|
const query = this.createQuery(SQL.accounts.insert);
|