@dascompany/product 1.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 (307) hide show
  1. package/README.md +0 -0
  2. package/dist/ProductConnectionFactory.d.ts +6 -0
  3. package/dist/ProductConnectionFactory.js +11 -0
  4. package/dist/ProductServiceConnection.d.ts +9 -0
  5. package/dist/ProductServiceConnection.js +16 -0
  6. package/dist/ProductsSchema.d.ts +52 -0
  7. package/dist/ProductsSchema.js +146 -0
  8. package/dist/SQL.json +162 -0
  9. package/dist/index.d.ts +77 -0
  10. package/dist/index.js +63 -0
  11. package/dist/mappers/AddressMapper.d.ts +9 -0
  12. package/dist/mappers/AddressMapper.js +17 -0
  13. package/dist/mappers/AdminMapper.d.ts +9 -0
  14. package/dist/mappers/AdminMapper.js +24 -0
  15. package/dist/mappers/ClientMapper.d.ts +9 -0
  16. package/dist/mappers/ClientMapper.js +24 -0
  17. package/dist/mappers/CompanyDataMapper.d.ts +9 -0
  18. package/dist/mappers/CompanyDataMapper.js +17 -0
  19. package/dist/mappers/CompanyDetailsMapper.d.ts +9 -0
  20. package/dist/mappers/CompanyDetailsMapper.js +22 -0
  21. package/dist/mappers/ContactDetailsMapper.d.ts +9 -0
  22. package/dist/mappers/ContactDetailsMapper.js +18 -0
  23. package/dist/mappers/DeliveryDetailsMapper.d.ts +9 -0
  24. package/dist/mappers/DeliveryDetailsMapper.js +17 -0
  25. package/dist/mappers/DeliveryMethodsMapper.d.ts +9 -0
  26. package/dist/mappers/DeliveryMethodsMapper.js +17 -0
  27. package/dist/mappers/DeliveryStatusMapper.d.ts +9 -0
  28. package/dist/mappers/DeliveryStatusMapper.js +15 -0
  29. package/dist/mappers/FileConnectionMapper.d.ts +9 -0
  30. package/dist/mappers/FileConnectionMapper.js +17 -0
  31. package/dist/mappers/FileMapper.d.ts +9 -0
  32. package/dist/mappers/FileMapper.js +17 -0
  33. package/dist/mappers/InvoiceDetailsMapper.d.ts +9 -0
  34. package/dist/mappers/InvoiceDetailsMapper.js +17 -0
  35. package/dist/mappers/OrderMapper.d.ts +9 -0
  36. package/dist/mappers/OrderMapper.js +19 -0
  37. package/dist/mappers/OrderProductMapper.d.ts +9 -0
  38. package/dist/mappers/OrderProductMapper.js +15 -0
  39. package/dist/mappers/PaymentDetailsMapper.d.ts +9 -0
  40. package/dist/mappers/PaymentDetailsMapper.js +17 -0
  41. package/dist/mappers/PaymentMethodsMapper.d.ts +9 -0
  42. package/dist/mappers/PaymentMethodsMapper.js +17 -0
  43. package/dist/mappers/PaymentStatusMapper.d.ts +9 -0
  44. package/dist/mappers/PaymentStatusMapper.js +15 -0
  45. package/dist/mappers/PersonalDataMapper.d.ts +9 -0
  46. package/dist/mappers/PersonalDataMapper.js +17 -0
  47. package/dist/mappers/ProductMapper.d.ts +9 -0
  48. package/dist/mappers/ProductMapper.js +20 -0
  49. package/dist/mappers/StatusMapper.d.ts +9 -0
  50. package/dist/mappers/StatusMapper.js +15 -0
  51. package/dist/reader/AddressesReader.d.ts +6 -0
  52. package/dist/reader/AddressesReader.js +24 -0
  53. package/dist/reader/AdminReader.d.ts +12 -0
  54. package/dist/reader/AdminReader.js +40 -0
  55. package/dist/reader/ClientAccountReader.d.ts +13 -0
  56. package/dist/reader/ClientAccountReader.js +47 -0
  57. package/dist/reader/CompanyDataReader.d.ts +4 -0
  58. package/dist/reader/CompanyDataReader.js +27 -0
  59. package/dist/reader/CompanyDetailsReader.d.ts +4 -0
  60. package/dist/reader/CompanyDetailsReader.js +15 -0
  61. package/dist/reader/ContactDetailsReader.d.ts +4 -0
  62. package/dist/reader/ContactDetailsReader.js +16 -0
  63. package/dist/reader/DeliveryDetailsReader.d.ts +4 -0
  64. package/dist/reader/DeliveryDetailsReader.js +26 -0
  65. package/dist/reader/DeliveryMethodReader.d.ts +6 -0
  66. package/dist/reader/DeliveryMethodReader.js +18 -0
  67. package/dist/reader/DeliveryStatusReader.d.ts +5 -0
  68. package/dist/reader/DeliveryStatusReader.js +31 -0
  69. package/dist/reader/FileConnectionsReader.d.ts +6 -0
  70. package/dist/reader/FileConnectionsReader.js +25 -0
  71. package/dist/reader/FilesReader.d.ts +12 -0
  72. package/dist/reader/FilesReader.js +46 -0
  73. package/dist/reader/InvoiceDetailsReader.d.ts +4 -0
  74. package/dist/reader/InvoiceDetailsReader.js +21 -0
  75. package/dist/reader/OrderProductsReader.d.ts +7 -0
  76. package/dist/reader/OrderProductsReader.js +51 -0
  77. package/dist/reader/OrderReader.d.ts +12 -0
  78. package/dist/reader/OrderReader.js +53 -0
  79. package/dist/reader/OrderStatusReader.d.ts +6 -0
  80. package/dist/reader/OrderStatusReader.js +29 -0
  81. package/dist/reader/PersonalDataReader.d.ts +5 -0
  82. package/dist/reader/PersonalDataReader.js +27 -0
  83. package/dist/reader/ProductReader.d.ts +11 -0
  84. package/dist/reader/ProductReader.js +62 -0
  85. package/dist/reader/StatusTypesReader.d.ts +3 -0
  86. package/dist/reader/StatusTypesReader.js +8 -0
  87. package/dist/reader/payment/PaymentDetailsReader.d.ts +5 -0
  88. package/dist/reader/payment/PaymentDetailsReader.js +27 -0
  89. package/dist/reader/payment/PaymentMethodReader.d.ts +6 -0
  90. package/dist/reader/payment/PaymentMethodReader.js +18 -0
  91. package/dist/reader/payment/PaymentStatusesReader.d.ts +5 -0
  92. package/dist/reader/payment/PaymentStatusesReader.js +30 -0
  93. package/dist/repo/AddressesRepo.d.ts +5 -0
  94. package/dist/repo/AddressesRepo.js +14 -0
  95. package/dist/repo/AdminRepo.d.ts +12 -0
  96. package/dist/repo/AdminRepo.js +32 -0
  97. package/dist/repo/ClientAccountRepo.d.ts +7 -0
  98. package/dist/repo/ClientAccountRepo.js +24 -0
  99. package/dist/repo/CompanyDataRepo.d.ts +4 -0
  100. package/dist/repo/CompanyDataRepo.js +11 -0
  101. package/dist/repo/CompanyDetailsRepo.d.ts +5 -0
  102. package/dist/repo/CompanyDetailsRepo.js +14 -0
  103. package/dist/repo/ContactDetailsRepo.d.ts +6 -0
  104. package/dist/repo/ContactDetailsRepo.js +19 -0
  105. package/dist/repo/DeliveryDetailsRepo.d.ts +5 -0
  106. package/dist/repo/DeliveryDetailsRepo.js +14 -0
  107. package/dist/repo/DeliveryMethodRepo.d.ts +4 -0
  108. package/dist/repo/DeliveryMethodRepo.js +11 -0
  109. package/dist/repo/FileConnectionsRepo.d.ts +7 -0
  110. package/dist/repo/FileConnectionsRepo.js +25 -0
  111. package/dist/repo/FilesRepo.d.ts +7 -0
  112. package/dist/repo/FilesRepo.js +26 -0
  113. package/dist/repo/InvoiceDetailsRepo.d.ts +5 -0
  114. package/dist/repo/InvoiceDetailsRepo.js +14 -0
  115. package/dist/repo/OrderProductsRepo.d.ts +7 -0
  116. package/dist/repo/OrderProductsRepo.js +36 -0
  117. package/dist/repo/OrderRepo.d.ts +5 -0
  118. package/dist/repo/OrderRepo.js +14 -0
  119. package/dist/repo/OrderStatusRepo.d.ts +7 -0
  120. package/dist/repo/OrderStatusRepo.js +27 -0
  121. package/dist/repo/PaymentDetailsRepo.d.ts +5 -0
  122. package/dist/repo/PaymentDetailsRepo.js +14 -0
  123. package/dist/repo/PaymentMethodRepo.d.ts +4 -0
  124. package/dist/repo/PaymentMethodRepo.js +11 -0
  125. package/dist/repo/PersonalDataRepo.d.ts +5 -0
  126. package/dist/repo/PersonalDataRepo.js +16 -0
  127. package/dist/repo/ProductRepo.d.ts +6 -0
  128. package/dist/repo/ProductRepo.js +20 -0
  129. package/dist/stockObjects/Address.d.ts +32 -0
  130. package/dist/stockObjects/Address.js +69 -0
  131. package/dist/stockObjects/Admin.d.ts +24 -0
  132. package/dist/stockObjects/Admin.js +57 -0
  133. package/dist/stockObjects/Client.d.ts +23 -0
  134. package/dist/stockObjects/Client.js +57 -0
  135. package/dist/stockObjects/CompanyData.d.ts +20 -0
  136. package/dist/stockObjects/CompanyData.js +51 -0
  137. package/dist/stockObjects/CompanyDetails.d.ts +13 -0
  138. package/dist/stockObjects/CompanyDetails.js +34 -0
  139. package/dist/stockObjects/ContactDetails.d.ts +11 -0
  140. package/dist/stockObjects/ContactDetails.js +26 -0
  141. package/dist/stockObjects/DeliveryDetails.d.ts +15 -0
  142. package/dist/stockObjects/DeliveryDetails.js +37 -0
  143. package/dist/stockObjects/DeliveryMethods.d.ts +11 -0
  144. package/dist/stockObjects/DeliveryMethods.js +26 -0
  145. package/dist/stockObjects/DeliveryStatus.d.ts +17 -0
  146. package/dist/stockObjects/DeliveryStatus.js +42 -0
  147. package/dist/stockObjects/File.d.ts +20 -0
  148. package/dist/stockObjects/File.js +50 -0
  149. package/dist/stockObjects/FileConnection.d.ts +17 -0
  150. package/dist/stockObjects/FileConnection.js +42 -0
  151. package/dist/stockObjects/InvoiceDetails.d.ts +11 -0
  152. package/dist/stockObjects/InvoiceDetails.js +26 -0
  153. package/dist/stockObjects/Order.d.ts +40 -0
  154. package/dist/stockObjects/Order.js +102 -0
  155. package/dist/stockObjects/OrderProduct.d.ts +14 -0
  156. package/dist/stockObjects/OrderProduct.js +33 -0
  157. package/dist/stockObjects/PaymentDetails.d.ts +11 -0
  158. package/dist/stockObjects/PaymentDetails.js +26 -0
  159. package/dist/stockObjects/PaymentMethods.d.ts +11 -0
  160. package/dist/stockObjects/PaymentMethods.js +26 -0
  161. package/dist/stockObjects/PaymentStatus.d.ts +12 -0
  162. package/dist/stockObjects/PaymentStatus.js +26 -0
  163. package/dist/stockObjects/PersonalData.d.ts +34 -0
  164. package/dist/stockObjects/PersonalData.js +81 -0
  165. package/dist/stockObjects/Product.d.ts +69 -0
  166. package/dist/stockObjects/Product.js +163 -0
  167. package/dist/stockObjects/Status.d.ts +22 -0
  168. package/dist/stockObjects/Status.js +50 -0
  169. package/dist/tables/SchemaNames.d.ts +4 -0
  170. package/dist/tables/SchemaNames.js +5 -0
  171. package/dist/tables/TableNames.d.ts +26 -0
  172. package/dist/tables/TableNames.js +27 -0
  173. package/dist/tables/clients/ClientAccountsTable.d.ts +16 -0
  174. package/dist/tables/clients/ClientAccountsTable.js +74 -0
  175. package/dist/tables/files/FileConnectionsTable.d.ts +12 -0
  176. package/dist/tables/files/FileConnectionsTable.js +41 -0
  177. package/dist/tables/files/FilesTable.d.ts +16 -0
  178. package/dist/tables/files/FilesTable.js +65 -0
  179. package/dist/tables/orders/OrdersProductsTable.d.ts +11 -0
  180. package/dist/tables/orders/OrdersProductsTable.js +42 -0
  181. package/dist/tables/orders/OrdersTable.d.ts +14 -0
  182. package/dist/tables/orders/OrdersTable.js +60 -0
  183. package/dist/tables/orders/PaymentDetailsTable.d.ts +10 -0
  184. package/dist/tables/orders/PaymentDetailsTable.js +34 -0
  185. package/dist/tables/orders/PaymentStatusTypesTable.d.ts +7 -0
  186. package/dist/tables/orders/PaymentStatusTypesTable.js +10 -0
  187. package/dist/tables/orders/PaymentStatusesTable.d.ts +9 -0
  188. package/dist/tables/orders/PaymentStatusesTable.js +30 -0
  189. package/dist/tables/orders/StatusTypesTable.d.ts +4 -0
  190. package/dist/tables/orders/StatusTypesTable.js +9 -0
  191. package/dist/tables/orders/StatusesTable.d.ts +10 -0
  192. package/dist/tables/orders/StatusesTable.js +34 -0
  193. package/dist/tables/personalInformation/AddressesTable.d.ts +10 -0
  194. package/dist/tables/personalInformation/AddressesTable.js +37 -0
  195. package/dist/tables/personalInformation/CompanyDetailsTable.d.ts +11 -0
  196. package/dist/tables/personalInformation/CompanyDetailsTable.js +38 -0
  197. package/dist/tables/personalInformation/ContactDetailsTable.d.ts +10 -0
  198. package/dist/tables/personalInformation/ContactDetailsTable.js +34 -0
  199. package/dist/tables/personalInformation/DeliveryDetailsTable.d.ts +10 -0
  200. package/dist/tables/personalInformation/DeliveryDetailsTable.js +35 -0
  201. package/dist/tables/personalInformation/DeliveryStatusTypesTable.d.ts +7 -0
  202. package/dist/tables/personalInformation/DeliveryStatusTypesTable.js +10 -0
  203. package/dist/tables/personalInformation/DeliveryStatusesTable.d.ts +9 -0
  204. package/dist/tables/personalInformation/DeliveryStatusesTable.js +31 -0
  205. package/dist/tables/personalInformation/InvoiceDetailsTable.d.ts +10 -0
  206. package/dist/tables/personalInformation/InvoiceDetailsTable.js +34 -0
  207. package/dist/tables/personalInformation/PersonalDataTable.d.ts +10 -0
  208. package/dist/tables/personalInformation/PersonalDataTable.js +37 -0
  209. package/dist/tables/public/AdminAccountsTable.d.ts +14 -0
  210. package/dist/tables/public/AdminAccountsTable.js +64 -0
  211. package/dist/tables/public/ProductsTable.d.ts +17 -0
  212. package/dist/tables/public/ProductsTable.js +89 -0
  213. package/dist/tables/settings/CompanyDataTable.d.ts +10 -0
  214. package/dist/tables/settings/CompanyDataTable.js +37 -0
  215. package/dist/tables/settings/DeliveryMethodsTable.d.ts +12 -0
  216. package/dist/tables/settings/DeliveryMethodsTable.js +43 -0
  217. package/dist/tables/settings/PaymentMethodsTable.d.ts +12 -0
  218. package/dist/tables/settings/PaymentMethodsTable.js +43 -0
  219. package/dist/types/AddressI.d.ts +9 -0
  220. package/dist/types/AddressI.js +1 -0
  221. package/dist/types/AdminI.d.ts +9 -0
  222. package/dist/types/AdminI.js +1 -0
  223. package/dist/types/ClaimI.d.ts +4 -0
  224. package/dist/types/ClaimI.js +1 -0
  225. package/dist/types/ClientAccountI.d.ts +10 -0
  226. package/dist/types/ClientAccountI.js +1 -0
  227. package/dist/types/CompanyDataI.d.ts +8 -0
  228. package/dist/types/CompanyDataI.js +1 -0
  229. package/dist/types/CompanyDetailsI.d.ts +5 -0
  230. package/dist/types/CompanyDetailsI.js +1 -0
  231. package/dist/types/ContactDetailsI.d.ts +7 -0
  232. package/dist/types/ContactDetailsI.js +1 -0
  233. package/dist/types/DeliveryDetailsI.d.ts +9 -0
  234. package/dist/types/DeliveryDetailsI.js +1 -0
  235. package/dist/types/DeliveryMethodI.d.ts +5 -0
  236. package/dist/types/DeliveryMethodI.js +1 -0
  237. package/dist/types/FileConnectionI.d.ts +6 -0
  238. package/dist/types/FileConnectionI.js +1 -0
  239. package/dist/types/FileConnectionTypeE.d.ts +4 -0
  240. package/dist/types/FileConnectionTypeE.js +5 -0
  241. package/dist/types/FileI.d.ts +6 -0
  242. package/dist/types/FileI.js +1 -0
  243. package/dist/types/InvoiceDetailsI.d.ts +7 -0
  244. package/dist/types/InvoiceDetailsI.js +1 -0
  245. package/dist/types/OrderI.d.ts +12 -0
  246. package/dist/types/OrderI.js +1 -0
  247. package/dist/types/OrderProductI.d.ts +14 -0
  248. package/dist/types/OrderProductI.js +1 -0
  249. package/dist/types/PaymentDetailsI.d.ts +6 -0
  250. package/dist/types/PaymentDetailsI.js +1 -0
  251. package/dist/types/PaymentMethodE.d.ts +5 -0
  252. package/dist/types/PaymentMethodE.js +6 -0
  253. package/dist/types/PaymentMethodI.d.ts +5 -0
  254. package/dist/types/PaymentMethodI.js +1 -0
  255. package/dist/types/PaymentStatusE.d.ts +6 -0
  256. package/dist/types/PaymentStatusE.js +7 -0
  257. package/dist/types/PersonalDataI.d.ts +10 -0
  258. package/dist/types/PersonalDataI.js +1 -0
  259. package/dist/types/ProductI.d.ts +20 -0
  260. package/dist/types/ProductI.js +1 -0
  261. package/dist/types/StatusI.d.ts +7 -0
  262. package/dist/types/StatusI.js +1 -0
  263. package/dist/types/rows/AddressRow.d.ts +9 -0
  264. package/dist/types/rows/AddressRow.js +1 -0
  265. package/dist/types/rows/AdminRow.d.ts +9 -0
  266. package/dist/types/rows/AdminRow.js +1 -0
  267. package/dist/types/rows/ClientAccountRow.d.ts +10 -0
  268. package/dist/types/rows/ClientAccountRow.js +1 -0
  269. package/dist/types/rows/CompanyDataRow.d.ts +8 -0
  270. package/dist/types/rows/CompanyDataRow.js +1 -0
  271. package/dist/types/rows/CompanyDetailsRow.d.ts +5 -0
  272. package/dist/types/rows/CompanyDetailsRow.js +1 -0
  273. package/dist/types/rows/ContactDetailsRow.d.ts +5 -0
  274. package/dist/types/rows/ContactDetailsRow.js +1 -0
  275. package/dist/types/rows/DeliveryDetailsRow.d.ts +6 -0
  276. package/dist/types/rows/DeliveryDetailsRow.js +1 -0
  277. package/dist/types/rows/DeliveryMethodRow.d.ts +5 -0
  278. package/dist/types/rows/DeliveryMethodRow.js +1 -0
  279. package/dist/types/rows/DeliveryStatusRow.d.ts +7 -0
  280. package/dist/types/rows/DeliveryStatusRow.js +1 -0
  281. package/dist/types/rows/FileConnectionRow.d.ts +6 -0
  282. package/dist/types/rows/FileConnectionRow.js +1 -0
  283. package/dist/types/rows/FileRow.d.ts +9 -0
  284. package/dist/types/rows/FileRow.js +1 -0
  285. package/dist/types/rows/InvoiceDetailsRow.d.ts +5 -0
  286. package/dist/types/rows/InvoiceDetailsRow.js +1 -0
  287. package/dist/types/rows/OrderProductRow.d.ts +10 -0
  288. package/dist/types/rows/OrderProductRow.js +1 -0
  289. package/dist/types/rows/OrderRow.d.ts +15 -0
  290. package/dist/types/rows/OrderRow.js +1 -0
  291. package/dist/types/rows/PaymentDetailsRow.d.ts +6 -0
  292. package/dist/types/rows/PaymentDetailsRow.js +1 -0
  293. package/dist/types/rows/PaymentMethodRow.d.ts +5 -0
  294. package/dist/types/rows/PaymentMethodRow.js +1 -0
  295. package/dist/types/rows/PaymentStatusRow.d.ts +6 -0
  296. package/dist/types/rows/PaymentStatusRow.js +1 -0
  297. package/dist/types/rows/PersonalDataRow.d.ts +8 -0
  298. package/dist/types/rows/PersonalDataRow.js +1 -0
  299. package/dist/types/rows/ProductRow.d.ts +17 -0
  300. package/dist/types/rows/ProductRow.js +1 -0
  301. package/dist/types/rows/StatusRow.d.ts +8 -0
  302. package/dist/types/rows/StatusRow.js +1 -0
  303. package/dist/utils/calculateNetToGrossPrice.d.ts +1 -0
  304. package/dist/utils/calculateNetToGrossPrice.js +7 -0
  305. package/dist/utils/correctPhoneNumber.d.ts +1 -0
  306. package/dist/utils/correctPhoneNumber.js +14 -0
  307. package/package.json +27 -0
package/README.md ADDED
File without changes
@@ -0,0 +1,6 @@
1
+ import { ConnectionFactory } from '@dascompany/database';
2
+ import ProductServiceConnection from './ProductServiceConnection';
3
+ export default class ProductConnectionFactory extends ConnectionFactory {
4
+ private static subdomain;
5
+ static get(): ProductServiceConnection;
6
+ }
@@ -0,0 +1,11 @@
1
+ import { ConnectionFactory } from '@dascompany/database';
2
+ import ProductsSchema from './ProductsSchema';
3
+ export default class ProductConnectionFactory extends ConnectionFactory {
4
+ static subdomain = 'defaultDatabaseName';
5
+ static get() {
6
+ const connection = super.get(this.subdomain);
7
+ if (!connection.productsSchema)
8
+ connection.productsSchema = new ProductsSchema(connection);
9
+ return connection;
10
+ }
11
+ }
@@ -0,0 +1,9 @@
1
+ import { Client } from 'pg';
2
+ import { Connection } from '@dascompany/database';
3
+ import ProductsSchema from './ProductsSchema';
4
+ export default class ProductServiceConnection extends Connection {
5
+ private tables;
6
+ constructor(pgClient: Client);
7
+ get productsSchema(): ProductsSchema;
8
+ set productsSchema(tables: ProductsSchema);
9
+ }
@@ -0,0 +1,16 @@
1
+ import SchemaNames from './tables/SchemaNames';
2
+ import { Connection } from '@dascompany/database';
3
+ export default class ProductServiceConnection extends Connection {
4
+ tables = new Map();
5
+ constructor(pgClient) {
6
+ super(pgClient);
7
+ }
8
+ get productsSchema() {
9
+ // if ( !this.tables.get( SchemaNames.products ) )
10
+ // this.tables.set( SchemaNames.products, new ProductsSchema( this ) )
11
+ return this.tables.get(SchemaNames.products);
12
+ }
13
+ set productsSchema(tables) {
14
+ this.tables.set(SchemaNames.products, tables);
15
+ }
16
+ }
@@ -0,0 +1,52 @@
1
+ import { Connection } from '@dascompany/database';
2
+ import StatusTypesTable from './tables/orders/StatusTypesTable';
3
+ import FilesTable from './tables/files/FilesTable';
4
+ import OrdersTable from './tables/orders/OrdersTable';
5
+ import ProductsTable from './tables/public/ProductsTable';
6
+ import StatusesTable from './tables/orders/StatusesTable';
7
+ import AddressesTable from './tables/personalInformation/AddressesTable';
8
+ import ClientAccountsTable from './tables/clients/ClientAccountsTable';
9
+ import PersonalDataTable from './tables/personalInformation/PersonalDataTable';
10
+ import OrdersProductsTable from './tables/orders/OrdersProductsTable';
11
+ import CompanyDetailsTable from './tables/personalInformation/CompanyDetailsTable';
12
+ import ContactDetailsTable from './tables/personalInformation/ContactDetailsTable';
13
+ import DeliveryDetailsTable from './tables/personalInformation/DeliveryDetailsTable';
14
+ import InvoiceDetailsTable from './tables/personalInformation/InvoiceDetailsTable';
15
+ import DeliveryMethodsTable from './tables/settings/DeliveryMethodsTable';
16
+ import PaymentMethodsTable from './tables/settings/PaymentMethodsTable';
17
+ import PaymentStatusTypesTable from './tables/orders/PaymentStatusTypesTable';
18
+ import DeliveryStatusTypesTable from './tables/personalInformation/DeliveryStatusTypesTable';
19
+ import DeliveryStatusesTable from './tables/personalInformation/DeliveryStatusesTable';
20
+ import PaymentDetailsTable from './tables/orders/PaymentDetailsTable';
21
+ import PaymentStatusesTable from './tables/orders/PaymentStatusesTable';
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 ProductsSchema {
26
+ private tables;
27
+ private connection;
28
+ constructor(connection: Connection);
29
+ get statusTypes(): StatusTypesTable;
30
+ get files(): FilesTable;
31
+ get orders(): OrdersTable;
32
+ get products(): ProductsTable;
33
+ get statuses(): StatusesTable;
34
+ get addresses(): AddressesTable;
35
+ get clientAccounts(): ClientAccountsTable;
36
+ get adminAccounts(): AdminAccountsTable;
37
+ get companyDetails(): CompanyDetailsTable;
38
+ get personalData(): PersonalDataTable;
39
+ get ordersProducts(): OrdersProductsTable;
40
+ get contactDetails(): ContactDetailsTable;
41
+ get deliveryDetails(): DeliveryDetailsTable;
42
+ get invoiceDetails(): InvoiceDetailsTable;
43
+ get deliveryMethods(): DeliveryMethodsTable;
44
+ get paymentMethods(): PaymentMethodsTable;
45
+ get paymentStatusTypes(): PaymentStatusTypesTable;
46
+ get deliveryStatusTypes(): DeliveryStatusTypesTable;
47
+ get deliveryStatuses(): DeliveryStatusesTable;
48
+ get paymentDetails(): PaymentDetailsTable;
49
+ get paymentStatuses(): PaymentStatusesTable;
50
+ get companyData(): CompanyDataTable;
51
+ get fileConnections(): FileConnectionsTable;
52
+ }
@@ -0,0 +1,146 @@
1
+ import StatusTypesTable from './tables/orders/StatusTypesTable';
2
+ import TableNames from './tables/TableNames';
3
+ import FilesTable from './tables/files/FilesTable';
4
+ import OrdersTable from './tables/orders/OrdersTable';
5
+ import ProductsTable from './tables/public/ProductsTable';
6
+ import StatusesTable from './tables/orders/StatusesTable';
7
+ import AddressesTable from './tables/personalInformation/AddressesTable';
8
+ import ClientAccountsTable from './tables/clients/ClientAccountsTable';
9
+ import PersonalDataTable from './tables/personalInformation/PersonalDataTable';
10
+ import OrdersProductsTable from './tables/orders/OrdersProductsTable';
11
+ import CompanyDetailsTable from './tables/personalInformation/CompanyDetailsTable';
12
+ import ContactDetailsTable from './tables/personalInformation/ContactDetailsTable';
13
+ import DeliveryDetailsTable from './tables/personalInformation/DeliveryDetailsTable';
14
+ import InvoiceDetailsTable from './tables/personalInformation/InvoiceDetailsTable';
15
+ import DeliveryMethodsTable from './tables/settings/DeliveryMethodsTable';
16
+ import PaymentMethodsTable from './tables/settings/PaymentMethodsTable';
17
+ import PaymentStatusTypesTable from './tables/orders/PaymentStatusTypesTable';
18
+ import DeliveryStatusTypesTable from './tables/personalInformation/DeliveryStatusTypesTable';
19
+ import DeliveryStatusesTable from './tables/personalInformation/DeliveryStatusesTable';
20
+ import PaymentDetailsTable from './tables/orders/PaymentDetailsTable';
21
+ import PaymentStatusesTable from './tables/orders/PaymentStatusesTable';
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 ProductsSchema {
26
+ tables = new Map();
27
+ connection;
28
+ constructor(connection) {
29
+ this.connection = connection;
30
+ }
31
+ get statusTypes() {
32
+ if (!this.tables.get(TableNames.products))
33
+ this.tables.set(TableNames.products, new StatusTypesTable(this.connection));
34
+ return this.tables.get(TableNames.products);
35
+ }
36
+ get files() {
37
+ if (!this.tables.get(TableNames.files))
38
+ this.tables.set(TableNames.files, new FilesTable(this.connection));
39
+ return this.tables.get(TableNames.files);
40
+ }
41
+ get orders() {
42
+ if (!this.tables.get(TableNames.orders))
43
+ this.tables.set(TableNames.orders, new OrdersTable(this.connection));
44
+ return this.tables.get(TableNames.orders);
45
+ }
46
+ get products() {
47
+ if (!this.tables.get(TableNames.products))
48
+ this.tables.set(TableNames.products, new ProductsTable(this.connection));
49
+ return this.tables.get(TableNames.products);
50
+ }
51
+ get statuses() {
52
+ if (!this.tables.get(TableNames.statuses))
53
+ this.tables.set(TableNames.statuses, new StatusesTable(this.connection));
54
+ return this.tables.get(TableNames.statuses);
55
+ }
56
+ get addresses() {
57
+ if (!this.tables.get(TableNames.addresses))
58
+ this.tables.set(TableNames.addresses, new AddressesTable(this.connection));
59
+ return this.tables.get(TableNames.addresses);
60
+ }
61
+ get clientAccounts() {
62
+ if (!this.tables.get(TableNames.clientAccounts))
63
+ this.tables.set(TableNames.clientAccounts, new ClientAccountsTable(this.connection));
64
+ return this.tables.get(TableNames.clientAccounts);
65
+ }
66
+ get adminAccounts() {
67
+ if (!this.tables.get(TableNames.adminAccounts))
68
+ this.tables.set(TableNames.adminAccounts, new AdminAccountsTable(this.connection));
69
+ return this.tables.get(TableNames.adminAccounts);
70
+ }
71
+ get companyDetails() {
72
+ if (!this.tables.get(TableNames.companyDetails))
73
+ this.tables.set(TableNames.companyDetails, new CompanyDetailsTable(this.connection));
74
+ return this.tables.get(TableNames.companyDetails);
75
+ }
76
+ get personalData() {
77
+ if (!this.tables.get(TableNames.personalData))
78
+ this.tables.set(TableNames.personalData, new PersonalDataTable(this.connection));
79
+ return this.tables.get(TableNames.personalData);
80
+ }
81
+ get ordersProducts() {
82
+ if (!this.tables.get(TableNames.ordersProducts))
83
+ this.tables.set(TableNames.ordersProducts, new OrdersProductsTable(this.connection));
84
+ return this.tables.get(TableNames.ordersProducts);
85
+ }
86
+ get contactDetails() {
87
+ if (!this.tables.get(TableNames.contactDetails))
88
+ this.tables.set(TableNames.contactDetails, new ContactDetailsTable(this.connection));
89
+ return this.tables.get(TableNames.contactDetails);
90
+ }
91
+ get deliveryDetails() {
92
+ if (!this.tables.get(TableNames.deliveryDetails))
93
+ this.tables.set(TableNames.deliveryDetails, new DeliveryDetailsTable(this.connection));
94
+ return this.tables.get(TableNames.deliveryDetails);
95
+ }
96
+ get invoiceDetails() {
97
+ if (!this.tables.get(TableNames.invoiceDetails))
98
+ this.tables.set(TableNames.invoiceDetails, new InvoiceDetailsTable(this.connection));
99
+ return this.tables.get(TableNames.invoiceDetails);
100
+ }
101
+ get deliveryMethods() {
102
+ if (!this.tables.get(TableNames.deliveryMethods))
103
+ this.tables.set(TableNames.deliveryMethods, new DeliveryMethodsTable(this.connection));
104
+ return this.tables.get(TableNames.deliveryMethods);
105
+ }
106
+ get paymentMethods() {
107
+ if (!this.tables.get(TableNames.paymentMethods))
108
+ this.tables.set(TableNames.paymentMethods, new PaymentMethodsTable(this.connection));
109
+ return this.tables.get(TableNames.paymentMethods);
110
+ }
111
+ get paymentStatusTypes() {
112
+ if (!this.tables.get(TableNames.paymentStatusTypes))
113
+ this.tables.set(TableNames.paymentStatusTypes, new PaymentStatusTypesTable(this.connection));
114
+ return this.tables.get(TableNames.paymentStatusTypes);
115
+ }
116
+ get deliveryStatusTypes() {
117
+ if (!this.tables.get(TableNames.deliveryStatusTypes))
118
+ this.tables.set(TableNames.deliveryStatusTypes, new DeliveryStatusTypesTable(this.connection));
119
+ return this.tables.get(TableNames.deliveryStatusTypes);
120
+ }
121
+ get deliveryStatuses() {
122
+ if (!this.tables.get(TableNames.deliveryStatuses))
123
+ this.tables.set(TableNames.deliveryStatuses, new DeliveryStatusesTable(this.connection));
124
+ return this.tables.get(TableNames.deliveryStatuses);
125
+ }
126
+ get paymentDetails() {
127
+ if (!this.tables.get(TableNames.paymentDetails))
128
+ this.tables.set(TableNames.paymentDetails, new PaymentDetailsTable(this.connection));
129
+ return this.tables.get(TableNames.paymentDetails);
130
+ }
131
+ get paymentStatuses() {
132
+ if (!this.tables.get(TableNames.paymentStatuses))
133
+ this.tables.set(TableNames.paymentStatuses, new PaymentStatusesTable(this.connection));
134
+ return this.tables.get(TableNames.paymentStatuses);
135
+ }
136
+ get companyData() {
137
+ if (!this.tables.get(TableNames.companyData))
138
+ this.tables.set(TableNames.companyData, new CompanyDataTable(this.connection));
139
+ return this.tables.get(TableNames.companyData);
140
+ }
141
+ get fileConnections() {
142
+ if (!this.tables.get(TableNames.fileConnections))
143
+ this.tables.set(TableNames.fileConnections, new FileConnectionsTable(this.connection));
144
+ return this.tables.get(TableNames.fileConnections);
145
+ }
146
+ }
package/dist/SQL.json ADDED
@@ -0,0 +1,162 @@
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
+ }
@@ -0,0 +1,77 @@
1
+ import Client from "./stockObjects/Client";
2
+ import ClientAccountRepo from "./repo/ClientAccountRepo";
3
+ import ClientAccountReader from "./reader/ClientAccountReader";
4
+ import Admin from "./stockObjects/Admin";
5
+ import AdminRepo from "./repo/AdminRepo";
6
+ import AdminReader from "./reader/AdminReader";
7
+ import Address from "./stockObjects/Address";
8
+ import AddressI from "./types/AddressI";
9
+ import AddressesRepo from "./repo/AddressesRepo";
10
+ import AddressesReader from "./reader/AddressesReader";
11
+ import PersonalData from "./stockObjects/PersonalData";
12
+ import PersonalDataRepo from "./repo/PersonalDataRepo";
13
+ import PersonalDataReader from "./reader/PersonalDataReader";
14
+ import PersonalDataI from "./types/PersonalDataI";
15
+ import CompanyDetails from "./stockObjects/CompanyDetails";
16
+ import CompanyDetailsRepo from "./repo/CompanyDetailsRepo";
17
+ import CompanyDetailsReader from "./reader/CompanyDetailsReader";
18
+ import CompanyDetailsI from "./types/CompanyDetailsI";
19
+ import ContactDetails from "./stockObjects/ContactDetails";
20
+ import ContactDetailsRepo from "./repo/ContactDetailsRepo";
21
+ import ContactDetailsReader from "./reader/ContactDetailsReader";
22
+ import ContactDetailsI from "./types/ContactDetailsI";
23
+ import DeliveryDetails from "./stockObjects/DeliveryDetails";
24
+ import DeliveryDetailsRepo from "./repo/DeliveryDetailsRepo";
25
+ import DeliveryDetailsReader from "./reader/DeliveryDetailsReader";
26
+ import DeliveryDetailsI from "./types/DeliveryDetailsI";
27
+ import DeliveryMethods from "./stockObjects/DeliveryMethods";
28
+ import DeliveryMethodRepo from './repo/DeliveryMethodRepo';
29
+ import DeliveryMethodReader from "./reader/DeliveryMethodReader";
30
+ import DeliveryMethodI from "./types/DeliveryMethodI";
31
+ import DeliveryStatus from "./stockObjects/DeliveryStatus";
32
+ import DeliveryStatusReader from './reader/DeliveryStatusReader';
33
+ import InvoiceDetails from "./stockObjects/InvoiceDetails";
34
+ import InvoiceDetailsRepo from "./repo/InvoiceDetailsRepo";
35
+ import InvoiceDetailsReader from "./reader/InvoiceDetailsReader";
36
+ import InvoiceDetailsI from "./types/InvoiceDetailsI";
37
+ import PaymentDetails from "./stockObjects/PaymentDetails";
38
+ import PaymentDetailsRepo from "./repo/PaymentDetailsRepo";
39
+ import PaymentDetailsReader from "./reader/payment/PaymentDetailsReader";
40
+ import PaymentDetailsI from "./types/PaymentDetailsI";
41
+ import PaymentMethods from "./stockObjects/PaymentMethods";
42
+ import PaymentMethodRepo from './repo/PaymentMethodRepo';
43
+ import PaymentMethodReader from "./reader/payment/PaymentMethodReader";
44
+ import PaymentMethodE from "./types/PaymentMethodE";
45
+ import PaymentMethodI from "./types/PaymentMethodI";
46
+ import PaymentStatus from "./stockObjects/PaymentStatus";
47
+ import PaymentStatusesReader from "./reader/payment/PaymentStatusesReader";
48
+ import PaymentStatusE from './types/PaymentStatusE';
49
+ import Order from "./stockObjects/Order";
50
+ import OrderRepo from "./repo/OrderRepo";
51
+ import OrderReader from "./reader/OrderReader";
52
+ import OrderProduct from "./stockObjects/OrderProduct";
53
+ import OrderProductsRepo from "./repo/OrderProductsRepo";
54
+ import OrderProductsReader from "./reader/OrderProductsReader";
55
+ import OrderProductI from './types/OrderProductI';
56
+ import Status from "./stockObjects/Status";
57
+ import OrderStatusRepo from "./repo/OrderStatusRepo";
58
+ import OrderStatusReader from "./reader/OrderStatusReader";
59
+ import StatusTypesReader from './reader/StatusTypesReader';
60
+ import ProductI from './types/ProductI';
61
+ import Product from "./stockObjects/Product";
62
+ import ProductRepo from "./repo/ProductRepo";
63
+ import ProductReader from "./reader/ProductReader";
64
+ import File from './stockObjects/File';
65
+ import FilesRepo from './repo/FilesRepo';
66
+ import FilesReader from './reader/FilesReader';
67
+ import FileI from "./types/FileI";
68
+ import FileConnection from "./stockObjects/FileConnection";
69
+ import FileConnectionsRepo from "./repo/FileConnectionsRepo";
70
+ import FileConnectionsReader from "./reader/FileConnectionsReader";
71
+ import FileConnectionTypeE from './types/FileConnectionTypeE';
72
+ import CompanyData from "./stockObjects/CompanyData";
73
+ import CompanyDataRepo from "./repo/CompanyDataRepo";
74
+ import CompanyDataReader from "./reader/CompanyDataReader";
75
+ import CompanyDataI from "./types/CompanyDataI";
76
+ import StatusI from "./types/StatusI";
77
+ export { Client, ClientAccountRepo, ClientAccountReader, Admin, AdminRepo, AdminReader, Address, AddressI, AddressesRepo, AddressesReader, PersonalData, PersonalDataRepo, PersonalDataReader, PersonalDataI, CompanyDetails, CompanyDetailsRepo, CompanyDetailsReader, CompanyDetailsI, ContactDetails, ContactDetailsRepo, ContactDetailsReader, ContactDetailsI, DeliveryDetails, DeliveryDetailsRepo, DeliveryDetailsReader, DeliveryDetailsI, DeliveryMethods, DeliveryMethodRepo, DeliveryMethodReader, DeliveryMethodI, 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, };
package/dist/index.js ADDED
@@ -0,0 +1,63 @@
1
+ import Client from "./stockObjects/Client";
2
+ import ClientAccountRepo from "./repo/ClientAccountRepo";
3
+ import ClientAccountReader from "./reader/ClientAccountReader";
4
+ import Admin from "./stockObjects/Admin";
5
+ import AdminRepo from "./repo/AdminRepo";
6
+ import AdminReader from "./reader/AdminReader";
7
+ import Address from "./stockObjects/Address";
8
+ import AddressesRepo from "./repo/AddressesRepo";
9
+ import AddressesReader from "./reader/AddressesReader";
10
+ import PersonalData from "./stockObjects/PersonalData";
11
+ import PersonalDataRepo from "./repo/PersonalDataRepo";
12
+ import PersonalDataReader from "./reader/PersonalDataReader";
13
+ import CompanyDetails from "./stockObjects/CompanyDetails";
14
+ import CompanyDetailsRepo from "./repo/CompanyDetailsRepo";
15
+ import CompanyDetailsReader from "./reader/CompanyDetailsReader";
16
+ import ContactDetails from "./stockObjects/ContactDetails";
17
+ import ContactDetailsRepo from "./repo/ContactDetailsRepo";
18
+ import ContactDetailsReader from "./reader/ContactDetailsReader";
19
+ import DeliveryDetails from "./stockObjects/DeliveryDetails";
20
+ import DeliveryDetailsRepo from "./repo/DeliveryDetailsRepo";
21
+ import DeliveryDetailsReader from "./reader/DeliveryDetailsReader";
22
+ import DeliveryMethods from "./stockObjects/DeliveryMethods";
23
+ import DeliveryMethodRepo from './repo/DeliveryMethodRepo';
24
+ import DeliveryMethodReader from "./reader/DeliveryMethodReader";
25
+ import DeliveryStatus from "./stockObjects/DeliveryStatus";
26
+ import DeliveryStatusReader from './reader/DeliveryStatusReader';
27
+ import InvoiceDetails from "./stockObjects/InvoiceDetails";
28
+ import InvoiceDetailsRepo from "./repo/InvoiceDetailsRepo";
29
+ import InvoiceDetailsReader from "./reader/InvoiceDetailsReader";
30
+ import PaymentDetails from "./stockObjects/PaymentDetails";
31
+ import PaymentDetailsRepo from "./repo/PaymentDetailsRepo";
32
+ import PaymentDetailsReader from "./reader/payment/PaymentDetailsReader";
33
+ import PaymentMethods from "./stockObjects/PaymentMethods";
34
+ import PaymentMethodRepo from './repo/PaymentMethodRepo';
35
+ import PaymentMethodReader from "./reader/payment/PaymentMethodReader";
36
+ import PaymentMethodE from "./types/PaymentMethodE";
37
+ import PaymentStatus from "./stockObjects/PaymentStatus";
38
+ import PaymentStatusesReader from "./reader/payment/PaymentStatusesReader";
39
+ import PaymentStatusE from './types/PaymentStatusE';
40
+ import Order from "./stockObjects/Order";
41
+ import OrderRepo from "./repo/OrderRepo";
42
+ import OrderReader from "./reader/OrderReader";
43
+ import OrderProduct from "./stockObjects/OrderProduct";
44
+ import OrderProductsRepo from "./repo/OrderProductsRepo";
45
+ import OrderProductsReader from "./reader/OrderProductsReader";
46
+ import Status from "./stockObjects/Status";
47
+ import OrderStatusRepo from "./repo/OrderStatusRepo";
48
+ import OrderStatusReader from "./reader/OrderStatusReader";
49
+ import StatusTypesReader from './reader/StatusTypesReader';
50
+ import Product from "./stockObjects/Product";
51
+ import ProductRepo from "./repo/ProductRepo";
52
+ import ProductReader from "./reader/ProductReader";
53
+ import File from './stockObjects/File';
54
+ import FilesRepo from './repo/FilesRepo';
55
+ import FilesReader from './reader/FilesReader';
56
+ import FileConnection from "./stockObjects/FileConnection";
57
+ import FileConnectionsRepo from "./repo/FileConnectionsRepo";
58
+ import FileConnectionsReader from "./reader/FileConnectionsReader";
59
+ import FileConnectionTypeE from './types/FileConnectionTypeE';
60
+ import CompanyData from "./stockObjects/CompanyData";
61
+ import CompanyDataRepo from "./repo/CompanyDataRepo";
62
+ import CompanyDataReader from "./reader/CompanyDataReader";
63
+ export { Client, ClientAccountRepo, ClientAccountReader, Admin, AdminRepo, AdminReader, 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, };
@@ -0,0 +1,9 @@
1
+ import { StockObjectMapper } from "@dascompany/database";
2
+ import Address from "../stockObjects/Address";
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
+ }
@@ -0,0 +1,17 @@
1
+ import ProductConnectionFactory from "../ProductConnectionFactory";
2
+ export default class AddressMapper {
3
+ address;
4
+ addressesTable;
5
+ constructor(address) {
6
+ this.addressesTable = ProductConnectionFactory.get().productsSchema.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
+ }
@@ -0,0 +1,9 @@
1
+ import { StockObjectMapper } from '@dascompany/database';
2
+ import Admin from '../stockObjects/Admin';
3
+ export default class AdminMapper implements StockObjectMapper {
4
+ private admin;
5
+ private adminAccountsTable;
6
+ constructor(admin: Admin);
7
+ save(): Promise<void>;
8
+ delete(): Promise<void>;
9
+ }
@@ -0,0 +1,24 @@
1
+ import ProductConnectionFactory from '../ProductConnectionFactory';
2
+ export default class AdminMapper {
3
+ admin;
4
+ adminAccountsTable;
5
+ constructor(admin) {
6
+ this.adminAccountsTable = ProductConnectionFactory.get().productsSchema.adminAccounts;
7
+ this.admin = admin;
8
+ }
9
+ async save() {
10
+ if (!this.admin.getDeleted()) {
11
+ if (this.admin.getId())
12
+ await this.adminAccountsTable.update(this.admin);
13
+ else
14
+ await this.adminAccountsTable.insert(this.admin);
15
+ }
16
+ else
17
+ throw new Error(`Admin account ${this.admin.getId()} is deleted. Restore before updating.`);
18
+ }
19
+ async delete() {
20
+ const id = this.admin.getId();
21
+ if (id)
22
+ await this.adminAccountsTable.delete(id);
23
+ }
24
+ }