chyz 1.0.12-rc.8 → 1.0.13-rc.3

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 (96) hide show
  1. package/BaseChyz.ts +72 -12
  2. package/Examples/Controllers/ApiController.ts +88 -30
  3. package/Examples/Controllers/KeyCloakController.ts +100 -0
  4. package/Examples/Controllers/PublicController.ts +5 -7
  5. package/Examples/Controllers/SiteController.ts +82 -32
  6. package/Examples/Models/Categories.ts +36 -0
  7. package/Examples/Models/Customer.ts +115 -0
  8. package/Examples/Models/KeycloakUser.ts +66 -0
  9. package/Examples/Models/Order.ts +64 -0
  10. package/Examples/Models/OrderItem.ts +27 -0
  11. package/Examples/Models/ProductModels.ts +50 -0
  12. package/Examples/Models/ProductToCategories.ts +35 -0
  13. package/Examples/Models/Products.ts +49 -0
  14. package/Examples/Models/Stocks.ts +60 -0
  15. package/Examples/Models/User.ts +66 -35
  16. package/Examples/Models/UserPermission.ts +37 -0
  17. package/Examples/index-keycloack.ts +78 -0
  18. package/Examples/index.ts +16 -15
  19. package/Examples/keycloak.json +7 -0
  20. package/Examples/log/app.log +903 -1034
  21. package/Examples/log/errors.log +79 -256
  22. package/Examples/package.json +46 -44
  23. package/Examples/tsconfig.json +1 -1
  24. package/README.md +118 -16
  25. package/base/ActionFilter.ts +2 -2
  26. package/base/BaseError.ts +2 -2
  27. package/base/DataErrorDbException.ts +1 -1
  28. package/base/DbConnection.ts +6 -0
  29. package/base/ForbiddenHttpException.ts +1 -1
  30. package/base/InvalidConfigException.ts +1 -1
  31. package/base/Model.ts +204 -15
  32. package/base/NotFoundHttpException.ts +1 -1
  33. package/base/RestClient.ts +28 -0
  34. package/base/UnauthorizedHttpException.ts +2 -1
  35. package/base/ValidationHttpException.ts +14 -0
  36. package/base/db/Exception.ts +14 -0
  37. package/base/index.ts +2 -0
  38. package/dist/BaseChyz.js +56 -10
  39. package/dist/BaseChyz.js.map +1 -1
  40. package/dist/README.md +270 -0
  41. package/dist/base/ActionFilter.js +2 -2
  42. package/dist/base/ActionFilter.js.map +1 -1
  43. package/dist/base/BaseError.js +2 -2
  44. package/dist/base/BaseError.js.map +1 -1
  45. package/dist/base/DataErrorDbException.js +1 -1
  46. package/dist/base/DataErrorDbException.js.map +1 -1
  47. package/dist/base/DbConnection.js +3 -0
  48. package/dist/base/DbConnection.js.map +1 -1
  49. package/dist/base/ForbiddenHttpException.js +1 -1
  50. package/dist/base/ForbiddenHttpException.js.map +1 -1
  51. package/dist/base/InvalidConfigException.js +1 -1
  52. package/dist/base/InvalidConfigException.js.map +1 -1
  53. package/dist/base/Model.js +181 -13
  54. package/dist/base/Model.js.map +1 -1
  55. package/dist/base/NotFoundHttpException.js +1 -1
  56. package/dist/base/NotFoundHttpException.js.map +1 -1
  57. package/dist/base/RestClient.js +27 -0
  58. package/dist/base/RestClient.js.map +1 -0
  59. package/dist/base/UnauthorizedHttpException.js +1 -1
  60. package/dist/base/UnauthorizedHttpException.js.map +1 -1
  61. package/dist/base/ValidationHttpException.js +18 -0
  62. package/dist/base/ValidationHttpException.js.map +1 -0
  63. package/dist/base/db/Exception.js +16 -0
  64. package/dist/base/db/Exception.js.map +1 -0
  65. package/dist/base/index.js +2 -0
  66. package/dist/base/index.js.map +1 -1
  67. package/dist/filters/AccessControl.js +2 -2
  68. package/dist/filters/AccessControl.js.map +1 -1
  69. package/dist/filters/AccessRule.js.map +1 -1
  70. package/dist/filters/auth/AuthMethod.js +2 -2
  71. package/dist/filters/auth/AuthMethod.js.map +1 -1
  72. package/dist/filters/auth/HttpHeaderAuth.js.map +1 -1
  73. package/dist/filters/auth/JwtHttpBearerAuth.js +1 -0
  74. package/dist/filters/auth/JwtHttpBearerAuth.js.map +1 -1
  75. package/dist/filters/auth/KeyCloakHttpBearerAuth.js +117 -0
  76. package/dist/filters/auth/KeyCloakHttpBearerAuth.js.map +1 -0
  77. package/dist/index.js +28 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/package.json +55 -0
  80. package/dist/web/{User.js → WebUser.js} +12 -7
  81. package/dist/web/WebUser.js.map +1 -0
  82. package/filters/AccessControl.ts +3 -3
  83. package/filters/AccessRule.ts +2 -2
  84. package/filters/auth/AuthMethod.ts +4 -4
  85. package/filters/auth/HttpHeaderAuth.ts +2 -2
  86. package/filters/auth/JwtHttpBearerAuth.ts +4 -5
  87. package/filters/auth/KeyCloakHttpBearerAuth.ts +115 -0
  88. package/index.ts +14 -0
  89. package/package-lock.json +5259 -0
  90. package/package.json +56 -52
  91. package/web/{User.ts → WebUser.ts} +10 -6
  92. package/.idea/Chy-Nodejs-Framework.iml +0 -12
  93. package/.idea/jsLibraryMappings.xml +0 -6
  94. package/.idea/modules.xml +0 -8
  95. package/.idea/vcs.xml +0 -6
  96. package/dist/web/User.js.map +0 -1
@@ -1,257 +1,80 @@
1
- [2021-08-17T10.12.10.891] [ERROR] BaseChyz [158] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: You are not allowed to perform this action.
2
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:59:22)
3
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:52:14)
4
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:40:43)
5
- at Generator.next (<anonymous>)
6
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:8:71
7
- at new Promise (<anonymous>)
8
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:4:12)
9
- at SiteController.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:24:16)
10
- at BaseChyz.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:303:34)
11
- at Generator.next (<anonymous>) {
12
- statusCode: 500
13
- }
14
- [2021-08-17T10.12.26.557] [ERROR] BaseChyz [158] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: You are not allowed to perform this action.
15
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:59:22)
16
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:52:14)
17
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:40:43)
18
- at Generator.next (<anonymous>)
19
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:8:71
20
- at new Promise (<anonymous>)
21
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:4:12)
22
- at SiteController.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:24:16)
23
- at BaseChyz.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:303:34)
24
- at Generator.next (<anonymous>) {
25
- statusCode: 500
26
- }
27
- [2021-08-17T10.18.01.676] [ERROR] BaseChyz [158] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: You are not allowed to perform this action.
28
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:59:22)
29
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:52:14)
30
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:40:43)
31
- at Generator.next (<anonymous>)
32
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:8:71
33
- at new Promise (<anonymous>)
34
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:4:12)
35
- at SiteController.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:24:16)
36
- at BaseChyz.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:303:34)
37
- at Generator.next (<anonymous>) {
38
- statusCode: 500
39
- }
40
- [2021-08-17T10.22.38.694] [ERROR] BaseChyz [158] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: You are not allowed to perform this action.
41
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:61:22)
42
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:54:14)
43
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:40:43)
44
- at Generator.next (<anonymous>)
45
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:8:71
46
- at new Promise (<anonymous>)
47
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:4:12)
48
- at SiteController.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:24:16)
49
- at BaseChyz.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:303:34)
50
- at Generator.next (<anonymous>) {
51
- statusCode: 500
52
- }
53
- [2021-08-17T10.23.32.331] [ERROR] BaseChyz [158] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: You are not allowed to perform this action.
54
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:61:22)
55
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:54:14)
56
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:40:43)
57
- at Generator.next (<anonymous>)
58
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:8:71
59
- at new Promise (<anonymous>)
60
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:4:12)
61
- at SiteController.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:24:16)
62
- at BaseChyz.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:303:34)
63
- at Generator.next (<anonymous>) {
64
- statusCode: 500
65
- }
66
- [2021-08-17T10.28.55.752] [ERROR] BaseChyz [158] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: You are not allowed to perform this action.
67
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:62:22)
68
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:55:14)
69
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:40:43)
70
- at Generator.next (<anonymous>)
71
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:8:71
72
- at new Promise (<anonymous>)
73
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:4:12)
74
- at SiteController.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:24:16)
75
- at BaseChyz.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:303:34)
76
- at Generator.next (<anonymous>) {
77
- statusCode: 500
78
- }
79
- [2021-08-17T13.03.32.549] [ERROR] BaseChyz [237] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - TypeError: controller.beforeAction is not a function
80
- at BaseChyz.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:234:46)
81
- at Generator.next (<anonymous>)
82
- at C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:8:71
83
- at new Promise (<anonymous>)
84
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:4:12)
85
- at C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:232:83
86
- at Layer.handle [as handle_request] (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\express\lib\router\layer.js:95:5)
87
- at next (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\express\lib\router\route.js:137:13)
88
- at Route.dispatch (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\express\lib\router\route.js:112:3)
89
- at Layer.handle [as handle_request] (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\express\lib\router\layer.js:95:5)
90
- [2021-08-17T13.06.24.875] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
91
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
92
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
93
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:49:22)
94
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:41:43)
95
- at Generator.next (<anonymous>)
96
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:8:71
97
- at new Promise (<anonymous>)
98
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:4:12)
99
- at SiteController.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:24:16)
100
- at BaseChyz.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:235:44) {
101
- statusCode: 500
102
- }
103
- [2021-08-17T13.07.00.040] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
104
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
105
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
106
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:49:22)
107
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:41:43)
108
- at Generator.next (<anonymous>)
109
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:8:71
110
- at new Promise (<anonymous>)
111
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:4:12)
112
- at SiteController.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:24:16)
113
- at BaseChyz.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:235:44) {
114
- statusCode: 500
115
- }
116
- [2021-08-17T13.07.52.749] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
117
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
118
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
119
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:49:22)
120
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:41:43)
121
- at Generator.next (<anonymous>)
122
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:8:71
123
- at new Promise (<anonymous>)
124
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:4:12)
125
- at SiteController.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:24:16)
126
- at BaseChyz.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:235:48) {
127
- statusCode: 500
128
- }
129
- [2021-08-17T13.08.56.316] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
130
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
131
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
132
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:49:22)
133
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:41:43)
134
- at Generator.next (<anonymous>)
135
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:8:71
136
- at new Promise (<anonymous>)
137
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:4:12)
138
- at SiteController.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:24:16)
139
- at BaseChyz.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts:235:48) {
140
- statusCode: 500
141
- }
142
- [2021-08-17T14.17.18.222] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
143
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
144
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
145
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:49:22)
146
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:42:43)
147
- at Generator.next (<anonymous>)
148
- at fulfilled (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:5:58)
149
- at processTicksAndRejections (internal/process/task_queues.js:93:5) {
150
- statusCode: 500
151
- }
152
- [2021-08-17T14.17.30.089] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
153
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
154
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
155
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:49:22)
156
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:42:43)
157
- at Generator.next (<anonymous>)
158
- at fulfilled (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:5:58)
1
+ [2021-11-30T13.12.27.134] [ERROR] BaseChyz [183] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - UnauthorizedHttpException: Your request was made with invalid credentials.
2
+ at new BaseError (C:\PROJELER\github\Chy-Nodejs-Framework\base\BaseError.ts:16:15)
3
+ at new UnauthorizedHttpException (C:\PROJELER\github\Chy-Nodejs-Framework\base\UnauthorizedHttpException.ts:12:9)
4
+ at JwtHttpBearerAuth.handleFailure (C:\PROJELER\github\Chy-Nodejs-Framework\filters\auth\AuthMethod.ts:64:15)
5
+ at JwtHttpBearerAuth.fail (C:\PROJELER\github\Chy-Nodejs-Framework\filters\auth\JwtHttpBearerAuth.ts:77:14)
6
+ at JwtHttpBearerAuth.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\filters\auth\JwtHttpBearerAuth.ts:65:36)
7
+ at Generator.next (<anonymous>)
8
+ at fulfilled (C:\PROJELER\github\Chy-Nodejs-Framework\filters\auth\JwtHttpBearerAuth.ts:5:58)
159
9
  at processTicksAndRejections (internal/process/task_queues.js:93:5) {
160
- statusCode: 500
161
- }
162
- [2021-08-17T14.17.41.197] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
163
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
164
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
165
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:54:14)
166
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:42:43)
167
- at Generator.next (<anonymous>)
168
- at fulfilled (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:5:58)
169
- at processTicksAndRejections (internal/process/task_queues.js:93:5) {
170
- statusCode: 500
171
- }
172
- [2021-08-17T14.20.49.429] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
173
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
174
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
175
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:54:14)
176
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:42:43)
177
- at Generator.next (<anonymous>)
178
- at fulfilled (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:5:58)
179
- at processTicksAndRejections (internal/process/task_queues.js:93:5) {
180
- statusCode: 500
181
- }
182
- [2021-08-17T14.25.04.096] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
183
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
184
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
185
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:54:14)
186
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:42:43)
187
- at Generator.next (<anonymous>)
188
- at fulfilled (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:5:58)
189
- at processTicksAndRejections (internal/process/task_queues.js:93:5) {
190
- statusCode: 500
191
- }
192
- [2021-08-17T14.25.09.929] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
193
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
194
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
195
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:54:14)
196
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:42:43)
197
- at Generator.next (<anonymous>)
198
- at fulfilled (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:5:58)
199
- at processTicksAndRejections (internal/process/task_queues.js:93:5) {
200
- statusCode: 500
201
- }
202
- [2021-08-17T14.25.20.516] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
203
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
204
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
205
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:54:14)
206
- at SiteController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:42:43)
207
- at Generator.next (<anonymous>)
208
- at fulfilled (C:\PROJELER\github\Chy-Nodejs-Framework\base\Controller.ts:5:58)
209
- at processTicksAndRejections (internal/process/task_queues.js:93:5) {
210
- statusCode: 500
211
- }
212
- [2021-08-17T15.00.25.834] [ERROR] BaseChyz [238] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - ForbiddenHttpException: Login Required
213
- at User.loginRequired (C:\PROJELER\github\Chy-Nodejs-Framework\web\User.ts:52:15)
214
- at AccessControl.denyAccess (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:60:18)
215
- at AccessControl.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:49:22)
216
- at Generator.next (<anonymous>)
217
- at C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:8:71
218
- at new Promise (<anonymous>)
219
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:4:12)
220
- at AccessControl.beforeAction (C:\PROJELER\github\Chy-Nodejs-Framework\filters\AccessControl.ts:42:16)
221
- at AccessControl.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\ActionFilter.ts:32:20)
222
- at Generator.next (<anonymous>) {
223
- statusCode: 500
224
- }
225
- [2021-08-23T14.37.16.305] [ERROR] BaseChyz [154] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - Unable to connect to the database: TypeError: Cannot read property 'authenticate' of undefined
226
- at DbConnection.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:30:28)
227
- at Generator.next (<anonymous>)
228
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:8:71
229
- at new Promise (<anonymous>)
230
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:4:12)
231
- at DbConnection.connect (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:28:26)
232
- at DbConnection.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:24:20)
233
- at Generator.next (<anonymous>)
234
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:8:71
235
- at new Promise (<anonymous>)
236
- [2021-08-23T14.37.43.626] [ERROR] BaseChyz [154] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - Unable to connect to the database: TypeError: Cannot read property 'authenticate' of undefined
237
- at DbConnection.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:30:28)
238
- at Generator.next (<anonymous>)
239
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:8:71
240
- at new Promise (<anonymous>)
241
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:4:12)
242
- at DbConnection.connect (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:28:26)
243
- at DbConnection.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:24:20)
244
- at Generator.next (<anonymous>)
245
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:8:71
246
- at new Promise (<anonymous>)
247
- [2021-08-23T14.39.19.529] [ERROR] BaseChyz [154] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - Unable to connect to the database: TypeError: Cannot read property 'authenticate' of undefined
248
- at DbConnection.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:30:28)
249
- at Generator.next (<anonymous>)
250
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:8:71
251
- at new Promise (<anonymous>)
252
- at __awaiter (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:4:12)
253
- at DbConnection.connect (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:28:26)
254
- at DbConnection.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:24:20)
255
- at Generator.next (<anonymous>)
256
- at C:\PROJELER\github\Chy-Nodejs-Framework\base\DbConnection.ts:8:71
257
- at new Promise (<anonymous>)
10
+ statusCode: 401
11
+ }
12
+ [2021-11-30T13.18.54.360] [ERROR] BaseChyz [183] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - EagerLoadingError [SequelizeEagerLoadingError]: ProductModelsClass is associated to ProductsClass using an alias. You must use the 'as' keyword to specify the alias within your include statement.
13
+ at Function._getIncludedAssociation (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:722:13)
14
+ at Function._validateIncludedElement (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:614:53)
15
+ at C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:509:37
16
+ at Array.map (<anonymous>)
17
+ at Function._validateIncludedElements (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:504:39)
18
+ at Function.findAll (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:1723:12)
19
+ at processTicksAndRejections (internal/process/task_queues.js:93:5)
20
+ [2021-11-30T13.18.59.902] [ERROR] BaseChyz [183] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - EagerLoadingError [SequelizeEagerLoadingError]: ProductModelsClass is associated to ProductsClass using an alias. You must use the 'as' keyword to specify the alias within your include statement.
21
+ at Function._getIncludedAssociation (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:722:13)
22
+ at Function._validateIncludedElement (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:614:53)
23
+ at C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:509:37
24
+ at Array.map (<anonymous>)
25
+ at Function._validateIncludedElements (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:504:39)
26
+ at Function.findAll (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:1723:12)
27
+ at processTicksAndRejections (internal/process/task_queues.js:93:5)
28
+ [2021-11-30T13.24.20.786] [ERROR] BaseChyz [183] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - EagerLoadingError [SequelizeEagerLoadingError]: ProductModelsClass is associated to ProductsClass using an alias. You must use the 'as' keyword to specify the alias within your include statement.
29
+ at Function._getIncludedAssociation (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:722:13)
30
+ at Function._validateIncludedElement (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:614:53)
31
+ at C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:509:37
32
+ at Array.map (<anonymous>)
33
+ at Function._validateIncludedElements (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:504:39)
34
+ at Function.findAll (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:1723:12)
35
+ at processTicksAndRejections (internal/process/task_queues.js:93:5)
36
+ [2021-11-30T13.24.21.768] [ERROR] BaseChyz [183] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - EagerLoadingError [SequelizeEagerLoadingError]: ProductModelsClass is associated to ProductsClass using an alias. You must use the 'as' keyword to specify the alias within your include statement.
37
+ at Function._getIncludedAssociation (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:722:13)
38
+ at Function._validateIncludedElement (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:614:53)
39
+ at C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:509:37
40
+ at Array.map (<anonymous>)
41
+ at Function._validateIncludedElements (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:504:39)
42
+ at Function.findAll (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:1723:12)
43
+ at processTicksAndRejections (internal/process/task_queues.js:93:5)
44
+ [2021-11-30T13.26.07.015] [ERROR] BaseChyz [183] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - EagerLoadingError [SequelizeEagerLoadingError]: ProductModelsClass is associated to ProductsClass using an alias. You must use the 'as' keyword to specify the alias within your include statement.
45
+ at Function._getIncludedAssociation (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:722:13)
46
+ at Function._validateIncludedElement (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:614:53)
47
+ at C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:509:37
48
+ at Array.map (<anonymous>)
49
+ at Function._validateIncludedElements (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:504:39)
50
+ at Function.findAll (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:1723:12)
51
+ at processTicksAndRejections (internal/process/task_queues.js:93:5)
52
+ [2021-11-30T13.26.21.193] [ERROR] BaseChyz [183] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - EagerLoadingError [SequelizeEagerLoadingError]: ProductModelsClass is associated to ProductsClass using an alias. You must use the 'as' keyword to specify the alias within your include statement.
53
+ at Function._getIncludedAssociation (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:722:13)
54
+ at Function._validateIncludedElement (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:614:53)
55
+ at C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:509:37
56
+ at Array.map (<anonymous>)
57
+ at Function._validateIncludedElements (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:504:39)
58
+ at Function.findAll (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:1723:12)
59
+ at processTicksAndRejections (internal/process/task_queues.js:93:5)
60
+ [2021-11-30T13.26.34.403] [ERROR] BaseChyz [183] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - EagerLoadingError [SequelizeEagerLoadingError]: ProductModelsClass is associated to ProductsClass using an alias. You must use the 'as' keyword to specify the alias within your include statement.
61
+ at Function._getIncludedAssociation (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:722:13)
62
+ at Function._validateIncludedElement (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:614:53)
63
+ at C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:509:37
64
+ at Array.map (<anonymous>)
65
+ at Function._validateIncludedElements (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:504:39)
66
+ at Function.findAll (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:1723:12)
67
+ at processTicksAndRejections (internal/process/task_queues.js:93:5)
68
+ [2021-11-30T13.26.35.598] [ERROR] BaseChyz [183] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - EagerLoadingError [SequelizeEagerLoadingError]: ProductModelsClass is associated to ProductsClass using an alias. You must use the 'as' keyword to specify the alias within your include statement.
69
+ at Function._getIncludedAssociation (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:722:13)
70
+ at Function._validateIncludedElement (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:614:53)
71
+ at C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:509:37
72
+ at Array.map (<anonymous>)
73
+ at Function._validateIncludedElements (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:504:39)
74
+ at Function.findAll (C:\PROJELER\github\Chy-Nodejs-Framework\node_modules\sequelize\lib\model.js:1723:12)
75
+ at processTicksAndRejections (internal/process/task_queues.js:93:5)
76
+ [2021-11-30T13.27.29.973] [ERROR] BaseChyz [183] [C:\PROJELER\github\Chy-Nodejs-Framework\BaseChyz.ts] - TypeError: product.getProductModelsClass is not a function
77
+ at ApiController.<anonymous> (C:\PROJELER\github\Chy-Nodejs-Framework\Examples\Controllers\ApiController.ts:123:29)
78
+ at Generator.next (<anonymous>)
79
+ at fulfilled (C:\PROJELER\github\Chy-Nodejs-Framework\Examples\Controllers\ApiController.ts:14:58)
80
+ at processTicksAndRejections (internal/process/task_queues.js:93:5)
@@ -1,44 +1,46 @@
1
- {
2
- "name": "edis-manager-node",
3
- "version": "1.0.0",
4
- "description": "Entranet ve Erken Deprem Bildirim Sistemi (EDİS) entegrasyonu",
5
- "main": "index.js",
6
- "scripts": {
7
- "dev": "nodemon index.ts",
8
- "debug": "ts-node index.ts",
9
- "test": "echo \"Error: no test specified\" && exit 1"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/cihan53/edis-manager-node.git"
14
- },
15
- "author": "",
16
- "license": "MIT",
17
- "bugs": {
18
- "url": "https://github.com/cihan53/edis-manager-node/issues"
19
- },
20
- "homepage": "https://github.com/cihan53/edis-manager-node#readme",
21
- "dependencies": {
22
- "babel-plugin-transform-decorators-legacy": "^1.3.5",
23
- "body-parser": "^1.19.0",
24
- "dotenv-flow": "^3.2.0",
25
- "express": "^4.17.1",
26
- "glob": "^7.1.7",
27
- "jsonwebtoken": "^8.5.1",
28
- "lodash": "^4.17.21",
29
- "log4js": "^6.3.0",
30
- "method-override": "^3.0.0",
31
- "passport": "^0.4.1",
32
- "pg": "^8.7.1",
33
- "pg-hstore": "^2.3.4",
34
- "reflect-metadata": "^0.1.13",
35
- "sequelize": "^6.6.5"
36
- },
37
- "devDependencies": {
38
- "@types/express": "^4.17.13",
39
- "@types/node": "^16.4.13",
40
- "nodemon": "^2.0.12",
41
- "ts-node": "^10.2.0",
42
- "typescript": "^4.3.5"
43
- }
44
- }
1
+ {
2
+ "name": "edis-manager-node",
3
+ "version": "1.0.0",
4
+ "description": "Entranet ve Erken Deprem Bildirim Sistemi (EDİS) entegrasyonu",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "dev": "nodemon index.ts",
8
+ "debug": "ts-node index.ts",
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/cihan53/edis-manager-node.git"
14
+ },
15
+ "author": "",
16
+ "license": "MIT",
17
+ "bugs": {
18
+ "url": "https://github.com/cihan53/edis-manager-node/issues"
19
+ },
20
+ "homepage": "https://github.com/cihan53/edis-manager-node#readme",
21
+ "dependencies": {
22
+ "babel-plugin-transform-decorators-legacy": "^1.3.5",
23
+ "bcrypt": "^5.0.1",
24
+ "body-parser": "^1.19.0",
25
+ "dotenv-flow": "^3.2.0",
26
+ "express": "^4.17.1",
27
+ "glob": "^7.1.7",
28
+ "jsonwebtoken": "^8.5.1",
29
+ "keycloak-connect": "^15.0.2",
30
+ "lodash": "^4.17.21",
31
+ "log4js": "^6.3.0",
32
+ "method-override": "^3.0.0",
33
+ "passport": "^0.4.1",
34
+ "pg": "^8.7.1",
35
+ "pg-hstore": "^2.3.4",
36
+ "reflect-metadata": "^0.1.13",
37
+ "sequelize": "^6.6.5"
38
+ },
39
+ "devDependencies": {
40
+ "@types/express": "^4.17.13",
41
+ "@types/node": "^16.4.13",
42
+ "nodemon": "^2.0.12",
43
+ "ts-node": "^10.2.0",
44
+ "typescript": "^4.3.5"
45
+ }
46
+ }
@@ -6,7 +6,7 @@
6
6
  "removeComments": true,
7
7
  "esModuleInterop": true,
8
8
  "allowSyntheticDefaultImports": true,
9
- // "moduleResolution": "node"
9
+ "moduleResolution": "node"
10
10
  },
11
11
  "exclude": [
12
12
  "node_modules"
package/README.md CHANGED
@@ -12,18 +12,26 @@ Klasör Yapısı<br>
12
12
  index.ts<br>
13
13
 
14
14
  `##Başlangıç<br>
15
- yarn start
15
+ yarn start
16
+
17
+ ## index.ts alanlar düzenlenmeli.
18
+
19
+ ```typescript
20
+ require('dotenv-flow').config();
21
+
22
+ import BaseChyz from "chyz/dist/BaseChyz";
23
+ import Chyz, {DbConnection} from "chyz/dist";
24
+ import {WebUser} from "../web/WebUser";
25
+ import {User} from "./Models/User";
16
26
 
17
- ##index.ts alanlar düzenlenmeli.
18
- ```js
19
27
  let config = {
20
28
  components: {
21
- db:{
22
- class:DbConnection,
29
+ db: {
30
+ class: DbConnection,
23
31
  database: process.env.DBDATABASE,
24
- username:process.env.DBUSER,
25
- password:process.env.DBPASS,
26
- options:{
32
+ username: process.env.DBUSER,
33
+ password: process.env.DBPASS,
34
+ options: {
27
35
  host: process.env.DBHOST,
28
36
  dialect: 'postgres', /* one of 'mysql' | 'mariadb' | 'postgres' | 'mssql' */
29
37
  // disable logging; default: console.log
@@ -31,21 +39,22 @@ let config = {
31
39
  }
32
40
  },
33
41
  user: {
34
- 'class': User,
35
- 'identityClass':Identity
42
+ 'class': WebUser,
43
+ 'identityClass': User
36
44
  }
37
45
  }
38
46
  }
39
47
  Chyz.app(config).Start();
40
48
  ```
41
49
 
42
- ##Create Model
50
+ ## Create Model
51
+
43
52
  Veritabanı işlemleri için model oluşturma, sequelize desteklidir.
44
53
 
45
- ```js
46
- import {Model,DataTypes} from "chyz/base/Model";
54
+ ```typescript
55
+ import {Model, DataTypes} from "chyz/base/Model";
47
56
 
48
- export class Customer extends Model {
57
+ export class CustomerCLass extends Model {
49
58
  public tableName() {
50
59
  return 'customer';
51
60
  }
@@ -77,11 +86,104 @@ export class Customer extends Model {
77
86
  }
78
87
 
79
88
  }
89
+ const Customer= new CustomerCLass();
90
+ export { Customer };
91
+
92
+ ```
93
+ ````typescript
94
+ export class ProductsClass extends Model {
95
+ [x: string]: any;
96
+
97
+ tableName() {
98
+ return 'products';
99
+ }
100
+
101
+ attributes() {
102
+ return {
103
+ // Model attributes are defined here
104
+ title: {
105
+ type: DataTypes.STRING,
106
+ allowNull: false
107
+ },
108
+ model_id: {
109
+ type: DataTypes.INTEGER,
110
+ allowNull: false
111
+ },
112
+ properties: {
113
+ type: DataTypes.STRING,
114
+ allowNull: false
115
+ }
116
+
117
+ }
118
+ }
119
+
120
+ relations(): Relation[] {
121
+ return [
122
+ {
123
+ type: "hasOne",
124
+ foreignKey: "id",
125
+ sourceKey: "customer_id",
126
+ model: Customer.model()
127
+ }
128
+ ]
129
+ }
130
+ }
131
+
132
+ const Products = new ProductsClass()
133
+ export {Products}
134
+ ````
135
+
136
+ ## Http POST ve GET verilerini model'e yükleme
137
+
138
+ ````typescript
139
+
140
+ /**
141
+ * post data
142
+ * {
143
+ * "Customer":{
144
+ * "firstname":"cihan",
145
+ * "lastname":"ozturk"
146
+ * ....
147
+ * }
148
+ * }
149
+ * @type {Customer}
150
+ */
151
+ import {Customer} from "./Customer";
152
+ //Customer Model Create
153
+ let customer: Customer = Customer;
154
+ customer.load(req.body, "Customer");//load customer data
155
+ let cus: any = await customer.save();
156
+
157
+
158
+ ````
159
+ ## Transaction
160
+ Transaction oluşturma
161
+
162
+
163
+ ```typescript
164
+ let transaction
165
+ try {
166
+ // get transaction
167
+ transaction = await BaseChyz.getComponent("db").transaction();
168
+ //Customer Model Create
169
+ let customer: Customer = new Customer();
170
+ customer.load(data, "Customer");//load customer data
171
+ let cus: any = await customer.save({}, {transaction});
172
+ if (!cus) {
173
+ throw new ValidationHttpException(customer.errors);
174
+ }
175
+ } catch (e) {
176
+ if (transaction) {
177
+ await transaction.rollback();
178
+ BaseChyz.warn("Rollback transaction")
179
+ }
180
+ ...
181
+ }
80
182
  ```
81
183
 
82
- ##Yetkilendirme için kullanıcı modeli
184
+ ## Yetkilendirme için kullanıcı modeli
83
185
 
84
- ```js
186
+ ```typescript
85
187
  /*
86
188
  * Copyright (c) 2021. Chy Bilgisayar Bilisim
87
189
  * Author: Cihan Ozturk