emilsoftware-utilities 1.6.1-dev.3 → 1.6.1-dev.4

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.
@@ -283,21 +283,58 @@ let UserService = class UserService {
283
283
  const utentiConfigPlaceholders = ['?', '?', '?'];
284
284
  const utentiConfigParams = [codiceUtente, registrationData.cognome, registrationData.nome];
285
285
  // Mapping dei campi opzionali
286
+ // const optionalFields: [keyof typeof registrationData, string][] = [
287
+ // ['cellulare', 'CELLULARE'],
288
+ // ['flagSuper', 'FLGSUPER'],
289
+ // ['flagAdminConfigurator', 'FLGADMINCONFIG'],
290
+ // ['avatar', 'AVATAR'],
291
+ // ['flagDueFattori', 'FLG2FATT'],
292
+ // ['paginaDefault', 'PAGDEF'],
293
+ // ['ragSocCli', 'RAGSOCCLI'],
294
+ // ];
286
295
  const optionalFields = [
287
- ['cellulare', 'CELLULARE'],
288
- ['flagSuper', 'FLGSUPER'],
289
- ['flagAdminConfigurator', 'FLGADMINCONFIG'],
290
- ['avatar', 'AVATAR'],
291
- ['flagDueFattori', 'FLG2FATT'],
292
- ['paginaDefault', 'PAGDEF'],
293
- ['ragSocCli', 'RAGSOCCLI'],
296
+ {
297
+ key: 'cellulare',
298
+ dbField: 'CELLULARE',
299
+ transform: (v) => String(v),
300
+ },
301
+ {
302
+ key: 'flagSuper',
303
+ dbField: 'FLGSUPER',
304
+ transform: (v) => (v ? 1 : 0),
305
+ },
306
+ {
307
+ key: 'flagAdminConfigurator',
308
+ dbField: 'FLGADMINCONFIG',
309
+ transform: (v) => (v ? 1 : 0),
310
+ },
311
+ {
312
+ key: 'avatar',
313
+ dbField: 'AVATAR',
314
+ transform: (v) => String(v),
315
+ },
316
+ {
317
+ key: 'flagDueFattori',
318
+ dbField: 'FLG2FATT',
319
+ transform: (v) => (v ? 1 : 0),
320
+ },
321
+ {
322
+ key: 'paginaDefault',
323
+ dbField: 'PAGDEF',
324
+ transform: (v) => String(v),
325
+ },
326
+ {
327
+ key: 'ragSocCli',
328
+ dbField: 'RAGSOCCLI',
329
+ transform: (v) => String(v),
330
+ },
294
331
  ];
295
- for (const [key, dbField] of optionalFields) {
296
- const value = registrationData[key];
332
+ for (const field of optionalFields) {
333
+ const value = registrationData[field.key];
297
334
  if (value !== undefined && value !== null) {
298
- utentiConfigFields.push(dbField);
335
+ utentiConfigFields.push(field.dbField);
299
336
  utentiConfigPlaceholders.push('?');
300
- utentiConfigParams.push(Number(value));
337
+ utentiConfigParams.push(field.transform ? field.transform(value) : value);
301
338
  }
302
339
  }
303
340
  const queryUtentiConfig = `INSERT INTO UTENTI_CONFIG (${utentiConfigFields.join(', ')}) VALUES (${utentiConfigPlaceholders.join(', ')})`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emilsoftware-utilities",
3
- "version": "1.6.1-dev.3",
3
+ "version": "1.6.1-dev.4",
4
4
  "description": "Utilities for EmilSoftware",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",