@pxp-nd/core 1.2.4 → 1.2.5
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/dist/PxpApp.js +4 -4
- package/dist/interfaces.d.ts +5 -0
- package/dist/lib/pxp/Controller.js +2 -6
- package/package.json +1 -1
package/dist/PxpApp.js
CHANGED
|
@@ -45,7 +45,7 @@ const modulesPxp = {
|
|
|
45
45
|
common: '@pxp-nd/common',
|
|
46
46
|
reports: '@pxp-nd/reports',
|
|
47
47
|
};
|
|
48
|
-
//auth configure
|
|
48
|
+
//auth configure
|
|
49
49
|
/**
|
|
50
50
|
*
|
|
51
51
|
* */
|
|
@@ -125,8 +125,8 @@ class PxpApp {
|
|
|
125
125
|
}
|
|
126
126
|
next();
|
|
127
127
|
});
|
|
128
|
-
this.app.use(express_1.default.json());
|
|
129
|
-
this.app.use(express_1.default.urlencoded({ extended: false }));
|
|
128
|
+
this.app.use(express_1.default.json(Object.assign({}, this.config.expressJsonConfig)));
|
|
129
|
+
this.app.use(express_1.default.urlencoded(Object.assign({ extended: false }, this.config.expressUrlEncodedConfig)));
|
|
130
130
|
this.app.use(express_fileupload_1.default({
|
|
131
131
|
limits: { fileSize: 5 * 1024 * 1024 },
|
|
132
132
|
}));
|
|
@@ -264,7 +264,7 @@ class PxpApp {
|
|
|
264
264
|
if (this.config.auth) {
|
|
265
265
|
await this.initializeAuthentication(this.configAuth);
|
|
266
266
|
}
|
|
267
|
-
// load ioServer
|
|
267
|
+
// load ioServer
|
|
268
268
|
this.loadIOserver();
|
|
269
269
|
// load controllers and routes
|
|
270
270
|
await this.loadControllers();
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -26,6 +26,9 @@ declare interface IModule {
|
|
|
26
26
|
declare interface IModules {
|
|
27
27
|
[name: string]: IModule;
|
|
28
28
|
}
|
|
29
|
+
declare interface IConfigExpress {
|
|
30
|
+
[name: string]: any;
|
|
31
|
+
}
|
|
29
32
|
export interface IConfigPxpApp {
|
|
30
33
|
defaultDbSettings?: string;
|
|
31
34
|
apiPrefix?: string;
|
|
@@ -40,5 +43,7 @@ export interface IConfigPxpApp {
|
|
|
40
43
|
scripts?: any[];
|
|
41
44
|
modules?: IModules;
|
|
42
45
|
enableSocket?: boolean;
|
|
46
|
+
expressJsonConfig?: IConfigExpress;
|
|
47
|
+
expressUrlEncodedConfig?: IConfigExpress;
|
|
43
48
|
}
|
|
44
49
|
export {};
|
|
@@ -171,7 +171,7 @@ class Controller {
|
|
|
171
171
|
const iniAt = req.start;
|
|
172
172
|
const endsAt = now.valueOf() - iniAt.valueOf();
|
|
173
173
|
res.logId = await index_1.__(index_1.insertLog('nouser', 'mac', req.ip, 'error', ex.tecMessage, this.module, this.transactionCode, '', // query
|
|
174
|
-
params, ex.stack, ex.statusCode, endsAt,
|
|
174
|
+
params, ex.stack, ex.statusCode, endsAt, logValue));
|
|
175
175
|
index_1.errorMiddleware(ex, req, res);
|
|
176
176
|
}
|
|
177
177
|
});
|
|
@@ -205,7 +205,7 @@ class Controller {
|
|
|
205
205
|
const iniAt = req.start;
|
|
206
206
|
const endsAt = now.valueOf() - iniAt.valueOf();
|
|
207
207
|
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
|
|
208
|
-
params, ex.stack, ex.statusCode, endsAt,
|
|
208
|
+
params, ex.stack, ex.statusCode, endsAt, logValue)));
|
|
209
209
|
index_1.errorMiddleware(ex, req, res);
|
|
210
210
|
}
|
|
211
211
|
});
|
|
@@ -274,7 +274,6 @@ class Controller {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
async list(params) {
|
|
277
|
-
console.log('lllleggaa en list');
|
|
278
277
|
const connection = typeorm_1.getConnection(process.env.DB_WRITE_CONNECTION_NAME);
|
|
279
278
|
const queryRunner = connection.getMetadata(this.model).ownColumns.find(column => column.isPrimary === true);
|
|
280
279
|
// ffp search if in the params has been sent the primary key
|
|
@@ -286,16 +285,13 @@ class Controller {
|
|
|
286
285
|
// filter by some column that exist in the entity
|
|
287
286
|
// ffp if some column is into of params for added in the condition
|
|
288
287
|
let ownColumnsForSchema = {};
|
|
289
|
-
console.log('connection.getMetadata(this.model).ownColumns', connection.getMetadata(this.model).ownColumns);
|
|
290
288
|
const whereOwnColumns = connection.getMetadata(this.model).ownColumns.reduce((t, column) => {
|
|
291
|
-
console.log('column.propertyName', column.propertyName);
|
|
292
289
|
if (`_${column.propertyName}` in params) {
|
|
293
290
|
ownColumnsForSchema = Object.assign(Object.assign({}, ownColumnsForSchema), { [`_${column.propertyName}`]: joi_1.default.string() });
|
|
294
291
|
t = Object.assign(Object.assign({}, t), { [column.propertyName]: params[`_${column.propertyName}`] });
|
|
295
292
|
}
|
|
296
293
|
return t;
|
|
297
294
|
}, {});
|
|
298
|
-
console.log('whereOwnColumns', whereOwnColumns);
|
|
299
295
|
const schema = this.getListSchema(ownColumnsForSchema);
|
|
300
296
|
const resParams = await index_1.__(this.schemaValidate(schema, params));
|
|
301
297
|
const listParam = this.getListParams(resParams, whereOwnColumns);
|