tango-app-api-task 3.7.7 → 3.7.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-task",
3
- "version": "3.7.7",
3
+ "version": "3.7.9",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  "mongodb": "^6.10.0",
26
26
  "nodemon": "^3.1.7",
27
27
  "npm": "^10.9.2",
28
- "tango-api-schema": "^2.4.29",
28
+ "tango-api-schema": "^2.4.30",
29
29
  "tango-app-api-middleware": "^3.6.8",
30
30
  "winston": "^3.17.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
@@ -25,6 +25,7 @@ import * as ApproverModel from '../service/approver.service.js';
25
25
  import { createTeamsModel, findOneTeams, updateOneTeamModel, findteams } from '../service/teams.service.js';
26
26
  import { sendPushNotification } from 'tango-app-api-middleware';
27
27
  import * as checklistService from '../service/checklist.service.js';
28
+ import * as clientService from '../service/client.service.js';
28
29
  import isEqual from 'lodash/isEqual.js';
29
30
  async function LamdaServiceCall( url, data ) {
30
31
  try {
@@ -97,6 +98,8 @@ export async function createUpdateTask( req, res ) {
97
98
  } else {
98
99
  query = { checkListName: inputBody.checklistName, client_id: req.body?.clientId };
99
100
  }
101
+ let clientDetails = await clientService.findOne( { clientId: req.body?.clientId }, { traxVideoUploadTimeLimit: 1 } );
102
+ checkListDetails = { ...checkListDetails, videoUploadTimeLimit: clientDetails?.traxVideoUploadTimeLimit };
100
103
  let data = await taskService.updateOne( query, checkListDetails );
101
104
  if ( data.upsertedId || inputBody._id ) {
102
105
  checkListId = data?.upsertedId || inputBody._id;
@@ -1045,7 +1048,8 @@ export async function taskConfig( req, res ) {
1045
1048
  let endDate = dayjs.utc( configDetails?.scheduleDate ).format( 'YYYY-MM-DD' ) + ' ' + configDetails.scheduleEndTime;
1046
1049
  configDetails.scheduleEndTimeISO = dayjs.utc( endDate, 'YYYY-MM-DD hh:mm A' ).format();
1047
1050
  configDetails.publishDate = dayjs.utc( dayjs().format( 'hh:mm A' ), 'hh:mm A' ).format();
1048
-
1051
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
1052
+ configDetails = { ...configDetails, videoUploadTimeLimit: clientDetails?.traxVideoUploadTimeLimit };
1049
1053
  let response = await taskService.updateOne( { _id: inputBody._id }, configDetails );
1050
1054
  if ( inputBody?.approver.length ) {
1051
1055
  let data = [];
@@ -1939,7 +1943,8 @@ export async function createChecklistTask( req, res ) {
1939
1943
  } else {
1940
1944
  data['approver'] = { name: req.user.userName, value: req.user.email };
1941
1945
  }
1942
-
1946
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
1947
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
1943
1948
  let response = await taskService.create( data );
1944
1949
  if ( response?.approver.length ) {
1945
1950
  let data = [];
@@ -2169,7 +2174,8 @@ export async function createChecklistMultiTask( req, res ) {
2169
2174
  } else {
2170
2175
  data['approver'] = { name: req.user.userName, value: req.user.email };
2171
2176
  }
2172
-
2177
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
2178
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
2173
2179
  let response = await taskService.create( data );
2174
2180
  let newquestion = {
2175
2181
  'qno': 1,
@@ -3086,7 +3092,8 @@ export const updatePublish = async ( req, res ) => {
3086
3092
  logger.info( { function: 'updatePublish', query: { date_string: { $gt: currentDate.format( 'YYYY-MM-DD' ) }, date_iso: { $gt: currentDate.format( '' ) }, sourceCheckList_id: req.body.checklistId, checklistStatus: { $ne: 'submit' } } } );
3087
3093
  }
3088
3094
 
3089
-
3095
+ let clientDetails = await clientService.findOne( { clientId: req.body?.clientId }, { traxVideoUploadTimeLimit: 1 } );
3096
+ getCheckDetails.videoUploadTimeLimit = clientDetails?.traxVideoUploadTimeLimit || 0;
3090
3097
  await taskService.updateOne( query, getCheckDetails );
3091
3098
  if ( true ) {
3092
3099
  let currentDate = dayjs.utc().format();
@@ -3203,6 +3210,7 @@ export const duplicateChecklist = async ( req, res ) => {
3203
3210
  } else {
3204
3211
  dupDetails.checkListName = dupDetails.checkListName + '(1)';
3205
3212
  }
3213
+ let clientDetails = await clientService.findOne( { clientId: req.query.clientId }, { traxVideoUploadTimeLimit: 1 } );
3206
3214
  dupDetails.publish = false;
3207
3215
  dupDetails.reinitiate = false;
3208
3216
  dupDetails.createdAt = new Date();
@@ -3210,7 +3218,7 @@ export const duplicateChecklist = async ( req, res ) => {
3210
3218
  dupDetails.publishDate = '';
3211
3219
  dupDetails.rawImageUpload = false;
3212
3220
  dupDetails.rawVideoUpload = false;
3213
- dupDetails.videoUploadTimeLimit = 0;
3221
+ dupDetails.videoUploadTimeLimit = clientDetails?.traxVideoUploadTimeLimit || 0;
3214
3222
  delete dupDetails._id;
3215
3223
  let logInsertData = {
3216
3224
  action: 'duplicateTask',
@@ -3444,7 +3452,8 @@ export async function createAiChecklist( req, res ) {
3444
3452
 
3445
3453
 
3446
3454
  data['approver'] = { name: userAdmin.userName, value: userAdmin.email };
3447
-
3455
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
3456
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
3448
3457
 
3449
3458
  let response = await taskService.create( data );
3450
3459
  if ( response?.approver.length ) {
@@ -3672,7 +3681,8 @@ export async function StoreHygienetaskOld( req, res ) {
3672
3681
  }
3673
3682
  }
3674
3683
 
3675
-
3684
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
3685
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
3676
3686
  let response = await taskService.create( data );
3677
3687
  if ( response?.approver.length ) {
3678
3688
  let inputData = [];
@@ -3898,7 +3908,8 @@ export async function eyeTesttask( req, res ) {
3898
3908
  }
3899
3909
  }
3900
3910
 
3901
-
3911
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
3912
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
3902
3913
  let response = await taskService.create( data );
3903
3914
  if ( response?.approver.length ) {
3904
3915
  let inputData = [];
@@ -4110,7 +4121,8 @@ export async function createAiTask( req, res ) {
4110
4121
  }
4111
4122
  }
4112
4123
 
4113
-
4124
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
4125
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
4114
4126
  let response = await taskService.create( data );
4115
4127
  if ( response?.approver.length ) {
4116
4128
  let inputData = [];
@@ -4876,6 +4888,8 @@ export async function commonAiTask( req, res ) {
4876
4888
  return res.sendError( 'please enter Valid Options', 500 );
4877
4889
  }
4878
4890
  }
4891
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
4892
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
4879
4893
  let response = await taskService.create( data );
4880
4894
  if ( response?.approver.length ) {
4881
4895
  let inputData = [];
@@ -5040,6 +5054,8 @@ export async function taskcreation( req, res ) {
5040
5054
  locationCount: 1,
5041
5055
  ...( inputBody?.checkListId ) ? { referenceCheckListId: inputBody?.checkListId } : {},
5042
5056
  };
5057
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
5058
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
5043
5059
  data['approver'] = userAdmin;
5044
5060
 
5045
5061
  let response = await taskService.create( data );
@@ -5314,6 +5330,8 @@ export async function breachedTasks( req, res ) {
5314
5330
  return res.sendError( 'please enter Valid Options', 500 );
5315
5331
  }
5316
5332
  }
5333
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
5334
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
5317
5335
  let response = await taskService.create( data );
5318
5336
  if ( response?.approver.length ) {
5319
5337
  let inputData = [];
@@ -5593,7 +5611,8 @@ export async function StoreHygienetask( req, res ) {
5593
5611
  return res.sendError( 'please enter Valid Options', 500 );
5594
5612
  }
5595
5613
  }
5596
-
5614
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
5615
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
5597
5616
  let response = await taskService.create( data );
5598
5617
  if ( response?.approver.length ) {
5599
5618
  let inputData = [];
@@ -5816,7 +5835,8 @@ export async function eyeTesttaskNew( req, res ) {
5816
5835
  return res.sendError( 'please enter Valid Options', 500 );
5817
5836
  }
5818
5837
  }
5819
-
5838
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
5839
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
5820
5840
  let response = await taskService.create( data );
5821
5841
  if ( response?.approver.length ) {
5822
5842
  let inputData = [];
@@ -6346,7 +6366,8 @@ export async function createTaskGroup( req, res ) {
6346
6366
  return res.sendError( 'please enter Valid Options', 500 );
6347
6367
  }
6348
6368
  }
6349
-
6369
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
6370
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
6350
6371
  let response = await taskService.create( data );
6351
6372
  if ( response?.approver.length ) {
6352
6373
  let inputData = [];
@@ -6808,7 +6829,8 @@ export async function createAITaskGroup( req, res ) {
6808
6829
  return res.sendError( 'please enter Valid Options', 500 );
6809
6830
  }
6810
6831
  }
6811
-
6832
+ let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
6833
+ data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
6812
6834
  let response = await taskService.create( data );
6813
6835
  if ( response?.approver.length ) {
6814
6836
  let inputData = [];
@@ -0,0 +1,5 @@
1
+ import model from 'tango-api-schema';
2
+
3
+ export const findOne = async ( query = {}, field={} ) => {
4
+ return model.clientModel.findOne( query, field );
5
+ };