tango-app-api-trax 3.9.37 → 3.9.39

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 (51) hide show
  1. package/index.js +1 -2
  2. package/package.json +1 -1
  3. package/src/controllers/internalTrax.controller.js +95 -217
  4. package/src/controllers/mobileTrax.controller.js +29 -69
  5. package/src/controllers/trax.controller.js +2 -3
  6. package/src/controllers/traxDashboard.controllers.js +55 -69
  7. package/src/hbs/flag.hbs +1 -1
  8. package/src/hbs/template.hbs +0 -7
  9. package/src/hbs/visit-checklist.hbs +91 -71
  10. package/src/routes/internalTraxApi.router.js +0 -1
  11. package/src/services/app.service.js +9 -15
  12. package/src/services/approver.service.js +15 -23
  13. package/src/services/authentication.service.js +3 -9
  14. package/src/services/camera.service.js +13 -19
  15. package/src/services/checklist.service.js +27 -35
  16. package/src/services/checklistAssign.service.js +38 -43
  17. package/src/services/checklistQuestion.service.js +34 -39
  18. package/src/services/checklistlog.service.js +34 -39
  19. package/src/services/clientRequest.service.js +2 -9
  20. package/src/services/clients.services.js +18 -23
  21. package/src/services/cluster.service.js +23 -31
  22. package/src/services/domain.service.js +18 -23
  23. package/src/services/download.services.js +25 -35
  24. package/src/services/group.service.js +17 -23
  25. package/src/services/lenskartEmployeeMapping.service.js +10 -15
  26. package/src/services/locus.service.js +28 -35
  27. package/src/services/notification.service.js +26 -35
  28. package/src/services/otp.service.js +13 -20
  29. package/src/services/planogram.service.js +2 -9
  30. package/src/services/processedTaskConfig.service.js +27 -35
  31. package/src/services/processedTaskList.service.js +26 -32
  32. package/src/services/processedchecklist.services.js +47 -55
  33. package/src/services/processedchecklistconfig.services.js +34 -39
  34. package/src/services/recurringFlagTracker.service.js +32 -39
  35. package/src/services/runAIFeatures.services.js +27 -32
  36. package/src/services/runAIRequest.services.js +38 -43
  37. package/src/services/store.service.js +27 -32
  38. package/src/services/tagging.service.js +2 -9
  39. package/src/services/taskConfig.service.js +27 -35
  40. package/src/services/teams.service.js +24 -35
  41. package/src/services/ticket.service.js +10 -15
  42. package/src/services/user.service.js +20 -27
  43. package/src/services/userAssignedstores.service.js +5 -12
  44. package/src/utils/visitChecklistPdf.utils.js +21 -449
  45. package/src/logging/activityLogFlusher.js +0 -59
  46. package/src/logging/activityLogMiddleware.js +0 -45
  47. package/src/logging/activityLogStore.js +0 -91
  48. package/src/logging/compressBatches.js +0 -83
  49. package/src/logging/config.js +0 -24
  50. package/src/logging/createLoggableService.js +0 -46
  51. package/src/logging/logExternalCall.js +0 -37
@@ -276,10 +276,29 @@ export const checklistPerformance = async ( req, res ) => {
276
276
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
277
277
  toDate.setUTCHours( 23, 59, 59, 59 );
278
278
  let result = {};
279
+ let checklistIdList = [];
279
280
 
280
281
  let limit = parseInt( requestData?.limit ) || 10;
281
282
  let skip = limit * ( requestData?.offset ) || 0;
282
283
 
284
+ const detectionPayload = {
285
+ 'fromDate': requestData.fromDate,
286
+ 'toDate': requestData.toDate,
287
+ 'clientId': requestData.clientId,
288
+ 'sortColumnName': requestData.sortColumnName,
289
+ 'sortBy': requestData.sortBy,
290
+ 'storeId': requestData.storeId,
291
+ };
292
+
293
+
294
+ let complianceURL = JSON.parse( process.env.LAMBDAURL ).complianceURL;
295
+ const complianceData = await LamdaServiceCall( complianceURL, detectionPayload );
296
+ if ( complianceData?.data?.length && requestData?.sortColumnName == 'questionCompliance' ) {
297
+ const end = skip + requestData?.limit;
298
+ checklistIdList = complianceData.data.slice( skip, end )?.map( ( ele ) => ele?.sourceCheckList_id );
299
+ }
300
+
301
+
283
302
  // Get User Based Checklist //
284
303
  // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
285
304
  // let getUserEmails = await getChecklistUsers( loginUser );
@@ -295,6 +314,10 @@ export const checklistPerformance = async ( req, res ) => {
295
314
  { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
296
315
  );
297
316
 
317
+ if ( requestData?.sortColumnName == 'questionCompliance' ) {
318
+ findAndQuery.push( { sourceCheckList_id: { $in: checklistIdList } } );
319
+ }
320
+
298
321
  findQuery.push( { $match: { $and: findAndQuery } } );
299
322
 
300
323
  if ( requestData.searchValue && requestData.searchValue != '' ) {
@@ -344,16 +367,6 @@ export const checklistPerformance = async ( req, res ) => {
344
367
  timeFlag: { $sum: '$timeFlag' },
345
368
  questionFlagCount: { $sum: '$questionFlag' },
346
369
  runAIFlagCount: { $sum: '$runAIFlag' },
347
- userComplianceCountTotal: {
348
- $sum: {
349
- $cond: [
350
- { $eq: [ '$checklistStatus', 'submit' ] },
351
- { $ifNull: [ '$userComplianceCount', 0 ] },
352
- 0,
353
- ],
354
- },
355
- },
356
- complianceCount: { $first: '$complianceCount' },
357
370
  checkListType: { $last: '$checkListType' },
358
371
  redo: { $sum: { $cond: [ { $eq: [ '$redoStatus', true ] }, 1, 0 ] } },
359
372
  task: {
@@ -413,41 +426,6 @@ export const checklistPerformance = async ( req, res ) => {
413
426
  checkListType: 1,
414
427
  redo: 1,
415
428
  task: 1,
416
- questionCompliance: {
417
- $let: {
418
- vars: {
419
- divisor: {
420
- $cond: [
421
- { $gt: [ '$submittedChecklist', 1 ] },
422
- { $multiply: [ { $ifNull: [ '$complianceCount', 0 ] }, '$submittedChecklist' ] },
423
- { $ifNull: [ '$complianceCount', 0 ] },
424
- ],
425
- },
426
- },
427
- in: {
428
- $cond: [
429
- { $gt: [ '$$divisor', 0 ] },
430
- {
431
- $max: [
432
- 0,
433
- {
434
- $round: [
435
- {
436
- $multiply: [
437
- { $divide: [ '$userComplianceCountTotal', '$$divisor' ] },
438
- 100,
439
- ],
440
- },
441
- 0,
442
- ],
443
- },
444
- ],
445
- },
446
- 0,
447
- ],
448
- },
449
- },
450
- },
451
429
  },
452
430
  } );
453
431
 
@@ -468,10 +446,18 @@ export const checklistPerformance = async ( req, res ) => {
468
446
  },
469
447
  } );
470
448
  let getChecklistPerformanceData = await processedchecklistService.aggregate( findQuery );
471
- if ( !getChecklistPerformanceData[0].count[0].total ) {
449
+ if ( !getChecklistPerformanceData[0].data.length ) {
472
450
  return res.sendError( 'no data found', 204 );
473
451
  }
474
452
 
453
+ getChecklistPerformanceData?.[0]?.data.forEach( ( ele ) => {
454
+ let findCompliance;
455
+ if ( complianceData?.data?.length ) {
456
+ findCompliance = complianceData?.data?.find( ( data ) => data.sourceCheckList_id == ele?.sourceCheckList_id );
457
+ }
458
+ ele['questionComplianceRate'] = findCompliance?.compliancePercentage ?? 0;
459
+ } );
460
+
475
461
  if ( requestData.export ) {
476
462
  const exportdata = [];
477
463
  getChecklistPerformanceData[0].data.forEach( ( element ) => {
@@ -4349,26 +4335,26 @@ function escapeRegex( text ) {
4349
4335
  // }
4350
4336
  // }
4351
4337
 
4352
- // async function LamdaServiceCall( url, data ) {
4353
- // try {
4354
- // const requestOptions = {
4355
- // method: 'POST',
4356
- // headers: {
4357
- // 'Content-Type': 'application/json',
4358
- // },
4359
- // body: JSON.stringify( data ),
4360
- // };
4361
- // console.log( data );
4362
- // const response = await fetch( url, requestOptions );
4363
- // if ( !response.ok ) {
4364
- // throw new Error( `Response status: ${response.status}` );
4365
- // return false;
4366
- // }
4367
- // const json = await response.json();
4368
- // return json;
4369
- // } catch ( error ) {
4370
- // console.log( error );
4371
- // logger.error( { error: error, message: data, function: 'LamdaServiceCall' } );
4372
- // return false;
4373
- // }
4374
- // }
4338
+ async function LamdaServiceCall( url, data ) {
4339
+ try {
4340
+ const requestOptions = {
4341
+ method: 'POST',
4342
+ headers: {
4343
+ 'Content-Type': 'application/json',
4344
+ },
4345
+ body: JSON.stringify( data ),
4346
+ };
4347
+ console.log( data );
4348
+ const response = await fetch( url, requestOptions );
4349
+ if ( !response.ok ) {
4350
+ throw new Error( `Response status: ${response.status}` );
4351
+ return false;
4352
+ }
4353
+ const json = await response.json();
4354
+ return json;
4355
+ } catch ( error ) {
4356
+ console.log( error );
4357
+ logger.error( { error: error, message: data, function: 'LamdaServiceCall' } );
4358
+ return false;
4359
+ }
4360
+ }
package/src/hbs/flag.hbs CHANGED
@@ -176,7 +176,7 @@
176
176
  <td class="flagText" style="padding-left:30px; line-height: 24px;">No of Flags :</td>
177
177
  <td></td>
178
178
  <td></td>
179
- <td class="flagText">{{data.flagCount}}{{#eq data.status 'submit'}}(RunAIFlag:{{data.runAIFlag}},QuestionFlag:{{data.questionFlag}}){{/eq}}</td>
179
+ <td class="flagText">{{data.flagCount}}</td>
180
180
  </tr>
181
181
  <tr bgcolor="#ffffff" style="border:none;margin-top:3px;">
182
182
  <td class="flagText" style="padding-left:30px; line-height: 24px;">Submitted By :</td>
@@ -267,13 +267,6 @@
267
267
  <img src="{{this}}" alt="test" width="200" height="180">
268
268
  {{/each}}
269
269
  </div>
270
- {{#if validationVideo.length}}
271
- <div class="Reference"><span>Uploaded Video</span><br>
272
- {{#each validationVideo}}
273
- <a href="{{this}}" target="_blank" style="text-decoration: underline;color:#0085D2">{{this}}</a><br>
274
- {{/each}}
275
- </div>
276
- {{/if}}
277
270
  {{/eq}}
278
271
  </td>
279
272
  </tr>
@@ -56,16 +56,14 @@
56
56
  .dp-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;padding-bottom:12px;border-bottom:2px solid #00AEEF}
57
57
  .dp-header h2{font-size:18px;font-weight:700;color:#1a1a2e}
58
58
  .dp-score{font-size:15px;font-weight:700;color:#000000}
59
- .q-row{position:relative;margin-bottom:14px;padding:12px 12px 12px 40px;border-radius:8px;background:transparent}
60
- .q-num{position:absolute;left:12px;top:12px;font-size:12px;font-weight:700;color:#000}
59
+ .q-row{display:flex;gap:12px;margin-bottom:14px;padding:12px;border-radius:8px;background:transparent}
60
+ .q-num{font-size:12px;font-weight:700;color:#000;min-width:22px}
61
+ .q-body{flex:1}
61
62
  .q-text{font-size:13px;color:#444;margin-bottom:4px}
62
63
  .q-ans{display:inline-flex;align-items:center;gap:4px;font-size:12px;font-weight:600;padding:2px 8px;border-radius:12px}
63
64
  .ans-yes{background:#e1f5ee;color:#0f6e56}
64
65
  .ans-no{background:#fcebeb;color:#a32d2d}
65
66
  .flag-badge{background:#faeeda;color:#854f0b;font-size:10px;font-weight:600;padding:1px 6px;border-radius:8px;margin-left:6px}
66
- .det-badge{display:inline-block;font-size:10px;font-weight:600;padding:2px 8px;border-radius:10px;white-space:nowrap}
67
- .det-matched{background:#e1f5ee;color:#0f6e56}
68
- .det-notmatched{background:#fcebeb;color:#a32d2d}
69
67
  .q-answer-list{margin-top:6px}
70
68
  .q-answer-item{margin-top:6px;padding:0;background:transparent;border:none;border-radius:0}
71
69
  .q-answer-text{font-size:12px;color:#1a1a1a;line-height:1.5}
@@ -74,21 +72,9 @@
74
72
  .q-answer-media img,.q-answer-media video,.q-answer-item td img{display:block;width:200px;height:180px;object-fit:cover;border-radius:6px;margin-bottom:6px}
75
73
  .img-grid{display:flex;flex-wrap:wrap;gap:8px}
76
74
  .img-grid img{margin-bottom:0}
77
- .answer-media-grid{margin-top:8px;font-size:0}
78
- .answer-media-cell{display:inline-block;width:calc(50% - 6px);vertical-align:top;margin-bottom:12px;break-inside:avoid}
79
- .answer-media-cell:nth-child(2n+1){margin-right:12px}
80
- .answer-media-cell .q-answer-caption{margin-bottom:4px}
81
- .answer-media-cell img{display:block;width:100%;height:200px;object-fit:fill;border-radius:6px;margin-bottom:0}
82
75
  .q-answer-link{font-size:12px;color:#0085D2;text-decoration:underline;word-break:break-all}
83
76
  .q-answer-caption{font-size:11px;color:#666;margin-bottom:4px}
84
77
  .q-answer-remarks{font-size:11px;color:#666;margin-top:6px;white-space:pre-line}
85
- /* User verification (Submitted By) */
86
- .user-verify{margin-top:28px;padding-top:18px;border-top:1px solid #d9d9d9;break-inside:avoid}
87
- .user-verify-title{font-size:15px;font-weight:700;color:#1a1a1a;margin-bottom:14px}
88
- .user-verify-photo{display:block;width:200px;height:240px;object-fit:cover;border-radius:8px;margin-bottom:10px}
89
- .user-verify-name{font-size:14px;color:#1a1a1a;font-weight:600}
90
- .user-verify-sign-label{font-size:12px;color:#666;margin-top:16px;margin-bottom:6px;font-weight:600}
91
- .user-verify-signature{display:block;width:220px;height:auto;max-height:110px;object-fit:contain;border:1px solid #eee;border-radius:6px;padding:6px;background:#fff}
92
78
  /* Footer */
93
79
  .page-footer{position:absolute;bottom:20px;left:40px;right:40px;display:flex;justify-content:space-between;align-items:center;font-size:11px;color:#999;border-top:1px solid #d9d9d9;padding-top:10px}
94
80
  .footer-brand{display:flex;align-items:center;gap:8px;font-weight:600;color:#0066CC;font-size:11px}
@@ -189,10 +175,10 @@
189
175
  <div class="q-row">
190
176
  <span class="q-num">{{this.qno}}</span>
191
177
  <div class="q-body">
192
- <div class="q-text" style="display:flex;justify-content:space-between;align-items:center;gap:8px">
178
+ <div class="q-text" style="display:flex;justify-content:space-between">
193
179
  <div>{{this.qname}}</div>
194
180
  {{#if this.compliance}}
195
- <div style="flex-shrink:0">Score:{{this.score}}</div>
181
+ <div>Score:{{this.score}}</div>
196
182
  {{/if}}
197
183
  </div>
198
184
  {{#if this.questionReferenceImage}}
@@ -218,7 +204,7 @@
218
204
  <div class="q-answer-item">
219
205
  {{#eq this.answerType 'text'}}
220
206
  {{#if this.answer}}
221
- <div class="q-answer-text {{#if this.sopFlag}}flagged{{/if}}">{{this.answer}}{{#if this.showDetectionStatus}} <span class="det-badge {{#eq this.detectionStatus 'Matched'}}det-matched{{else}}det-notmatched{{/eq}}">{{this.detectionStatus}}</span>{{/if}}</div>
207
+ <div class="q-answer-text {{#if this.sopFlag}}flagged{{/if}}">{{this.answer}}</div>
222
208
  {{/if}}
223
209
  {{/eq}}
224
210
  {{#eq this.answerType 'video'}}
@@ -229,20 +215,6 @@
229
215
  </div>
230
216
  {{/if}}
231
217
  {{/eq}}
232
- {{!-- This answer's own images (reference / uploaded / validation), grouped with its label, two per row --}}
233
- {{#if this.answerMedia.length}}
234
- <div class="answer-media-grid">
235
- {{#each this.answerMedia}}
236
- <div class="answer-media-cell">
237
- <div class="q-answer-caption" style="display:flex;justify-content:space-between;align-items:center;gap:6px">
238
- <span>{{this.label}}</span>
239
- {{#if this.detectionStatus}}<span class="det-badge {{#eq this.detectionStatus 'Matched'}}det-matched{{else}}det-notmatched{{/eq}}">{{this.detectionStatus}}</span>{{/if}}
240
- </div>
241
- <img src="{{this.url}}" alt="{{this.label}}" />
242
- </div>
243
- {{/each}}
244
- </div>
245
- {{/if}}
246
218
  {{#eq this.validationDisplayType 'text'}}
247
219
  {{#if this.validationAnswer}}
248
220
  <div class="q-answer-text {{#if this.sopFlag}}flagged{{/if}}">validation Answer: {{this.validationAnswer}}</div>
@@ -255,36 +227,95 @@
255
227
  {{/if}}
256
228
  {{/eq}}
257
229
 
258
- {{!-- Validation videos captured with multi-image validation (shown as links) --}}
259
- {{#eq this.validationDisplayType 'multiImage'}}
260
- {{#if this.validationVideo.length}}
261
- <div class="q-answer-media">
262
- <div class="q-answer-caption">Validation Video</div>
263
- {{#each this.validationVideo}}
264
- <a class="q-answer-link" href="{{this}}" target="_blank">{{this}}</a>
265
- {{/each}}
266
- </div>
267
- {{/if}}
268
- {{/eq}}
269
-
230
+ <table style="width:100%;margin-top:8px;table-layout:fixed"><tr>
231
+ <td style="width:50%;vertical-align:top;padding-right:8px">
232
+ {{#neq ../answerType 'image/video'}}
233
+ {{#neq ../answerType 'multipleImage'}}
234
+ {{#if this.multiReferenceImage.length}}
235
+ <div class="q-answer-media">
236
+ <div class="q-answer-caption">Reference Images</div>
237
+ {{#each this.multiReferenceImage}}
238
+ <img src="{{this}}" alt="Reference Image" />
239
+ {{/each}}
240
+ </div>
241
+ {{else}}
242
+ {{#if this.referenceImage}}
243
+ <div class="q-answer-media">
244
+ <div class="q-answer-caption">Reference Image</div>
245
+ <img src="{{this.referenceImage}}" alt="Reference Image" />
246
+ </div>
247
+ {{else}}
248
+ {{#eq this.answerType 'image'}}
249
+ {{#if this.answer}}
250
+ <div class="q-answer-media">
251
+ <div class="q-answer-caption">Uploaded Image</div>
252
+ <img src="{{this.answer}}" alt="Uploaded Image" />
253
+ </div>
254
+ {{/if}}
255
+ {{/eq}}
256
+ {{/if}}
257
+ {{/if}}
258
+ {{else}}
259
+ {{#eq this.answerType 'image'}}
260
+ {{#if this.answer}}
261
+ <div class="q-answer-media">
262
+ <div class="q-answer-caption">Uploaded Image</div>
263
+ <img src="{{this.answer}}" alt="Uploaded Image" />
264
+ </div>
265
+ {{/if}}
266
+ {{/eq}}
267
+ {{/neq}}
268
+ {{else}}
269
+ {{#eq this.answerType 'image'}}
270
+ {{#if this.answer}}
271
+ <div class="q-answer-media">
272
+ <div class="q-answer-caption">Uploaded Image</div>
273
+ <img src="{{this.answer}}" alt="Uploaded Image" />
274
+ </div>
275
+ {{/if}}
276
+ {{/eq}}
277
+ {{/neq}}
278
+ </td>
279
+ <td style="width:50%;vertical-align:top;padding-left:8px">
280
+ {{#eq this.answerType 'image'}}
281
+ {{#if this.answer}}
282
+ {{#neq ../answerType 'image/video'}}
283
+ {{#neq ../answerType 'multipleImage'}}
284
+ {{#if this.multiReferenceImage.length}}
285
+ <div class="q-answer-caption">Uploaded Image</div>
286
+ <img src="{{this.answer}}" alt="Uploaded Image" />
287
+ {{else}}
288
+ {{#if this.referenceImage}}
289
+ <div class="q-answer-caption">Uploaded Image</div>
290
+ <img src="{{this.answer}}" alt="Uploaded Image" />
291
+ {{/if}}
292
+ {{/if}}
293
+ {{/neq}}
294
+ {{/neq}}
295
+ {{/if}}
296
+ {{/eq}}
297
+ {{#if this.validation}}
298
+ {{#eq this.validationDisplayType 'image'}}
299
+ {{#if this.validationAnswer}}
300
+ <div class="q-answer-caption">Validation Image</div>
301
+ <img src="{{this.validationAnswer}}" alt="Validation Image" />
302
+ {{/if}}
303
+ {{/eq}}
304
+ {{#eq this.validationDisplayType 'multiImage'}}
305
+ {{#if this.validationImage.length}}
306
+ <div class="q-answer-caption">Validation Image</div>
307
+ {{#each this.validationImage}}
308
+ <img src="{{this}}" alt="Validation Image" />
309
+ {{/each}}
310
+ {{/if}}
311
+ {{/eq}}
312
+ {{/if}}
313
+ </td>
314
+ </tr></table>
270
315
  </div>
271
316
  {{/each}}
272
317
  </div>
273
318
  {{/if}}
274
- {{!-- All images for this question (reference / uploaded / validation), two per row --}}
275
- {{#if this.mediaItems.length}}
276
- <div class="answer-media-grid">
277
- {{#each this.mediaItems}}
278
- <div class="answer-media-cell">
279
- <div class="q-answer-caption" style="display:flex;justify-content:space-between;align-items:center;gap:6px">
280
- <span>{{this.label}}</span>
281
- {{#if this.detectionStatus}}<span class="det-badge {{#eq this.detectionStatus 'Matched'}}det-matched{{else}}det-notmatched{{/eq}}">{{this.detectionStatus}}</span>{{/if}}
282
- </div>
283
- <img src="{{this.url}}" alt="{{this.label}}" />
284
- </div>
285
- {{/each}}
286
- </div>
287
- {{/if}}
288
319
  {{#if this.remarks}}
289
320
  <div class="q-answer-remarks">Remarks: {{this.remarks}}</div>
290
321
  {{/if}}
@@ -293,17 +324,6 @@
293
324
  {{/each}}
294
325
  </div>
295
326
  {{/each}}
296
- {{#if showUserVerification}}
297
- <div class="user-verify">
298
- <div class="user-verify-title">Submitted By</div>
299
- {{#if userImage}}
300
- <img class="user-verify-photo" src="{{userImage}}" alt="Submitted by photo" />
301
- {{/if}}
302
- {{#if submittedBy}}
303
- <div class="user-verify-name">{{userSignature}}</div>
304
- {{/if}}
305
- </div>
306
- {{/if}}
307
327
  </div>
308
328
 
309
329
  </body>
@@ -13,7 +13,6 @@ internalTraxRouter
13
13
  .get( '/list', isAllowedInternalAPIHandler, internalController.list )
14
14
  .post( '/updateAomDetails', isAllowedInternalAPIHandler, internalController.aomupdateCollection )
15
15
  .post( '/updateSaleManagerDetails', isAllowedInternalAPIHandler, internalController.saleUpdateCollection )
16
- .post( '/updateValidationType', isAllowedInternalAPIHandler, internalController.updateMultipleChoiceSingleValidationType )
17
16
  .get( '/profile', isAllowedMobileSessionHandler, internalController.getUserStoreList )
18
17
  .post( '/pushNotification', isAllowedInternalAPIHandler, internalController.pushNotification )
19
18
  .post( '/taskPushNotification', isAllowedInternalAPIHandler, internalController.taskPushNotification )
@@ -1,20 +1,14 @@
1
1
  import model from 'tango-api-schema';
2
- import { createLoggableService } from '../logging/createLoggableService.js';
3
2
 
4
- const _methods = {
5
- async aggregate( query ={} ) {
6
- return model.appVersionModel.aggregate( query );
7
- },
8
- async updateOne( query, record ) {
9
- return model.appVersionModel.updateOne( query, { $set: record }, { upsert: true } );
10
- },
11
- async findOne( query ={}, field={} ) {
12
- return model.appVersionModel.findOne( query, field );
13
- },
3
+ export const aggregate = async ( query ={} ) => {
4
+ return model.appVersionModel.aggregate( query );
14
5
  };
15
6
 
16
- const _svc = createLoggableService( _methods, 'appversions' );
7
+ export const updateOne = async ( query, record ) => {
8
+ return model.appVersionModel.updateOne( query, { $set: record }, { upsert: true } );
9
+ };
10
+
11
+ export const findOne = async ( query ={}, field={} ) => {
12
+ return model.appVersionModel.findOne( query, field );
13
+ };
17
14
 
18
- export const aggregate = ( ...args ) => _svc.aggregate( ...args );
19
- export const updateOne = ( ...args ) => _svc.updateOne( ...args );
20
- export const findOne = ( ...args ) => _svc.findOne( ...args );
@@ -1,28 +1,20 @@
1
1
  import model from 'tango-api-schema';
2
- import { createLoggableService } from '../logging/createLoggableService.js';
3
2
 
4
- const _methods = {
5
- async create( data ) {
6
- return model.traxApproverModel.create( data );
7
- },
8
- async updateMany( query={}, record={} ) {
9
- return model.traxApproverModel.updateMany( query, { $set: record } );
10
- },
11
- async insertMany( data = [] ) {
12
- return model.traxApproverModel.insertMany( data );
13
- },
14
- async find( query ={}, field={} ) {
15
- return model.traxApproverModel.find( query, field );
16
- },
17
- async findOne( query ={}, field={} ) {
18
- return model.traxApproverModel.findOne( query, field );
19
- },
3
+ export const create = async ( data ) => {
4
+ return model.traxApproverModel.create( data );
20
5
  };
21
6
 
22
- const _svc = createLoggableService( _methods, 'approvers' );
7
+ export const updateMany = async ( query={}, record={} ) => {
8
+ return model.traxApproverModel.updateMany( query, { $set: record } );
9
+ };
10
+
11
+ export const insertMany = async ( data = [] ) => {
12
+ return model.traxApproverModel.insertMany( data );
13
+ };
23
14
 
24
- export const create = ( ...args ) => _svc.create( ...args );
25
- export const updateMany = ( ...args ) => _svc.updateMany( ...args );
26
- export const insertMany = ( ...args ) => _svc.insertMany( ...args );
27
- export const find = ( ...args ) => _svc.find( ...args );
28
- export const findOne = ( ...args ) => _svc.findOne( ...args );
15
+ export const find = async ( query ={}, field={} ) => {
16
+ return model.traxApproverModel.find( query, field );
17
+ };
18
+ export const findOne = async ( query ={}, field={} ) => {
19
+ return model.traxApproverModel.findOne( query, field );
20
+ };
@@ -1,12 +1,6 @@
1
1
  import authenticationModel from 'tango-api-schema/schema/authentication.model.js';
2
- import { createLoggableService } from '../logging/createLoggableService.js';
3
2
 
4
- const _methods = {
5
- async create( data ) {
6
- return authenticationModel.create( data );
7
- },
8
- };
3
+ export async function create( data ) {
4
+ return authenticationModel.create( data );
5
+ }
9
6
 
10
- const _svc = createLoggableService( _methods, 'authentications' );
11
-
12
- export const create = ( ...args ) => _svc.create( ...args );
@@ -1,24 +1,18 @@
1
1
  import model from 'tango-api-schema';
2
- import { createLoggableService } from '../logging/createLoggableService.js';
3
2
 
4
- const _methods = {
5
- async aggregate( query ={} ) {
6
- return model.cameraModel.aggregate( query );
7
- },
8
- async updateOne( query, record ) {
9
- return model.cameraModel.updateOne( query, { $set: record }, { upsert: true } );
10
- },
11
- async findOne( query ={}, field={} ) {
12
- return model.cameraModel.findOne( query, field );
13
- },
14
- async find( query ={}, field={} ) {
15
- return model.cameraModel.find( query, field );
16
- },
3
+ export const aggregate = async ( query ={} ) => {
4
+ return model.cameraModel.aggregate( query );
17
5
  };
18
6
 
19
- const _svc = createLoggableService( _methods, 'cameras' );
7
+ export const updateOne = async ( query, record ) => {
8
+ return model.cameraModel.updateOne( query, { $set: record }, { upsert: true } );
9
+ };
10
+
11
+ export const findOne = async ( query ={}, field={} ) => {
12
+ return model.cameraModel.findOne( query, field );
13
+ };
14
+
15
+ export const find = async ( query ={}, field={} ) => {
16
+ return model.cameraModel.find( query, field );
17
+ };
20
18
 
21
- export const aggregate = ( ...args ) => _svc.aggregate( ...args );
22
- export const updateOne = ( ...args ) => _svc.updateOne( ...args );
23
- export const findOne = ( ...args ) => _svc.findOne( ...args );
24
- export const find = ( ...args ) => _svc.find( ...args );
@@ -1,39 +1,31 @@
1
1
  import model from 'tango-api-schema';
2
- import { createLoggableService } from '../logging/createLoggableService.js';
3
-
4
- const _methods = {
5
- async findOne( query={}, field={} ) {
6
- return model.checklistconfigModel.findOne( query, field );
7
- },
8
- async find( query={}, field={} ) {
9
- return model.checklistconfigModel.find( query, field );
10
- },
11
- async create( document = {} ) {
12
- return model.checklistconfigModel.create( document );
13
- },
14
- async deleteOne( query = {} ) {
15
- return model.checklistconfigModel.deleteOne( query );
16
- },
17
- async updateOne( query = {}, record={} ) {
18
- return model.checklistconfigModel.updateOne( query, { $set: record }, { upsert: true } );
19
- },
20
- async updateMany( query = {}, record={} ) {
21
- return model.checklistconfigModel.updateMany( query, { $set: record } );
22
- },
23
- async aggregate( query = {} ) {
24
- return model.checklistconfigModel.aggregate( query ).collation( {
25
- locale: 'en_US',
26
- numericOrdering: true,
27
- } ); ;
28
- },
2
+
3
+ export const findOne = async ( query={}, field={} ) => {
4
+ return model.checklistconfigModel.findOne( query, field );
5
+ };
6
+
7
+ export const find = async ( query={}, field={} ) => {
8
+ return model.checklistconfigModel.find( query, field );
9
+ };
10
+
11
+ export const create = async ( document = {} ) => {
12
+ return model.checklistconfigModel.create( document );
13
+ };
14
+
15
+ export const deleteOne = async ( query = {} ) => {
16
+ return model.checklistconfigModel.deleteOne( query );
17
+ };
18
+
19
+ export const updateOne = async ( query = {}, record={} ) => {
20
+ return model.checklistconfigModel.updateOne( query, { $set: record }, { upsert: true } );
21
+ };
22
+
23
+ export const updateMany = async ( query = {}, record={} ) => {
24
+ return model.checklistconfigModel.updateMany( query, { $set: record } );
25
+ };
26
+
27
+ export const aggregate = async ( query = {} ) => {
28
+ return model.checklistconfigModel.aggregate( query );
29
29
  };
30
30
 
31
- const _svc = createLoggableService( _methods, 'checklists' );
32
31
 
33
- export const findOne = ( ...args ) => _svc.findOne( ...args );
34
- export const find = ( ...args ) => _svc.find( ...args );
35
- export const create = ( ...args ) => _svc.create( ...args );
36
- export const deleteOne = ( ...args ) => _svc.deleteOne( ...args );
37
- export const updateOne = ( ...args ) => _svc.updateOne( ...args );
38
- export const updateMany = ( ...args ) => _svc.updateMany( ...args );
39
- export const aggregate = ( ...args ) => _svc.aggregate( ...args );