@dascompany/product 4.3.0 → 4.4.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/index.d.ts +3 -61
- package/dist/index.js +1 -61
- package/package.json +1 -1
- package/dist/DatabaseConnection.d.ts +0 -57
- package/dist/DatabaseConnection.js +0 -165
- package/dist/SQL.json +0 -153
- package/dist/lib/errors/CilentAccountExistWithThisEmail.d.ts +0 -3
- package/dist/lib/errors/CilentAccountExistWithThisEmail.js +0 -5
- package/dist/mappers/AddressMapper.d.ts +0 -9
- package/dist/mappers/AddressMapper.js +0 -22
- package/dist/mappers/AdminMapper.d.ts +0 -9
- package/dist/mappers/AdminMapper.js +0 -24
- package/dist/mappers/ClientMapper.d.ts +0 -9
- package/dist/mappers/ClientMapper.js +0 -24
- package/dist/mappers/CompanyDataMapper.d.ts +0 -9
- package/dist/mappers/CompanyDataMapper.js +0 -17
- package/dist/mappers/CompanyDetailsMapper.d.ts +0 -9
- package/dist/mappers/CompanyDetailsMapper.js +0 -27
- package/dist/mappers/DeliveryDetailsMapper.d.ts +0 -9
- package/dist/mappers/DeliveryDetailsMapper.js +0 -30
- package/dist/mappers/DeliveryMethodsMapper.d.ts +0 -9
- package/dist/mappers/DeliveryMethodsMapper.js +0 -17
- package/dist/mappers/DeliveryStatusMapper.d.ts +0 -9
- package/dist/mappers/DeliveryStatusMapper.js +0 -15
- package/dist/mappers/FileConnectionMapper.d.ts +0 -9
- package/dist/mappers/FileConnectionMapper.js +0 -18
- package/dist/mappers/FileMapper.d.ts +0 -9
- package/dist/mappers/FileMapper.js +0 -17
- package/dist/mappers/OrderMapper.d.ts +0 -9
- package/dist/mappers/OrderMapper.js +0 -19
- package/dist/mappers/OrderProductMapper.d.ts +0 -9
- package/dist/mappers/OrderProductMapper.js +0 -19
- package/dist/mappers/PaymentDetailsMapper.d.ts +0 -9
- package/dist/mappers/PaymentDetailsMapper.js +0 -17
- package/dist/mappers/PaymentMethodsMapper.d.ts +0 -9
- package/dist/mappers/PaymentMethodsMapper.js +0 -17
- package/dist/mappers/PaymentStatusMapper.d.ts +0 -9
- package/dist/mappers/PaymentStatusMapper.js +0 -15
- package/dist/mappers/PersonalDataMapper.d.ts +0 -9
- package/dist/mappers/PersonalDataMapper.js +0 -22
- package/dist/mappers/ProductMapper.d.ts +0 -9
- package/dist/mappers/ProductMapper.js +0 -20
- package/dist/mappers/StatusMapper.d.ts +0 -9
- package/dist/mappers/StatusMapper.js +0 -15
- package/dist/reader/AccountCartReader.d.ts +0 -6
- package/dist/reader/AccountCartReader.js +0 -25
- package/dist/reader/AccountCompanyDetailsReader.d.ts +0 -5
- package/dist/reader/AccountCompanyDetailsReader.js +0 -17
- package/dist/reader/AccountDeliveryDetailsReader.d.ts +0 -5
- package/dist/reader/AccountDeliveryDetailsReader.js +0 -17
- package/dist/reader/AddressesReader.d.ts +0 -6
- package/dist/reader/AddressesReader.js +0 -18
- package/dist/reader/AdminReader.d.ts +0 -10
- package/dist/reader/AdminReader.js +0 -37
- package/dist/reader/ClientAccountReader.d.ts +0 -10
- package/dist/reader/ClientAccountReader.js +0 -39
- package/dist/reader/CompanyDataReader.d.ts +0 -4
- package/dist/reader/CompanyDataReader.js +0 -39
- package/dist/reader/CompanyDetailsReader.d.ts +0 -5
- package/dist/reader/CompanyDetailsReader.js +0 -18
- package/dist/reader/DeliveryDetailsReader.d.ts +0 -5
- package/dist/reader/DeliveryDetailsReader.js +0 -26
- package/dist/reader/DeliveryMethodReader.d.ts +0 -6
- package/dist/reader/DeliveryMethodReader.js +0 -11
- package/dist/reader/DeliveryStatusReader.d.ts +0 -6
- package/dist/reader/DeliveryStatusReader.js +0 -29
- package/dist/reader/FileConnectionsReader.d.ts +0 -7
- package/dist/reader/FileConnectionsReader.js +0 -24
- package/dist/reader/FilesReader.d.ts +0 -11
- package/dist/reader/FilesReader.js +0 -43
- package/dist/reader/MarketPlacesReader.d.ts +0 -8
- package/dist/reader/MarketPlacesReader.js +0 -28
- package/dist/reader/OrderProductsReader.d.ts +0 -7
- package/dist/reader/OrderProductsReader.js +0 -40
- package/dist/reader/OrderReader.d.ts +0 -10
- package/dist/reader/OrderReader.js +0 -57
- package/dist/reader/OrderStatusReader.d.ts +0 -6
- package/dist/reader/OrderStatusReader.js +0 -29
- package/dist/reader/PersonalDataReader.d.ts +0 -6
- package/dist/reader/PersonalDataReader.js +0 -19
- package/dist/reader/ProductReader.d.ts +0 -11
- package/dist/reader/ProductReader.js +0 -64
- package/dist/reader/StatusTypesReader.d.ts +0 -8
- package/dist/reader/StatusTypesReader.js +0 -11
- package/dist/reader/payment/PaymentDetailsReader.d.ts +0 -5
- package/dist/reader/payment/PaymentDetailsReader.js +0 -29
- package/dist/reader/payment/PaymentMethodReader.d.ts +0 -6
- package/dist/reader/payment/PaymentMethodReader.js +0 -11
- package/dist/reader/payment/PaymentStatusesReader.d.ts +0 -6
- package/dist/reader/payment/PaymentStatusesReader.js +0 -28
- package/dist/repo/AddressesRepo.d.ts +0 -6
- package/dist/repo/AddressesRepo.js +0 -13
- package/dist/repo/AdminRepo.d.ts +0 -8
- package/dist/repo/AdminRepo.js +0 -20
- package/dist/repo/ClientAccountRepo.d.ts +0 -6
- package/dist/repo/ClientAccountRepo.js +0 -13
- package/dist/repo/CompanyDataRepo.d.ts +0 -4
- package/dist/repo/CompanyDataRepo.js +0 -10
- package/dist/repo/CompanyDetailsRepo.d.ts +0 -6
- package/dist/repo/CompanyDetailsRepo.js +0 -13
- package/dist/repo/DeliveryDetailsRepo.d.ts +0 -6
- package/dist/repo/DeliveryDetailsRepo.js +0 -13
- package/dist/repo/DeliveryMethodRepo.d.ts +0 -5
- package/dist/repo/DeliveryMethodRepo.js +0 -10
- package/dist/repo/FileConnectionsRepo.d.ts +0 -8
- package/dist/repo/FileConnectionsRepo.js +0 -23
- package/dist/repo/FilesRepo.d.ts +0 -7
- package/dist/repo/FilesRepo.js +0 -24
- package/dist/repo/OrderProductsRepo.d.ts +0 -7
- package/dist/repo/OrderProductsRepo.js +0 -21
- package/dist/repo/OrderRepo.d.ts +0 -6
- package/dist/repo/OrderRepo.js +0 -13
- package/dist/repo/PaymentDetailsRepo.d.ts +0 -6
- package/dist/repo/PaymentDetailsRepo.js +0 -13
- package/dist/repo/PaymentMethodRepo.d.ts +0 -5
- package/dist/repo/PaymentMethodRepo.js +0 -10
- package/dist/repo/PersonalDataRepo.d.ts +0 -6
- package/dist/repo/PersonalDataRepo.js +0 -15
- package/dist/repo/ProductRepo.d.ts +0 -6
- package/dist/repo/ProductRepo.js +0 -14
- package/dist/stockObjects/AccountCartItem.ts.d.ts +0 -21
- package/dist/stockObjects/AccountCartItem.ts.js +0 -44
- package/dist/stockObjects/Address.d.ts +0 -32
- package/dist/stockObjects/Address.js +0 -69
- package/dist/stockObjects/Admin.d.ts +0 -24
- package/dist/stockObjects/Admin.js +0 -57
- package/dist/stockObjects/Client.d.ts +0 -27
- package/dist/stockObjects/Client.js +0 -93
- package/dist/stockObjects/CompanyData.d.ts +0 -35
- package/dist/stockObjects/CompanyData.js +0 -90
- package/dist/stockObjects/CompanyDetails.d.ts +0 -14
- package/dist/stockObjects/CompanyDetails.js +0 -34
- package/dist/stockObjects/DeliveryDetails.d.ts +0 -15
- package/dist/stockObjects/DeliveryDetails.js +0 -37
- package/dist/stockObjects/DeliveryMethods.d.ts +0 -11
- package/dist/stockObjects/DeliveryMethods.js +0 -26
- package/dist/stockObjects/DeliveryStatus.d.ts +0 -17
- package/dist/stockObjects/DeliveryStatus.js +0 -42
- package/dist/stockObjects/File.d.ts +0 -24
- package/dist/stockObjects/File.js +0 -60
- package/dist/stockObjects/FileConnection.d.ts +0 -17
- package/dist/stockObjects/FileConnection.js +0 -42
- package/dist/stockObjects/Order.d.ts +0 -42
- package/dist/stockObjects/Order.js +0 -109
- package/dist/stockObjects/OrderProduct.d.ts +0 -16
- package/dist/stockObjects/OrderProduct.js +0 -38
- package/dist/stockObjects/PaymentDetails.d.ts +0 -11
- package/dist/stockObjects/PaymentDetails.js +0 -26
- package/dist/stockObjects/PaymentMethods.d.ts +0 -11
- package/dist/stockObjects/PaymentMethods.js +0 -26
- package/dist/stockObjects/PaymentStatus.d.ts +0 -12
- package/dist/stockObjects/PaymentStatus.js +0 -26
- package/dist/stockObjects/PersonalData.d.ts +0 -24
- package/dist/stockObjects/PersonalData.js +0 -53
- package/dist/stockObjects/Product.d.ts +0 -81
- package/dist/stockObjects/Product.js +0 -200
- package/dist/stockObjects/Status.d.ts +0 -17
- package/dist/stockObjects/Status.js +0 -42
- package/dist/tables/TableNames.d.ts +0 -28
- package/dist/tables/TableNames.js +0 -29
- package/dist/tables/clients/AccountCartTable.d.ts +0 -11
- package/dist/tables/clients/AccountCartTable.js +0 -35
- package/dist/tables/clients/AccountCompanyDetailsTable.d.ts +0 -7
- package/dist/tables/clients/AccountCompanyDetailsTable.js +0 -22
- package/dist/tables/clients/AccountDeliveryDetailsTable.d.ts +0 -7
- package/dist/tables/clients/AccountDeliveryDetailsTable.js +0 -22
- package/dist/tables/clients/ClientAccountsTable.d.ts +0 -14
- package/dist/tables/clients/ClientAccountsTable.js +0 -65
- package/dist/tables/files/FileConnectionsTable.d.ts +0 -9
- package/dist/tables/files/FileConnectionsTable.js +0 -25
- package/dist/tables/files/FilesTable.d.ts +0 -15
- package/dist/tables/files/FilesTable.js +0 -65
- package/dist/tables/orders/OrdersProductsTable.d.ts +0 -10
- package/dist/tables/orders/OrdersProductsTable.js +0 -36
- package/dist/tables/orders/OrdersTable.d.ts +0 -13
- package/dist/tables/orders/OrdersTable.js +0 -54
- package/dist/tables/orders/PaymentDetailsTable.d.ts +0 -10
- package/dist/tables/orders/PaymentDetailsTable.js +0 -33
- package/dist/tables/orders/PaymentStatusTypesTable.d.ts +0 -7
- package/dist/tables/orders/PaymentStatusTypesTable.js +0 -9
- package/dist/tables/orders/PaymentStatusesTable.d.ts +0 -9
- package/dist/tables/orders/PaymentStatusesTable.js +0 -28
- package/dist/tables/orders/StatusTypesTable.d.ts +0 -8
- package/dist/tables/orders/StatusTypesTable.js +0 -14
- package/dist/tables/orders/StatusesTable.d.ts +0 -10
- package/dist/tables/orders/StatusesTable.js +0 -32
- package/dist/tables/personalInformation/AddressesTable.d.ts +0 -11
- package/dist/tables/personalInformation/AddressesTable.js +0 -41
- package/dist/tables/personalInformation/CompanyDetailsTable.d.ts +0 -11
- package/dist/tables/personalInformation/CompanyDetailsTable.js +0 -38
- package/dist/tables/personalInformation/DeliveryDetailsTable.d.ts +0 -11
- package/dist/tables/personalInformation/DeliveryDetailsTable.js +0 -39
- package/dist/tables/personalInformation/DeliveryStatusTypesTable.d.ts +0 -7
- package/dist/tables/personalInformation/DeliveryStatusTypesTable.js +0 -9
- package/dist/tables/personalInformation/DeliveryStatusesTable.d.ts +0 -9
- package/dist/tables/personalInformation/DeliveryStatusesTable.js +0 -29
- package/dist/tables/personalInformation/PersonalDataTable.d.ts +0 -11
- package/dist/tables/personalInformation/PersonalDataTable.js +0 -40
- package/dist/tables/public/AdminAccountsTable.d.ts +0 -14
- package/dist/tables/public/AdminAccountsTable.js +0 -66
- package/dist/tables/public/ProductsTable.d.ts +0 -15
- package/dist/tables/public/ProductsTable.js +0 -83
- package/dist/tables/settings/CompanyDataTable.d.ts +0 -10
- package/dist/tables/settings/CompanyDataTable.js +0 -42
- package/dist/tables/settings/DeliveryMethodsTable.d.ts +0 -11
- package/dist/tables/settings/DeliveryMethodsTable.js +0 -39
- package/dist/tables/settings/MarketPlacesTable.d.ts +0 -5
- package/dist/tables/settings/MarketPlacesTable.js +0 -9
- package/dist/tables/settings/PaymentMethodsTable.d.ts +0 -11
- package/dist/tables/settings/PaymentMethodsTable.js +0 -39
- package/dist/utils/AccountCart.d.ts +0 -6
- package/dist/utils/AccountCart.js +0 -20
- package/dist/utils/PriceConverter.d.ts +0 -5
- package/dist/utils/PriceConverter.js +0 -14
- package/dist/utils/correctPhoneNumber.d.ts +0 -1
- package/dist/utils/correctPhoneNumber.js +0 -14
- package/dist/utils/createQueryOptionsForId.d.ts +0 -2
- package/dist/utils/createQueryOptionsForId.js +0 -6
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import Client from "../stockObjects/Client";
|
|
2
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
3
|
-
export default class ClientMapper implements StockObjectMapper {
|
|
4
|
-
private client;
|
|
5
|
-
private clientAccountsTable;
|
|
6
|
-
constructor(client: Client);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class ClientMapper {
|
|
3
|
-
client;
|
|
4
|
-
clientAccountsTable;
|
|
5
|
-
constructor(client) {
|
|
6
|
-
this.clientAccountsTable = DatabaseConnection.getInstance().clientAccounts;
|
|
7
|
-
this.client = client;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
if (!this.client.getDeleted()) {
|
|
11
|
-
if (this.client.getId())
|
|
12
|
-
await this.clientAccountsTable.update(this.client);
|
|
13
|
-
else
|
|
14
|
-
await this.clientAccountsTable.insert(this.client);
|
|
15
|
-
}
|
|
16
|
-
else
|
|
17
|
-
throw new Error(`Client account ${this.client.getId()} is deleted. Restore before updating.`);
|
|
18
|
-
}
|
|
19
|
-
async delete() {
|
|
20
|
-
const id = this.client.getId();
|
|
21
|
-
if (id)
|
|
22
|
-
await this.clientAccountsTable.delete(id);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import CompanyData from "../stockObjects/CompanyData";
|
|
3
|
-
export default class CompanyDataMapper implements StockObjectMapper {
|
|
4
|
-
private companyData;
|
|
5
|
-
private companyDataTable;
|
|
6
|
-
constructor(companyData: CompanyData);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class CompanyDataMapper {
|
|
3
|
-
companyData;
|
|
4
|
-
companyDataTable;
|
|
5
|
-
constructor(companyData) {
|
|
6
|
-
this.companyDataTable = DatabaseConnection.getInstance().companyData;
|
|
7
|
-
this.companyData = companyData;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
if (this.companyData.getId())
|
|
11
|
-
await this.companyDataTable.update(this.companyData);
|
|
12
|
-
else
|
|
13
|
-
await this.companyDataTable.insert(this.companyData);
|
|
14
|
-
}
|
|
15
|
-
async delete() {
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import CompanyDetails from "../stockObjects/CompanyDetails";
|
|
3
|
-
export default class CompanyDetailsMapper implements StockObjectMapper {
|
|
4
|
-
private companyDetails;
|
|
5
|
-
private companyDetailsTable;
|
|
6
|
-
constructor(companyDetails: CompanyDetails);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
import AddressesRepo from "../repo/AddressesRepo";
|
|
3
|
-
import createQueryOptionsForId from "../utils/createQueryOptionsForId";
|
|
4
|
-
export default class CompanyDetailsMapper {
|
|
5
|
-
companyDetails;
|
|
6
|
-
companyDetailsTable;
|
|
7
|
-
constructor(companyDetails) {
|
|
8
|
-
this.companyDetailsTable = DatabaseConnection.getInstance().companyDetails;
|
|
9
|
-
this.companyDetails = companyDetails;
|
|
10
|
-
}
|
|
11
|
-
async save() {
|
|
12
|
-
if (this.companyDetails.getId())
|
|
13
|
-
await this.companyDetailsTable.update(this.companyDetails);
|
|
14
|
-
else
|
|
15
|
-
await this.companyDetailsTable.insert(this.companyDetails);
|
|
16
|
-
}
|
|
17
|
-
async delete() {
|
|
18
|
-
const id = this.companyDetails.getId();
|
|
19
|
-
if (id) {
|
|
20
|
-
const address = await AddressesRepo.get(createQueryOptionsForId(this.companyDetails.getAddressId()));
|
|
21
|
-
address.delete();
|
|
22
|
-
await this.companyDetailsTable.delete(id);
|
|
23
|
-
}
|
|
24
|
-
else
|
|
25
|
-
throw Error('Uncreated companyDetails cannot be deleted');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import DeliveryDetails from "../stockObjects/DeliveryDetails";
|
|
3
|
-
export default class DeliveryDetailsMapper implements StockObjectMapper {
|
|
4
|
-
private deliveryDetails;
|
|
5
|
-
private deliveryDetailsTable;
|
|
6
|
-
constructor(deliveryDetails: DeliveryDetails);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
import PersonalDataRepo from "../repo/PersonalDataRepo";
|
|
3
|
-
import AddressesRepo from "../repo/AddressesRepo";
|
|
4
|
-
import createQueryOptionsForId from "../utils/createQueryOptionsForId";
|
|
5
|
-
export default class DeliveryDetailsMapper {
|
|
6
|
-
deliveryDetails;
|
|
7
|
-
deliveryDetailsTable;
|
|
8
|
-
constructor(deliveryDetails) {
|
|
9
|
-
this.deliveryDetailsTable = DatabaseConnection.getInstance().deliveryDetails;
|
|
10
|
-
this.deliveryDetails = deliveryDetails;
|
|
11
|
-
}
|
|
12
|
-
async save() {
|
|
13
|
-
if (this.deliveryDetails.getId())
|
|
14
|
-
await this.deliveryDetailsTable.update(this.deliveryDetails);
|
|
15
|
-
else
|
|
16
|
-
await this.deliveryDetailsTable.insert(this.deliveryDetails);
|
|
17
|
-
}
|
|
18
|
-
async delete() {
|
|
19
|
-
const id = this.deliveryDetails.getId();
|
|
20
|
-
if (id) {
|
|
21
|
-
const personalData = await PersonalDataRepo.get(createQueryOptionsForId(this.deliveryDetails.getPersonalDataId()));
|
|
22
|
-
personalData.delete();
|
|
23
|
-
const address = await AddressesRepo.get(createQueryOptionsForId(this.deliveryDetails.getAddressId()));
|
|
24
|
-
address.delete();
|
|
25
|
-
await this.deliveryDetailsTable.delete(id);
|
|
26
|
-
}
|
|
27
|
-
else
|
|
28
|
-
throw Error('Uncreated companyDetails cannot be deleted');
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import DeliveryMethods from "../stockObjects/DeliveryMethods";
|
|
3
|
-
export default class DeliveryMethodsMapper implements StockObjectMapper {
|
|
4
|
-
private deliveryMethods;
|
|
5
|
-
private deliveryMethodsTable;
|
|
6
|
-
constructor(deliveryMethods: DeliveryMethods);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class DeliveryMethodsMapper {
|
|
3
|
-
deliveryMethods;
|
|
4
|
-
deliveryMethodsTable;
|
|
5
|
-
constructor(deliveryMethods) {
|
|
6
|
-
this.deliveryMethodsTable = DatabaseConnection.getInstance().deliveryMethods;
|
|
7
|
-
this.deliveryMethods = deliveryMethods;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
if (this.deliveryMethods.getId())
|
|
11
|
-
await this.deliveryMethodsTable.update(this.deliveryMethods);
|
|
12
|
-
else
|
|
13
|
-
await this.deliveryMethodsTable.insert(this.deliveryMethods);
|
|
14
|
-
}
|
|
15
|
-
async delete() {
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import DeliveryStatus from "../stockObjects/DeliveryStatus";
|
|
3
|
-
export default class DeliveryStatusMapper implements StockObjectMapper {
|
|
4
|
-
private deliveryStatus;
|
|
5
|
-
private deliveryStatusesTable;
|
|
6
|
-
constructor(deliveryStatus: DeliveryStatus);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class DeliveryStatusMapper {
|
|
3
|
-
deliveryStatus;
|
|
4
|
-
deliveryStatusesTable;
|
|
5
|
-
constructor(deliveryStatus) {
|
|
6
|
-
this.deliveryStatusesTable = DatabaseConnection.getInstance().deliveryStatuses;
|
|
7
|
-
this.deliveryStatus = deliveryStatus;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
await this.deliveryStatusesTable.insert(this.deliveryStatus);
|
|
11
|
-
}
|
|
12
|
-
async delete() {
|
|
13
|
-
throw Error('Method not implemented');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from '@dascompany/database';
|
|
2
|
-
import FileConnection from '../stockObjects/FileConnection';
|
|
3
|
-
export default class FileConnectionMapper implements StockObjectMapper {
|
|
4
|
-
private fileConnection;
|
|
5
|
-
private fileConnectionsTable;
|
|
6
|
-
constructor(fileConnection: FileConnection);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from '../DatabaseConnection';
|
|
2
|
-
import createQueryOptionsForId from '../utils/createQueryOptionsForId';
|
|
3
|
-
export default class FileConnectionMapper {
|
|
4
|
-
fileConnection;
|
|
5
|
-
fileConnectionsTable;
|
|
6
|
-
constructor(fileConnection) {
|
|
7
|
-
this.fileConnectionsTable = DatabaseConnection.getInstance().fileConnections;
|
|
8
|
-
this.fileConnection = fileConnection;
|
|
9
|
-
}
|
|
10
|
-
async save() {
|
|
11
|
-
const id = this.fileConnection.getId();
|
|
12
|
-
if (id)
|
|
13
|
-
await this.fileConnectionsTable.delete(createQueryOptionsForId(id));
|
|
14
|
-
await this.fileConnectionsTable.insert(this.fileConnection);
|
|
15
|
-
}
|
|
16
|
-
async delete() {
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import File from "../stockObjects/File";
|
|
3
|
-
export default class FileMapper implements StockObjectMapper {
|
|
4
|
-
private file;
|
|
5
|
-
private filesTable;
|
|
6
|
-
constructor(file: File);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class FileMapper {
|
|
3
|
-
file;
|
|
4
|
-
filesTable;
|
|
5
|
-
constructor(file) {
|
|
6
|
-
this.filesTable = DatabaseConnection.getInstance().files;
|
|
7
|
-
this.file = file;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
if (this.file.getId())
|
|
11
|
-
await this.filesTable.update(this.file);
|
|
12
|
-
else
|
|
13
|
-
await this.filesTable.insert(this.file);
|
|
14
|
-
}
|
|
15
|
-
async delete() {
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import Order from "../stockObjects/Order";
|
|
3
|
-
export default class OrderMapper implements StockObjectMapper {
|
|
4
|
-
private order;
|
|
5
|
-
private orderTable;
|
|
6
|
-
constructor(order: Order);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class OrderMapper {
|
|
3
|
-
order;
|
|
4
|
-
orderTable;
|
|
5
|
-
constructor(order) {
|
|
6
|
-
this.orderTable = DatabaseConnection.getInstance().orders;
|
|
7
|
-
this.order = order;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
const orderId = this.order.getId();
|
|
11
|
-
if (orderId)
|
|
12
|
-
await this.orderTable.update(this.order);
|
|
13
|
-
else
|
|
14
|
-
await this.orderTable.insert(this.order);
|
|
15
|
-
}
|
|
16
|
-
async delete() {
|
|
17
|
-
throw Error('method not implemented');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import OrderProduct from "../stockObjects/OrderProduct";
|
|
3
|
-
export default class OrderProductMapper implements StockObjectMapper {
|
|
4
|
-
private orderProduct;
|
|
5
|
-
private orderProductsTable;
|
|
6
|
-
constructor(orderProduct: OrderProduct);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class OrderProductMapper {
|
|
3
|
-
orderProduct;
|
|
4
|
-
orderProductsTable;
|
|
5
|
-
constructor(orderProduct) {
|
|
6
|
-
this.orderProductsTable = DatabaseConnection.getInstance().ordersProducts;
|
|
7
|
-
this.orderProduct = orderProduct;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
await this.orderProductsTable.insert(this.orderProduct);
|
|
11
|
-
}
|
|
12
|
-
async delete() {
|
|
13
|
-
const orderId = this.orderProduct.getId();
|
|
14
|
-
if (orderId)
|
|
15
|
-
await this.orderProductsTable.delete(orderId);
|
|
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 PaymentDetails from "../stockObjects/PaymentDetails";
|
|
3
|
-
export default class PaymentDetailsMapper implements StockObjectMapper {
|
|
4
|
-
private paymentDetails;
|
|
5
|
-
private paymentDetailsTable;
|
|
6
|
-
constructor(paymentDetails: PaymentDetails);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class PaymentDetailsMapper {
|
|
3
|
-
paymentDetails;
|
|
4
|
-
paymentDetailsTable;
|
|
5
|
-
constructor(paymentDetails) {
|
|
6
|
-
this.paymentDetailsTable = DatabaseConnection.getInstance().paymentDetails;
|
|
7
|
-
this.paymentDetails = paymentDetails;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
if (this.paymentDetails.getId())
|
|
11
|
-
await this.paymentDetailsTable.update(this.paymentDetails);
|
|
12
|
-
else
|
|
13
|
-
await this.paymentDetailsTable.insert(this.paymentDetails);
|
|
14
|
-
}
|
|
15
|
-
async delete() {
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import PaymentMethods from "../stockObjects/PaymentMethods";
|
|
3
|
-
export default class PaymentMethodsMapper implements StockObjectMapper {
|
|
4
|
-
private paymentMethods;
|
|
5
|
-
private paymentMethodsTable;
|
|
6
|
-
constructor(paymentMethods: PaymentMethods);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class PaymentMethodsMapper {
|
|
3
|
-
paymentMethods;
|
|
4
|
-
paymentMethodsTable;
|
|
5
|
-
constructor(paymentMethods) {
|
|
6
|
-
this.paymentMethodsTable = DatabaseConnection.getInstance().paymentMethods;
|
|
7
|
-
this.paymentMethods = paymentMethods;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
if (this.paymentMethods.getId())
|
|
11
|
-
await this.paymentMethodsTable.update(this.paymentMethods);
|
|
12
|
-
else
|
|
13
|
-
await this.paymentMethodsTable.insert(this.paymentMethods);
|
|
14
|
-
}
|
|
15
|
-
async delete() {
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import PaymentStatus from "../stockObjects/PaymentStatus";
|
|
3
|
-
export default class PaymentStatusMapper implements StockObjectMapper {
|
|
4
|
-
private paymentStatus;
|
|
5
|
-
private paymentStatusesTable;
|
|
6
|
-
constructor(paymentStatus: PaymentStatus);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class PaymentStatusMapper {
|
|
3
|
-
paymentStatus;
|
|
4
|
-
paymentStatusesTable;
|
|
5
|
-
constructor(paymentStatus) {
|
|
6
|
-
this.paymentStatusesTable = DatabaseConnection.getInstance().paymentStatuses;
|
|
7
|
-
this.paymentStatus = paymentStatus;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
await this.paymentStatusesTable.insert(this.paymentStatus);
|
|
11
|
-
}
|
|
12
|
-
async delete() {
|
|
13
|
-
throw Error('Method not implemented');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import PersonalData from "../stockObjects/PersonalData";
|
|
3
|
-
export default class PersonalDataMapper implements StockObjectMapper {
|
|
4
|
-
private personalData;
|
|
5
|
-
private personalDataTable;
|
|
6
|
-
constructor(personalData: PersonalData);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class PersonalDataMapper {
|
|
3
|
-
personalData;
|
|
4
|
-
personalDataTable;
|
|
5
|
-
constructor(personalData) {
|
|
6
|
-
this.personalDataTable = DatabaseConnection.getInstance().personalData;
|
|
7
|
-
this.personalData = personalData;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
if (this.personalData.getId())
|
|
11
|
-
await this.personalDataTable.update(this.personalData);
|
|
12
|
-
else
|
|
13
|
-
await this.personalDataTable.insert(this.personalData);
|
|
14
|
-
}
|
|
15
|
-
async delete() {
|
|
16
|
-
const id = this.personalData.getId();
|
|
17
|
-
if (id)
|
|
18
|
-
await this.personalDataTable.delete(id);
|
|
19
|
-
else
|
|
20
|
-
throw Error('Uncreated personalData cannot be deleted');
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import Product from "../stockObjects/Product";
|
|
3
|
-
export default class ProductMapper implements StockObjectMapper {
|
|
4
|
-
private product;
|
|
5
|
-
private productTable;
|
|
6
|
-
constructor(product: Product);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class ProductMapper {
|
|
3
|
-
product;
|
|
4
|
-
productTable;
|
|
5
|
-
constructor(product) {
|
|
6
|
-
this.productTable = DatabaseConnection.getInstance().products;
|
|
7
|
-
this.product = product;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
if (this.product.getId() && !this.product.getDeleted())
|
|
11
|
-
await this.productTable.update(this.product);
|
|
12
|
-
else
|
|
13
|
-
await this.productTable.insert(this.product);
|
|
14
|
-
}
|
|
15
|
-
async delete() {
|
|
16
|
-
const id = this.product.getId();
|
|
17
|
-
if (id)
|
|
18
|
-
await this.productTable.delete(id);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StockObjectMapper } from "@dascompany/database";
|
|
2
|
-
import Status from "../stockObjects/Status";
|
|
3
|
-
export default class StatusMapper implements StockObjectMapper {
|
|
4
|
-
private status;
|
|
5
|
-
private statusTable;
|
|
6
|
-
constructor(status: Status);
|
|
7
|
-
save(): Promise<void>;
|
|
8
|
-
delete(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class StatusMapper {
|
|
3
|
-
status;
|
|
4
|
-
statusTable;
|
|
5
|
-
constructor(status) {
|
|
6
|
-
this.statusTable = DatabaseConnection.getInstance().statuses;
|
|
7
|
-
this.status = status;
|
|
8
|
-
}
|
|
9
|
-
async save() {
|
|
10
|
-
await this.statusTable.insert(this.status);
|
|
11
|
-
}
|
|
12
|
-
async delete() {
|
|
13
|
-
throw Error('method not implemented');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ParameterType, QueryOptions } from "@dascompany/database";
|
|
2
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
3
|
-
export default class AccountCartReader {
|
|
4
|
-
static async getAll(accountId) {
|
|
5
|
-
const queryOptions = new QueryOptions();
|
|
6
|
-
queryOptions.setWhere([{ name: 'account_id', type: ParameterType.bigint, value: accountId }]);
|
|
7
|
-
const accountCart = await DatabaseConnection.getInstance().accountCart.select(queryOptions);
|
|
8
|
-
return this.correctAccountCart(accountCart);
|
|
9
|
-
}
|
|
10
|
-
static async get(queryOptions) {
|
|
11
|
-
const accountCart = await DatabaseConnection.getInstance().accountCart.select(queryOptions);
|
|
12
|
-
return this.correctAccountCart(accountCart);
|
|
13
|
-
}
|
|
14
|
-
static async correctAccountCart(accountCart) {
|
|
15
|
-
const correctAccountCart = [];
|
|
16
|
-
for (let i = 0; i < accountCart.length; i++) {
|
|
17
|
-
correctAccountCart.push({
|
|
18
|
-
id: accountCart[i].product_id,
|
|
19
|
-
installation: accountCart[i].installation,
|
|
20
|
-
quantity: accountCart[i].quantity
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return correctAccountCart;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
-
export default class AddressesReader {
|
|
3
|
-
static async get(queryOptions) {
|
|
4
|
-
const address = await DatabaseConnection.getInstance().addresses.select(queryOptions);
|
|
5
|
-
return this.getCorrectData(address);
|
|
6
|
-
}
|
|
7
|
-
static getCorrectData(address) {
|
|
8
|
-
return {
|
|
9
|
-
id: address.id,
|
|
10
|
-
country: address.country,
|
|
11
|
-
city: address.city,
|
|
12
|
-
postalCode: address.postal_code,
|
|
13
|
-
street: address.street,
|
|
14
|
-
houseNumber: address.house_number,
|
|
15
|
-
apartmentNumber: address.apartment_number,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { QueryOptions } from "@dascompany/database";
|
|
2
|
-
import AdminI from "../types/AdminI";
|
|
3
|
-
export default class AdminReader {
|
|
4
|
-
static get(queryOptions: QueryOptions): Promise<AdminI>;
|
|
5
|
-
static getId(queryOptions: QueryOptions): Promise<string>;
|
|
6
|
-
static getAll(queryOptions?: QueryOptions): Promise<AdminI[]>;
|
|
7
|
-
static getQuantity(queryOptions: QueryOptions): Promise<number>;
|
|
8
|
-
private static correctAdmins;
|
|
9
|
-
private static correctAdmin;
|
|
10
|
-
}
|