@dascompany/database 1.0.2 → 2.0.0

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 (284) hide show
  1. package/dist/DatabaseConnection.d.ts +3 -3
  2. package/dist/DatabaseConnection.js +2 -2
  3. package/dist/index.d.ts +3 -77
  4. package/dist/index.js +3 -63
  5. package/package.json +1 -1
  6. package/dist/SQL.json +0 -162
  7. package/dist/TableConnection.d.ts +0 -74
  8. package/dist/TableConnection.js +0 -144
  9. package/dist/mappers/AddressMapper.d.ts +0 -9
  10. package/dist/mappers/AddressMapper.js +0 -17
  11. package/dist/mappers/ClientMapper.d.ts +0 -9
  12. package/dist/mappers/ClientMapper.js +0 -24
  13. package/dist/mappers/CompanyDataMapper.d.ts +0 -9
  14. package/dist/mappers/CompanyDataMapper.js +0 -17
  15. package/dist/mappers/CompanyDetailsMapper.d.ts +0 -9
  16. package/dist/mappers/CompanyDetailsMapper.js +0 -22
  17. package/dist/mappers/ContactDetailsMapper.d.ts +0 -9
  18. package/dist/mappers/ContactDetailsMapper.js +0 -18
  19. package/dist/mappers/DeliveryDetailsMapper.d.ts +0 -9
  20. package/dist/mappers/DeliveryDetailsMapper.js +0 -17
  21. package/dist/mappers/DeliveryMethodsMapper.d.ts +0 -9
  22. package/dist/mappers/DeliveryMethodsMapper.js +0 -17
  23. package/dist/mappers/DeliveryStatusMapper.d.ts +0 -9
  24. package/dist/mappers/DeliveryStatusMapper.js +0 -15
  25. package/dist/mappers/FileConnectionMapper.d.ts +0 -9
  26. package/dist/mappers/FileConnectionMapper.js +0 -17
  27. package/dist/mappers/FileMapper.d.ts +0 -9
  28. package/dist/mappers/FileMapper.js +0 -17
  29. package/dist/mappers/InvoiceDetailsMapper.d.ts +0 -9
  30. package/dist/mappers/InvoiceDetailsMapper.js +0 -17
  31. package/dist/mappers/OrderMapper.d.ts +0 -9
  32. package/dist/mappers/OrderMapper.js +0 -19
  33. package/dist/mappers/OrderProductMapper.d.ts +0 -9
  34. package/dist/mappers/OrderProductMapper.js +0 -15
  35. package/dist/mappers/PaymentDetailsMapper.d.ts +0 -9
  36. package/dist/mappers/PaymentDetailsMapper.js +0 -17
  37. package/dist/mappers/PaymentMethodsMapper.d.ts +0 -9
  38. package/dist/mappers/PaymentMethodsMapper.js +0 -17
  39. package/dist/mappers/PaymentStatusMapper.d.ts +0 -9
  40. package/dist/mappers/PaymentStatusMapper.js +0 -15
  41. package/dist/mappers/PersonalDataMapper.d.ts +0 -9
  42. package/dist/mappers/PersonalDataMapper.js +0 -17
  43. package/dist/mappers/ProductMapper.d.ts +0 -9
  44. package/dist/mappers/ProductMapper.js +0 -20
  45. package/dist/mappers/StatusMapper.d.ts +0 -9
  46. package/dist/mappers/StatusMapper.js +0 -15
  47. package/dist/reader/AddressesReader.d.ts +0 -6
  48. package/dist/reader/AddressesReader.js +0 -24
  49. package/dist/reader/ClientAccountReader.d.ts +0 -13
  50. package/dist/reader/ClientAccountReader.js +0 -47
  51. package/dist/reader/CompanyDataReader.d.ts +0 -4
  52. package/dist/reader/CompanyDataReader.js +0 -27
  53. package/dist/reader/CompanyDetailsReader.d.ts +0 -4
  54. package/dist/reader/CompanyDetailsReader.js +0 -15
  55. package/dist/reader/ContactDetailsReader.d.ts +0 -4
  56. package/dist/reader/ContactDetailsReader.js +0 -16
  57. package/dist/reader/DeliveryDetailsReader.d.ts +0 -4
  58. package/dist/reader/DeliveryDetailsReader.js +0 -26
  59. package/dist/reader/DeliveryMethodReader.d.ts +0 -6
  60. package/dist/reader/DeliveryMethodReader.js +0 -18
  61. package/dist/reader/DeliveryStatusReader.d.ts +0 -5
  62. package/dist/reader/DeliveryStatusReader.js +0 -31
  63. package/dist/reader/FileConnectionsReader.d.ts +0 -6
  64. package/dist/reader/FileConnectionsReader.js +0 -25
  65. package/dist/reader/FilesReader.d.ts +0 -12
  66. package/dist/reader/FilesReader.js +0 -46
  67. package/dist/reader/InvoiceDetailsReader.d.ts +0 -4
  68. package/dist/reader/InvoiceDetailsReader.js +0 -21
  69. package/dist/reader/OrderProductsReader.d.ts +0 -7
  70. package/dist/reader/OrderProductsReader.js +0 -51
  71. package/dist/reader/OrderReader.d.ts +0 -12
  72. package/dist/reader/OrderReader.js +0 -53
  73. package/dist/reader/OrderStatusReader.d.ts +0 -6
  74. package/dist/reader/OrderStatusReader.js +0 -29
  75. package/dist/reader/PersonalDataReader.d.ts +0 -5
  76. package/dist/reader/PersonalDataReader.js +0 -27
  77. package/dist/reader/ProductReader.d.ts +0 -11
  78. package/dist/reader/ProductReader.js +0 -62
  79. package/dist/reader/StatusTypesReader.d.ts +0 -3
  80. package/dist/reader/StatusTypesReader.js +0 -8
  81. package/dist/reader/payment/PaymentDetailsReader.d.ts +0 -5
  82. package/dist/reader/payment/PaymentDetailsReader.js +0 -27
  83. package/dist/reader/payment/PaymentMethodReader.d.ts +0 -6
  84. package/dist/reader/payment/PaymentMethodReader.js +0 -18
  85. package/dist/reader/payment/PaymentStatusesReader.d.ts +0 -5
  86. package/dist/reader/payment/PaymentStatusesReader.js +0 -30
  87. package/dist/repo/AddressesRepo.d.ts +0 -5
  88. package/dist/repo/AddressesRepo.js +0 -14
  89. package/dist/repo/ClientAccountRepo.d.ts +0 -7
  90. package/dist/repo/ClientAccountRepo.js +0 -24
  91. package/dist/repo/CompanyDataRepo.d.ts +0 -4
  92. package/dist/repo/CompanyDataRepo.js +0 -11
  93. package/dist/repo/CompanyDetailsRepo.d.ts +0 -5
  94. package/dist/repo/CompanyDetailsRepo.js +0 -14
  95. package/dist/repo/ContactDetailsRepo.d.ts +0 -6
  96. package/dist/repo/ContactDetailsRepo.js +0 -19
  97. package/dist/repo/DeliveryDetailsRepo.d.ts +0 -5
  98. package/dist/repo/DeliveryDetailsRepo.js +0 -14
  99. package/dist/repo/DeliveryMethodRepo.d.ts +0 -4
  100. package/dist/repo/DeliveryMethodRepo.js +0 -11
  101. package/dist/repo/FileConnectionsRepo.d.ts +0 -7
  102. package/dist/repo/FileConnectionsRepo.js +0 -25
  103. package/dist/repo/FilesRepo.d.ts +0 -7
  104. package/dist/repo/FilesRepo.js +0 -26
  105. package/dist/repo/InvoiceDetailsRepo.d.ts +0 -5
  106. package/dist/repo/InvoiceDetailsRepo.js +0 -14
  107. package/dist/repo/OrderProductsRepo.d.ts +0 -7
  108. package/dist/repo/OrderProductsRepo.js +0 -37
  109. package/dist/repo/OrderRepo.d.ts +0 -5
  110. package/dist/repo/OrderRepo.js +0 -14
  111. package/dist/repo/OrderStatusRepo.d.ts +0 -7
  112. package/dist/repo/OrderStatusRepo.js +0 -27
  113. package/dist/repo/PaymentDetailsRepo.d.ts +0 -5
  114. package/dist/repo/PaymentDetailsRepo.js +0 -14
  115. package/dist/repo/PaymentMethodRepo.d.ts +0 -4
  116. package/dist/repo/PaymentMethodRepo.js +0 -11
  117. package/dist/repo/PersonalDataRepo.d.ts +0 -5
  118. package/dist/repo/PersonalDataRepo.js +0 -16
  119. package/dist/repo/ProductRepo.d.ts +0 -6
  120. package/dist/repo/ProductRepo.js +0 -20
  121. package/dist/stockObjects/Address.d.ts +0 -33
  122. package/dist/stockObjects/Address.js +0 -69
  123. package/dist/stockObjects/Client.d.ts +0 -24
  124. package/dist/stockObjects/Client.js +0 -57
  125. package/dist/stockObjects/CompanyData.d.ts +0 -21
  126. package/dist/stockObjects/CompanyData.js +0 -51
  127. package/dist/stockObjects/CompanyDetails.d.ts +0 -17
  128. package/dist/stockObjects/CompanyDetails.js +0 -34
  129. package/dist/stockObjects/ContactDetails.d.ts +0 -12
  130. package/dist/stockObjects/ContactDetails.js +0 -26
  131. package/dist/stockObjects/DeliveryDetails.d.ts +0 -16
  132. package/dist/stockObjects/DeliveryDetails.js +0 -37
  133. package/dist/stockObjects/DeliveryMethods.d.ts +0 -12
  134. package/dist/stockObjects/DeliveryMethods.js +0 -26
  135. package/dist/stockObjects/DeliveryStatus.d.ts +0 -18
  136. package/dist/stockObjects/DeliveryStatus.js +0 -42
  137. package/dist/stockObjects/File.d.ts +0 -21
  138. package/dist/stockObjects/File.js +0 -50
  139. package/dist/stockObjects/FileConnection.d.ts +0 -18
  140. package/dist/stockObjects/FileConnection.js +0 -42
  141. package/dist/stockObjects/InvoiceDetails.d.ts +0 -12
  142. package/dist/stockObjects/InvoiceDetails.js +0 -26
  143. package/dist/stockObjects/Order.d.ts +0 -41
  144. package/dist/stockObjects/Order.js +0 -102
  145. package/dist/stockObjects/OrderProduct.d.ts +0 -15
  146. package/dist/stockObjects/OrderProduct.js +0 -33
  147. package/dist/stockObjects/PaymentDetails.d.ts +0 -12
  148. package/dist/stockObjects/PaymentDetails.js +0 -26
  149. package/dist/stockObjects/PaymentMethods.d.ts +0 -12
  150. package/dist/stockObjects/PaymentMethods.js +0 -26
  151. package/dist/stockObjects/PaymentStatus.d.ts +0 -13
  152. package/dist/stockObjects/PaymentStatus.js +0 -26
  153. package/dist/stockObjects/PersonalData.d.ts +0 -42
  154. package/dist/stockObjects/PersonalData.js +0 -81
  155. package/dist/stockObjects/Product.d.ts +0 -70
  156. package/dist/stockObjects/Product.js +0 -163
  157. package/dist/stockObjects/Status.d.ts +0 -23
  158. package/dist/stockObjects/Status.js +0 -50
  159. package/dist/tables/clients/ClientAccountsTable.d.ts +0 -17
  160. package/dist/tables/clients/ClientAccountsTable.js +0 -74
  161. package/dist/tables/files/FileConnectionsTable.d.ts +0 -12
  162. package/dist/tables/files/FileConnectionsTable.js +0 -41
  163. package/dist/tables/files/FilesTable.d.ts +0 -17
  164. package/dist/tables/files/FilesTable.js +0 -65
  165. package/dist/tables/orders/OrdersProductsTable.d.ts +0 -12
  166. package/dist/tables/orders/OrdersProductsTable.js +0 -42
  167. package/dist/tables/orders/OrdersTable.d.ts +0 -15
  168. package/dist/tables/orders/OrdersTable.js +0 -60
  169. package/dist/tables/orders/PaymentDetailsTable.d.ts +0 -10
  170. package/dist/tables/orders/PaymentDetailsTable.js +0 -34
  171. package/dist/tables/orders/PaymentStatusTypesTable.d.ts +0 -7
  172. package/dist/tables/orders/PaymentStatusTypesTable.js +0 -10
  173. package/dist/tables/orders/PaymentStatusesTable.d.ts +0 -9
  174. package/dist/tables/orders/PaymentStatusesTable.js +0 -30
  175. package/dist/tables/orders/StatusTypesTable.d.ts +0 -4
  176. package/dist/tables/orders/StatusTypesTable.js +0 -9
  177. package/dist/tables/orders/StatusesTable.d.ts +0 -10
  178. package/dist/tables/orders/StatusesTable.js +0 -34
  179. package/dist/tables/personalInformation/AddressesTable.d.ts +0 -10
  180. package/dist/tables/personalInformation/AddressesTable.js +0 -37
  181. package/dist/tables/personalInformation/CompanyDetailsTable.d.ts +0 -11
  182. package/dist/tables/personalInformation/CompanyDetailsTable.js +0 -38
  183. package/dist/tables/personalInformation/ContactDetailsTable.d.ts +0 -10
  184. package/dist/tables/personalInformation/ContactDetailsTable.js +0 -34
  185. package/dist/tables/personalInformation/DeliveryDetailsTable.d.ts +0 -10
  186. package/dist/tables/personalInformation/DeliveryDetailsTable.js +0 -35
  187. package/dist/tables/personalInformation/DeliveryStatusTypesTable.d.ts +0 -7
  188. package/dist/tables/personalInformation/DeliveryStatusTypesTable.js +0 -10
  189. package/dist/tables/personalInformation/DeliveryStatusesTable.d.ts +0 -9
  190. package/dist/tables/personalInformation/DeliveryStatusesTable.js +0 -31
  191. package/dist/tables/personalInformation/InvoiceDetailsTable.d.ts +0 -10
  192. package/dist/tables/personalInformation/InvoiceDetailsTable.js +0 -34
  193. package/dist/tables/personalInformation/PersonalDataTable.d.ts +0 -10
  194. package/dist/tables/personalInformation/PersonalDataTable.js +0 -37
  195. package/dist/tables/public/AdminAccountsTable.d.ts +0 -13
  196. package/dist/tables/public/AdminAccountsTable.js +0 -64
  197. package/dist/tables/public/ProductsTable.d.ts +0 -18
  198. package/dist/tables/public/ProductsTable.js +0 -89
  199. package/dist/tables/settings/CompanyDataTable.d.ts +0 -10
  200. package/dist/tables/settings/CompanyDataTable.js +0 -37
  201. package/dist/tables/settings/DeliveryMethodsTable.d.ts +0 -12
  202. package/dist/tables/settings/DeliveryMethodsTable.js +0 -43
  203. package/dist/tables/settings/PaymentMethodsTable.d.ts +0 -12
  204. package/dist/tables/settings/PaymentMethodsTable.js +0 -43
  205. package/dist/types/AddressI.d.ts +0 -9
  206. package/dist/types/AddressI.js +0 -1
  207. package/dist/types/ClaimI.d.ts +0 -4
  208. package/dist/types/ClaimI.js +0 -1
  209. package/dist/types/ClientAccountI.d.ts +0 -10
  210. package/dist/types/ClientAccountI.js +0 -1
  211. package/dist/types/CompanyDataI.d.ts +0 -8
  212. package/dist/types/CompanyDataI.js +0 -1
  213. package/dist/types/CompanyDetailsI.d.ts +0 -5
  214. package/dist/types/CompanyDetailsI.js +0 -1
  215. package/dist/types/ContactDetailsI.d.ts +0 -7
  216. package/dist/types/ContactDetailsI.js +0 -1
  217. package/dist/types/DeliveryDetailsI.d.ts +0 -9
  218. package/dist/types/DeliveryDetailsI.js +0 -1
  219. package/dist/types/DeliveryMethodI.d.ts +0 -5
  220. package/dist/types/DeliveryMethodI.js +0 -1
  221. package/dist/types/FileConnectionI.d.ts +0 -6
  222. package/dist/types/FileConnectionI.js +0 -1
  223. package/dist/types/FileConnectionTypeE.d.ts +0 -4
  224. package/dist/types/FileConnectionTypeE.js +0 -5
  225. package/dist/types/FileI.d.ts +0 -6
  226. package/dist/types/FileI.js +0 -1
  227. package/dist/types/InvoiceDetailsI.d.ts +0 -7
  228. package/dist/types/InvoiceDetailsI.js +0 -1
  229. package/dist/types/OrderI.d.ts +0 -12
  230. package/dist/types/OrderI.js +0 -1
  231. package/dist/types/OrderProductI.d.ts +0 -14
  232. package/dist/types/OrderProductI.js +0 -1
  233. package/dist/types/PaymentDetailsI.d.ts +0 -6
  234. package/dist/types/PaymentDetailsI.js +0 -1
  235. package/dist/types/PaymentMethodE.d.ts +0 -5
  236. package/dist/types/PaymentMethodE.js +0 -6
  237. package/dist/types/PaymentMethodI.d.ts +0 -5
  238. package/dist/types/PaymentMethodI.js +0 -1
  239. package/dist/types/PaymentStatusE.d.ts +0 -6
  240. package/dist/types/PaymentStatusE.js +0 -7
  241. package/dist/types/PersonalDataI.d.ts +0 -10
  242. package/dist/types/PersonalDataI.js +0 -1
  243. package/dist/types/ProductI.d.ts +0 -20
  244. package/dist/types/ProductI.js +0 -1
  245. package/dist/types/StatusI.d.ts +0 -7
  246. package/dist/types/StatusI.js +0 -1
  247. package/dist/types/rows/AddressRow.d.ts +0 -9
  248. package/dist/types/rows/AddressRow.js +0 -1
  249. package/dist/types/rows/ClientAccountRow.d.ts +0 -10
  250. package/dist/types/rows/ClientAccountRow.js +0 -1
  251. package/dist/types/rows/CompanyDataRow.d.ts +0 -8
  252. package/dist/types/rows/CompanyDataRow.js +0 -1
  253. package/dist/types/rows/CompanyDetailsRow.d.ts +0 -5
  254. package/dist/types/rows/CompanyDetailsRow.js +0 -1
  255. package/dist/types/rows/ContactDetailsRow.d.ts +0 -5
  256. package/dist/types/rows/ContactDetailsRow.js +0 -1
  257. package/dist/types/rows/DeliveryDetailsRow.d.ts +0 -6
  258. package/dist/types/rows/DeliveryDetailsRow.js +0 -1
  259. package/dist/types/rows/DeliveryMethodRow.d.ts +0 -5
  260. package/dist/types/rows/DeliveryMethodRow.js +0 -1
  261. package/dist/types/rows/DeliveryStatusRow.d.ts +0 -7
  262. package/dist/types/rows/DeliveryStatusRow.js +0 -1
  263. package/dist/types/rows/FileConnectionRow.d.ts +0 -6
  264. package/dist/types/rows/FileConnectionRow.js +0 -1
  265. package/dist/types/rows/FileRow.d.ts +0 -9
  266. package/dist/types/rows/FileRow.js +0 -1
  267. package/dist/types/rows/InvoiceDetailsRow.d.ts +0 -5
  268. package/dist/types/rows/InvoiceDetailsRow.js +0 -1
  269. package/dist/types/rows/OrderProductRow.d.ts +0 -10
  270. package/dist/types/rows/OrderProductRow.js +0 -1
  271. package/dist/types/rows/OrderRow.d.ts +0 -15
  272. package/dist/types/rows/OrderRow.js +0 -1
  273. package/dist/types/rows/PaymentDetailsRow.d.ts +0 -6
  274. package/dist/types/rows/PaymentDetailsRow.js +0 -1
  275. package/dist/types/rows/PaymentMethodRow.d.ts +0 -5
  276. package/dist/types/rows/PaymentMethodRow.js +0 -1
  277. package/dist/types/rows/PaymentStatusRow.d.ts +0 -6
  278. package/dist/types/rows/PaymentStatusRow.js +0 -1
  279. package/dist/types/rows/PersonalDataRow.d.ts +0 -8
  280. package/dist/types/rows/PersonalDataRow.js +0 -1
  281. package/dist/types/rows/ProductRow.d.ts +0 -17
  282. package/dist/types/rows/ProductRow.js +0 -1
  283. package/dist/types/rows/StatusRow.d.ts +0 -8
  284. package/dist/types/rows/StatusRow.js +0 -1
@@ -1,11 +1,11 @@
1
1
  import DatabaseConfig from "./DatabaseConfig";
2
- import TableConnection from "./TableConnection";
2
+ import Connection from "./Connection";
3
3
  export default class DatabaseConnection {
4
4
  private static connection;
5
5
  private static configName;
6
6
  private static configField;
7
7
  private static configPath;
8
- static get(): TableConnection;
9
- static create(): Promise<TableConnection>;
8
+ static get(): Connection;
9
+ static create(): Promise<Connection>;
10
10
  static getDatabaseConfig(): Promise<DatabaseConfig>;
11
11
  }
@@ -1,5 +1,5 @@
1
1
  import Database from "./Database";
2
- import TableConnection from "./TableConnection";
2
+ import Connection from "./Connection";
3
3
  import { readFile } from 'fs/promises';
4
4
  export default class DatabaseConnection {
5
5
  static connection;
@@ -15,7 +15,7 @@ export default class DatabaseConnection {
15
15
  if (!this.connection) {
16
16
  const databaseConfig = await this.getDatabaseConfig();
17
17
  const pgClient = await Database.connect(databaseConfig);
18
- this.connection = new TableConnection(pgClient);
18
+ this.connection = new Connection(pgClient);
19
19
  }
20
20
  return this.connection;
21
21
  }
package/dist/index.d.ts CHANGED
@@ -3,88 +3,14 @@ import StockObject from "./types/StockObject";
3
3
  import StockObjectMapper from "./types/StockObjectMapper";
4
4
  import Table from "./Table";
5
5
  import Query from "./query/Query";
6
- import TableConnection from './TableConnection';
7
6
  import ParameterType from './types/parameters/ParameterType';
8
7
  import ParameterFilter from './types/parameters/ParameterFilter';
9
- import ConnectorE from './types/ConnectorE';
10
8
  import ParameterI from './types/ParameterI';
11
9
  import QueryOptionsI from './types/QueryOptionsI';
12
10
  import ResultLimitationI from './types/ResultLimitationI';
13
11
  import Parameters from './utils/Parameters';
14
12
  import OrderByI from "./utils/OrderByI";
15
13
  import QueryOptions from './query/QueryOptions';
16
- import AdminAccountsTable from "./tables/public/AdminAccountsTable";
17
- import Client from "./stockObjects/Client";
18
- import ClientAccountRepo from "./repo/ClientAccountRepo";
19
- import ClientAccountReader from "./reader/ClientAccountReader";
20
- import Address from "./stockObjects/Address";
21
- import AddressI from "./types/AddressI";
22
- import AddressesRepo from "./repo/AddressesRepo";
23
- import AddressesReader from "./reader/AddressesReader";
24
- import PersonalData from "./stockObjects/PersonalData";
25
- import PersonalDataRepo from "./repo/PersonalDataRepo";
26
- import PersonalDataReader from "./reader/PersonalDataReader";
27
- import PersonalDataI from "./types/PersonalDataI";
28
- import CompanyDetails from "./stockObjects/CompanyDetails";
29
- import CompanyDetailsRepo from "./repo/CompanyDetailsRepo";
30
- import CompanyDetailsReader from "./reader/CompanyDetailsReader";
31
- import CompanyDetailsI from "./types/CompanyDetailsI";
32
- import ContactDetails from "./stockObjects/ContactDetails";
33
- import ContactDetailsRepo from "./repo/ContactDetailsRepo";
34
- import ContactDetailsReader from "./reader/ContactDetailsReader";
35
- import ContactDetailsI from "./types/ContactDetailsI";
36
- import DeliveryDetails from "./stockObjects/DeliveryDetails";
37
- import DeliveryDetailsRepo from "./repo/DeliveryDetailsRepo";
38
- import DeliveryDetailsReader from "./reader/DeliveryDetailsReader";
39
- import DeliveryDetailsI from "./types/DeliveryDetailsI";
40
- import DeliveryMethods from "./stockObjects/DeliveryMethods";
41
- import DeliveryMethodRepo from './repo/DeliveryMethodRepo';
42
- import DeliveryMethodReader from "./reader/DeliveryMethodReader";
43
- import DeliveryMethodI from "./types/DeliveryMethodI";
44
- import DeliveryStatus from "./stockObjects/DeliveryStatus";
45
- import DeliveryStatusReader from './reader/DeliveryStatusReader';
46
- import InvoiceDetails from "./stockObjects/InvoiceDetails";
47
- import InvoiceDetailsRepo from "./repo/InvoiceDetailsRepo";
48
- import InvoiceDetailsReader from "./reader/InvoiceDetailsReader";
49
- import InvoiceDetailsI from "./types/InvoiceDetailsI";
50
- import PaymentDetails from "./stockObjects/PaymentDetails";
51
- import PaymentDetailsRepo from "./repo/PaymentDetailsRepo";
52
- import PaymentDetailsReader from "./reader/payment/PaymentDetailsReader";
53
- import PaymentDetailsI from "./types/PaymentDetailsI";
54
- import PaymentMethods from "./stockObjects/PaymentMethods";
55
- import PaymentMethodRepo from './repo/PaymentMethodRepo';
56
- import PaymentMethodReader from "./reader/payment/PaymentMethodReader";
57
- import PaymentMethodE from "./types/PaymentMethodE";
58
- import PaymentMethodI from "./types/PaymentMethodI";
59
- import PaymentStatus from "./stockObjects/PaymentStatus";
60
- import PaymentStatusesReader from "./reader/payment/PaymentStatusesReader";
61
- import PaymentStatusE from './types/PaymentStatusE';
62
- import Order from "./stockObjects/Order";
63
- import OrderRepo from "./repo/OrderRepo";
64
- import OrderReader from "./reader/OrderReader";
65
- import OrderProduct from "./stockObjects/OrderProduct";
66
- import OrderProductsRepo from "./repo/OrderProductsRepo";
67
- import OrderProductsReader from "./reader/OrderProductsReader";
68
- import OrderProductI from './types/OrderProductI';
69
- import Status from "./stockObjects/Status";
70
- import OrderStatusRepo from "./repo/OrderStatusRepo";
71
- import OrderStatusReader from "./reader/OrderStatusReader";
72
- import StatusI from "./types/StatusI";
73
- import StatusTypesReader from './reader/StatusTypesReader';
74
- import ProductI from './types/ProductI';
75
- import Product from "./stockObjects/Product";
76
- import ProductRepo from "./repo/ProductRepo";
77
- import ProductReader from "./reader/ProductReader";
78
- import File from './stockObjects/File';
79
- import FilesRepo from './repo/FilesRepo';
80
- import FilesReader from './reader/FilesReader';
81
- import FileI from "./types/FileI";
82
- import FileConnection from "./stockObjects/FileConnection";
83
- import FileConnectionsRepo from "./repo/FileConnectionsRepo";
84
- import FileConnectionsReader from "./reader/FileConnectionsReader";
85
- import FileConnectionTypeE from './types/FileConnectionTypeE';
86
- import CompanyData from "./stockObjects/CompanyData";
87
- import CompanyDataRepo from "./repo/CompanyDataRepo";
88
- import CompanyDataReader from "./reader/CompanyDataReader";
89
- import CompanyDataI from "./types/CompanyDataI";
90
- export { DatabaseConnection, StockObject, StockObjectMapper, Table, Query, TableConnection, ParameterType, ParameterFilter, ConnectorE, ParameterI, QueryOptionsI, ResultLimitationI, Parameters, OrderByI, QueryOptions, AdminAccountsTable, Client, ClientAccountRepo, ClientAccountReader, Address, AddressI, AddressesRepo, AddressesReader, PersonalData, PersonalDataRepo, PersonalDataReader, PersonalDataI, CompanyDetails, CompanyDetailsRepo, CompanyDetailsReader, CompanyDetailsI, ContactDetails, ContactDetailsRepo, ContactDetailsReader, ContactDetailsI, DeliveryDetails, DeliveryDetailsRepo, DeliveryDetailsReader, DeliveryDetailsI, DeliveryMethods, DeliveryMethodRepo, DeliveryMethodReader, DeliveryMethodI, DeliveryStatus, DeliveryStatusReader, InvoiceDetails, InvoiceDetailsRepo, InvoiceDetailsReader, InvoiceDetailsI, PaymentDetails, PaymentDetailsRepo, PaymentDetailsReader, PaymentDetailsI, PaymentMethods, PaymentMethodRepo, PaymentMethodReader, PaymentMethodE, PaymentMethodI, PaymentStatus, PaymentStatusesReader, PaymentStatusE, Order, OrderRepo, OrderReader, OrderProduct, OrderProductsRepo, OrderProductsReader, OrderProductI, Status, OrderStatusRepo, OrderStatusReader, StatusI, StatusTypesReader, ProductI, Product, ProductRepo, ProductReader, File, FilesRepo, FilesReader, FileI, FileConnection, FileConnectionsRepo, FileConnectionsReader, FileConnectionTypeE, CompanyData, CompanyDataRepo, CompanyDataReader, CompanyDataI, };
14
+ import ConnectorE from "./types/ConnectorE";
15
+ import Connection from "./Connection";
16
+ export { DatabaseConnection, StockObject, StockObjectMapper, Table, Query, ParameterType, ParameterFilter, ConnectorE, ParameterI, QueryOptionsI, ResultLimitationI, Parameters, OrderByI, QueryOptions, Connection };
package/dist/index.js CHANGED
@@ -2,69 +2,9 @@ import DatabaseConnection from "./DatabaseConnection";
2
2
  import StockObject from "./types/StockObject";
3
3
  import Table from "./Table";
4
4
  import Query from "./query/Query";
5
- import TableConnection from './TableConnection';
6
5
  import ParameterType from './types/parameters/ParameterType';
7
- import ConnectorE from './types/ConnectorE';
8
6
  import Parameters from './utils/Parameters';
9
7
  import QueryOptions from './query/QueryOptions';
10
- import AdminAccountsTable from "./tables/public/AdminAccountsTable";
11
- import Client from "./stockObjects/Client";
12
- import ClientAccountRepo from "./repo/ClientAccountRepo";
13
- import ClientAccountReader from "./reader/ClientAccountReader";
14
- import Address from "./stockObjects/Address";
15
- import AddressesRepo from "./repo/AddressesRepo";
16
- import AddressesReader from "./reader/AddressesReader";
17
- import PersonalData from "./stockObjects/PersonalData";
18
- import PersonalDataRepo from "./repo/PersonalDataRepo";
19
- import PersonalDataReader from "./reader/PersonalDataReader";
20
- import CompanyDetails from "./stockObjects/CompanyDetails";
21
- import CompanyDetailsRepo from "./repo/CompanyDetailsRepo";
22
- import CompanyDetailsReader from "./reader/CompanyDetailsReader";
23
- import ContactDetails from "./stockObjects/ContactDetails";
24
- import ContactDetailsRepo from "./repo/ContactDetailsRepo";
25
- import ContactDetailsReader from "./reader/ContactDetailsReader";
26
- import DeliveryDetails from "./stockObjects/DeliveryDetails";
27
- import DeliveryDetailsRepo from "./repo/DeliveryDetailsRepo";
28
- import DeliveryDetailsReader from "./reader/DeliveryDetailsReader";
29
- import DeliveryMethods from "./stockObjects/DeliveryMethods";
30
- import DeliveryMethodRepo from './repo/DeliveryMethodRepo';
31
- import DeliveryMethodReader from "./reader/DeliveryMethodReader";
32
- import DeliveryStatus from "./stockObjects/DeliveryStatus";
33
- import DeliveryStatusReader from './reader/DeliveryStatusReader';
34
- import InvoiceDetails from "./stockObjects/InvoiceDetails";
35
- import InvoiceDetailsRepo from "./repo/InvoiceDetailsRepo";
36
- import InvoiceDetailsReader from "./reader/InvoiceDetailsReader";
37
- import PaymentDetails from "./stockObjects/PaymentDetails";
38
- import PaymentDetailsRepo from "./repo/PaymentDetailsRepo";
39
- import PaymentDetailsReader from "./reader/payment/PaymentDetailsReader";
40
- import PaymentMethods from "./stockObjects/PaymentMethods";
41
- import PaymentMethodRepo from './repo/PaymentMethodRepo';
42
- import PaymentMethodReader from "./reader/payment/PaymentMethodReader";
43
- import PaymentMethodE from "./types/PaymentMethodE";
44
- import PaymentStatus from "./stockObjects/PaymentStatus";
45
- import PaymentStatusesReader from "./reader/payment/PaymentStatusesReader";
46
- import PaymentStatusE from './types/PaymentStatusE';
47
- import Order from "./stockObjects/Order";
48
- import OrderRepo from "./repo/OrderRepo";
49
- import OrderReader from "./reader/OrderReader";
50
- import OrderProduct from "./stockObjects/OrderProduct";
51
- import OrderProductsRepo from "./repo/OrderProductsRepo";
52
- import OrderProductsReader from "./reader/OrderProductsReader";
53
- import Status from "./stockObjects/Status";
54
- import OrderStatusRepo from "./repo/OrderStatusRepo";
55
- import OrderStatusReader from "./reader/OrderStatusReader";
56
- import StatusTypesReader from './reader/StatusTypesReader';
57
- import Product from "./stockObjects/Product";
58
- import ProductRepo from "./repo/ProductRepo";
59
- import ProductReader from "./reader/ProductReader";
60
- import File from './stockObjects/File';
61
- import FilesRepo from './repo/FilesRepo';
62
- import FilesReader from './reader/FilesReader';
63
- import FileConnection from "./stockObjects/FileConnection";
64
- import FileConnectionsRepo from "./repo/FileConnectionsRepo";
65
- import FileConnectionsReader from "./reader/FileConnectionsReader";
66
- import FileConnectionTypeE from './types/FileConnectionTypeE';
67
- import CompanyData from "./stockObjects/CompanyData";
68
- import CompanyDataRepo from "./repo/CompanyDataRepo";
69
- import CompanyDataReader from "./reader/CompanyDataReader";
70
- export { DatabaseConnection, StockObject, Table, Query, TableConnection, ParameterType, ConnectorE, Parameters, QueryOptions, AdminAccountsTable, Client, ClientAccountRepo, ClientAccountReader, Address, AddressesRepo, AddressesReader, PersonalData, PersonalDataRepo, PersonalDataReader, CompanyDetails, CompanyDetailsRepo, CompanyDetailsReader, ContactDetails, ContactDetailsRepo, ContactDetailsReader, DeliveryDetails, DeliveryDetailsRepo, DeliveryDetailsReader, DeliveryMethods, DeliveryMethodRepo, DeliveryMethodReader, DeliveryStatus, DeliveryStatusReader, InvoiceDetails, InvoiceDetailsRepo, InvoiceDetailsReader, PaymentDetails, PaymentDetailsRepo, PaymentDetailsReader, PaymentMethods, PaymentMethodRepo, PaymentMethodReader, PaymentMethodE, PaymentStatus, PaymentStatusesReader, PaymentStatusE, Order, OrderRepo, OrderReader, OrderProduct, OrderProductsRepo, OrderProductsReader, Status, OrderStatusRepo, OrderStatusReader, StatusTypesReader, Product, ProductRepo, ProductReader, File, FilesRepo, FilesReader, FileConnection, FileConnectionsRepo, FileConnectionsReader, FileConnectionTypeE, CompanyData, CompanyDataRepo, CompanyDataReader, };
8
+ import ConnectorE from "./types/ConnectorE";
9
+ import Connection from "./Connection";
10
+ export { DatabaseConnection, StockObject, Table, Query, ParameterType, ConnectorE, Parameters, QueryOptions, Connection };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dascompany/database",
3
- "version": "1.0.2",
3
+ "version": "2.0.0",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "vitest",
package/dist/SQL.json DELETED
@@ -1,162 +0,0 @@
1
- {
2
- "adminAccounts": {
3
- "select": "SELECT id, first_name, last_name, email, created_at, activated, deleted FROM admin_accounts WHERE id = $id::BIGINT",
4
- "selectAll": "SELECT id, first_name, last_name, email, created_at, activated, deleted FROM admin_accounts $WHERE $ORDERBY $LIMIT ",
5
- "selectNextId": "SELECT nextval('admin_account_id'::regclass)",
6
- "selectForEmail": "SELECT id FROM admin_accounts WHERE LOWER( email ) = LOWER($email::TEXT)",
7
- "insert": "INSERT INTO admin_accounts( id, first_name, last_name, email, activated) VALUES ($id::BIGINT, $first_name::TEXT, $last_name::TEXT, LOWER($email::TEXT), $activated::BOOL)",
8
- "update": "UPDATE admin_accounts SET first_name = $first_name::TEXT, last_name = $last_name::TEXT , email = LOWER($email::TEXT), activated = $activated::BOOL, deleted = $deleted::BOOL WHERE id = $id::BIGINT",
9
- "delete": "UPDATE admin_accounts SET deleted = true, activated = false WHERE id = $id::BIGINT",
10
- "count": "SELECT COUNT(*) AS total_rows FROM admin_accounts $WHERE "
11
- },
12
- "accounts": {
13
- "select": "SELECT id, email, created_at, activated, deleted, contact_details_id, delivery_details_id, invoice_details_id FROM clients.accounts WHERE id = $account_id::BIGINT",
14
- "selectAll": "SELECT id, email, created_at, activated, deleted FROM clients.accounts $WHERE $ORDERBY $LIMIT",
15
- "selectNextId": "SELECT nextval('clients.accounts_id'::regclass)",
16
- "getIdForEmail": "SELECT id FROM clients.accounts WHERE LOWER( email ) = LOWER($email::TEXT)",
17
- "insert": "INSERT INTO clients.accounts( id, email, activated, contact_details_id) VALUES ($id::BIGINT, LOWER($email::TEXT), $activated::BOOL, $contact_details_id::BIGINT)",
18
- "update": "UPDATE clients.accounts SET activated = $activated::BOOL, deleted = $deleted::BOOL, contact_details_id = $contact_details_id::BIGINT, delivery_details_id = $delivery_details_id::BIGINT, invoice_details_id = $invoice_details_id::BIGINT WHERE id = $id::BIGINT",
19
- "delete": "DELETE FROM clients.accounts WHERE id = $account_id::BIGINT",
20
- "count": "SELECT COUNT(*) AS total_rows FROM clients.accounts $WHERE ",
21
- "selectEmail": "SELECT email FROM clients.accounts WHERE id = $id:BIGINT"
22
- },
23
- "contactDetails": {
24
- "select": "SELECT id, personal_data_id, address_id FROM personal_information.contact_details WHERE id = $id::BIGINT",
25
- "insert": "INSERT INTO personal_information.contact_details(id, personal_data_id, address_id) VALUES ($id::BIGINT, $personal_data_id::BIGINT, $address_id::BIGINT)",
26
- "update": "UPDATE personal_information.contact_details SET personal_data_id = $personal_data_id::BIGINT, address_id = $address_id::BIGINT WHERE id = $id::BIGINT",
27
- "selectNextId": "SELECT nextval('personal_information.contact_details_id'::regclass)"
28
- },
29
- "deliveryDetails": {
30
- "select": "SELECT id, personal_data_id, address_id, delivery_method_id FROM personal_information.delivery_details WHERE id = $id::BIGINT",
31
- "insert": "INSERT INTO personal_information.delivery_details(id, personal_data_id, address_id, delivery_method_id) VALUES ($id::BIGINT, $personal_data_id::BIGINT, $address_id::BIGINT, $delivery_method_id::BIGINT)",
32
- "update": "UPDATE personal_information.delivery_details SET personal_data_id = $personal_data_id::BIGINT, address_id = $address_id::BIGINT, delivery_method_id = $delivery_method_id::BIGINT WHERE id = $id::BIGINT",
33
- "selectNextId": "SELECT nextval('personal_information.delivery_details_id'::regclass)"
34
- },
35
- "invoiceDetails": {
36
- "select": "SELECT id, personal_data_id, address_id FROM personal_information.invoice_details WHERE id = $id::BIGINT",
37
- "insert": "INSERT INTO personal_information.invoice_details(id, personal_data_id, address_id) VALUES ($id::BIGINT, $personal_data_id::BIGINT, $address_id::BIGINT)",
38
- "update": "UPDATE personal_information.invoice_details SET personal_data_id = $personal_data_id::BIGINT, address_id = $address_id::BIGINT WHERE id = $id::BIGINT",
39
- "selectNextId": "SELECT nextval('personal_information.invoice_details_id'::regclass)"
40
- },
41
- "addresses": {
42
- "select": "SELECT id, country, city, postal_code, street, house_number, apartment_number FROM personal_information.addresses WHERE id = $id::BIGINT",
43
- "insert": "INSERT INTO personal_information.addresses( id, country, city, postal_code, street, house_number, apartment_number) VALUES( $id::BIGINT, $country::TEXT, $city::TEXT, $postal_code::TEXT, $street::TEXT, $house_number::TEXT, $apartment_number::TEXT) ",
44
- "update": "UPDATE personal_information.addresses SET country = $country::TEXT, city = $city::TEXT, postal_code = $postal_code::TEXT , street = $street::TEXT , house_number = $house_number::TEXT , apartment_number = $apartment_number::TEXT WHERE id = $id::BIGINT",
45
- "selectNextId": "SELECT nextval('personal_information.addresses_id'::regclass)"
46
- },
47
- "personalData": {
48
- "select": "SELECT id, first_name, last_name, email, phone_number, company_details_id FROM personal_information.personal_data WHERE id = $id::BIGINT",
49
- "insert": "INSERT INTO personal_information.personal_data (id, first_name, last_name, email, phone_number, company_details_id) VALUES ($id::BIGINT, $first_name::TEXT, $last_name::TEXT, $email::TEXT, $phone_number::TEXT, $company_details_id::BIGINT)",
50
- "update": "UPDATE personal_information.personal_data SET email = $email::TEXT, first_name = $first_name::TEXT, last_name= $last_name::TEXT, phone_number = $phone_number::TEXT, company_details_id = $company_details_id::BIGINT WHERE id = $id::BIGINT",
51
- "selectNextId": "SELECT nextval('personal_information.personal_data_id'::regclass)"
52
- },
53
- "companyDetails": {
54
- "select": "SELECT id, name, tax_number FROM personal_information.company_details WHERE id = $id::BIGINT",
55
- "insert": "INSERT INTO personal_information.company_details( id, name, tax_number ) VALUES ($id::BIGINT, $name::TEXT, $tax_number::TEXT )",
56
- "update": "UPDATE personal_information.company_details SET name = $name::TEXT, tax_number = $tax_number::TEXT WHERE id = $id::BIGINT",
57
- "delete": "DELETE FROM personal_information.company_details WHERE id = $id::BIGINT",
58
- "selectNextId": "SELECT nextval('personal_information.company_details_id'::regclass)"
59
- },
60
- "products": {
61
- "select": "SELECT id, sku, url, title, description, net_price, vat, color, quantity, width, height, length, file_id, created_at, deleted FROM products WHERE id = $id::BIGINT",
62
- "selectForUrl": "SELECT id, sku, url, title, description, net_price, vat, color, quantity, width, height, length, file_id, created_at, deleted FROM products WHERE LOWER( url ) = LOWER($url::TEXT)",
63
- "selectForSku": "SELECT * FROM products WHERE LOWER( sku ) = LOWER($sku::TEXT)",
64
- "selectAll": "SELECT id, sku, url, title, description, net_price, vat, color, quantity, width, height, length, file_id, created_at, deleted FROM products $WHERE $ORDERBY LIMIT $limit::BIGINT OFFSET $offset::BIGINT",
65
- "selectAllActive": "SELECT id, sku, url, title, description, net_price, vat, color, quantity, width, height, length, file_id, created_at, deleted FROM products WHERE deleted = false $PARAMS $ORDERBY LIMIT $limit::BIGINT OFFSET $offset::BIGINT",
66
- "selectIdForSku": "SELECT id FROM products WHERE LOWER( sku ) = LOWER($sku::TEXT) AND deleted = false",
67
- "insert": "INSERT INTO products( id, sku, url, title, description, net_price, vat, color, quantity, width, length, height, file_id, deleted) VALUES ($id::BIGINT, $sku::TEXT, $url::TEXT, $title::TEXT, $description::TEXT, $net_price::DOUBLE PRECISION, $vat::INT, $color::TEXT, $quantity::INT, $width::INT, $length::INT, $height::DOUBLE PRECISION,$file_id::BIGINT ,false::BOOL)",
68
- "update": "UPDATE products SET url = $url::TEXT, title = $title::TEXT, description = $description::TEXT , net_price = $net_price::DOUBLE PRECISION, vat = $vat::INT, color = $color::TEXT, quantity = $quantity::INT, width = $width::INT, length = $length::INT, height = $height::DOUBLE PRECISION, file_id = $file_id::BIGINT WHERE id = $id::BIGINT",
69
- "delete": "UPDATE products SET deleted = true WHERE id = $id::BIGINT",
70
- "selectNextId": "SELECT nextval('product_id'::regclass)",
71
- "count": "SELECT COUNT(*) AS total_rows FROM products WHERE deleted = false $PARAMS"
72
- },
73
- "orders": {
74
- "selectAll": "SELECT id, email, price, client_id, contact_details_id, delivery_details_id, invoice_details_id, payment_details_id, zsi_id, created_at FROM orders.orders",
75
- "select": "SELECT id, email, price, client_id, contact_details_id, delivery_details_id, invoice_details_id, payment_details_id, zsi_id FROM orders.orders WHERE id = $id::BIGINT",
76
- "selectForClient": "SELECT id, email, price, client_id, contact_details_id, delivery_details_id, invoice_details_id, payment_details_id FROM orders.orders WHERE client_id = $client_id::BIGINT ORDER BY id DESC",
77
- "insert": "INSERT INTO orders.orders( id, email, price, client_id, contact_details_id, delivery_details_id, invoice_details_id, payment_details_id ) VALUES ($order_id::BIGINT, $email::TEXT, $price::DOUBLE PRECISION, $client_id::BIGINT, $contact_details_id::BIGINT, $delivery_details_id::BIGINT , $invoice_details_id::BIGINT, $payment_details_id::BIGINT )",
78
- "update": "UPDATE orders.orders SET price = $price::DOUBLE PRECISION, contact_details_id = $contact_details_id::BIGINT, delivery_details_id = $delivery_details_id::BIGINT, invoice_details_id = $invoice_details_id::BIGINT, payment_details_id = $payment_details_id::BIGINT, zsi_id = $zsi_id::BIGINT WHERE id = $id::BIGINT",
79
- "selectNextId": "SELECT nextval('orders.orders_id'::regclass)",
80
- "count": "SELECT COUNT (*) AS TOTAL_ROWS FROM orders.orders as o JOIN orders.statuses as os ON o.id = os.order_id JOIN (SELECT order_id, MAX(id) as max_id FROM orders.statuses GROUP BY order_id) as latest ON os.order_id = latest.order_id AND os.id = latest.max_id $WHERE"
81
- },
82
- "ordersProducts": {
83
- "selectAll": "SELECT op.id, order_id, product_id, title, sku, vat, p.file_id, op.net_price FROM orders.orders_products WHERE order_id = $order_id::BIGINT",
84
- "selectAllActive": "SELECT op.id, order_id, product_id, title, sku, vat, p.file_id, op.net_price FROM orders.orders_products as op JOIN products as p ON op.product_id = p.id WHERE order_id = $order_id::BIGINT and in_order = true",
85
- "insert": "INSERT INTO orders.orders_products( id, order_id, product_id, net_price ) VALUES ( $id::BIGINT , $order_id::BIGINT, $product_id::BIGINT, $net_price::DOUBLE PRECISION )",
86
- "selectNextId": "SELECT nextval('orders.orders_products_id'::regclass)",
87
- "delete": "UPDATE orders.orders_products SET in_order = false WHERE id = $id::BIGINT"
88
- },
89
- "statuses": {
90
- "select": "SELECT s.id, s.order_id, created_at, user_id, s.type as type_id, st.key as type_name FROM orders.statuses as s JOIN orders.status_types as st ON s.type = st.id WHERE s.order_id = $order_id::BIGINT ORDER BY s.id DESC LIMIT 1",
91
- "selectAll": "SELECT s.id, s.order_id, created_at, user_id, s.type as type_id, st.key as type_name FROM orders.statuses as s JOIN orders.status_types as st ON s.type = st.id WHERE order_id = $order_id::BIGINT ORDER BY s.id DESC",
92
- "insert": "INSERT INTO orders.statuses( id, type, order_id, user_id ) VALUES ($id::BIGINT, $type::BIGINT, $order_id::BIGINT, $user_id::BIGINT)",
93
- "selectNextId": "SELECT nextval('orders.statuses_id'::regclass)"
94
- },
95
- "paymentDetails": {
96
- "select": "SELECT id, payment_method_id, payment_order_id FROM orders.payment_details WHERE id = $id::BIGINT",
97
- "insert": "INSERT INTO orders.payment_details(id, payment_method_id, payment_order_id) VALUES ($id::BIGINT, $payment_method_id::BIGINT, $payment_order_id::TEXT)",
98
- "update": "UPDATE orders.payment_details SET payment_method_id = $payment_method_id::BIGINT, payment_order_id = $payment_order_id::TEXT WHERE id = $id::BIGINT",
99
- "selectNextId": "SELECT nextval('orders.payment_details_id'::regclass)"
100
- },
101
- "files": {
102
- "selectId": "SELECT id FROM files.files $WHERE",
103
- "selectAll": "SELECT f.id, f.name, f.orginal_name, f.catalog, f.size_kb, f.type, f.created_at FROM files.files as f $WHERE $ORDERBY",
104
- "select": "SELECT id, name, orginal_name, catalog, size_kb, type, created_at FROM files.files WHERE id = $id::BIGINT",
105
- "selectForConnection": "SELECT id, name, catalog, type, sequence FROM files.files JOIN files.file_connections ON file_id = id WHERE connection_type = $connection_type::TEXT AND connection_id = $connection_id::BIGINT ORDER BY sequence",
106
- "selectNextId": "SELECT nextval('files.files_id'::regclass)",
107
- "insert": "INSERT INTO files.files( id, name, orginal_name, catalog, size_kb, type, created_at ) VALUES ( $id::BIGINT, $name::TEXT, $orginal_name::TEXT, $catalog::TEXT, $size_kb::BIGINT, $type::TEXT, now() )",
108
- "update": "UPDATE files.files SET name = $name::TEXT, orginal_name = $orginal_name::TEXT, catalog = $catalog::TEXT, size_kb = $size_kb::BIGINT, type = $type::TEXT WHERE id = $id::BIGINT ",
109
- "count": "SELECT COUNT(*) AS total_rows FROM files.files as f $WHERE ",
110
- "delete": "DELETE FROM files.files WHERE id = $id::BIGINT "
111
- },
112
- "fileConnections": {
113
- "select": "SELECT file_id, sequence FROM files.file_connections WHERE connection_type = $connection_type::BIGINT and connection_id = $connection_id::BIGINT",
114
- "selectForFileId": "SELECT * FROM files.file_connections WHERE file_id = $file_id::BIGINT",
115
- "insert": "INSERT INTO files.file_connections( file_id, connection_type, connection_id, sequence) VALUES ($file_id::BIGINT, $connection_type::TEXT, $connection_id::BIGINT, $sequence::BIGINT)",
116
- "delete": "DELETE FROM files.file_connections WHERE file_id = $file_id::BIGINT",
117
- "deleteForConnection": "DELETE FROM files.file_connections WHERE connection_type = $connection_type::TEXT AND connection_id = $connection_id::BIGINT"
118
- },
119
- "paymentMethods": {
120
- "select": "SELECT * FROM settings.payment_methods WHERE id = $id::BIGINT",
121
- "selectAll": "SELECT * FROM settings.payment_methods ORDER BY id",
122
- "selectAllActive": "SELECT * FROM settings.payment_methods WHERE active=true ORDER BY id",
123
- "insert": "INSERT INTO settings.payment_methods(id, key, active) VALUES ( $id::BIGINT, $key::TEXT, $active::BOOL)",
124
- "update": "UPDATE settings.payment_methods SET id = $id::BIGINT, key = $key::TEXT, active = $active::BOOL WHERE id = $id::BIGINT",
125
- "selectNextId": "SELECT nextval('settings.payment_methods_id'::regclass)"
126
- },
127
- "deliveryMethods": {
128
- "select": "SELECT * FROM settings.delivery_methods WHERE id = $id::BIGINT",
129
- "selectAll": "SELECT * FROM settings.delivery_methods ORDER BY id",
130
- "selectAllActive": "SELECT * FROM settings.delivery_methods WHERE active=true ORDER BY id",
131
- "insert": "INSERT INTO settings.delivery_methods(id, key, active) VALUES ( $id::BIGINT, $key::TEXT, $active::BOOL)",
132
- "update": "UPDATE settings.delivery_methods SET id = $id::BIGINT, key = $key::TEXT, active = $active::BOOL WHERE id = $id::BIGINT",
133
- "selectNextId": "SELECT nextval('settings.delivery_methods_id'::regclass)"
134
- },
135
- "paymentStatusTypes": {
136
- "select": "SELECT * FROM orders.payment_status_types WHERE id = $id::BIGINT"
137
- },
138
- "deliveryStatusTypes": {
139
- "select": "SELECT * FROM personal_information.delivery_status_types WHERE id = $id::BIGINT"
140
- },
141
- "deliveryStatuses": {
142
- "select": "SELECT * FROM personal_information.delivery_statuses WHERE delivery_details_id = $delivery_details_id::BIGINT ORDER BY id DESC LIMIT 1",
143
- "selectAll": "SELECT * FROM personal_information.delivery_statuses WHERE delivery_details_id = $delivery_details_id::BIGINT ORDER BY id DESC",
144
- "insert": "INSERT INTO personal_information.delivery_statuses( id, delivery_details_id, delivery_status_type_id, user_id ) VALUES ($id::BIGINT, $delivery_details_id::BIGINT, $delivery_status_type_id::BIGINT, $user_id::BIGINT)",
145
- "selectNextId": "SELECT nextval('personal_information.delivery_statuses_id'::regclass)"
146
- },
147
- "paymentStatuses": {
148
- "select": "SELECT * FROM orders.payment_statuses WHERE payment_details_id = $payment_details_id::BIGINT ORDER BY id DESC LIMIT 1",
149
- "selectAll": "SELECT * FROM orders.payment_statuses WHERE payment_details_id = $payment_details_id::BIGINT ORDER BY id DESC",
150
- "insert": "INSERT INTO orders.payment_statuses( id, payment_details_id, payment_status_type_id ) VALUES ($id::BIGINT, $payment_details_id::BIGINT, $payment_status_type_id::BIGINT)",
151
- "selectNextId": "SELECT nextval('orders.payment_statuses_id'::regclass)"
152
- },
153
- "statusTypes": {
154
- "select": "SELECT * FROM orders.status_types"
155
- },
156
- "companyData": {
157
- "select": "SELECT * FROM settings.company_data ORDER BY id DESC LIMIT 1",
158
- "insert": "INSERT INTO settings.company_data(id, name, tax_number, email, phone_number, address_id) VALUES ( $id::BIGINT, $name::TEXT, $tax_number::TEXT, $email::TEXT, $phone_number::TEXT, $address_id::BIGINT )",
159
- "update": "UPDATE settings.company_data SET id = $id::BIGINT, name = $name::TEXT , email = LOWER($email::TEXT), phone_number = $phone_number::TEXT, tax_number = $tax_number::TEXT WHERE id = $id::BIGINT",
160
- "selectNextId": "SELECT nextval('settings.company_data_id'::regclass)"
161
- }
162
- }
@@ -1,74 +0,0 @@
1
- import { Client } from 'pg';
2
- import Connection from './Connection';
3
- import OrdersTable from './tables/orders/OrdersTable';
4
- import FilesTable from './tables/files/FilesTable';
5
- import StatusesTable from './tables/orders/StatusesTable';
6
- import ProductsTable from './tables/public/ProductsTable';
7
- import ClientAccountsTable from './tables/clients/ClientAccountsTable';
8
- import OrdersProductsTable from './tables/orders/OrdersProductsTable';
9
- import PaymentStatusTypesTable from './tables/orders/PaymentStatusTypesTable';
10
- import AddressesTable from './tables/personalInformation/AddressesTable';
11
- import DeliveryStatusTypesTable from './tables/personalInformation/DeliveryStatusTypesTable';
12
- import PaymentMethodsTable from './tables/settings/PaymentMethodsTable';
13
- import PersonalDataTable from './tables/personalInformation/PersonalDataTable';
14
- import DeliveryMethodsTable from './tables/settings/DeliveryMethodsTable';
15
- import CompanyDetailsTable from './tables/personalInformation/CompanyDetailsTable';
16
- import ContactDetailsTable from './tables/personalInformation/ContactDetailsTable';
17
- import InvoiceDetailsTable from './tables/personalInformation/InvoiceDetailsTable';
18
- import DeliveryDetailsTable from './tables/personalInformation/DeliveryDetailsTable';
19
- import DeliveryStatusesTable from './tables/personalInformation/DeliveryStatusesTable';
20
- import PaymentDetailsTable from './tables/orders/PaymentDetailsTable';
21
- import PaymentStatusesTable from './tables/orders/PaymentStatusesTable';
22
- import StatusTypesTable from './tables/orders/StatusTypesTable';
23
- import CompanyDataTable from './tables/settings/CompanyDataTable';
24
- import FileConnectionsTable from './tables/files/FileConnectionsTable';
25
- import AdminAccountsTable from './tables/public/AdminAccountsTable';
26
- export default class TableConnection extends Connection {
27
- private _AdminAccountsTable;
28
- private _StatusTypesTable;
29
- private _FilesTable;
30
- private _OrdersTable;
31
- private _ProductsTable;
32
- private _StatusesTable;
33
- private _AddressesTable;
34
- private _PersonalDataTable;
35
- private _CompanyDetailsTable;
36
- private _ClientAccountsTable;
37
- private _OrdersProductsTable;
38
- private _ContactDetailsTable;
39
- private _InvoiceDetailsTable;
40
- private _PaymentMethodsTable;
41
- private _DeliveryDetailsTable;
42
- private _DeliveryMethodsTable;
43
- private _PaymentStatusTypesTable;
44
- private _DeliveryStatusTypesTable;
45
- private _DeliveryStatusesTable;
46
- private _PaymentDetailsTable;
47
- private _PaymentStatusesTable;
48
- private _CompanyDataTable;
49
- private _FileConnectionsTable;
50
- constructor(pgClient: Client);
51
- get adminAccounts(): AdminAccountsTable;
52
- get statusTypes(): StatusTypesTable;
53
- get files(): FilesTable;
54
- get orders(): OrdersTable;
55
- get products(): ProductsTable;
56
- get statuses(): StatusesTable;
57
- get addresses(): AddressesTable;
58
- get accounts(): ClientAccountsTable;
59
- get companyDetails(): CompanyDetailsTable;
60
- get personalData(): PersonalDataTable;
61
- get ordersProducts(): OrdersProductsTable;
62
- get contactDetails(): ContactDetailsTable;
63
- get deliveryDetails(): DeliveryDetailsTable;
64
- get invoiceDetails(): InvoiceDetailsTable;
65
- get deliveryMethods(): DeliveryMethodsTable;
66
- get paymentMethods(): PaymentMethodsTable;
67
- get paymentStatusTypes(): PaymentStatusTypesTable;
68
- get deliveryStatusTypes(): DeliveryStatusTypesTable;
69
- get deliveryStatuses(): DeliveryStatusesTable;
70
- get paymentDetails(): PaymentDetailsTable;
71
- get paymentStatuses(): PaymentStatusesTable;
72
- get companyData(): CompanyDataTable;
73
- get fileConnections(): FileConnectionsTable;
74
- }
@@ -1,144 +0,0 @@
1
- import Connection from './Connection';
2
- import OrdersTable from './tables/orders/OrdersTable';
3
- import FilesTable from './tables/files/FilesTable';
4
- import StatusesTable from './tables/orders/StatusesTable';
5
- import ProductsTable from './tables/public/ProductsTable';
6
- import ClientAccountsTable from './tables/clients/ClientAccountsTable';
7
- import OrdersProductsTable from './tables/orders/OrdersProductsTable';
8
- import PaymentStatusTypesTable from './tables/orders/PaymentStatusTypesTable';
9
- import AddressesTable from './tables/personalInformation/AddressesTable';
10
- import DeliveryStatusTypesTable from './tables/personalInformation/DeliveryStatusTypesTable';
11
- import PaymentMethodsTable from './tables/settings/PaymentMethodsTable';
12
- import PersonalDataTable from './tables/personalInformation/PersonalDataTable';
13
- import DeliveryMethodsTable from './tables/settings/DeliveryMethodsTable';
14
- import CompanyDetailsTable from './tables/personalInformation/CompanyDetailsTable';
15
- import ContactDetailsTable from './tables/personalInformation/ContactDetailsTable';
16
- import InvoiceDetailsTable from './tables/personalInformation/InvoiceDetailsTable';
17
- import DeliveryDetailsTable from './tables/personalInformation/DeliveryDetailsTable';
18
- import DeliveryStatusesTable from './tables/personalInformation/DeliveryStatusesTable';
19
- import PaymentDetailsTable from './tables/orders/PaymentDetailsTable';
20
- import PaymentStatusesTable from './tables/orders/PaymentStatusesTable';
21
- import StatusTypesTable from './tables/orders/StatusTypesTable';
22
- import CompanyDataTable from './tables/settings/CompanyDataTable';
23
- import FileConnectionsTable from './tables/files/FileConnectionsTable';
24
- import AdminAccountsTable from './tables/public/AdminAccountsTable';
25
- export default class TableConnection extends Connection {
26
- _AdminAccountsTable;
27
- _StatusTypesTable;
28
- _FilesTable;
29
- _OrdersTable;
30
- _ProductsTable;
31
- _StatusesTable;
32
- _AddressesTable;
33
- _PersonalDataTable;
34
- _CompanyDetailsTable;
35
- _ClientAccountsTable;
36
- _OrdersProductsTable;
37
- _ContactDetailsTable;
38
- _InvoiceDetailsTable;
39
- _PaymentMethodsTable;
40
- _DeliveryDetailsTable;
41
- _DeliveryMethodsTable;
42
- _PaymentStatusTypesTable;
43
- _DeliveryStatusTypesTable;
44
- _DeliveryStatusesTable;
45
- _PaymentDetailsTable;
46
- _PaymentStatusesTable;
47
- _CompanyDataTable;
48
- _FileConnectionsTable;
49
- constructor(pgClient) {
50
- super(pgClient);
51
- this._AdminAccountsTable = new AdminAccountsTable(this);
52
- this._StatusTypesTable = new StatusTypesTable(this);
53
- this._FilesTable = new FilesTable(this);
54
- this._OrdersTable = new OrdersTable(this);
55
- this._StatusesTable = new StatusesTable(this);
56
- this._ProductsTable = new ProductsTable(this);
57
- this._AddressesTable = new AddressesTable(this);
58
- this._PersonalDataTable = new PersonalDataTable(this);
59
- this._CompanyDetailsTable = new CompanyDetailsTable(this);
60
- this._OrdersProductsTable = new OrdersProductsTable(this);
61
- this._ContactDetailsTable = new ContactDetailsTable(this);
62
- this._InvoiceDetailsTable = new InvoiceDetailsTable(this);
63
- this._ClientAccountsTable = new ClientAccountsTable(this);
64
- this._PaymentMethodsTable = new PaymentMethodsTable(this);
65
- this._DeliveryDetailsTable = new DeliveryDetailsTable(this);
66
- this._DeliveryMethodsTable = new DeliveryMethodsTable(this);
67
- this._PaymentStatusTypesTable = new PaymentStatusTypesTable(this);
68
- this._DeliveryStatusTypesTable = new DeliveryStatusTypesTable(this);
69
- this._DeliveryStatusesTable = new DeliveryStatusesTable(this);
70
- this._PaymentDetailsTable = new PaymentDetailsTable(this);
71
- this._PaymentStatusesTable = new PaymentStatusesTable(this);
72
- this._CompanyDataTable = new CompanyDataTable(this);
73
- this._FileConnectionsTable = new FileConnectionsTable(this);
74
- }
75
- get adminAccounts() {
76
- return this._AdminAccountsTable;
77
- }
78
- get statusTypes() {
79
- return this._StatusTypesTable;
80
- }
81
- get files() {
82
- return this._FilesTable;
83
- }
84
- get orders() {
85
- return this._OrdersTable;
86
- }
87
- get products() {
88
- return this._ProductsTable;
89
- }
90
- get statuses() {
91
- return this._StatusesTable;
92
- }
93
- get addresses() {
94
- return this._AddressesTable;
95
- }
96
- get accounts() {
97
- return this._ClientAccountsTable;
98
- }
99
- get companyDetails() {
100
- return this._CompanyDetailsTable;
101
- }
102
- get personalData() {
103
- return this._PersonalDataTable;
104
- }
105
- get ordersProducts() {
106
- return this._OrdersProductsTable;
107
- }
108
- get contactDetails() {
109
- return this._ContactDetailsTable;
110
- }
111
- get deliveryDetails() {
112
- return this._DeliveryDetailsTable;
113
- }
114
- get invoiceDetails() {
115
- return this._InvoiceDetailsTable;
116
- }
117
- get deliveryMethods() {
118
- return this._DeliveryMethodsTable;
119
- }
120
- get paymentMethods() {
121
- return this._PaymentMethodsTable;
122
- }
123
- get paymentStatusTypes() {
124
- return this._PaymentStatusTypesTable;
125
- }
126
- get deliveryStatusTypes() {
127
- return this._DeliveryStatusTypesTable;
128
- }
129
- get deliveryStatuses() {
130
- return this._DeliveryStatusesTable;
131
- }
132
- get paymentDetails() {
133
- return this._PaymentDetailsTable;
134
- }
135
- get paymentStatuses() {
136
- return this._PaymentStatusesTable;
137
- }
138
- get companyData() {
139
- return this._CompanyDataTable;
140
- }
141
- get fileConnections() {
142
- return this._FileConnectionsTable;
143
- }
144
- }
@@ -1,9 +0,0 @@
1
- import Address from "../stockObjects/Address";
2
- import StockObjectMapper from "../types/StockObjectMapper";
3
- export default class AddressMapper implements StockObjectMapper {
4
- private address;
5
- private addressesTable;
6
- constructor(address: Address);
7
- save(): Promise<void>;
8
- delete(): Promise<void>;
9
- }
@@ -1,17 +0,0 @@
1
- import DatabaseConnection from "../DatabaseConnection";
2
- export default class AddressMapper {
3
- address;
4
- addressesTable;
5
- constructor(address) {
6
- this.addressesTable = DatabaseConnection.get().addresses;
7
- this.address = address;
8
- }
9
- async save() {
10
- if (this.address.getId())
11
- await this.addressesTable.update(this.address);
12
- else
13
- await this.addressesTable.insert(this.address);
14
- }
15
- async delete() {
16
- }
17
- }