@dascompany/product 3.2.4 → 3.2.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.
Files changed (53) hide show
  1. package/dist/SQL.json +1 -1
  2. package/dist/tables/orders/OrdersTable.js +1 -1
  3. package/package.json +1 -1
  4. package/dist/mappers/AccountAddressMapper.d.ts +0 -9
  5. package/dist/mappers/AccountAddressMapper.js +0 -19
  6. package/dist/mappers/ContactDetailsMapper.d.ts +0 -9
  7. package/dist/mappers/ContactDetailsMapper.js +0 -18
  8. package/dist/mappers/InvoiceDetailsMapper.d.ts +0 -9
  9. package/dist/mappers/InvoiceDetailsMapper.js +0 -17
  10. package/dist/reader/AccountAddressesReader.d.ts +0 -7
  11. package/dist/reader/AccountAddressesReader.js +0 -26
  12. package/dist/reader/ContactDetailsReader.d.ts +0 -5
  13. package/dist/reader/ContactDetailsReader.js +0 -16
  14. package/dist/reader/InvoiceDetailsReader.d.ts +0 -5
  15. package/dist/reader/InvoiceDetailsReader.js +0 -21
  16. package/dist/repo/AccountAddressesRepo.d.ts +0 -6
  17. package/dist/repo/AccountAddressesRepo.js +0 -13
  18. package/dist/repo/ContactDetailsRepo.d.ts +0 -7
  19. package/dist/repo/ContactDetailsRepo.js +0 -17
  20. package/dist/repo/InvoiceDetailsRepo.d.ts +0 -6
  21. package/dist/repo/InvoiceDetailsRepo.js +0 -13
  22. package/dist/repo/OrderStatusRepo.d.ts +0 -8
  23. package/dist/repo/OrderStatusRepo.js +0 -25
  24. package/dist/stockObjects/AccountAddress.d.ts +0 -11
  25. package/dist/stockObjects/AccountAddress.js +0 -26
  26. package/dist/stockObjects/ContactDetails.d.ts +0 -11
  27. package/dist/stockObjects/ContactDetails.js +0 -26
  28. package/dist/stockObjects/InvoiceDetails.d.ts +0 -11
  29. package/dist/stockObjects/InvoiceDetails.js +0 -26
  30. package/dist/tables/clients/AccountAddressesTable.d.ts +0 -12
  31. package/dist/tables/clients/AccountAddressesTable.js +0 -41
  32. package/dist/tables/clients/AccountDeliveryDetailsTable copy.d.ts +0 -7
  33. package/dist/tables/clients/AccountDeliveryDetailsTable copy.js +0 -22
  34. package/dist/tables/personalInformation/ContactDetailsTable.d.ts +0 -10
  35. package/dist/tables/personalInformation/ContactDetailsTable.js +0 -33
  36. package/dist/tables/personalInformation/InvoiceDetailsTable.d.ts +0 -10
  37. package/dist/tables/personalInformation/InvoiceDetailsTable.js +0 -33
  38. package/dist/types/AccountAddressesI.d.ts +0 -6
  39. package/dist/types/AccountAddressesI.js +0 -1
  40. package/dist/types/ContactDetailsI.d.ts +0 -7
  41. package/dist/types/ContactDetailsI.js +0 -1
  42. package/dist/types/InvoiceDetailsI.d.ts +0 -7
  43. package/dist/types/InvoiceDetailsI.js +0 -1
  44. package/dist/types/rows/AccountAddressesRow.d.ts +0 -5
  45. package/dist/types/rows/AccountAddressesRow.js +0 -1
  46. package/dist/types/rows/ContactDetailsRow.d.ts +0 -5
  47. package/dist/types/rows/ContactDetailsRow.js +0 -1
  48. package/dist/types/rows/InvoiceDetailsRow.d.ts +0 -5
  49. package/dist/types/rows/InvoiceDetailsRow.js +0 -1
  50. package/dist/utils/calculateNetToGrossPrice.d.ts +0 -1
  51. package/dist/utils/calculateNetToGrossPrice.js +0 -7
  52. package/dist/utils/getTentInstallationPrice.d.ts +0 -2
  53. package/dist/utils/getTentInstallationPrice.js +0 -14
package/dist/SQL.json CHANGED
@@ -68,7 +68,7 @@
68
68
  "orders": {
69
69
  "select": "SELECT * FROM orders.orders",
70
70
  "insert": "INSERT INTO orders.orders( id, email, price, client_id, delivery_details_id, company_details_id, payment_details_id, invoice ) VALUES ($order_id::BIGINT, $email::TEXT, $price::DOUBLE PRECISION, $client_id::BIGINT, $delivery_details_id::BIGINT , $company_details_id::BIGINT, $payment_details_id::BIGINT, $invoice::BOOL )",
71
- "update": "UPDATE orders.orders SET price = $price::DOUBLE PRECISION, delivery_details_id = $delivery_details_id::BIGINT, company_details_id = $company_details_id::BIGINT, payment_details_id = $payment_details_id::BIGINT, zsi_id = $zsi_id::BIGINT, invoice = $invoice::BIGINT WHERE id = $id::BIGINT",
71
+ "update": "UPDATE orders.orders SET price = $price::DOUBLE PRECISION, delivery_details_id = $delivery_details_id::BIGINT, company_details_id = $company_details_id::BIGINT, payment_details_id = $payment_details_id::BIGINT, zsi_id = $zsi_id::BIGINT, invoice = $invoice::BOOL WHERE id = $id::BIGINT",
72
72
  "count": "SELECT COUNT (*) AS TOTAL_ROWS FROM orders.orders",
73
73
  "selectNextId": "SELECT nextval('orders.orders_id'::regclass)"
74
74
  },
@@ -37,10 +37,10 @@ export default class OrdersTable extends Table {
37
37
  query.bindParameter('email', order.getEmail());
38
38
  query.bindParameter('price', order.getPrice());
39
39
  query.bindParameter('client_id', order.getClientId());
40
- query.bindParameter('invoice', order.isInvoice());
41
40
  this.bindDetailsParameters(query, order);
42
41
  }
43
42
  bindDetailsParameters(query, order) {
43
+ query.bindParameter('invoice', order.isInvoice());
44
44
  query.bindParameter('delivery_details_id', order.getDeliveryDetailsId());
45
45
  query.bindParameter('company_details_id', order.getCompanyDetailsId());
46
46
  query.bindParameter('payment_details_id', order.getPaymentDetailsId());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dascompany/product",
3
- "version": "3.2.4",
3
+ "version": "3.2.6",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "vitest",
@@ -1,9 +0,0 @@
1
- import { StockObjectMapper } from "@dascompany/database";
2
- import AccountAddress from "../stockObjects/AccountAddress";
3
- export default class AccountAddressMapper implements StockObjectMapper {
4
- private accountAddress;
5
- private accountAddressessTable;
6
- constructor(accountAddress: AccountAddress);
7
- save(): Promise<void>;
8
- delete(): Promise<void>;
9
- }
@@ -1,19 +0,0 @@
1
- import DatabaseConnection from "../DatabaseConnection";
2
- export default class AccountAddressMapper {
3
- accountAddress;
4
- accountAddressessTable;
5
- constructor(accountAddress) {
6
- this.accountAddressessTable = DatabaseConnection.getInstance().accountAddresses;
7
- this.accountAddress = accountAddress;
8
- }
9
- async save() {
10
- await this.accountAddressessTable.insert(this.accountAddress);
11
- }
12
- async delete() {
13
- const accountAddressId = this.accountAddress.getId();
14
- if (accountAddressId)
15
- await this.accountAddressessTable.delete(accountAddressId);
16
- else
17
- throw new Error('Can`t remove the order and product connection without providing its ID');
18
- }
19
- }
@@ -1,9 +0,0 @@
1
- import { StockObjectMapper } from "@dascompany/database";
2
- import ContactDetails from "../stockObjects/ContactDetails";
3
- export default class ContactDetailsMapper implements StockObjectMapper {
4
- private contactDetails;
5
- private contactDetailsTable;
6
- constructor(contactDetails: ContactDetails);
7
- save(): Promise<void>;
8
- delete(): Promise<void>;
9
- }
@@ -1,18 +0,0 @@
1
- import DatabaseConnection from "../DatabaseConnection";
2
- export default class ContactDetailsMapper {
3
- contactDetails;
4
- contactDetailsTable;
5
- constructor(contactDetails) {
6
- this.contactDetailsTable = DatabaseConnection.getInstance().contactDetails;
7
- this.contactDetails = contactDetails;
8
- }
9
- async save() {
10
- if (this.contactDetails.getId())
11
- await this.contactDetailsTable.update(this.contactDetails);
12
- else
13
- await this.contactDetailsTable.insert(this.contactDetails);
14
- }
15
- async delete() {
16
- throw Error('Method not impemented');
17
- }
18
- }
@@ -1,9 +0,0 @@
1
- import { StockObjectMapper } from '@dascompany/database';
2
- import InvoiceDetails from '../stockObjects/InvoiceDetails';
3
- export default class InvoiceDetailsMapper implements StockObjectMapper {
4
- private invoiceDetails;
5
- private invoiceDetailsTable;
6
- constructor(invoiceDetails: InvoiceDetails);
7
- save(): Promise<void>;
8
- delete(): Promise<void>;
9
- }
@@ -1,17 +0,0 @@
1
- import DatabaseConnection from '../DatabaseConnection';
2
- export default class InvoiceDetailsMapper {
3
- invoiceDetails;
4
- invoiceDetailsTable;
5
- constructor(invoiceDetails) {
6
- this.invoiceDetailsTable = DatabaseConnection.getInstance().invoiceDetails;
7
- this.invoiceDetails = invoiceDetails;
8
- }
9
- async save() {
10
- if (this.invoiceDetails.getId())
11
- await this.invoiceDetailsTable.update(this.invoiceDetails);
12
- else
13
- await this.invoiceDetailsTable.insert(this.invoiceDetails);
14
- }
15
- async delete() {
16
- }
17
- }
@@ -1,7 +0,0 @@
1
- import { QueryOptions } from "@dascompany/database";
2
- import AccountAddressesI from "../types/AccountAddressesI";
3
- export default class AccountAddressesReader {
4
- static getAll(queryOptions?: QueryOptions): Promise<AccountAddressesI[]>;
5
- private static correctAccountAddresses;
6
- private static correctAccountAddress;
7
- }
@@ -1,26 +0,0 @@
1
- import DatabaseConnection from "../DatabaseConnection";
2
- import AddressesReader from "./AddressesReader";
3
- import createQueryOptionsForId from "../utils/createQueryOptionsForId";
4
- export default class AccountAddressesReader {
5
- static async getAll(queryOptions) {
6
- const accountAddresses = await DatabaseConnection.getInstance().accountAddresses.selectAll(queryOptions);
7
- return this.correctAccountAddresses(accountAddresses);
8
- }
9
- static async correctAccountAddresses(accountAddresses) {
10
- const correctAccountAddresses = [];
11
- for (let i = 0; i < accountAddresses.length; i++) {
12
- const correctAccountAddress = await this.correctAccountAddress(accountAddresses[i]);
13
- correctAccountAddresses.push(correctAccountAddress);
14
- }
15
- return correctAccountAddresses;
16
- }
17
- static async correctAccountAddress(accountAddress) {
18
- const address = await AddressesReader.get(createQueryOptionsForId(accountAddress.address_id));
19
- const correctAddress = {
20
- id: accountAddress.id,
21
- accountId: accountAddress.account_id,
22
- address: address
23
- };
24
- return correctAddress;
25
- }
26
- }
@@ -1,5 +0,0 @@
1
- import { QueryOptions } from "@dascompany/database";
2
- import ContactDetailsI from "../types/ContactDetailsI";
3
- export default class ContactDetailsReader {
4
- static get(queryOptions: QueryOptions): Promise<ContactDetailsI>;
5
- }
@@ -1,16 +0,0 @@
1
- import DatabaseConnection from "../DatabaseConnection";
2
- import AddressesReader from "./AddressesReader";
3
- import PersonalDataReader from "./PersonalDataReader";
4
- import createQueryOptionsForId from "../utils/createQueryOptionsForId";
5
- export default class ContactDetailsReader {
6
- static async get(queryOptions) {
7
- const contactDetails = await DatabaseConnection.getInstance().contactDetails.select(queryOptions);
8
- const personalData = await PersonalDataReader.get(createQueryOptionsForId(contactDetails.personal_data_id));
9
- const address = contactDetails.address_id ? await AddressesReader.get(createQueryOptionsForId(contactDetails.address_id)) : null;
10
- return {
11
- id: contactDetails.id,
12
- personalData,
13
- address
14
- };
15
- }
16
- }
@@ -1,5 +0,0 @@
1
- import { QueryOptions } from "@dascompany/database";
2
- import InvoiceDetailsI from "../types/InvoiceDetailsI";
3
- export default class InvoiceDetailsReader {
4
- static get(queryOptions: QueryOptions): Promise<InvoiceDetailsI>;
5
- }
@@ -1,21 +0,0 @@
1
- import DatabaseConnection from "../DatabaseConnection";
2
- import AddressesReader from "./AddressesReader";
3
- import PersonalDataReader from "./PersonalDataReader";
4
- import createQueryOptionsForId from "../utils/createQueryOptionsForId";
5
- export default class InvoiceDetailsReader {
6
- static async get(queryOptions) {
7
- const invoiceDetails = await DatabaseConnection.getInstance().invoiceDetails.select(queryOptions);
8
- const id = invoiceDetails.id;
9
- let personalData = null;
10
- let address = null;
11
- if (invoiceDetails.personal_data_id)
12
- personalData = await PersonalDataReader.get(createQueryOptionsForId(invoiceDetails.personal_data_id));
13
- if (invoiceDetails.address_id)
14
- address = await AddressesReader.get(createQueryOptionsForId(invoiceDetails.address_id));
15
- return {
16
- id,
17
- personalData,
18
- address
19
- };
20
- }
21
- }
@@ -1,6 +0,0 @@
1
- import { QueryOptions } from "@dascompany/database";
2
- import AccountAddress from "../stockObjects/AccountAddress";
3
- export default class AccountAddressesRepo {
4
- static get(queryOptions: QueryOptions): Promise<AccountAddress>;
5
- private static createAccountAddressFromRow;
6
- }
@@ -1,13 +0,0 @@
1
- import DatabaseConnection from "../DatabaseConnection";
2
- import AccountAddress from "../stockObjects/AccountAddress";
3
- export default class AccountAddressesRepo {
4
- static async get(queryOptions) {
5
- const accountAddress = await DatabaseConnection.getInstance().accountAddresses.select(queryOptions);
6
- return this.createAccountAddressFromRow(accountAddress);
7
- }
8
- static async createAccountAddressFromRow(dataRow) {
9
- const accountAddress = new AccountAddress(dataRow.account_id, dataRow.address_id);
10
- accountAddress.setId(dataRow.id);
11
- return accountAddress;
12
- }
13
- }
@@ -1,7 +0,0 @@
1
- import { QueryOptions } from "@dascompany/database";
2
- import ContactDetails from "../stockObjects/ContactDetails";
3
- export default class ContactDetailsRepo {
4
- static get(queryOptions: QueryOptions): Promise<ContactDetails>;
5
- static getNextId(): Promise<number>;
6
- private static createContactDetailsFromRow;
7
- }
@@ -1,17 +0,0 @@
1
- import DatabaseConnection from "../DatabaseConnection";
2
- import ContactDetails from "../stockObjects/ContactDetails";
3
- export default class ContactDetailsRepo {
4
- static async get(queryOptions) {
5
- const contactDetailsRow = await DatabaseConnection.getInstance().contactDetails.select(queryOptions);
6
- return this.createContactDetailsFromRow(contactDetailsRow);
7
- }
8
- static async getNextId() {
9
- const contactDetails = await DatabaseConnection.getInstance().contactDetails.selectNextId();
10
- return contactDetails;
11
- }
12
- static createContactDetailsFromRow(contactDetailsRow) {
13
- const contactDetails = new ContactDetails(contactDetailsRow.personal_data_id, contactDetailsRow.address_id);
14
- contactDetails.setId(contactDetailsRow.id);
15
- return contactDetails;
16
- }
17
- }
@@ -1,6 +0,0 @@
1
- import { QueryOptions } from "@dascompany/database";
2
- import InvoiceDetails from "../stockObjects/InvoiceDetails";
3
- export default class InvoiceDetailsRepo {
4
- static get(queryOptions: QueryOptions): Promise<InvoiceDetails>;
5
- private static createInvoiceDetailsFromRow;
6
- }
@@ -1,13 +0,0 @@
1
- import DatabaseConnection from "../DatabaseConnection";
2
- import InvoiceDetails from "../stockObjects/InvoiceDetails";
3
- export default class InvoiceDetailsRepo {
4
- static async get(queryOptions) {
5
- const invoiceDetailsRow = await DatabaseConnection.getInstance().invoiceDetails.select(queryOptions);
6
- return this.createInvoiceDetailsFromRow(invoiceDetailsRow);
7
- }
8
- static createInvoiceDetailsFromRow(invoiceDetailsRow) {
9
- const invoiceDetails = new InvoiceDetails(invoiceDetailsRow.personal_data_id, invoiceDetailsRow.address_id);
10
- invoiceDetails.setId(invoiceDetailsRow.id);
11
- return invoiceDetails;
12
- }
13
- }
@@ -1,8 +0,0 @@
1
- import { QueryOptions } from "@dascompany/database";
2
- import Status from "../stockObjects/Status";
3
- export default class OrderStatusRepo {
4
- static get(queryOptions: QueryOptions): Promise<Status>;
5
- static getAll(queryOptions?: QueryOptions): Promise<Status[]>;
6
- private static createStatusesFromRows;
7
- private static createStatusFromRow;
8
- }
@@ -1,25 +0,0 @@
1
- import DatabaseConnection from "../DatabaseConnection";
2
- import Status from "../stockObjects/Status";
3
- export default class OrderStatusRepo {
4
- static async get(queryOptions) {
5
- const status = await DatabaseConnection.getInstance().statuses.select(queryOptions);
6
- return this.createStatusFromRow(status);
7
- }
8
- static async getAll(queryOptions) {
9
- const statuses = await DatabaseConnection.getInstance().statuses.selectAll(queryOptions);
10
- return this.createStatusesFromRows(statuses);
11
- }
12
- static async createStatusesFromRows(dataRows) {
13
- const statuses = [];
14
- for (const dataRow of dataRows) {
15
- const status = await this.createStatusFromRow(dataRow);
16
- statuses.push(status);
17
- }
18
- return statuses;
19
- }
20
- static async createStatusFromRow(dataRow) {
21
- const status = new Status(dataRow.order_id, dataRow.user_id, dataRow.type, dataRow.created_at);
22
- status.setId(dataRow.id);
23
- return status;
24
- }
25
- }
@@ -1,11 +0,0 @@
1
- import { StockObject, StockObjectMapper } from "@dascompany/database";
2
- export default class AccountAddress extends StockObject {
3
- private accountId;
4
- private addressId;
5
- constructor(accountId: number, addressId: number);
6
- getAccountId(): number;
7
- getAddressId(): number;
8
- setAccountId(accountId: number): void;
9
- setAddressId(addressId: number): void;
10
- protected getMapper(): StockObjectMapper;
11
- }
@@ -1,26 +0,0 @@
1
- import { StockObject } from "@dascompany/database";
2
- import AccountAddressMapper from "../mappers/AccountAddressMapper";
3
- export default class AccountAddress extends StockObject {
4
- accountId;
5
- addressId;
6
- constructor(accountId, addressId) {
7
- super();
8
- this.accountId = accountId;
9
- this.addressId = addressId;
10
- }
11
- getAccountId() {
12
- return this.accountId;
13
- }
14
- getAddressId() {
15
- return this.addressId;
16
- }
17
- setAccountId(accountId) {
18
- this.accountId = accountId;
19
- }
20
- setAddressId(addressId) {
21
- this.addressId = addressId;
22
- }
23
- getMapper() {
24
- return new AccountAddressMapper(this);
25
- }
26
- }
@@ -1,11 +0,0 @@
1
- import { StockObject, StockObjectMapper } from "@dascompany/database";
2
- export default class ContactDetails extends StockObject {
3
- private personalDataId;
4
- private addressId;
5
- constructor(personalDataId: number, addressId: number | null);
6
- getPersonalDataId(): number | null;
7
- getAddressId(): number | null;
8
- setAddressId(addressId: number): number;
9
- setPersonalDataId(personalDataId: number): number;
10
- protected getMapper(): StockObjectMapper;
11
- }
@@ -1,26 +0,0 @@
1
- import { StockObject } from "@dascompany/database";
2
- import ContactDetailsMapper from "../mappers/ContactDetailsMapper";
3
- export default class ContactDetails extends StockObject {
4
- personalDataId;
5
- addressId;
6
- constructor(personalDataId, addressId) {
7
- super();
8
- this.personalDataId = personalDataId;
9
- this.addressId = addressId;
10
- }
11
- getPersonalDataId() {
12
- return this.personalDataId;
13
- }
14
- getAddressId() {
15
- return this.addressId;
16
- }
17
- setAddressId(addressId) {
18
- return this.addressId = addressId;
19
- }
20
- setPersonalDataId(personalDataId) {
21
- return this.personalDataId = personalDataId;
22
- }
23
- getMapper() {
24
- return new ContactDetailsMapper(this);
25
- }
26
- }
@@ -1,11 +0,0 @@
1
- import { StockObject, StockObjectMapper } from "@dascompany/database";
2
- export default class InvoiceDetails extends StockObject {
3
- private personalDataId;
4
- private addressId;
5
- constructor(personalDataId: number, addressId: number);
6
- getPersonalDataId(): number | null;
7
- getAddressId(): number | null;
8
- setAddressId(addressId: number): number;
9
- setPersonalDataId(personalDataId: number): number;
10
- protected getMapper(): StockObjectMapper;
11
- }
@@ -1,26 +0,0 @@
1
- import { StockObject } from "@dascompany/database";
2
- import InvoiceDetailsMapper from "../mappers/InvoiceDetailsMapper";
3
- export default class InvoiceDetails extends StockObject {
4
- personalDataId;
5
- addressId;
6
- constructor(personalDataId, addressId) {
7
- super();
8
- this.personalDataId = personalDataId;
9
- this.addressId = addressId;
10
- }
11
- getPersonalDataId() {
12
- return this.personalDataId;
13
- }
14
- getAddressId() {
15
- return this.addressId;
16
- }
17
- setAddressId(addressId) {
18
- return this.addressId = addressId;
19
- }
20
- setPersonalDataId(personalDataId) {
21
- return this.personalDataId = personalDataId;
22
- }
23
- getMapper() {
24
- return new InvoiceDetailsMapper(this);
25
- }
26
- }
@@ -1,12 +0,0 @@
1
- import { QueryOptions, Table } from '@dascompany/database';
2
- import AccountAddressesRow from '../../types/rows/AccountAddressesRow';
3
- import AccountAddress from '../../stockObjects/AccountAddress';
4
- export default class AccountAddressesTable extends Table {
5
- select(queryOptions: QueryOptions): Promise<AccountAddressesRow>;
6
- selectAll(queryOptions?: QueryOptions): Promise<AccountAddressesRow[]>;
7
- selectId(queryOptions: QueryOptions): Promise<number | null>;
8
- delete(id: number): Promise<number>;
9
- private bindParameters;
10
- insert(AccountAddresses: AccountAddress): Promise<void>;
11
- private selectNextId;
12
- }
@@ -1,41 +0,0 @@
1
- import { Table } from '@dascompany/database';
2
- import * as SQL from '../../SQL.json';
3
- export default class AccountAddressesTable extends Table {
4
- async select(queryOptions) {
5
- const query = this.createQuery(SQL.accountAddresses.select, queryOptions);
6
- const result = await query.execute();
7
- return result.getRow();
8
- }
9
- async selectAll(queryOptions) {
10
- const query = this.createQuery(SQL.accountAddresses.select, queryOptions);
11
- const result = await query.execute();
12
- return result.getRows();
13
- }
14
- async selectId(queryOptions) {
15
- const query = this.createQuery(SQL.accountAddresses.selectId, queryOptions);
16
- const result = await query.execute();
17
- return result.getValue();
18
- }
19
- async delete(id) {
20
- const query = this.createQuery(SQL.accountAddresses.delete);
21
- query.bindParameter('id', id);
22
- const result = await query.execute();
23
- return result.getRowCount();
24
- }
25
- bindParameters(query, AccountAddresses) {
26
- query.bindParameter('account_id', AccountAddresses.getAccountId());
27
- query.bindParameter('address_id', AccountAddresses.getAddressId());
28
- }
29
- async insert(AccountAddresses) {
30
- const id = await this.selectNextId();
31
- const query = this.createQuery(SQL.accountAddresses.insert);
32
- this.bindParameters(query, AccountAddresses);
33
- await query.execute();
34
- AccountAddresses.setId(id);
35
- }
36
- async selectNextId() {
37
- const query = this.createQuery(SQL.accountAddresses.selectNextId);
38
- const result = await query.execute();
39
- return result.getValue();
40
- }
41
- }
@@ -1,7 +0,0 @@
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
- }
@@ -1,22 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
1
- import { QueryOptions, Table } from '@dascompany/database';
2
- import ContactDetails from '../../stockObjects/ContactDetails';
3
- import ContactDetailsRow from '../../types/rows/ContactDetailsRow';
4
- export default class ContactDetailsTable extends Table {
5
- select(queryOptions: QueryOptions): Promise<ContactDetailsRow>;
6
- insert(contactDetails: ContactDetails): Promise<void>;
7
- update(contactDetails: ContactDetails): Promise<void>;
8
- selectNextId(): Promise<number>;
9
- private bindParameters;
10
- }
@@ -1,33 +0,0 @@
1
- import { Table } from '@dascompany/database';
2
- import * as SQL from '../../SQL.json';
3
- export default class ContactDetailsTable extends Table {
4
- async select(queryOptions) {
5
- const query = this.createQuery(SQL.contactDetails.select, queryOptions);
6
- const result = await query.execute();
7
- return result.getRow();
8
- }
9
- async insert(contactDetails) {
10
- const id = await this.selectNextId();
11
- const query = this.createQuery(SQL.contactDetails.insert);
12
- query.bindParameter('id', id);
13
- this.bindParameters(query, contactDetails);
14
- await query.execute();
15
- contactDetails.setId(id);
16
- }
17
- async update(contactDetails) {
18
- const query = this.createQuery(SQL.contactDetails.update);
19
- const id = contactDetails.getId();
20
- query.bindParameter('id', id);
21
- this.bindParameters(query, contactDetails);
22
- await query.execute();
23
- }
24
- async selectNextId() {
25
- const query = this.createQuery(SQL.contactDetails.selectNextId);
26
- const result = await query.execute();
27
- return result.getValue();
28
- }
29
- bindParameters(query, contactDetails) {
30
- query.bindParameter('personal_data_id', contactDetails.getPersonalDataId());
31
- query.bindParameter('address_id', contactDetails.getAddressId());
32
- }
33
- }
@@ -1,10 +0,0 @@
1
- import { QueryOptions, Table } from '@dascompany/database';
2
- import InvoiceDetails from '../../stockObjects/InvoiceDetails';
3
- import InvoiceDetailsRow from '../../types/rows/InvoiceDetailsRow';
4
- export default class InvoiceDetailsTable extends Table {
5
- select(queryOptions: QueryOptions): Promise<InvoiceDetailsRow>;
6
- insert(invoiceDetails: InvoiceDetails): Promise<void>;
7
- update(invoiceDetails: InvoiceDetails): Promise<void>;
8
- private selectNextId;
9
- private bindParameters;
10
- }
@@ -1,33 +0,0 @@
1
- import { Table } from '@dascompany/database';
2
- import * as SQL from '../../SQL.json';
3
- export default class InvoiceDetailsTable extends Table {
4
- async select(queryOptions) {
5
- const query = this.createQuery(SQL.invoiceDetails.select, queryOptions);
6
- const result = await query.execute();
7
- return result.getRow();
8
- }
9
- async insert(invoiceDetails) {
10
- const id = await this.selectNextId();
11
- const query = this.createQuery(SQL.invoiceDetails.insert);
12
- query.bindParameter('id', id);
13
- this.bindParameters(query, invoiceDetails);
14
- await query.execute();
15
- invoiceDetails.setId(id);
16
- }
17
- async update(invoiceDetails) {
18
- const id = invoiceDetails.getId();
19
- const query = this.createQuery(SQL.invoiceDetails.update);
20
- query.bindParameter('id', id);
21
- this.bindParameters(query, invoiceDetails);
22
- await query.execute();
23
- }
24
- async selectNextId() {
25
- const query = this.createQuery(SQL.invoiceDetails.selectNextId);
26
- const result = await query.execute();
27
- return result.getValue();
28
- }
29
- bindParameters(query, invoiceDetails) {
30
- query.bindParameter('personal_data_id', invoiceDetails.getPersonalDataId());
31
- query.bindParameter('address_id', invoiceDetails.getAddressId());
32
- }
33
- }
@@ -1,6 +0,0 @@
1
- import AddressI from "./AddressI";
2
- export default interface AccountAddressesI {
3
- id: number;
4
- accountId: number;
5
- address: AddressI;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import AddressI from "./AddressI";
2
- import PersonalDataI from "./PersonalDataI";
3
- export default interface ContactDetailsI {
4
- id: number;
5
- personalData: PersonalDataI | null;
6
- address: AddressI | null;
7
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import type AddressI from "./AddressI";
2
- import type PersonalDataI from "./PersonalDataI";
3
- export default interface InvoiceDetailsI {
4
- id: number | null;
5
- personalData: PersonalDataI | null;
6
- address: AddressI | null;
7
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export default interface AccountAddressesRow {
2
- id: number;
3
- account_id: number;
4
- address_id: number;
5
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export default interface ContactDetailsRow {
2
- id: number;
3
- personal_data_id: number;
4
- address_id: number;
5
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export default interface InvoiceDetailsRow {
2
- id: number;
3
- personal_data_id: number;
4
- address_id: number;
5
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export default function calculateNetToGrossPrice(netPrice: number, vatPercentage: number): number;
@@ -1,7 +0,0 @@
1
- export default function calculateNetToGrossPrice(netPrice, vatPercentage) {
2
- const netPriceInPenny = Math.round(netPrice * 100);
3
- const vatPriceInPenny = Math.round((netPriceInPenny * vatPercentage) / 100);
4
- const grossPriceInPenny = netPriceInPenny + vatPriceInPenny;
5
- const grossPrice = (grossPriceInPenny / 100).toFixed(2);
6
- return Number(grossPrice);
7
- }
@@ -1,2 +0,0 @@
1
- import ProductI from "../types/ProductI";
2
- export default function getTentInstallationPrice(productData: ProductI): Promise<number>;
@@ -1,14 +0,0 @@
1
- import { TentInstallation } from "@dascompany/zsi";
2
- export default async function getTentInstallationPrice(productData) {
3
- const constructionSplit = productData.jsonData.construction.type.split(' ');
4
- const tentData = {
5
- construction: constructionSplit[0],
6
- reinforcement: constructionSplit[1].toUpperCase() === 'POLAR',
7
- fireResistant: (productData.jsonData.cover.type === 'PVC - 600g' || productData.jsonData.cover.type === 'PVC - 620g'),
8
- width: productData.width,
9
- length: productData.length,
10
- height: productData.height
11
- };
12
- const installationPrice = await TentInstallation.getPrice(tentData);
13
- return installationPrice;
14
- }