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.
- package/BaseChyz.ts +72 -12
- package/Examples/Controllers/ApiController.ts +88 -30
- package/Examples/Controllers/KeyCloakController.ts +100 -0
- package/Examples/Controllers/PublicController.ts +5 -7
- package/Examples/Controllers/SiteController.ts +82 -32
- package/Examples/Models/Categories.ts +36 -0
- package/Examples/Models/Customer.ts +115 -0
- package/Examples/Models/KeycloakUser.ts +66 -0
- package/Examples/Models/Order.ts +64 -0
- package/Examples/Models/OrderItem.ts +27 -0
- package/Examples/Models/ProductModels.ts +50 -0
- package/Examples/Models/ProductToCategories.ts +35 -0
- package/Examples/Models/Products.ts +49 -0
- package/Examples/Models/Stocks.ts +60 -0
- package/Examples/Models/User.ts +66 -35
- package/Examples/Models/UserPermission.ts +37 -0
- package/Examples/index-keycloack.ts +78 -0
- package/Examples/index.ts +16 -15
- package/Examples/keycloak.json +7 -0
- package/Examples/log/app.log +903 -1034
- package/Examples/log/errors.log +79 -256
- package/Examples/package.json +46 -44
- package/Examples/tsconfig.json +1 -1
- package/README.md +118 -16
- package/base/ActionFilter.ts +2 -2
- package/base/BaseError.ts +2 -2
- package/base/DataErrorDbException.ts +1 -1
- package/base/DbConnection.ts +6 -0
- package/base/ForbiddenHttpException.ts +1 -1
- package/base/InvalidConfigException.ts +1 -1
- package/base/Model.ts +204 -15
- package/base/NotFoundHttpException.ts +1 -1
- package/base/RestClient.ts +28 -0
- package/base/UnauthorizedHttpException.ts +2 -1
- package/base/ValidationHttpException.ts +14 -0
- package/base/db/Exception.ts +14 -0
- package/base/index.ts +2 -0
- package/dist/BaseChyz.js +56 -10
- package/dist/BaseChyz.js.map +1 -1
- package/dist/README.md +270 -0
- package/dist/base/ActionFilter.js +2 -2
- package/dist/base/ActionFilter.js.map +1 -1
- package/dist/base/BaseError.js +2 -2
- package/dist/base/BaseError.js.map +1 -1
- package/dist/base/DataErrorDbException.js +1 -1
- package/dist/base/DataErrorDbException.js.map +1 -1
- package/dist/base/DbConnection.js +3 -0
- package/dist/base/DbConnection.js.map +1 -1
- package/dist/base/ForbiddenHttpException.js +1 -1
- package/dist/base/ForbiddenHttpException.js.map +1 -1
- package/dist/base/InvalidConfigException.js +1 -1
- package/dist/base/InvalidConfigException.js.map +1 -1
- package/dist/base/Model.js +181 -13
- package/dist/base/Model.js.map +1 -1
- package/dist/base/NotFoundHttpException.js +1 -1
- package/dist/base/NotFoundHttpException.js.map +1 -1
- package/dist/base/RestClient.js +27 -0
- package/dist/base/RestClient.js.map +1 -0
- package/dist/base/UnauthorizedHttpException.js +1 -1
- package/dist/base/UnauthorizedHttpException.js.map +1 -1
- package/dist/base/ValidationHttpException.js +18 -0
- package/dist/base/ValidationHttpException.js.map +1 -0
- package/dist/base/db/Exception.js +16 -0
- package/dist/base/db/Exception.js.map +1 -0
- package/dist/base/index.js +2 -0
- package/dist/base/index.js.map +1 -1
- package/dist/filters/AccessControl.js +2 -2
- package/dist/filters/AccessControl.js.map +1 -1
- package/dist/filters/AccessRule.js.map +1 -1
- package/dist/filters/auth/AuthMethod.js +2 -2
- package/dist/filters/auth/AuthMethod.js.map +1 -1
- package/dist/filters/auth/HttpHeaderAuth.js.map +1 -1
- package/dist/filters/auth/JwtHttpBearerAuth.js +1 -0
- package/dist/filters/auth/JwtHttpBearerAuth.js.map +1 -1
- package/dist/filters/auth/KeyCloakHttpBearerAuth.js +117 -0
- package/dist/filters/auth/KeyCloakHttpBearerAuth.js.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/package.json +55 -0
- package/dist/web/{User.js → WebUser.js} +12 -7
- package/dist/web/WebUser.js.map +1 -0
- package/filters/AccessControl.ts +3 -3
- package/filters/AccessRule.ts +2 -2
- package/filters/auth/AuthMethod.ts +4 -4
- package/filters/auth/HttpHeaderAuth.ts +2 -2
- package/filters/auth/JwtHttpBearerAuth.ts +4 -5
- package/filters/auth/KeyCloakHttpBearerAuth.ts +115 -0
- package/index.ts +14 -0
- package/package-lock.json +5259 -0
- package/package.json +56 -52
- package/web/{User.ts → WebUser.ts} +10 -6
- package/.idea/Chy-Nodejs-Framework.iml +0 -12
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/dist/web/User.js.map +0 -1
package/Examples/log/errors.log
CHANGED
|
@@ -1,257 +1,80 @@
|
|
|
1
|
-
[2021-
|
|
2
|
-
at
|
|
3
|
-
at
|
|
4
|
-
at
|
|
5
|
-
at
|
|
6
|
-
at C:\PROJELER\github\Chy-Nodejs-Framework\
|
|
7
|
-
at
|
|
8
|
-
at
|
|
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:
|
|
161
|
-
}
|
|
162
|
-
[2021-
|
|
163
|
-
at
|
|
164
|
-
at
|
|
165
|
-
at
|
|
166
|
-
at
|
|
167
|
-
at
|
|
168
|
-
at
|
|
169
|
-
at processTicksAndRejections (internal/process/task_queues.js:93:5)
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
at
|
|
174
|
-
at
|
|
175
|
-
at
|
|
176
|
-
at
|
|
177
|
-
at
|
|
178
|
-
|
|
179
|
-
at
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
at
|
|
184
|
-
at
|
|
185
|
-
at
|
|
186
|
-
|
|
187
|
-
at
|
|
188
|
-
at
|
|
189
|
-
at
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
at
|
|
194
|
-
|
|
195
|
-
at
|
|
196
|
-
at
|
|
197
|
-
at
|
|
198
|
-
at
|
|
199
|
-
at
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
[2021-
|
|
203
|
-
at
|
|
204
|
-
at
|
|
205
|
-
at
|
|
206
|
-
at
|
|
207
|
-
at
|
|
208
|
-
at
|
|
209
|
-
at processTicksAndRejections (internal/process/task_queues.js:93:5)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
at
|
|
214
|
-
at
|
|
215
|
-
at
|
|
216
|
-
at
|
|
217
|
-
at
|
|
218
|
-
|
|
219
|
-
at
|
|
220
|
-
at
|
|
221
|
-
at
|
|
222
|
-
at
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
at
|
|
228
|
-
at
|
|
229
|
-
at
|
|
230
|
-
at
|
|
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)
|
package/Examples/package.json
CHANGED
|
@@ -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
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
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
|
+
}
|
package/Examples/tsconfig.json
CHANGED
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':
|
|
35
|
-
'identityClass':
|
|
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
|
-
```
|
|
46
|
-
import {Model,DataTypes} from "chyz/base/Model";
|
|
54
|
+
```typescript
|
|
55
|
+
import {Model, DataTypes} from "chyz/base/Model";
|
|
47
56
|
|
|
48
|
-
export class
|
|
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
|
-
```
|
|
186
|
+
```typescript
|
|
85
187
|
/*
|
|
86
188
|
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
87
189
|
* Author: Cihan Ozturk
|