@dascompany/product 2.1.16 → 3.0.1
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 +4 -2
- package/dist/DatabaseConnection.js +11 -5
- package/dist/SQL.json +11 -8
- package/dist/index.d.ts +3 -4
- package/dist/index.js +3 -4
- package/dist/reader/AccountCompanyDetailsReader.d.ts +5 -0
- package/dist/reader/AccountCompanyDetailsReader.js +17 -0
- package/dist/reader/AccountDeliveryDetailsReader.d.ts +5 -0
- package/dist/reader/AccountDeliveryDetailsReader.js +17 -0
- package/dist/reader/ClientAccountReader.js +2 -2
- package/dist/reader/ProductReader.js +1 -0
- package/dist/repo/ClientAccountRepo.js +1 -1
- package/dist/repo/ProductRepo.js +1 -1
- package/dist/stockObjects/Client.d.ts +10 -7
- package/dist/stockObjects/Client.js +30 -13
- package/dist/stockObjects/Product.d.ts +5 -1
- package/dist/stockObjects/Product.js +10 -1
- package/dist/tables/TableNames.d.ts +2 -1
- package/dist/tables/TableNames.js +2 -1
- package/dist/tables/clients/AccountCompanyDetailsTable.d.ts +7 -0
- package/dist/tables/clients/AccountCompanyDetailsTable.js +22 -0
- package/dist/tables/clients/AccountDeliveryDetailsTable copy.d.ts +7 -0
- package/dist/tables/clients/AccountDeliveryDetailsTable copy.js +22 -0
- package/dist/tables/clients/ClientAccountsTable.js +2 -2
- package/dist/tables/public/ProductsTable.js +1 -0
- package/dist/types/AccountDeliveryDetailsI.d.ts +7 -0
- package/dist/types/AccountDeliveryDetailsI.js +1 -0
- package/dist/types/ClientAccountI.d.ts +2 -2
- package/dist/types/ProductI.d.ts +1 -0
- package/dist/types/rows/AccountCompanyDetailsRow.d.ts +4 -0
- package/dist/types/rows/AccountCompanyDetailsRow.js +1 -0
- package/dist/types/rows/AccountDeliveryDetailsRow.d.ts +4 -0
- package/dist/types/rows/AccountDeliveryDetailsRow.js +1 -0
- package/dist/types/rows/ClientAccountRow.d.ts +2 -2
- package/dist/types/rows/ProductRow.d.ts +1 -0
- package/package.json +1 -1
|
@@ -21,7 +21,8 @@ import PaymentStatusesTable from './tables/orders/PaymentStatusesTable';
|
|
|
21
21
|
import CompanyDataTable from './tables/settings/CompanyDataTable';
|
|
22
22
|
import FileConnectionsTable from './tables/files/FileConnectionsTable';
|
|
23
23
|
import AdminAccountsTable from './tables/public/AdminAccountsTable';
|
|
24
|
-
import
|
|
24
|
+
import AccountCompanyDetailsTable from './tables/clients/AccountCompanyDetailsTable';
|
|
25
|
+
import AccountDeliveryDetailsTable from './tables/clients/AccountDeliveryDetailsTable copy';
|
|
25
26
|
export default class DatabaseConnection {
|
|
26
27
|
static instance: DatabaseConnection;
|
|
27
28
|
private tables;
|
|
@@ -35,7 +36,8 @@ export default class DatabaseConnection {
|
|
|
35
36
|
get statuses(): StatusesTable;
|
|
36
37
|
get addresses(): AddressesTable;
|
|
37
38
|
get clientAccounts(): ClientAccountsTable;
|
|
38
|
-
get
|
|
39
|
+
get accountCompanyDetails(): AccountCompanyDetailsTable;
|
|
40
|
+
get accountDeliveryDetails(): AccountDeliveryDetailsTable;
|
|
39
41
|
get adminAccounts(): AdminAccountsTable;
|
|
40
42
|
get companyDetails(): CompanyDetailsTable;
|
|
41
43
|
get personalData(): PersonalDataTable;
|
|
@@ -23,7 +23,8 @@ import PaymentStatusesTable from './tables/orders/PaymentStatusesTable';
|
|
|
23
23
|
import CompanyDataTable from './tables/settings/CompanyDataTable';
|
|
24
24
|
import FileConnectionsTable from './tables/files/FileConnectionsTable';
|
|
25
25
|
import AdminAccountsTable from './tables/public/AdminAccountsTable';
|
|
26
|
-
import
|
|
26
|
+
import AccountCompanyDetailsTable from './tables/clients/AccountCompanyDetailsTable';
|
|
27
|
+
import AccountDeliveryDetailsTable from './tables/clients/AccountDeliveryDetailsTable copy';
|
|
27
28
|
export default class DatabaseConnection {
|
|
28
29
|
static instance;
|
|
29
30
|
tables = new Map();
|
|
@@ -71,10 +72,15 @@ export default class DatabaseConnection {
|
|
|
71
72
|
this.tables.set(TableNames.clientAccounts, new ClientAccountsTable(this.connection));
|
|
72
73
|
return this.tables.get(TableNames.clientAccounts);
|
|
73
74
|
}
|
|
74
|
-
get
|
|
75
|
-
if (!this.tables.get(TableNames.
|
|
76
|
-
this.tables.set(TableNames.
|
|
77
|
-
return this.tables.get(TableNames.
|
|
75
|
+
get accountCompanyDetails() {
|
|
76
|
+
if (!this.tables.get(TableNames.accountCompanyDetails))
|
|
77
|
+
this.tables.set(TableNames.accountCompanyDetails, new AccountCompanyDetailsTable(this.connection));
|
|
78
|
+
return this.tables.get(TableNames.accountCompanyDetails);
|
|
79
|
+
}
|
|
80
|
+
get accountDeliveryDetails() {
|
|
81
|
+
if (!this.tables.get(TableNames.accountDeliveryDetails))
|
|
82
|
+
this.tables.set(TableNames.accountDeliveryDetails, new AccountDeliveryDetailsTable(this.connection));
|
|
83
|
+
return this.tables.get(TableNames.accountDeliveryDetails);
|
|
78
84
|
}
|
|
79
85
|
get adminAccounts() {
|
|
80
86
|
if (!this.tables.get(TableNames.adminAccounts))
|
package/dist/SQL.json
CHANGED
|
@@ -17,12 +17,15 @@
|
|
|
17
17
|
"count": "SELECT COUNT(*) AS total_rows FROM clients.accounts",
|
|
18
18
|
"selectNextId": "SELECT nextval('clients.accounts_id'::regclass)"
|
|
19
19
|
},
|
|
20
|
-
"
|
|
21
|
-
"select": "SELECT * FROM clients.
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
"accountDeliveryDetails": {
|
|
21
|
+
"select": "SELECT * FROM clients.account_delivery_details WHERE account_id = $account_id::BIGINT",
|
|
22
|
+
"insert": "INSERT INTO clients.account_delivery_details(account_id, delivery_details_id) VALUES ($account_id::BIGINT, $delivery_details_id::BIGINT)",
|
|
23
|
+
"delete": "DELETE FROM clients.account_delivery_details"
|
|
24
|
+
},
|
|
25
|
+
"accountCompanyDetails": {
|
|
26
|
+
"select": "SELECT * FROM clients.account_company_details WHERE account_id = $account_id::BIGINT",
|
|
27
|
+
"insert": "INSERT INTO clients.account_company_details(account_id, company_details_id) VALUES ($account_id::BIGINT, $company_details_id::BIGINT)",
|
|
28
|
+
"delete": "DELETE FROM clients.account_company_details"
|
|
26
29
|
},
|
|
27
30
|
"contactDetails": {
|
|
28
31
|
"select": "SELECT * FROM personal_information.contact_details",
|
|
@@ -64,8 +67,8 @@
|
|
|
64
67
|
"products": {
|
|
65
68
|
"select": "SELECT * FROM products",
|
|
66
69
|
"selectId": "SELECT id FROM products",
|
|
67
|
-
"insert": "INSERT INTO products( id, sku, url, title, description, net_price, vat, color, quantity, width, length, height, file_id, json_data, deleted) VALUES ($id::BIGINT, $sku::TEXT, $url::TEXT, $title::TEXT, $description::TEXT, $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)",
|
|
68
|
-
"update": "UPDATE products SET url = $url::TEXT, title = $title::TEXT, description = $description::TEXT , net_price = $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",
|
|
70
|
+
"insert": "INSERT INTO products( id, sku, url, title, description, net_price, installation_price, vat, color, quantity, width, length, height, file_id, json_data, deleted) VALUES ($id::BIGINT, $sku::TEXT, $url::TEXT, $title::TEXT, $description::TEXT, $net_price::DOUBLE PRECISION, $installation_price::DOUBLE PRECISION, $vat::INT, $color::TEXT, $quantity::INT, $width::INT, $length::INT, $height::DOUBLE PRECISION,$file_id::BIGINT , $json_data::JSON, false::BOOL)",
|
|
71
|
+
"update": "UPDATE products SET url = $url::TEXT, title = $title::TEXT, description = $description::TEXT , net_price = $net_price::DOUBLE PRECISION, installation_price = $installation_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",
|
|
69
72
|
"delete": "UPDATE products SET deleted = true WHERE id = $id::BIGINT",
|
|
70
73
|
"maxPrice": "SELECT MAX(net_price) FROM products",
|
|
71
74
|
"count": "SELECT COUNT(*) AS total_rows FROM products",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import Client from "./stockObjects/Client";
|
|
2
2
|
import ClientAccountRepo from "./repo/ClientAccountRepo";
|
|
3
3
|
import ClientAccountReader from "./reader/ClientAccountReader";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import AccountAddressesRepo from "./repo/AccountAddressesRepo";
|
|
4
|
+
import AccountDeliveryDetailsReader from "./reader/AccountDeliveryDetailsReader";
|
|
5
|
+
import AccountCompanyDetailsReader from "./reader/AccountCompanyDetailsReader";
|
|
7
6
|
import Admin from "./stockObjects/Admin";
|
|
8
7
|
import AdminRepo from "./repo/AdminRepo";
|
|
9
8
|
import AdminReader from "./reader/AdminReader";
|
|
@@ -81,4 +80,4 @@ import CompanyDataReader from "./reader/CompanyDataReader";
|
|
|
81
80
|
import CompanyDataI from "./types/CompanyDataI";
|
|
82
81
|
import PriceConverter from "./utils/PriceConverter";
|
|
83
82
|
import createQueryOptionsForId from "./utils/createQueryOptionsForId";
|
|
84
|
-
export { Client, ClientAccountRepo, ClientAccountReader,
|
|
83
|
+
export { Client, ClientAccountRepo, ClientAccountReader, AccountDeliveryDetailsReader, AccountCompanyDetailsReader, Admin, AdminRepo, AdminReader, Address, AddressI, AddressesRepo, AddressesReader, PersonalData, PersonalDataRepo, PersonalDataReader, PersonalDataI, CompanyDetails, CompanyDetailsRepo, CompanyDetailsReader, CompanyDetailsI, ContactDetails, ContactDetailsRepo, ContactDetailsReader, ContactDetailsI, 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
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import Client from "./stockObjects/Client";
|
|
2
2
|
import ClientAccountRepo from "./repo/ClientAccountRepo";
|
|
3
3
|
import ClientAccountReader from "./reader/ClientAccountReader";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import AccountAddressesRepo from "./repo/AccountAddressesRepo";
|
|
4
|
+
import AccountDeliveryDetailsReader from "./reader/AccountDeliveryDetailsReader";
|
|
5
|
+
import AccountCompanyDetailsReader from "./reader/AccountCompanyDetailsReader";
|
|
7
6
|
import Admin from "./stockObjects/Admin";
|
|
8
7
|
import AdminRepo from "./repo/AdminRepo";
|
|
9
8
|
import AdminReader from "./reader/AdminReader";
|
|
@@ -67,4 +66,4 @@ import CompanyDataRepo from "./repo/CompanyDataRepo";
|
|
|
67
66
|
import CompanyDataReader from "./reader/CompanyDataReader";
|
|
68
67
|
import PriceConverter from "./utils/PriceConverter";
|
|
69
68
|
import createQueryOptionsForId from "./utils/createQueryOptionsForId";
|
|
70
|
-
export { Client, ClientAccountRepo, ClientAccountReader,
|
|
69
|
+
export { Client, ClientAccountRepo, ClientAccountReader, AccountDeliveryDetailsReader, AccountCompanyDetailsReader, Admin, AdminRepo, AdminReader, Address, AddressesRepo, AddressesReader, PersonalData, PersonalDataRepo, PersonalDataReader, CompanyDetails, CompanyDetailsRepo, CompanyDetailsReader, ContactDetails, ContactDetailsRepo, ContactDetailsReader, 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 };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
+
import createQueryOptionsForId from "../utils/createQueryOptionsForId";
|
|
3
|
+
import CompanyDetailsReader from "./CompanyDetailsReader";
|
|
4
|
+
export default class AccountCompanyDetailsReader {
|
|
5
|
+
static async getAll(accountId) {
|
|
6
|
+
const accountCompanyDetails = await DatabaseConnection.getInstance().accountCompanyDetails.selectAll(accountId);
|
|
7
|
+
return this.correctAccountCompanyDetails(accountCompanyDetails);
|
|
8
|
+
}
|
|
9
|
+
static async correctAccountCompanyDetails(accountCompanyDetails) {
|
|
10
|
+
const correctAccountCompanyDetails = [];
|
|
11
|
+
for (let i = 0; i < accountCompanyDetails.length; i++) {
|
|
12
|
+
const companyDetails = await CompanyDetailsReader.get(createQueryOptionsForId(accountCompanyDetails[i].company_details_id));
|
|
13
|
+
correctAccountCompanyDetails.push(companyDetails);
|
|
14
|
+
}
|
|
15
|
+
return correctAccountCompanyDetails;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
+
import createQueryOptionsForId from "../utils/createQueryOptionsForId";
|
|
3
|
+
import DeliveryDetailsReader from "./DeliveryDetailsReader";
|
|
4
|
+
export default class AccountDeliveryDetailsReader {
|
|
5
|
+
static async getAll(accountId) {
|
|
6
|
+
const accountDeliveryDetails = await DatabaseConnection.getInstance().accountDeliveryDetails.selectAll(accountId);
|
|
7
|
+
return this.correctAccountDeliveryDetails(accountDeliveryDetails);
|
|
8
|
+
}
|
|
9
|
+
static async correctAccountDeliveryDetails(accountDeliveryDetails) {
|
|
10
|
+
const correctAccountDeliveryDetails = [];
|
|
11
|
+
for (let i = 0; i < accountDeliveryDetails.length; i++) {
|
|
12
|
+
const deliveryDetails = await DeliveryDetailsReader.get(createQueryOptionsForId(accountDeliveryDetails[i].delivery_details_id));
|
|
13
|
+
correctAccountDeliveryDetails.push(deliveryDetails);
|
|
14
|
+
}
|
|
15
|
+
return correctAccountDeliveryDetails;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -31,9 +31,9 @@ export default class ClientAccountReader {
|
|
|
31
31
|
createdAt: client.created_at,
|
|
32
32
|
activated: client.activated,
|
|
33
33
|
deleted: client.deleted,
|
|
34
|
-
|
|
34
|
+
personalDataId: client.contact_details_id,
|
|
35
35
|
deliveryDetailsId: client.delivery_details_id,
|
|
36
|
-
|
|
36
|
+
companyDetailsId: client.invoice_details_id,
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -6,7 +6,7 @@ export default class ClientAccountRepo {
|
|
|
6
6
|
return this.createCilentAccountFromRow(accountData);
|
|
7
7
|
}
|
|
8
8
|
static createCilentAccountFromRow(accountData) {
|
|
9
|
-
const client = new Client(accountData.email, accountData.activated, accountData.deleted, accountData.
|
|
9
|
+
const client = new Client(accountData.email, accountData.activated, accountData.deleted, accountData.personal_data_id, accountData.delivery_details_id, accountData.company_details_id, accountData.created_at);
|
|
10
10
|
client.setId(accountData.id);
|
|
11
11
|
return client;
|
|
12
12
|
}
|
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.title, productRow.description, productRow.net_price, productRow.vat, productRow.color, productRow.quantity, productRow.width, productRow.length, productRow.height, productRow.file_id, productRow.deleted);
|
|
9
|
+
const product = new Product(productRow.sku, productRow.url, productRow.title, productRow.description, productRow.net_price, productRow.installation_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;
|
|
@@ -3,21 +3,24 @@ export default class Client extends StockObject {
|
|
|
3
3
|
private email;
|
|
4
4
|
private activated;
|
|
5
5
|
private deleted;
|
|
6
|
-
private
|
|
6
|
+
private personalDetailsId;
|
|
7
7
|
private deliveryDetailsId;
|
|
8
|
-
private
|
|
8
|
+
private companyDetailsId;
|
|
9
9
|
private createdAt;
|
|
10
|
-
constructor(email: string, activated: boolean, deleted: boolean,
|
|
10
|
+
constructor(email: string, activated: boolean, deleted: boolean, personalDetailsId: number, deliveryDetailsId?: number | null, companyDetailsId?: number | null, createdAt?: string | null);
|
|
11
11
|
getEmail(): string;
|
|
12
12
|
getActivated(): boolean;
|
|
13
13
|
getDeleted(): boolean;
|
|
14
|
-
|
|
14
|
+
getPersonalDataId(): number | null;
|
|
15
15
|
getDeliveryDetailsId(): number | null;
|
|
16
|
-
|
|
16
|
+
getCompanyDetailsId(): number | null;
|
|
17
17
|
setActivated(activated: boolean): void;
|
|
18
18
|
setDeleted(deleted: boolean): void;
|
|
19
|
-
|
|
19
|
+
setPersonalDetailsId(personalDetailsId: number): void;
|
|
20
20
|
setDeliveryDetailsId(deliveryDetailsId: number): void;
|
|
21
|
-
|
|
21
|
+
setCompanyDetailsId(companyDetailsId: number): void;
|
|
22
|
+
addCompanyDetails(companyDetailsId: number): Promise<void>;
|
|
23
|
+
addDeliveryDetails(deliveryDetailsId: number): Promise<void>;
|
|
24
|
+
getCompanyDetails(): void;
|
|
22
25
|
protected getMapper(): StockObjectMapper;
|
|
23
26
|
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { StockObject } from "@dascompany/database";
|
|
2
2
|
import ClientMapper from "../mappers/ClientMapper";
|
|
3
|
+
import DatabaseConnection from "../DatabaseConnection";
|
|
3
4
|
export default class Client extends StockObject {
|
|
4
5
|
email;
|
|
5
6
|
activated;
|
|
6
7
|
deleted;
|
|
7
|
-
|
|
8
|
+
personalDetailsId;
|
|
8
9
|
deliveryDetailsId;
|
|
9
|
-
|
|
10
|
+
companyDetailsId;
|
|
10
11
|
createdAt;
|
|
11
|
-
constructor(email, activated, deleted,
|
|
12
|
+
constructor(email, activated, deleted, personalDetailsId, deliveryDetailsId = null, companyDetailsId = null, createdAt = null) {
|
|
12
13
|
super();
|
|
13
14
|
this.email = email;
|
|
14
15
|
this.activated = activated;
|
|
15
16
|
this.deleted = deleted;
|
|
16
|
-
this.
|
|
17
|
+
this.personalDetailsId = personalDetailsId;
|
|
17
18
|
this.deliveryDetailsId = deliveryDetailsId;
|
|
18
|
-
this.
|
|
19
|
+
this.companyDetailsId = companyDetailsId;
|
|
19
20
|
this.createdAt = createdAt;
|
|
20
21
|
}
|
|
21
22
|
getEmail() {
|
|
@@ -27,14 +28,14 @@ export default class Client extends StockObject {
|
|
|
27
28
|
getDeleted() {
|
|
28
29
|
return this.deleted;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
return this.
|
|
31
|
+
getPersonalDataId() {
|
|
32
|
+
return this.personalDetailsId;
|
|
32
33
|
}
|
|
33
34
|
getDeliveryDetailsId() {
|
|
34
35
|
return this.deliveryDetailsId;
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
return this.
|
|
37
|
+
getCompanyDetailsId() {
|
|
38
|
+
return this.companyDetailsId;
|
|
38
39
|
}
|
|
39
40
|
setActivated(activated) {
|
|
40
41
|
this.activated = activated;
|
|
@@ -42,14 +43,30 @@ export default class Client extends StockObject {
|
|
|
42
43
|
setDeleted(deleted) {
|
|
43
44
|
this.deleted = deleted;
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
-
this.
|
|
46
|
+
setPersonalDetailsId(personalDetailsId) {
|
|
47
|
+
this.personalDetailsId = personalDetailsId;
|
|
47
48
|
}
|
|
48
49
|
setDeliveryDetailsId(deliveryDetailsId) {
|
|
49
50
|
this.deliveryDetailsId = deliveryDetailsId;
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
-
this.
|
|
52
|
+
setCompanyDetailsId(companyDetailsId) {
|
|
53
|
+
this.companyDetailsId = companyDetailsId;
|
|
54
|
+
}
|
|
55
|
+
async addCompanyDetails(companyDetailsId) {
|
|
56
|
+
const id = this.getId();
|
|
57
|
+
if (id)
|
|
58
|
+
await DatabaseConnection.getInstance().accountCompanyDetails.insert(id, companyDetailsId);
|
|
59
|
+
else
|
|
60
|
+
throw new Error(`Client account ${id} does not exist. Cannot add company details.`);
|
|
61
|
+
}
|
|
62
|
+
async addDeliveryDetails(deliveryDetailsId) {
|
|
63
|
+
const id = this.getId();
|
|
64
|
+
if (id)
|
|
65
|
+
await DatabaseConnection.getInstance().accountDeliveryDetails.insert(id, deliveryDetailsId);
|
|
66
|
+
else
|
|
67
|
+
throw new Error(`Client account ${id} does not exist. Cannot add delivery details.`);
|
|
68
|
+
}
|
|
69
|
+
getCompanyDetails() {
|
|
53
70
|
}
|
|
54
71
|
getMapper() {
|
|
55
72
|
return new ClientMapper(this);
|
|
@@ -6,6 +6,7 @@ export default class Product extends StockObject {
|
|
|
6
6
|
private title;
|
|
7
7
|
private description;
|
|
8
8
|
private netPrice;
|
|
9
|
+
private installationPrice;
|
|
9
10
|
private vat;
|
|
10
11
|
private color;
|
|
11
12
|
private quantity;
|
|
@@ -18,12 +19,13 @@ export default class Product extends StockObject {
|
|
|
18
19
|
private file;
|
|
19
20
|
private jsonData;
|
|
20
21
|
private files;
|
|
21
|
-
constructor(sku: string, url: string, title: string, description: string, netPrice: number, vat: number, color: string, quantity: number, width: number, length: number, height: number, fileId: number, jsonData: any, deleted?: boolean);
|
|
22
|
+
constructor(sku: string, url: string, title: string, description: string, netPrice: number, installationPrice: number, vat: number, color: string, quantity: number, width: number, length: number, height: number, fileId: number, jsonData: any, deleted?: boolean);
|
|
22
23
|
getSku(): string;
|
|
23
24
|
getUrl(): string;
|
|
24
25
|
getTitle(): string;
|
|
25
26
|
getDescription(): string;
|
|
26
27
|
getNetPrice(): number;
|
|
28
|
+
getInstallationPrice(): number;
|
|
27
29
|
getGrossPrice(): number;
|
|
28
30
|
getVat(): number;
|
|
29
31
|
getColor(): string;
|
|
@@ -43,6 +45,7 @@ export default class Product extends StockObject {
|
|
|
43
45
|
title: string;
|
|
44
46
|
description: string;
|
|
45
47
|
netPrice: number;
|
|
48
|
+
installationPrice: number;
|
|
46
49
|
vat: number;
|
|
47
50
|
color: string;
|
|
48
51
|
quantity: number;
|
|
@@ -59,6 +62,7 @@ export default class Product extends StockObject {
|
|
|
59
62
|
setTitle(title: string): string;
|
|
60
63
|
setDescription(description: string): string;
|
|
61
64
|
setNetPrice(netPrice: number): number;
|
|
65
|
+
setInstallationPrice(installationPrice: number): number;
|
|
62
66
|
setVat(vat: number): number;
|
|
63
67
|
setColor(color: string): string;
|
|
64
68
|
setQuantity(quantity: number): number;
|
|
@@ -9,6 +9,7 @@ export default class Product extends StockObject {
|
|
|
9
9
|
title;
|
|
10
10
|
description;
|
|
11
11
|
netPrice;
|
|
12
|
+
installationPrice;
|
|
12
13
|
vat;
|
|
13
14
|
color;
|
|
14
15
|
quantity;
|
|
@@ -21,13 +22,14 @@ export default class Product extends StockObject {
|
|
|
21
22
|
file;
|
|
22
23
|
jsonData;
|
|
23
24
|
files;
|
|
24
|
-
constructor(sku, url, title, description, netPrice, vat, color, quantity, width, length, height, fileId, jsonData, deleted = false) {
|
|
25
|
+
constructor(sku, url, title, description, netPrice, installationPrice, vat, color, quantity, width, length, height, fileId, jsonData, deleted = false) {
|
|
25
26
|
super();
|
|
26
27
|
this.sku = sku;
|
|
27
28
|
this.url = url;
|
|
28
29
|
this.title = title;
|
|
29
30
|
this.description = description;
|
|
30
31
|
this.netPrice = netPrice;
|
|
32
|
+
this.installationPrice = installationPrice;
|
|
31
33
|
this.vat = vat;
|
|
32
34
|
this.color = color;
|
|
33
35
|
this.quantity = quantity;
|
|
@@ -56,6 +58,9 @@ export default class Product extends StockObject {
|
|
|
56
58
|
getNetPrice() {
|
|
57
59
|
return PriceConverter.netToGrossPrice(this.netPrice, this.vat);
|
|
58
60
|
}
|
|
61
|
+
getInstallationPrice() {
|
|
62
|
+
return this.installationPrice;
|
|
63
|
+
}
|
|
59
64
|
getGrossPrice() {
|
|
60
65
|
return this.netPrice;
|
|
61
66
|
}
|
|
@@ -114,6 +119,7 @@ export default class Product extends StockObject {
|
|
|
114
119
|
title: this.title,
|
|
115
120
|
description: this.description,
|
|
116
121
|
netPrice: this.netPrice,
|
|
122
|
+
installationPrice: this.installationPrice,
|
|
117
123
|
vat: this.vat,
|
|
118
124
|
color: this.color,
|
|
119
125
|
quantity: this.quantity,
|
|
@@ -143,6 +149,9 @@ export default class Product extends StockObject {
|
|
|
143
149
|
setNetPrice(netPrice) {
|
|
144
150
|
return this.netPrice = netPrice;
|
|
145
151
|
}
|
|
152
|
+
setInstallationPrice(installationPrice) {
|
|
153
|
+
return this.installationPrice = installationPrice;
|
|
154
|
+
}
|
|
146
155
|
setVat(vat) {
|
|
147
156
|
return this.vat = vat;
|
|
148
157
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
declare enum TableNames {
|
|
2
2
|
adminAccounts = "adminAccountsTable",
|
|
3
3
|
clientAccounts = "clientAccountsTable",
|
|
4
|
-
|
|
4
|
+
accountDeliveryDetails = "accountDeliveryDetailsTable",
|
|
5
|
+
accountCompanyDetails = "accountCompanyDetailsTable",
|
|
5
6
|
fileConnections = "fileConnectionsTable",
|
|
6
7
|
files = "filesTable",
|
|
7
8
|
ordersProducts = "ordersProductsTable",
|
|
@@ -2,7 +2,8 @@ var TableNames;
|
|
|
2
2
|
(function (TableNames) {
|
|
3
3
|
TableNames["adminAccounts"] = "adminAccountsTable";
|
|
4
4
|
TableNames["clientAccounts"] = "clientAccountsTable";
|
|
5
|
-
TableNames["
|
|
5
|
+
TableNames["accountDeliveryDetails"] = "accountDeliveryDetailsTable";
|
|
6
|
+
TableNames["accountCompanyDetails"] = "accountCompanyDetailsTable";
|
|
6
7
|
TableNames["fileConnections"] = "fileConnectionsTable";
|
|
7
8
|
TableNames["files"] = "filesTable";
|
|
8
9
|
TableNames["ordersProducts"] = "ordersProductsTable";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Table } from '@dascompany/database';
|
|
2
|
+
import AccountCompanyDetailsRow from '../../types/rows/AccountCompanyDetailsRow';
|
|
3
|
+
export default class AccountCompanyDetailsTable extends Table {
|
|
4
|
+
selectAll(accountId: number): Promise<AccountCompanyDetailsRow[]>;
|
|
5
|
+
delete(companyDetailsId: number): Promise<number>;
|
|
6
|
+
insert(acoountId: number, companyDetailsId: number): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Table } from '@dascompany/database';
|
|
2
|
+
import * as SQL from '../../SQL.json';
|
|
3
|
+
export default class AccountCompanyDetailsTable extends Table {
|
|
4
|
+
async selectAll(accountId) {
|
|
5
|
+
const query = this.createQuery(SQL.accountCompanyDetails.select);
|
|
6
|
+
query.bindParameter('account_id', accountId);
|
|
7
|
+
const result = await query.execute();
|
|
8
|
+
return result.getRows();
|
|
9
|
+
}
|
|
10
|
+
async delete(companyDetailsId) {
|
|
11
|
+
const query = this.createQuery(SQL.accountCompanyDetails.delete);
|
|
12
|
+
query.bindParameter('company_details_id', companyDetailsId);
|
|
13
|
+
const result = await query.execute();
|
|
14
|
+
return result.getRowCount();
|
|
15
|
+
}
|
|
16
|
+
async insert(acoountId, companyDetailsId) {
|
|
17
|
+
const query = this.createQuery(SQL.accountCompanyDetails.insert);
|
|
18
|
+
query.bindParameter('company_details_id', companyDetailsId);
|
|
19
|
+
query.bindParameter('account_id', acoountId);
|
|
20
|
+
await query.execute();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Table } from '@dascompany/database';
|
|
2
|
+
import AccountDeliveryDetailsRow from '../../types/rows/AccountDeliveryDetailsRow';
|
|
3
|
+
export default class AccountDeliveryDetailsTable extends Table {
|
|
4
|
+
selectAll(accountId: number): Promise<AccountDeliveryDetailsRow[]>;
|
|
5
|
+
delete(deliveryDetailsId: number): Promise<number>;
|
|
6
|
+
insert(acoountId: number, deliveryDetailsId: number): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Table } from '@dascompany/database';
|
|
2
|
+
import * as SQL from '../../SQL.json';
|
|
3
|
+
export default class AccountDeliveryDetailsTable extends Table {
|
|
4
|
+
async selectAll(accountId) {
|
|
5
|
+
const query = this.createQuery(SQL.accountDeliveryDetails.select);
|
|
6
|
+
query.bindParameter('account_id', accountId);
|
|
7
|
+
const result = await query.execute();
|
|
8
|
+
return result.getRows();
|
|
9
|
+
}
|
|
10
|
+
async delete(deliveryDetailsId) {
|
|
11
|
+
const query = this.createQuery(SQL.accountDeliveryDetails.delete);
|
|
12
|
+
query.bindParameter('delivery_details_id', deliveryDetailsId);
|
|
13
|
+
const result = await query.execute();
|
|
14
|
+
return result.getRowCount();
|
|
15
|
+
}
|
|
16
|
+
async insert(acoountId, deliveryDetailsId) {
|
|
17
|
+
const query = this.createQuery(SQL.accountDeliveryDetails.insert);
|
|
18
|
+
query.bindParameter('delivery_details_id', deliveryDetailsId);
|
|
19
|
+
query.bindParameter('account_id', acoountId);
|
|
20
|
+
await query.execute();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -36,9 +36,9 @@ export default class ClientAccountsTable extends Table {
|
|
|
36
36
|
bindParameters(query, clientAccount) {
|
|
37
37
|
query.bindParameter('activated', clientAccount.getActivated());
|
|
38
38
|
query.bindParameter('deleted', clientAccount.getDeleted());
|
|
39
|
-
query.bindParameter('
|
|
39
|
+
query.bindParameter('personal_data_id', clientAccount.getPersonalDataId());
|
|
40
40
|
query.bindParameter('delivery_details_id', clientAccount.getDeliveryDetailsId());
|
|
41
|
-
query.bindParameter('
|
|
41
|
+
query.bindParameter('company_details_id', clientAccount.getCompanyDetailsId());
|
|
42
42
|
}
|
|
43
43
|
async insert(clientAccount) {
|
|
44
44
|
const clientEmail = clientAccount.getEmail();
|
|
@@ -68,6 +68,7 @@ export default class ProductsTable extends Table {
|
|
|
68
68
|
query.bindParameter('title', product.getTitle());
|
|
69
69
|
query.bindParameter('description', product.getDescription());
|
|
70
70
|
query.bindParameter('net_price', product.getNetPrice());
|
|
71
|
+
query.bindParameter('installation_price', product.getInstallationPrice());
|
|
71
72
|
query.bindParameter('vat', product.getVat());
|
|
72
73
|
query.bindParameter('color', product.getColor());
|
|
73
74
|
query.bindParameter('quantity', product.getQuantity());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/ProductI.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|