@dascompany/database 0.0.3 → 0.0.5
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/SQL.json +26 -2
- package/dist/TableConnection.d.ts +14 -8
- package/dist/TableConnection.js +20 -8
- package/dist/index.d.ts +11 -1
- package/dist/index.js +10 -1
- package/dist/mappers/CompanyDataMapper.d.ts +9 -0
- package/dist/mappers/CompanyDataMapper.js +17 -0
- package/dist/mappers/FileConnectionMapper.d.ts +9 -0
- package/dist/mappers/FileConnectionMapper.js +17 -0
- package/dist/mappers/FileMapper.d.ts +9 -0
- package/dist/mappers/FileMapper.js +17 -0
- package/dist/mappers/PaymentMethodsMapper.d.ts +9 -0
- package/dist/mappers/PaymentMethodsMapper.js +17 -0
- package/dist/mappers/ProductMapper.d.ts +9 -0
- package/dist/mappers/ProductMapper.js +18 -0
- package/dist/reader/CompanyDataReader.d.ts +4 -0
- package/dist/reader/CompanyDataReader.js +27 -0
- package/dist/reader/FileConnectionsReader.d.ts +6 -0
- package/dist/reader/FileConnectionsReader.js +25 -0
- package/dist/reader/FilesReader.d.ts +5 -0
- package/dist/reader/FilesReader.js +24 -5
- package/dist/reader/ProductReader.d.ts +2 -0
- package/dist/reader/ProductReader.js +21 -0
- package/dist/reader/StatusTypesReader.d.ts +3 -0
- package/dist/reader/StatusTypesReader.js +8 -0
- package/dist/reader/payment/PaymentMethodReader.d.ts +1 -0
- package/dist/reader/payment/PaymentMethodReader.js +5 -0
- package/dist/repo/CompanyDataRepo.d.ts +4 -0
- package/dist/repo/CompanyDataRepo.js +11 -0
- package/dist/repo/DeliveryMethodRepo.d.ts +4 -0
- package/dist/repo/DeliveryMethodRepo.js +11 -0
- package/dist/repo/FileConnectionsRepo.d.ts +7 -0
- package/dist/repo/FileConnectionsRepo.js +25 -0
- package/dist/repo/FilesRepo.d.ts +7 -0
- package/dist/repo/FilesRepo.js +26 -0
- package/dist/repo/PaymentMethodRepo.d.ts +4 -0
- package/dist/repo/PaymentMethodRepo.js +11 -0
- package/dist/stockObjects/CompanyData.d.ts +21 -0
- package/dist/stockObjects/CompanyData.js +51 -0
- package/dist/stockObjects/DeliveryDetails.d.ts +1 -0
- package/dist/stockObjects/DeliveryDetails.js +3 -0
- package/dist/stockObjects/File.d.ts +21 -0
- package/dist/stockObjects/File.js +50 -0
- package/dist/stockObjects/FileConnection.d.ts +18 -0
- package/dist/stockObjects/FileConnection.js +42 -0
- package/dist/stockObjects/PaymentDetails.d.ts +1 -1
- package/dist/stockObjects/PaymentDetails.js +1 -1
- package/dist/stockObjects/PaymentMethods.d.ts +12 -0
- package/dist/stockObjects/PaymentMethods.js +26 -0
- package/dist/stockObjects/Product.d.ts +30 -0
- package/dist/stockObjects/Product.js +60 -1
- package/dist/tables/{ClientAccountsTable.d.ts → clients/ClientAccountsTable.d.ts} +4 -4
- package/dist/tables/{ClientAccountsTable.js → clients/ClientAccountsTable.js} +2 -2
- package/dist/tables/files/FileConnectionsTable.d.ts +12 -0
- package/dist/tables/files/FileConnectionsTable.js +41 -0
- package/dist/tables/files/FilesTable.d.ts +10 -0
- package/dist/tables/files/FilesTable.js +48 -0
- package/dist/tables/{DeliveryStatusTypesTable.d.ts → personalInformation/DeliveryStatusTypesTable.d.ts} +1 -1
- package/dist/tables/{DeliveryStatusTypesTable.js → personalInformation/DeliveryStatusTypesTable.js} +2 -2
- package/dist/tables/{DeliveryStatusesTable.d.ts → personalInformation/DeliveryStatusesTable.d.ts} +3 -3
- package/dist/tables/{DeliveryStatusesTable.js → personalInformation/DeliveryStatusesTable.js} +2 -2
- package/dist/tables/{AdminAccountsTable.d.ts → public/AdminAccountsTable.d.ts} +4 -4
- package/dist/tables/{AdminAccountsTable.js → public/AdminAccountsTable.js} +2 -2
- package/dist/tables/{ProductsTable.d.ts → public/ProductsTable.d.ts} +4 -4
- package/dist/tables/{ProductsTable.js → public/ProductsTable.js} +2 -2
- package/dist/tables/settings/CompanyDataTable.d.ts +10 -0
- package/dist/tables/settings/CompanyDataTable.js +37 -0
- package/dist/tables/settings/PaymentMethodsTable.d.ts +12 -0
- package/dist/tables/settings/PaymentMethodsTable.js +43 -0
- package/dist/types/CompanyDataI.d.ts +8 -0
- package/dist/types/CompanyDataI.js +1 -0
- package/dist/types/FileConnectionI.d.ts +6 -0
- package/dist/types/FileConnectionI.js +1 -0
- package/dist/types/PersonalDataI.d.ts +1 -1
- package/dist/types/QueryOptionsI.d.ts +2 -1
- package/dist/types/rows/CompanyDataRow.d.ts +8 -0
- package/dist/types/rows/CompanyDataRow.js +1 -0
- package/dist/types/rows/FileConnectionRow.d.ts +6 -0
- package/dist/types/rows/FileConnectionRow.js +1 -0
- package/dist/types/rows/PaymentMethodRow.d.ts +5 -0
- package/dist/types/rows/PaymentMethodRow.js +1 -0
- package/package.json +1 -1
- package/dist/tables/StatusTypesTable.d.ts +0 -4
- package/dist/tables/StatusTypesTable.js +0 -9
- package/dist/tables/store-settings/PaymentMethodsTable.d.ts +0 -6
- package/dist/tables/store-settings/PaymentMethodsTable.js +0 -15
- /package/dist/tables/{store-settings → settings}/DeliveryMethodsTable.d.ts +0 -0
- /package/dist/tables/{store-settings → settings}/DeliveryMethodsTable.js +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
+
import FileConnection from "../stockObjects/FileConnection";
|
|
3
|
+
export default class FileConnectionsRepo {
|
|
4
|
+
static async getAllForFileId(fileId) {
|
|
5
|
+
const connection = DatabaseConnection.get();
|
|
6
|
+
const fileConnections = await connection.fileConnections.selectForFileId(fileId);
|
|
7
|
+
return this.correctFileConnections(fileConnections);
|
|
8
|
+
}
|
|
9
|
+
static async deleteAllForConnection(connectionType, connectionId) {
|
|
10
|
+
const connection = DatabaseConnection.get();
|
|
11
|
+
return await connection.fileConnections.deleteForConnection(connectionType, connectionId);
|
|
12
|
+
}
|
|
13
|
+
static correctFileConnections(dataRows) {
|
|
14
|
+
const fileConnections = [];
|
|
15
|
+
for (const dataRow of dataRows) {
|
|
16
|
+
const fileConnection = this.correctFileConnection(dataRow);
|
|
17
|
+
fileConnections.push(fileConnection);
|
|
18
|
+
}
|
|
19
|
+
return fileConnections;
|
|
20
|
+
}
|
|
21
|
+
static correctFileConnection(fileConnections) {
|
|
22
|
+
const correctFileConnection = new FileConnection(fileConnections.file_id, fileConnections.connection_type, fileConnections.connection_id, fileConnections.sequence);
|
|
23
|
+
return correctFileConnection;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import FileConnectionE from "../types/FileConnectionE";
|
|
2
|
+
export default class FilesRepo {
|
|
3
|
+
static get(fileId: number): Promise<any>;
|
|
4
|
+
static getAllForConnection(connectionType: FileConnectionE, connectionId: number): Promise<any>;
|
|
5
|
+
private static createFilesFromRows;
|
|
6
|
+
private static createFileFromRow;
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
+
import File from "../stockObjects/File";
|
|
3
|
+
export default class FilesRepo {
|
|
4
|
+
static async get(fileId) {
|
|
5
|
+
const connection = DatabaseConnection.get();
|
|
6
|
+
const file = await connection.files.select(fileId);
|
|
7
|
+
return this.createFileFromRow(file);
|
|
8
|
+
}
|
|
9
|
+
static async getAllForConnection(connectionType, connectionId) {
|
|
10
|
+
const connection = DatabaseConnection.get();
|
|
11
|
+
const files = await connection.files.selectForConnection(connectionType, connectionId);
|
|
12
|
+
return this.createFilesFromRows(files);
|
|
13
|
+
}
|
|
14
|
+
static async createFilesFromRows(dataRows) {
|
|
15
|
+
const files = [];
|
|
16
|
+
for (const dataRow of dataRows) {
|
|
17
|
+
const file = await this.createFileFromRow(dataRow);
|
|
18
|
+
files.push(file);
|
|
19
|
+
}
|
|
20
|
+
return files;
|
|
21
|
+
}
|
|
22
|
+
static createFileFromRow(file) {
|
|
23
|
+
const correctFile = new File(file.name, file.catalog, file.size_kb, file.type, file.orginal_name);
|
|
24
|
+
return correctFile;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import DatabaseConnection from "../DatabaseConnection";
|
|
2
|
+
import PaymentMethods from "../stockObjects/PaymentMethods";
|
|
3
|
+
export default class PaymentMethodRepo {
|
|
4
|
+
static async get(id) {
|
|
5
|
+
const connection = DatabaseConnection.get();
|
|
6
|
+
const paymentMethodsRow = await connection.paymentMethods.select(id);
|
|
7
|
+
const paymentMethods = new PaymentMethods(paymentMethodsRow.key, paymentMethodsRow.active);
|
|
8
|
+
paymentMethods.setId(paymentMethodsRow.id);
|
|
9
|
+
return paymentMethods;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import StockObject from "../types/StockObject";
|
|
2
|
+
import StockObjectMapper from "../types/StockObjectMapper";
|
|
3
|
+
export default class CompanyData extends StockObject {
|
|
4
|
+
private name;
|
|
5
|
+
private email;
|
|
6
|
+
private taxNumber;
|
|
7
|
+
private phoneNumber;
|
|
8
|
+
private addressId;
|
|
9
|
+
constructor(name: string, email: string, taxNumber: string, phoneNumber: string, addressId: number);
|
|
10
|
+
getAddressId(): number | null;
|
|
11
|
+
getEmail(): string;
|
|
12
|
+
getTaxNumber(): string;
|
|
13
|
+
getPhoneNumber(): string;
|
|
14
|
+
getName(): string;
|
|
15
|
+
setAddressId(addressId: number): number;
|
|
16
|
+
setEmail(email: string): string;
|
|
17
|
+
setTaxNumber(taxNumber: string): string;
|
|
18
|
+
setPhoneNumber(phoneNumber: string): string;
|
|
19
|
+
setName(name: string): string;
|
|
20
|
+
protected getMapper(): StockObjectMapper;
|
|
21
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import CompanyDataMapper from "../mappers/CompanyDataMapper";
|
|
2
|
+
import StockObject from "../types/StockObject";
|
|
3
|
+
export default class CompanyData extends StockObject {
|
|
4
|
+
name;
|
|
5
|
+
email;
|
|
6
|
+
taxNumber;
|
|
7
|
+
phoneNumber;
|
|
8
|
+
addressId;
|
|
9
|
+
constructor(name, email, taxNumber, phoneNumber, addressId) {
|
|
10
|
+
super();
|
|
11
|
+
this.name = name;
|
|
12
|
+
this.email = email;
|
|
13
|
+
this.taxNumber = taxNumber;
|
|
14
|
+
this.phoneNumber = phoneNumber;
|
|
15
|
+
this.email = email;
|
|
16
|
+
this.addressId = addressId;
|
|
17
|
+
}
|
|
18
|
+
getAddressId() {
|
|
19
|
+
return this.addressId;
|
|
20
|
+
}
|
|
21
|
+
getEmail() {
|
|
22
|
+
return this.email;
|
|
23
|
+
}
|
|
24
|
+
getTaxNumber() {
|
|
25
|
+
return this.taxNumber;
|
|
26
|
+
}
|
|
27
|
+
getPhoneNumber() {
|
|
28
|
+
return this.phoneNumber;
|
|
29
|
+
}
|
|
30
|
+
getName() {
|
|
31
|
+
return this.name;
|
|
32
|
+
}
|
|
33
|
+
setAddressId(addressId) {
|
|
34
|
+
return this.addressId = addressId;
|
|
35
|
+
}
|
|
36
|
+
setEmail(email) {
|
|
37
|
+
return this.email = email;
|
|
38
|
+
}
|
|
39
|
+
setTaxNumber(taxNumber) {
|
|
40
|
+
return this.taxNumber = taxNumber;
|
|
41
|
+
}
|
|
42
|
+
setPhoneNumber(phoneNumber) {
|
|
43
|
+
return this.phoneNumber = phoneNumber;
|
|
44
|
+
}
|
|
45
|
+
setName(name) {
|
|
46
|
+
return this.name = name;
|
|
47
|
+
}
|
|
48
|
+
getMapper() {
|
|
49
|
+
return new CompanyDataMapper(this);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -11,5 +11,6 @@ export default class DeliveryDetails extends StockObject {
|
|
|
11
11
|
setAddressId(addressId: number): number;
|
|
12
12
|
setPersonalDataId(personalDataId: number): number;
|
|
13
13
|
setDeliveryDetailsId(deliveryMethodId: number): number;
|
|
14
|
+
setDeliveryMethodId(deliveryMethodId: number): number;
|
|
14
15
|
protected getMapper(): StockObjectMapper;
|
|
15
16
|
}
|
|
@@ -28,6 +28,9 @@ export default class DeliveryDetails extends StockObject {
|
|
|
28
28
|
setDeliveryDetailsId(deliveryMethodId) {
|
|
29
29
|
return this.deliveryMethodId = deliveryMethodId;
|
|
30
30
|
}
|
|
31
|
+
setDeliveryMethodId(deliveryMethodId) {
|
|
32
|
+
return this.deliveryMethodId = deliveryMethodId;
|
|
33
|
+
}
|
|
31
34
|
getMapper() {
|
|
32
35
|
return new DeliveryDetailsMapper(this);
|
|
33
36
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import StockObject from "../types/StockObject";
|
|
2
|
+
import StockObjectMapper from "../types/StockObjectMapper";
|
|
3
|
+
export default class File extends StockObject {
|
|
4
|
+
private name;
|
|
5
|
+
private catalog;
|
|
6
|
+
private sizeKb;
|
|
7
|
+
private type;
|
|
8
|
+
private orginalName;
|
|
9
|
+
constructor(name: string, catalog: string, sizeKb: number, type: string, orginalName: string);
|
|
10
|
+
getName(): string;
|
|
11
|
+
getCatalog(): string;
|
|
12
|
+
getSizeKb(): number;
|
|
13
|
+
getType(): string;
|
|
14
|
+
getOrginalName(): string;
|
|
15
|
+
setName(name: string): void;
|
|
16
|
+
setCatalog(catalog: string): void;
|
|
17
|
+
setSizeKb(sizeKb: number): void;
|
|
18
|
+
setType(type: string): void;
|
|
19
|
+
setOrginalName(orginalName: string): void;
|
|
20
|
+
protected getMapper(): StockObjectMapper;
|
|
21
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import FileMapper from "../mappers/FileMapper";
|
|
2
|
+
import StockObject from "../types/StockObject";
|
|
3
|
+
export default class File extends StockObject {
|
|
4
|
+
name;
|
|
5
|
+
catalog;
|
|
6
|
+
sizeKb;
|
|
7
|
+
type;
|
|
8
|
+
orginalName;
|
|
9
|
+
constructor(name, catalog, sizeKb, type, orginalName) {
|
|
10
|
+
super();
|
|
11
|
+
this.name = name;
|
|
12
|
+
this.catalog = catalog;
|
|
13
|
+
this.sizeKb = sizeKb;
|
|
14
|
+
this.type = type;
|
|
15
|
+
this.orginalName = orginalName;
|
|
16
|
+
}
|
|
17
|
+
getName() {
|
|
18
|
+
return this.name;
|
|
19
|
+
}
|
|
20
|
+
getCatalog() {
|
|
21
|
+
return this.catalog;
|
|
22
|
+
}
|
|
23
|
+
getSizeKb() {
|
|
24
|
+
return this.sizeKb;
|
|
25
|
+
}
|
|
26
|
+
getType() {
|
|
27
|
+
return this.type;
|
|
28
|
+
}
|
|
29
|
+
getOrginalName() {
|
|
30
|
+
return this.orginalName;
|
|
31
|
+
}
|
|
32
|
+
setName(name) {
|
|
33
|
+
this.name = name;
|
|
34
|
+
}
|
|
35
|
+
setCatalog(catalog) {
|
|
36
|
+
this.catalog = catalog;
|
|
37
|
+
}
|
|
38
|
+
setSizeKb(sizeKb) {
|
|
39
|
+
this.sizeKb = sizeKb;
|
|
40
|
+
}
|
|
41
|
+
setType(type) {
|
|
42
|
+
this.type = type;
|
|
43
|
+
}
|
|
44
|
+
setOrginalName(orginalName) {
|
|
45
|
+
this.orginalName = orginalName;
|
|
46
|
+
}
|
|
47
|
+
getMapper() {
|
|
48
|
+
return new FileMapper(this);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import StockObject from "../types/StockObject";
|
|
2
|
+
import StockObjectMapper from "../types/StockObjectMapper";
|
|
3
|
+
export default class FileConnection extends StockObject {
|
|
4
|
+
private fileId;
|
|
5
|
+
private connectionType;
|
|
6
|
+
private connectionId;
|
|
7
|
+
private sequence;
|
|
8
|
+
constructor(fileId: number, connectionType: string, connectionId: number, sequence: number);
|
|
9
|
+
getFileId(): number;
|
|
10
|
+
getConnectionType(): string;
|
|
11
|
+
getConnectionId(): number;
|
|
12
|
+
getSequence(): number;
|
|
13
|
+
setFileId(fileId: number): void;
|
|
14
|
+
setConnectionType(connectionType: string): void;
|
|
15
|
+
setConnectionId(connectionId: number): void;
|
|
16
|
+
setSequence(sequence: number): void;
|
|
17
|
+
protected getMapper(): StockObjectMapper;
|
|
18
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import FileConnectionMapper from "../mappers/FileConnectionMapper";
|
|
2
|
+
import StockObject from "../types/StockObject";
|
|
3
|
+
export default class FileConnection extends StockObject {
|
|
4
|
+
fileId;
|
|
5
|
+
connectionType;
|
|
6
|
+
connectionId;
|
|
7
|
+
sequence;
|
|
8
|
+
constructor(fileId, connectionType, connectionId, sequence) {
|
|
9
|
+
super();
|
|
10
|
+
this.fileId = fileId;
|
|
11
|
+
this.connectionType = connectionType;
|
|
12
|
+
this.connectionId = connectionId;
|
|
13
|
+
this.sequence = sequence;
|
|
14
|
+
}
|
|
15
|
+
getFileId() {
|
|
16
|
+
return this.fileId;
|
|
17
|
+
}
|
|
18
|
+
getConnectionType() {
|
|
19
|
+
return this.connectionType;
|
|
20
|
+
}
|
|
21
|
+
getConnectionId() {
|
|
22
|
+
return this.connectionId;
|
|
23
|
+
}
|
|
24
|
+
getSequence() {
|
|
25
|
+
return this.sequence;
|
|
26
|
+
}
|
|
27
|
+
setFileId(fileId) {
|
|
28
|
+
this.fileId = fileId;
|
|
29
|
+
}
|
|
30
|
+
setConnectionType(connectionType) {
|
|
31
|
+
this.connectionType = connectionType;
|
|
32
|
+
}
|
|
33
|
+
setConnectionId(connectionId) {
|
|
34
|
+
this.connectionId = connectionId;
|
|
35
|
+
}
|
|
36
|
+
setSequence(sequence) {
|
|
37
|
+
this.sequence = sequence;
|
|
38
|
+
}
|
|
39
|
+
getMapper() {
|
|
40
|
+
return new FileConnectionMapper(this);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -6,7 +6,7 @@ export default class PaymentDetails extends StockObject {
|
|
|
6
6
|
constructor(paymentMethodId: number, paymentOrderId: string | null);
|
|
7
7
|
getPaymentMethodId(): number | null;
|
|
8
8
|
getPaymentOrderId(): string | null;
|
|
9
|
-
|
|
9
|
+
setPaymentMethodId(paymentMethodId: number): number;
|
|
10
10
|
setPaymentOrderId(paymentOrderId: string): string;
|
|
11
11
|
protected getMapper(): StockObjectMapper;
|
|
12
12
|
}
|
|
@@ -14,7 +14,7 @@ export default class PaymentDetails extends StockObject {
|
|
|
14
14
|
getPaymentOrderId() {
|
|
15
15
|
return this.paymentOrderId;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
setPaymentMethodId(paymentMethodId) {
|
|
18
18
|
return this.paymentMethodId = paymentMethodId;
|
|
19
19
|
}
|
|
20
20
|
setPaymentOrderId(paymentOrderId) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import StockObject from "../types/StockObject";
|
|
2
|
+
import StockObjectMapper from "../types/StockObjectMapper";
|
|
3
|
+
export default class PaymentMethods extends StockObject {
|
|
4
|
+
private key;
|
|
5
|
+
private active;
|
|
6
|
+
constructor(key: string, active: boolean);
|
|
7
|
+
getKey(): string;
|
|
8
|
+
getActive(): boolean;
|
|
9
|
+
setKey(key: string): string;
|
|
10
|
+
setActive(active: boolean): boolean;
|
|
11
|
+
protected getMapper(): StockObjectMapper;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import PaymentMethodsMapper from "../mappers/PaymentMethodsMapper";
|
|
2
|
+
import StockObject from "../types/StockObject";
|
|
3
|
+
export default class PaymentMethods extends StockObject {
|
|
4
|
+
key;
|
|
5
|
+
active;
|
|
6
|
+
constructor(key, active) {
|
|
7
|
+
super();
|
|
8
|
+
this.key = key;
|
|
9
|
+
this.active = active;
|
|
10
|
+
}
|
|
11
|
+
getKey() {
|
|
12
|
+
return this.key;
|
|
13
|
+
}
|
|
14
|
+
getActive() {
|
|
15
|
+
return this.active;
|
|
16
|
+
}
|
|
17
|
+
setKey(key) {
|
|
18
|
+
return this.key = key;
|
|
19
|
+
}
|
|
20
|
+
setActive(active) {
|
|
21
|
+
return this.active = active;
|
|
22
|
+
}
|
|
23
|
+
getMapper() {
|
|
24
|
+
return new PaymentMethodsMapper(this);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -35,6 +35,36 @@ export default class Product extends StockObject {
|
|
|
35
35
|
getDeleted(): boolean;
|
|
36
36
|
getFile(): Promise<FileI | null>;
|
|
37
37
|
getFiles(): Promise<FileI[] | null>;
|
|
38
|
+
getData(): {
|
|
39
|
+
id: number | null;
|
|
40
|
+
sku: string;
|
|
41
|
+
url: string;
|
|
42
|
+
title: string;
|
|
43
|
+
description: string;
|
|
44
|
+
netPrice: number;
|
|
45
|
+
vat: number;
|
|
46
|
+
color: string;
|
|
47
|
+
quantity: number;
|
|
48
|
+
width: number;
|
|
49
|
+
length: number;
|
|
50
|
+
height: number;
|
|
51
|
+
deleted: boolean;
|
|
52
|
+
createdAt: number | null;
|
|
53
|
+
fileId: number;
|
|
54
|
+
};
|
|
55
|
+
calculateGrossPrice(): number;
|
|
38
56
|
setCreatedAt(createdAt: any): void;
|
|
57
|
+
setUrl(url: string): string;
|
|
58
|
+
setTitle(title: string): string;
|
|
59
|
+
setDescription(description: string): string;
|
|
60
|
+
setNetPrice(netPrice: number): number;
|
|
61
|
+
setVat(vat: number): number;
|
|
62
|
+
setColor(color: string): string;
|
|
63
|
+
setQuantity(quantity: number): number;
|
|
64
|
+
setWidth(width: number): number;
|
|
65
|
+
setLength(length: number): number;
|
|
66
|
+
setHeight(height: number): number;
|
|
67
|
+
setFileId(fileId: number): number;
|
|
68
|
+
setDeleted(deleted: boolean): boolean;
|
|
39
69
|
protected getMapper(): StockObjectMapper;
|
|
40
70
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import ProductMapper from "../mappers/ProductMapper";
|
|
1
2
|
import FilesReader from "../reader/FilesReader";
|
|
2
3
|
import FileConnectionE from "../types/FileConnectionE";
|
|
3
4
|
import StockObject from "../types/StockObject";
|
|
@@ -95,10 +96,68 @@ export default class Product extends StockObject {
|
|
|
95
96
|
}
|
|
96
97
|
return this.files;
|
|
97
98
|
}
|
|
99
|
+
getData() {
|
|
100
|
+
return {
|
|
101
|
+
id: this.getId(),
|
|
102
|
+
sku: this.sku,
|
|
103
|
+
url: this.url,
|
|
104
|
+
title: this.title,
|
|
105
|
+
description: this.description,
|
|
106
|
+
netPrice: this.netPrice,
|
|
107
|
+
vat: this.vat,
|
|
108
|
+
color: this.color,
|
|
109
|
+
quantity: this.quantity,
|
|
110
|
+
width: this.width,
|
|
111
|
+
length: this.length,
|
|
112
|
+
height: this.height,
|
|
113
|
+
deleted: this.deleted,
|
|
114
|
+
createdAt: this.createdAt,
|
|
115
|
+
fileId: this.fileId,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
calculateGrossPrice() {
|
|
119
|
+
return calculateNetToGrossPrice(this.netPrice, this.vat);
|
|
120
|
+
}
|
|
98
121
|
setCreatedAt(createdAt) {
|
|
99
122
|
this.createdAt = createdAt;
|
|
100
123
|
}
|
|
124
|
+
setUrl(url) {
|
|
125
|
+
return this.url = url;
|
|
126
|
+
}
|
|
127
|
+
setTitle(title) {
|
|
128
|
+
return this.title = title;
|
|
129
|
+
}
|
|
130
|
+
setDescription(description) {
|
|
131
|
+
return this.description = description;
|
|
132
|
+
}
|
|
133
|
+
setNetPrice(netPrice) {
|
|
134
|
+
return this.netPrice = netPrice;
|
|
135
|
+
}
|
|
136
|
+
setVat(vat) {
|
|
137
|
+
return this.vat = vat;
|
|
138
|
+
}
|
|
139
|
+
setColor(color) {
|
|
140
|
+
return this.color = color;
|
|
141
|
+
}
|
|
142
|
+
setQuantity(quantity) {
|
|
143
|
+
return this.quantity = quantity;
|
|
144
|
+
}
|
|
145
|
+
setWidth(width) {
|
|
146
|
+
return this.width = width;
|
|
147
|
+
}
|
|
148
|
+
setLength(length) {
|
|
149
|
+
return this.length = length;
|
|
150
|
+
}
|
|
151
|
+
setHeight(height) {
|
|
152
|
+
return this.height = height;
|
|
153
|
+
}
|
|
154
|
+
setFileId(fileId) {
|
|
155
|
+
return this.fileId = fileId;
|
|
156
|
+
}
|
|
157
|
+
setDeleted(deleted) {
|
|
158
|
+
return this.deleted = deleted;
|
|
159
|
+
}
|
|
101
160
|
getMapper() {
|
|
102
|
-
|
|
161
|
+
return new ProductMapper(this);
|
|
103
162
|
}
|
|
104
163
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Table from '
|
|
2
|
-
import ClientAccountRow from '
|
|
3
|
-
import Client from '
|
|
4
|
-
import QueryOptions from '
|
|
1
|
+
import Table from '../../Table';
|
|
2
|
+
import ClientAccountRow from '../../types/rows/ClientAccountRow';
|
|
3
|
+
import Client from '../../stockObjects/Client';
|
|
4
|
+
import QueryOptions from '../../query/QueryOptions';
|
|
5
5
|
export default class ClientAccountsTable extends Table {
|
|
6
6
|
select(accountId: number): Promise<ClientAccountRow>;
|
|
7
7
|
selectEmail(id: number): Promise<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Table from '
|
|
2
|
-
import * as SQL from '
|
|
1
|
+
import Table from '../../Table';
|
|
2
|
+
import * as SQL from '../../SQL.json';
|
|
3
3
|
export default class ClientAccountsTable extends Table {
|
|
4
4
|
async select(accountId) {
|
|
5
5
|
const query = this.createQuery(SQL.accounts.select);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Table from '../../Table';
|
|
2
|
+
import FileConnectionE from '../../types/FileConnectionE';
|
|
3
|
+
import FileConnection from '../../stockObjects/FileConnection';
|
|
4
|
+
import FileConnectionRow from '../../types/rows/FileConnectionRow';
|
|
5
|
+
export default class FileConnectionsTable extends Table {
|
|
6
|
+
select(connectionType: FileConnectionE, connection_id: number): Promise<any[]>;
|
|
7
|
+
selectForFileId(fileId: number): Promise<FileConnectionRow[]>;
|
|
8
|
+
insert(fileConnection: FileConnection): Promise<void>;
|
|
9
|
+
delete(fileId: number): Promise<boolean>;
|
|
10
|
+
deleteForConnection(connectionType: string, connectionId: number): Promise<boolean>;
|
|
11
|
+
private bindParameters;
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Table from '../../Table';
|
|
2
|
+
import * as SQL from '../../SQL.json';
|
|
3
|
+
export default class FileConnectionsTable extends Table {
|
|
4
|
+
async select(connectionType, connection_id) {
|
|
5
|
+
const query = this.createQuery(SQL.fileConnections.select);
|
|
6
|
+
query.bindParameter('connectionType', connectionType);
|
|
7
|
+
query.bindParameter('connection_id', connection_id);
|
|
8
|
+
const result = await query.execute();
|
|
9
|
+
return result.getRows();
|
|
10
|
+
}
|
|
11
|
+
async selectForFileId(fileId) {
|
|
12
|
+
const query = this.createQuery(SQL.fileConnections.selectForFileId);
|
|
13
|
+
query.bindParameter('file_id', fileId);
|
|
14
|
+
const result = await query.execute();
|
|
15
|
+
return result.getRows();
|
|
16
|
+
}
|
|
17
|
+
async insert(fileConnection) {
|
|
18
|
+
const query = this.createQuery(SQL.fileConnections.insert);
|
|
19
|
+
this.bindParameters(query, fileConnection);
|
|
20
|
+
await query.execute();
|
|
21
|
+
}
|
|
22
|
+
async delete(fileId) {
|
|
23
|
+
const query = this.createQuery(SQL.fileConnections.delete);
|
|
24
|
+
query.bindParameter('file_id', fileId);
|
|
25
|
+
await query.execute();
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
async deleteForConnection(connectionType, connectionId) {
|
|
29
|
+
const query = this.createQuery(SQL.fileConnections.deleteForConnection);
|
|
30
|
+
query.bindParameter('connection_type', connectionType);
|
|
31
|
+
query.bindParameter('connection_id', connectionId);
|
|
32
|
+
await query.execute();
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
bindParameters(query, fileConnection) {
|
|
36
|
+
query.bindParameter('file_id', fileConnection.getFileId());
|
|
37
|
+
query.bindParameter('connection_type', fileConnection.getConnectionType());
|
|
38
|
+
query.bindParameter('connection_id', fileConnection.getConnectionId());
|
|
39
|
+
query.bindParameter('sequence', fileConnection.getSequence());
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import Table from '../../Table';
|
|
2
2
|
import FileRow from '../../types/rows/FileRow';
|
|
3
3
|
import FileConnectionE from '../../types/FileConnectionE';
|
|
4
|
+
import QueryOptionsI from '../../types/QueryOptionsI';
|
|
5
|
+
import File from '../../stockObjects/File';
|
|
4
6
|
export default class FilesTable extends Table {
|
|
7
|
+
selectId(queryOptions: QueryOptionsI): Promise<number>;
|
|
8
|
+
selectAll(queryOptions: QueryOptionsI): Promise<FileRow[]>;
|
|
5
9
|
select(fileId: number): Promise<FileRow>;
|
|
6
10
|
selectForConnection(connectionType: FileConnectionE, connectionId: number): Promise<FileRow[]>;
|
|
11
|
+
insert(file: File): Promise<boolean>;
|
|
12
|
+
update(fileData: File): Promise<boolean>;
|
|
13
|
+
count(queryOptions: QueryOptionsI): Promise<number>;
|
|
14
|
+
private bindParameters;
|
|
15
|
+
delete(fileId: number): Promise<number>;
|
|
16
|
+
private selectNextId;
|
|
7
17
|
}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import Table from '../../Table';
|
|
2
2
|
import * as SQL from '../../SQL.json';
|
|
3
3
|
export default class FilesTable extends Table {
|
|
4
|
+
async selectId(queryOptions) {
|
|
5
|
+
const query = this.createQuery(SQL.files.selectId, queryOptions);
|
|
6
|
+
const result = await query.execute();
|
|
7
|
+
return result.getValue();
|
|
8
|
+
}
|
|
9
|
+
async selectAll(queryOptions) {
|
|
10
|
+
const query = this.createQuery(SQL.files.selectAll, queryOptions);
|
|
11
|
+
const result = await query.execute();
|
|
12
|
+
return result.getRows();
|
|
13
|
+
}
|
|
4
14
|
async select(fileId) {
|
|
5
15
|
const query = this.createQuery(SQL.files.select);
|
|
6
16
|
query.bindParameter('id', fileId);
|
|
@@ -14,4 +24,42 @@ export default class FilesTable extends Table {
|
|
|
14
24
|
const result = await query.execute();
|
|
15
25
|
return result.getRows();
|
|
16
26
|
}
|
|
27
|
+
async insert(file) {
|
|
28
|
+
const query = this.createQuery(SQL.files.insert);
|
|
29
|
+
const id = await this.selectNextId();
|
|
30
|
+
query.bindParameter('id', id);
|
|
31
|
+
this.bindParameters(query, file);
|
|
32
|
+
await query.execute();
|
|
33
|
+
file.setId(id);
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
async update(fileData) {
|
|
37
|
+
const query = this.createQuery(SQL.files.update);
|
|
38
|
+
this.bindParameters(query, fileData);
|
|
39
|
+
await query.execute();
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
async count(queryOptions) {
|
|
43
|
+
const query = this.createQuery(SQL.files.count, queryOptions);
|
|
44
|
+
const result = await query.execute();
|
|
45
|
+
return result.getValue();
|
|
46
|
+
}
|
|
47
|
+
bindParameters(query, file) {
|
|
48
|
+
query.bindParameter('name', file.getName());
|
|
49
|
+
query.bindParameter('orginal_name', file.getOrginalName());
|
|
50
|
+
query.bindParameter('catalog', file.getCatalog());
|
|
51
|
+
query.bindParameter('size_kb', file.getSizeKb());
|
|
52
|
+
query.bindParameter('type', file.getType());
|
|
53
|
+
}
|
|
54
|
+
async delete(fileId) {
|
|
55
|
+
const query = this.createQuery(SQL.files.delete);
|
|
56
|
+
query.bindParameter('file_id', fileId);
|
|
57
|
+
const response = await query.execute();
|
|
58
|
+
return response.getRowCount();
|
|
59
|
+
}
|
|
60
|
+
async selectNextId() {
|
|
61
|
+
const query = this.createQuery(SQL.files.selectNextId);
|
|
62
|
+
const result = await query.execute();
|
|
63
|
+
return result.getValue();
|
|
64
|
+
}
|
|
17
65
|
}
|
package/dist/tables/{DeliveryStatusTypesTable.js → personalInformation/DeliveryStatusTypesTable.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as SQL from '
|
|
2
|
-
import Table from '
|
|
1
|
+
import * as SQL from '../../SQL.json';
|
|
2
|
+
import Table from '../../Table';
|
|
3
3
|
export default class DeliveryStatusTypesTable extends Table {
|
|
4
4
|
async select(deliveryStatusTypeId) {
|
|
5
5
|
const query = this.createQuery(SQL.deliveryStatusTypes.select);
|
package/dist/tables/{DeliveryStatusesTable.d.ts → personalInformation/DeliveryStatusesTable.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import DeliveryStatus from '
|
|
2
|
-
import Table from '
|
|
3
|
-
import DeliveryStatusRow from '
|
|
1
|
+
import DeliveryStatus from '../../stockObjects/DeliveryStatus';
|
|
2
|
+
import Table from '../../Table';
|
|
3
|
+
import DeliveryStatusRow from '../../types/rows/DeliveryStatusRow';
|
|
4
4
|
export default class DeliveryStatusesTable extends Table {
|
|
5
5
|
select(deliveryDetailsId: number): Promise<DeliveryStatusRow>;
|
|
6
6
|
selectAll(deliveryDetailsId: number): Promise<DeliveryStatusRow[]>;
|