@dascompany/product 3.0.4 → 3.0.6
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 +3 -8
- package/dist/index.d.ts +1 -5
- package/dist/index.js +1 -4
- package/dist/mappers/DeliveryDetailsMapper.js +8 -0
- package/dist/reader/OrderReader.js +1 -1
- package/dist/repo/OrderRepo.js +1 -1
- package/dist/stockObjects/Client.d.ts +1 -0
- package/dist/stockObjects/Client.js +9 -0
- package/dist/stockObjects/DeliveryDetails.d.ts +3 -3
- package/dist/stockObjects/Order.d.ts +6 -6
- package/dist/stockObjects/Order.js +9 -9
- package/dist/tables/TableNames.d.ts +0 -1
- package/dist/tables/TableNames.js +0 -1
- package/dist/tables/orders/OrdersTable.js +2 -2
- package/dist/tables/personalInformation/DeliveryDetailsTable.d.ts +1 -0
- package/dist/tables/personalInformation/DeliveryDetailsTable.js +6 -0
- package/dist/types/OrderI.d.ts +1 -1
- package/dist/types/rows/OrderRow.d.ts +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,6 @@ import ClientAccountsTable from './tables/clients/ClientAccountsTable';
|
|
|
8
8
|
import PersonalDataTable from './tables/personalInformation/PersonalDataTable';
|
|
9
9
|
import OrdersProductsTable from './tables/orders/OrdersProductsTable';
|
|
10
10
|
import CompanyDetailsTable from './tables/personalInformation/CompanyDetailsTable';
|
|
11
|
-
import ContactDetailsTable from './tables/personalInformation/ContactDetailsTable';
|
|
12
11
|
import DeliveryDetailsTable from './tables/personalInformation/DeliveryDetailsTable';
|
|
13
12
|
import InvoiceDetailsTable from './tables/personalInformation/InvoiceDetailsTable';
|
|
14
13
|
import DeliveryMethodsTable from './tables/settings/DeliveryMethodsTable';
|
|
@@ -42,7 +41,6 @@ export default class DatabaseConnection {
|
|
|
42
41
|
get companyDetails(): CompanyDetailsTable;
|
|
43
42
|
get personalData(): PersonalDataTable;
|
|
44
43
|
get ordersProducts(): OrdersProductsTable;
|
|
45
|
-
get contactDetails(): ContactDetailsTable;
|
|
46
44
|
get deliveryDetails(): DeliveryDetailsTable;
|
|
47
45
|
get invoiceDetails(): InvoiceDetailsTable;
|
|
48
46
|
get deliveryMethods(): DeliveryMethodsTable;
|
|
@@ -10,7 +10,6 @@ import ClientAccountsTable from './tables/clients/ClientAccountsTable';
|
|
|
10
10
|
import PersonalDataTable from './tables/personalInformation/PersonalDataTable';
|
|
11
11
|
import OrdersProductsTable from './tables/orders/OrdersProductsTable';
|
|
12
12
|
import CompanyDetailsTable from './tables/personalInformation/CompanyDetailsTable';
|
|
13
|
-
import ContactDetailsTable from './tables/personalInformation/ContactDetailsTable';
|
|
14
13
|
import DeliveryDetailsTable from './tables/personalInformation/DeliveryDetailsTable';
|
|
15
14
|
import InvoiceDetailsTable from './tables/personalInformation/InvoiceDetailsTable';
|
|
16
15
|
import DeliveryMethodsTable from './tables/settings/DeliveryMethodsTable';
|
|
@@ -102,11 +101,6 @@ export default class DatabaseConnection {
|
|
|
102
101
|
this.tables.set(TableNames.ordersProducts, new OrdersProductsTable(this.connection));
|
|
103
102
|
return this.tables.get(TableNames.ordersProducts);
|
|
104
103
|
}
|
|
105
|
-
get contactDetails() {
|
|
106
|
-
if (!this.tables.get(TableNames.contactDetails))
|
|
107
|
-
this.tables.set(TableNames.contactDetails, new ContactDetailsTable(this.connection));
|
|
108
|
-
return this.tables.get(TableNames.contactDetails);
|
|
109
|
-
}
|
|
110
104
|
get deliveryDetails() {
|
|
111
105
|
if (!this.tables.get(TableNames.deliveryDetails))
|
|
112
106
|
this.tables.set(TableNames.deliveryDetails, new DeliveryDetailsTable(this.connection));
|
package/dist/SQL.json
CHANGED
|
@@ -27,16 +27,11 @@
|
|
|
27
27
|
"insert": "INSERT INTO clients.account_company_details(account_id, company_details_id) VALUES ($account_id::BIGINT, $company_details_id::BIGINT)",
|
|
28
28
|
"delete": "DELETE FROM clients.account_company_details"
|
|
29
29
|
},
|
|
30
|
-
"contactDetails": {
|
|
31
|
-
"select": "SELECT * FROM personal_information.contact_details",
|
|
32
|
-
"insert": "INSERT INTO personal_information.contact_details(id, personal_data_id, address_id) VALUES ($id::BIGINT, $personal_data_id::BIGINT, $address_id::BIGINT)",
|
|
33
|
-
"update": "UPDATE personal_information.contact_details SET personal_data_id = $personal_data_id::BIGINT, address_id = $address_id::BIGINT WHERE id = $id::BIGINT",
|
|
34
|
-
"selectNextId": "SELECT nextval('personal_information.contact_details_id'::regclass)"
|
|
35
|
-
},
|
|
36
30
|
"deliveryDetails": {
|
|
37
31
|
"select": "SELECT * FROM personal_information.delivery_details",
|
|
38
32
|
"insert": "INSERT INTO personal_information.delivery_details(id, personal_data_id, address_id, delivery_method_id) VALUES ($id::BIGINT, $personal_data_id::BIGINT, $address_id::BIGINT, $delivery_method_id::BIGINT)",
|
|
39
33
|
"update": "UPDATE personal_information.delivery_details SET personal_data_id = $personal_data_id::BIGINT, address_id = $address_id::BIGINT, delivery_method_id = $delivery_method_id::BIGINT WHERE id = $id::BIGINT",
|
|
34
|
+
"delete": "DELETE FROM personal_information.delivery_details WHERE id = $id::BIGINT",
|
|
40
35
|
"selectNextId": "SELECT nextval('personal_information.delivery_details_id'::regclass)"
|
|
41
36
|
},
|
|
42
37
|
"invoiceDetails": {
|
|
@@ -76,8 +71,8 @@
|
|
|
76
71
|
},
|
|
77
72
|
"orders": {
|
|
78
73
|
"select": "SELECT * FROM orders.orders",
|
|
79
|
-
"insert": "INSERT INTO orders.orders( id, email, price, client_id,
|
|
80
|
-
"update": "UPDATE orders.orders SET price = $price::DOUBLE PRECISION,
|
|
74
|
+
"insert": "INSERT INTO orders.orders( id, email, price, client_id, personal_data_id_id, delivery_details_id, invoice_details_id, payment_details_id ) VALUES ($order_id::BIGINT, $email::TEXT, $price::DOUBLE PRECISION, $client_id::BIGINT, $personal_data_id_id::BIGINT, $delivery_details_id::BIGINT , $invoice_details_id::BIGINT, $payment_details_id::BIGINT )",
|
|
75
|
+
"update": "UPDATE orders.orders SET price = $price::DOUBLE PRECISION, personal_data_id_id = $personal_data_id_id::BIGINT, delivery_details_id = $delivery_details_id::BIGINT, invoice_details_id = $invoice_details_id::BIGINT, payment_details_id = $payment_details_id::BIGINT, zsi_id = $zsi_id::BIGINT WHERE id = $id::BIGINT",
|
|
81
76
|
"count": "SELECT COUNT (*) AS TOTAL_ROWS FROM orders.orders",
|
|
82
77
|
"selectNextId": "SELECT nextval('orders.orders_id'::regclass)"
|
|
83
78
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -18,10 +18,6 @@ import CompanyDetails from "./stockObjects/CompanyDetails";
|
|
|
18
18
|
import CompanyDetailsRepo from "./repo/CompanyDetailsRepo";
|
|
19
19
|
import CompanyDetailsReader from "./reader/CompanyDetailsReader";
|
|
20
20
|
import CompanyDetailsI from "./types/CompanyDetailsI";
|
|
21
|
-
import ContactDetails from "./stockObjects/ContactDetails";
|
|
22
|
-
import ContactDetailsRepo from "./repo/ContactDetailsRepo";
|
|
23
|
-
import ContactDetailsReader from "./reader/ContactDetailsReader";
|
|
24
|
-
import ContactDetailsI from "./types/ContactDetailsI";
|
|
25
21
|
import DeliveryDetails from "./stockObjects/DeliveryDetails";
|
|
26
22
|
import DeliveryDetailsRepo from "./repo/DeliveryDetailsRepo";
|
|
27
23
|
import DeliveryDetailsReader from "./reader/DeliveryDetailsReader";
|
|
@@ -80,4 +76,4 @@ import CompanyDataReader from "./reader/CompanyDataReader";
|
|
|
80
76
|
import CompanyDataI from "./types/CompanyDataI";
|
|
81
77
|
import PriceConverter from "./utils/PriceConverter";
|
|
82
78
|
import createQueryOptionsForId from "./utils/createQueryOptionsForId";
|
|
83
|
-
export { Client, ClientAccountRepo, ClientAccountReader, AccountDeliveryDetailsReader, AccountCompanyDetailsReader, Admin, AdminRepo, AdminReader, Address, AddressI, AddressesRepo, AddressesReader, PersonalData, PersonalDataRepo, PersonalDataReader, PersonalDataI, CompanyDetails, CompanyDetailsRepo, CompanyDetailsReader, CompanyDetailsI,
|
|
79
|
+
export { Client, ClientAccountRepo, ClientAccountReader, AccountDeliveryDetailsReader, AccountCompanyDetailsReader, 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, InvoiceDetails, InvoiceDetailsRepo, InvoiceDetailsReader, InvoiceDetailsI, 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, PriceConverter, createQueryOptionsForId };
|
package/dist/index.js
CHANGED
|
@@ -15,9 +15,6 @@ import PersonalDataReader from "./reader/PersonalDataReader";
|
|
|
15
15
|
import CompanyDetails from "./stockObjects/CompanyDetails";
|
|
16
16
|
import CompanyDetailsRepo from "./repo/CompanyDetailsRepo";
|
|
17
17
|
import CompanyDetailsReader from "./reader/CompanyDetailsReader";
|
|
18
|
-
import ContactDetails from "./stockObjects/ContactDetails";
|
|
19
|
-
import ContactDetailsRepo from "./repo/ContactDetailsRepo";
|
|
20
|
-
import ContactDetailsReader from "./reader/ContactDetailsReader";
|
|
21
18
|
import DeliveryDetails from "./stockObjects/DeliveryDetails";
|
|
22
19
|
import DeliveryDetailsRepo from "./repo/DeliveryDetailsRepo";
|
|
23
20
|
import DeliveryDetailsReader from "./reader/DeliveryDetailsReader";
|
|
@@ -66,4 +63,4 @@ import CompanyDataRepo from "./repo/CompanyDataRepo";
|
|
|
66
63
|
import CompanyDataReader from "./reader/CompanyDataReader";
|
|
67
64
|
import PriceConverter from "./utils/PriceConverter";
|
|
68
65
|
import createQueryOptionsForId from "./utils/createQueryOptionsForId";
|
|
69
|
-
export { Client, ClientAccountRepo, ClientAccountReader, AccountDeliveryDetailsReader, AccountCompanyDetailsReader, Admin, AdminRepo, AdminReader, Address, AddressesRepo, AddressesReader, PersonalData, PersonalDataRepo, PersonalDataReader, CompanyDetails, CompanyDetailsRepo, CompanyDetailsReader,
|
|
66
|
+
export { Client, ClientAccountRepo, ClientAccountReader, AccountDeliveryDetailsReader, AccountCompanyDetailsReader, Admin, AdminRepo, AdminReader, Address, AddressesRepo, AddressesReader, PersonalData, PersonalDataRepo, PersonalDataReader, CompanyDetails, CompanyDetailsRepo, CompanyDetailsReader, DeliveryDetails, DeliveryDetailsRepo, DeliveryDetailsReader, DeliveryMethods, DeliveryMethodRepo, DeliveryMethodReader, DeliveryMethodTypeE, DeliveryStatus, DeliveryStatusReader, DeliveryStatusTypeE, InvoiceDetails, InvoiceDetailsRepo, InvoiceDetailsReader, 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, PriceConverter, createQueryOptionsForId };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
+
import PersonalDataRepo from "../repo/PersonalDataRepo";
|
|
3
|
+
import AddressesRepo from "../repo/AddressesRepo";
|
|
4
|
+
import createQueryOptionsForId from "../utils/createQueryOptionsForId";
|
|
2
5
|
export default class DeliveryDetailsMapper {
|
|
3
6
|
deliveryDetails;
|
|
4
7
|
deliveryDetailsTable;
|
|
@@ -13,5 +16,10 @@ export default class DeliveryDetailsMapper {
|
|
|
13
16
|
await this.deliveryDetailsTable.insert(this.deliveryDetails);
|
|
14
17
|
}
|
|
15
18
|
async delete() {
|
|
19
|
+
const personalData = await PersonalDataRepo.get(createQueryOptionsForId(this.deliveryDetails.getPersonalDataId()));
|
|
20
|
+
personalData.delete();
|
|
21
|
+
const address = await AddressesRepo.get(createQueryOptionsForId(this.deliveryDetails.getAddressId()));
|
|
22
|
+
address.delete();
|
|
23
|
+
await this.deliveryDetailsTable.delete(this.deliveryDetails);
|
|
16
24
|
}
|
|
17
25
|
}
|
|
@@ -42,7 +42,7 @@ export default class OrderReader {
|
|
|
42
42
|
price: order.price,
|
|
43
43
|
createdAt: order.created_at,
|
|
44
44
|
clientId: order.client_id,
|
|
45
|
-
|
|
45
|
+
personalDataId: order.personal_data_id,
|
|
46
46
|
deliveryDetailsId: order.delivery_details_id,
|
|
47
47
|
invoiceDetailsId: order.invoice_details_id,
|
|
48
48
|
paymentDetailsId: order.payment_details_id,
|
package/dist/repo/OrderRepo.js
CHANGED
|
@@ -6,7 +6,7 @@ export default class OrderRepo {
|
|
|
6
6
|
return this.createOrderFromRow(orderData);
|
|
7
7
|
}
|
|
8
8
|
static createOrderFromRow(orderData) {
|
|
9
|
-
const order = new Order(orderData.email, orderData.price, orderData.client_id, orderData.
|
|
9
|
+
const order = new Order(orderData.email, orderData.price, orderData.client_id, orderData.personal_data_id, orderData.delivery_details_id, orderData.invoice_details_id, orderData.payment_details_id);
|
|
10
10
|
order.setId(orderData.id);
|
|
11
11
|
return order;
|
|
12
12
|
}
|
|
@@ -21,6 +21,7 @@ export default class Client extends StockObject {
|
|
|
21
21
|
setCompanyDetailsId(companyDetailsId: number): void;
|
|
22
22
|
addCompanyDetails(companyDetailsId: number): Promise<void>;
|
|
23
23
|
addDeliveryDetails(deliveryDetailsId: number): Promise<void>;
|
|
24
|
+
deleteDeliveryDetails(deliveryDetailsId: number): Promise<void>;
|
|
24
25
|
getCompanyDetails(): void;
|
|
25
26
|
protected getMapper(): StockObjectMapper;
|
|
26
27
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { StockObject } from "@dascompany/database";
|
|
2
2
|
import ClientMapper from "../mappers/ClientMapper";
|
|
3
3
|
import DatabaseConnection from "../DatabaseConnection";
|
|
4
|
+
import DeliveryDetailsRepo from "../repo/DeliveryDetailsRepo";
|
|
5
|
+
import createQueryOptionsForId from "../utils/createQueryOptionsForId";
|
|
4
6
|
export default class Client extends StockObject {
|
|
5
7
|
email;
|
|
6
8
|
activated;
|
|
@@ -66,6 +68,13 @@ export default class Client extends StockObject {
|
|
|
66
68
|
else
|
|
67
69
|
throw new Error(`Client account ${id} does not exist. Cannot add delivery details.`);
|
|
68
70
|
}
|
|
71
|
+
async deleteDeliveryDetails(deliveryDetailsId) {
|
|
72
|
+
await DatabaseConnection.getInstance().accountDeliveryDetails.delete(deliveryDetailsId);
|
|
73
|
+
if (this.deliveryDetailsId == deliveryDetailsId)
|
|
74
|
+
this.deliveryDetailsId = null;
|
|
75
|
+
const deliveryDetails = await DeliveryDetailsRepo.get(createQueryOptionsForId(deliveryDetailsId));
|
|
76
|
+
deliveryDetails.delete();
|
|
77
|
+
}
|
|
69
78
|
getCompanyDetails() {
|
|
70
79
|
}
|
|
71
80
|
getMapper() {
|
|
@@ -3,9 +3,9 @@ export default class DeliveryDetails extends StockObject {
|
|
|
3
3
|
private personalDataId;
|
|
4
4
|
private addressId;
|
|
5
5
|
private deliveryMethodId;
|
|
6
|
-
constructor(personalDataId: number, addressId: number
|
|
7
|
-
getPersonalDataId(): number
|
|
8
|
-
getAddressId(): number
|
|
6
|
+
constructor(personalDataId: number, addressId: number, deliveryMethodId: number | null);
|
|
7
|
+
getPersonalDataId(): number;
|
|
8
|
+
getAddressId(): number;
|
|
9
9
|
getDeliveryMethodId(): number | null;
|
|
10
10
|
setAddressId(addressId: number): number;
|
|
11
11
|
setPersonalDataId(personalDataId: number): number;
|
|
@@ -3,18 +3,18 @@ export default class Order extends StockObject {
|
|
|
3
3
|
private email;
|
|
4
4
|
private price;
|
|
5
5
|
private clientId;
|
|
6
|
-
private
|
|
6
|
+
private personalDataId;
|
|
7
7
|
private deliveryDetailsId;
|
|
8
8
|
private invoiceDetailsId;
|
|
9
9
|
private paymentDetailsId;
|
|
10
10
|
private zsiId;
|
|
11
|
-
constructor(email: string, price: number, clientId: number | null,
|
|
11
|
+
constructor(email: string, price: number, clientId: number | null, personalDataId: number, deliveryDetailsId: number, invoiceDetailsId?: number | null, paymentDetailsId?: number | null);
|
|
12
12
|
getData(): Promise<{
|
|
13
13
|
id: number | null;
|
|
14
14
|
email: string;
|
|
15
15
|
price: number;
|
|
16
16
|
clientId: number | null;
|
|
17
|
-
|
|
17
|
+
personalDataId: number | null;
|
|
18
18
|
deliveryDetailsId: number | null;
|
|
19
19
|
invoiceDetailsId: number | null;
|
|
20
20
|
paymentDetailsId: number | null;
|
|
@@ -23,14 +23,14 @@ export default class Order extends StockObject {
|
|
|
23
23
|
getPrice(): number;
|
|
24
24
|
getZsiId(): number | null;
|
|
25
25
|
getGrossPrice(): number;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
getClientId(): number | null;
|
|
27
|
+
getPersonalDataId(): number | null;
|
|
28
28
|
getDeliveryDetailsId(): number | null;
|
|
29
29
|
getInvoiceDetailsId(): number | null;
|
|
30
30
|
getPaymentDetailsId(): number | null;
|
|
31
31
|
setPrice(price: number): void;
|
|
32
32
|
setclientId(clientId: number): void;
|
|
33
|
-
|
|
33
|
+
setPersonalDataId(personalDataId: number): void;
|
|
34
34
|
setDeliveryDetailsId(deliveryDetailsId: number): void;
|
|
35
35
|
setInvoiceDetailsId(invoiceDetailsId: number): void;
|
|
36
36
|
setPaymentDetailsId(paymentDetailsId: number): void;
|
|
@@ -6,17 +6,17 @@ export default class Order extends StockObject {
|
|
|
6
6
|
email;
|
|
7
7
|
price;
|
|
8
8
|
clientId;
|
|
9
|
-
|
|
9
|
+
personalDataId;
|
|
10
10
|
deliveryDetailsId;
|
|
11
11
|
invoiceDetailsId;
|
|
12
12
|
paymentDetailsId;
|
|
13
13
|
zsiId;
|
|
14
|
-
constructor(email, price, clientId,
|
|
14
|
+
constructor(email, price, clientId, personalDataId, deliveryDetailsId, invoiceDetailsId = null, paymentDetailsId = null) {
|
|
15
15
|
super();
|
|
16
16
|
this.email = email;
|
|
17
17
|
this.price = price;
|
|
18
18
|
this.clientId = clientId;
|
|
19
|
-
this.
|
|
19
|
+
this.personalDataId = personalDataId;
|
|
20
20
|
this.deliveryDetailsId = deliveryDetailsId;
|
|
21
21
|
this.invoiceDetailsId = invoiceDetailsId;
|
|
22
22
|
this.paymentDetailsId = paymentDetailsId;
|
|
@@ -28,7 +28,7 @@ export default class Order extends StockObject {
|
|
|
28
28
|
email: this.email,
|
|
29
29
|
price: this.price,
|
|
30
30
|
clientId: this.clientId,
|
|
31
|
-
|
|
31
|
+
personalDataId: this.personalDataId,
|
|
32
32
|
deliveryDetailsId: this.deliveryDetailsId,
|
|
33
33
|
invoiceDetailsId: this.invoiceDetailsId,
|
|
34
34
|
paymentDetailsId: this.paymentDetailsId,
|
|
@@ -47,11 +47,11 @@ export default class Order extends StockObject {
|
|
|
47
47
|
const vatPercentage = 23; //brak stawki vat dla zamówienia
|
|
48
48
|
return PriceConverter.netToGrossPrice(this.price, vatPercentage);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
getClientId() {
|
|
51
51
|
return this.clientId;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
return this.
|
|
53
|
+
getPersonalDataId() {
|
|
54
|
+
return this.personalDataId;
|
|
55
55
|
}
|
|
56
56
|
getDeliveryDetailsId() {
|
|
57
57
|
return this.deliveryDetailsId;
|
|
@@ -68,8 +68,8 @@ export default class Order extends StockObject {
|
|
|
68
68
|
setclientId(clientId) {
|
|
69
69
|
this.clientId = clientId;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
this.
|
|
71
|
+
setPersonalDataId(personalDataId) {
|
|
72
|
+
this.personalDataId = personalDataId;
|
|
73
73
|
}
|
|
74
74
|
setDeliveryDetailsId(deliveryDetailsId) {
|
|
75
75
|
this.deliveryDetailsId = deliveryDetailsId;
|
|
@@ -14,7 +14,6 @@ declare enum TableNames {
|
|
|
14
14
|
statusTypes = "statusTypesTable",
|
|
15
15
|
addresses = "addressesTable",
|
|
16
16
|
companyDetails = "companyDetailsTable",
|
|
17
|
-
contactDetails = "contactDetailsTable",
|
|
18
17
|
deliveryDetails = "deliveryDetailsTable",
|
|
19
18
|
deliveryStatuses = "deliveryStatusesTable",
|
|
20
19
|
deliveryStatusTypes = "deliveryStatusTypesTable",
|
|
@@ -15,7 +15,6 @@ var TableNames;
|
|
|
15
15
|
TableNames["statusTypes"] = "statusTypesTable";
|
|
16
16
|
TableNames["addresses"] = "addressesTable";
|
|
17
17
|
TableNames["companyDetails"] = "companyDetailsTable";
|
|
18
|
-
TableNames["contactDetails"] = "contactDetailsTable";
|
|
19
18
|
TableNames["deliveryDetails"] = "deliveryDetailsTable";
|
|
20
19
|
TableNames["deliveryStatuses"] = "deliveryStatusesTable";
|
|
21
20
|
TableNames["deliveryStatusTypes"] = "deliveryStatusTypesTable";
|
|
@@ -36,11 +36,11 @@ export default class OrdersTable extends Table {
|
|
|
36
36
|
bindParameters(query, order) {
|
|
37
37
|
query.bindParameter('email', order.getEmail());
|
|
38
38
|
query.bindParameter('price', order.getPrice());
|
|
39
|
-
query.bindParameter('client_id', order.
|
|
39
|
+
query.bindParameter('client_id', order.getClientId());
|
|
40
40
|
this.bindDetailsParameters(query, order);
|
|
41
41
|
}
|
|
42
42
|
bindDetailsParameters(query, order) {
|
|
43
|
-
query.bindParameter('
|
|
43
|
+
query.bindParameter('personal_data_id', order.getPersonalDataId());
|
|
44
44
|
query.bindParameter('delivery_details_id', order.getDeliveryDetailsId());
|
|
45
45
|
query.bindParameter('invoice_details_id', order.getInvoiceDetailsId());
|
|
46
46
|
query.bindParameter('payment_details_id', order.getPaymentDetailsId());
|
|
@@ -5,6 +5,7 @@ export default class DeliveryDetailsTable extends Table {
|
|
|
5
5
|
select(queryOptions: QueryOptions): Promise<DeliveryDetailsRow>;
|
|
6
6
|
insert(deliveryDetails: DeliveryDetails): Promise<void>;
|
|
7
7
|
update(deliveryDetails: DeliveryDetails): Promise<void>;
|
|
8
|
+
delete(deliveryDetails: DeliveryDetails): Promise<void>;
|
|
8
9
|
private selectNextId;
|
|
9
10
|
private bindParameters;
|
|
10
11
|
}
|
|
@@ -21,6 +21,12 @@ export default class DeliveryDetailsTable extends Table {
|
|
|
21
21
|
this.bindParameters(query, deliveryDetails);
|
|
22
22
|
await query.execute();
|
|
23
23
|
}
|
|
24
|
+
async delete(deliveryDetails) {
|
|
25
|
+
const id = deliveryDetails.getId();
|
|
26
|
+
const query = this.createQuery(SQL.deliveryDetails.delete);
|
|
27
|
+
query.bindParameter('id', id);
|
|
28
|
+
await query.execute();
|
|
29
|
+
}
|
|
24
30
|
async selectNextId() {
|
|
25
31
|
const query = this.createQuery(SQL.deliveryDetails.selectNextId);
|
|
26
32
|
const result = await query.execute();
|
package/dist/types/OrderI.d.ts
CHANGED