@pxp-nd/core 1.2.86 → 1.2.88

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.
@@ -164,15 +164,17 @@ class Controller {
164
164
  // Execute our method for this path and pass our express request and response object.
165
165
  // const params = { ...req.query, ...req.body, ...req.params };
166
166
  const params = Object.assign(Object.assign({}, req.files), req.paramasMerge);
167
- this.pxpParams = req.pxpParams;
168
- this.headers = req.headers;
169
- this.transactionCode = (this.module + this.path + route.path)
167
+ const controllerForRequest = Object.assign({}, this);
168
+ controllerForRequest.user = req.user || null;
169
+ controllerForRequest.headers = req.headers;
170
+ controllerForRequest.pxpParams = req.pxpParams;
171
+ controllerForRequest.transactionCode = (this.module + this.path + route.path)
170
172
  .split('/')
171
173
  .join('.')
172
174
  .toLowerCase();
173
- this.validated = false;
175
+ controllerForRequest.validated = false;
174
176
  try {
175
- await index_1.__(this.genericMethodWrapper(params, req, next, res, route.methodName, methodDbSettings, readOnlyMethod, false, logKey, logValue, isHtmlMethod, isFileMethod));
177
+ await index_1.__(this.genericMethodWrapper.call(controllerForRequest, params, req, next, res, route.methodName, methodDbSettings, readOnlyMethod, false, logKey, logValue, isHtmlMethod, isFileMethod));
176
178
  }
177
179
  catch (ex) {
178
180
  const now = new Date();
@@ -195,25 +197,23 @@ class Controller {
195
197
  ], async (req, res, next) => {
196
198
  // Execute our method for this path and pass our express request and response object.
197
199
  const params = Object.assign(Object.assign({}, req.files), req.paramasMerge);
198
- this.pxpParams = req.pxpParams;
199
- this.headers = req.headers;
200
- if (req.user) {
201
- // this.user = req.user as User;
202
- this.user = req.user;
203
- }
204
- this.transactionCode = (this.module + this.path + route.path)
200
+ const controllerForRequest = Object.assign({}, this);
201
+ controllerForRequest.user = req.user || null;
202
+ controllerForRequest.headers = req.headers;
203
+ controllerForRequest.pxpParams = req.pxpParams;
204
+ controllerForRequest.transactionCode = (this.module + this.path + route.path)
205
205
  .split('/')
206
206
  .join('.')
207
207
  .toLowerCase();
208
- this.validated = false;
208
+ controllerForRequest.validated = false;
209
209
  try {
210
- await index_1.__(this.genericMethodWrapper(params, req, next, res, route.methodName, methodDbSettings, readOnlyMethod, permission[route.methodName], logKey, logValue, isHtmlMethod, isFileMethod));
210
+ await index_1.__(this.genericMethodWrapper.call(controllerForRequest, params, req, next, res, route.methodName, methodDbSettings, readOnlyMethod, permission[route.methodName], logKey, logValue, isHtmlMethod, isFileMethod));
211
211
  }
212
212
  catch (ex) {
213
213
  const now = new Date();
214
214
  const iniAt = req.start;
215
215
  const endsAt = now.valueOf() - iniAt.valueOf();
216
- res.logId = (await index_1.__(index_1.insertLog(this.user && this.user.username ? this.user.username : 'nouser', 'mac', req.ip, 'error', ex.tecMessage, this.module, this.transactionCode, '', // query
216
+ res.logId = (await index_1.__(index_1.insertLog(controllerForRequest.user && controllerForRequest.user.username ? controllerForRequest.user.username : 'nouser', 'mac', req.ip, 'error', ex.tecMessage, this.module, this.transactionCode, '', // query
217
217
  params, ex.stack, ex.statusCode, endsAt, logValue)));
218
218
  index_1.errorMiddleware(ex, req, res);
219
219
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxp-nd/core",
3
- "version": "1.2.86",
3
+ "version": "1.2.88",
4
4
  "description": "Contains main files for pxp-nd",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",