tango-app-api-task 3.2.1 → 3.3.1-beta-2

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.
@@ -1,6 +1,6 @@
1
1
  import * as traxApprover from '../service/approver.service.js';
2
2
  import * as processedTask from '../service/processedTaskList.service.js';
3
- import { logger } from 'tango-app-api-middleware';
3
+ import { logger } from 'tango-app-api-middleware'; // getChecklistUsers
4
4
  import * as processedChecklist from '../service/processedChecklist.service.js';
5
5
  import * as checklistLog from '../service/checklistLog.service.js';
6
6
  import mongoose from 'mongoose';
@@ -46,14 +46,21 @@ export const overallCardsV1 = async ( req, res ) => {
46
46
  },
47
47
  };
48
48
 
49
+ let requestData = req.body;
50
+ // Get User Based Checklist //
51
+ // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
52
+ // let getUserEmails = await getChecklistUsers( loginUser );
53
+ // End: Get User Based Checklist////
54
+
49
55
  let taskQuery = [
50
56
  {
51
57
  $match: {
52
58
  date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
53
59
  sourceCheckList_id: { $in: taskIdList },
54
60
  checklistStatus: 'submit',
55
- ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
56
61
  approvalStatus: false,
62
+ // ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
63
+ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ],
57
64
  },
58
65
  },
59
66
  { ...groupQuery },
@@ -65,8 +72,9 @@ export const overallCardsV1 = async ( req, res ) => {
65
72
  date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
66
73
  sourceCheckList_id: { $in: checklistIdList },
67
74
  checklistStatus: 'submit',
68
- ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
69
75
  approvalStatus: false,
76
+ // ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
77
+ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ],
70
78
  },
71
79
  },
72
80
  { ...groupQuery },
@@ -151,6 +159,7 @@ export const approvalTableV1 = async ( req, res ) => {
151
159
  ],
152
160
  },
153
161
  },
162
+ coverage: { $first: '$coverage' },
154
163
  },
155
164
  },
156
165
  {
@@ -169,6 +178,7 @@ export const approvalTableV1 = async ( req, res ) => {
169
178
  unApproveCount: 1,
170
179
  storeName: 1,
171
180
  redo: '$_id.redoType',
181
+ coverage: 1,
172
182
  },
173
183
  },
174
184
  {
@@ -180,13 +190,20 @@ export const approvalTableV1 = async ( req, res ) => {
180
190
 
181
191
  const promises = [];
182
192
 
193
+ let requestData = req.body;
194
+ // Get User Based Checklist //
195
+ // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
196
+ // let getUserEmails = await getChecklistUsers( loginUser );
197
+ // End: Get User Based Checklist////
198
+
183
199
  if ( [ 'task', 'all' ].includes( req.body.type ) ) {
184
200
  query = [
185
201
  {
186
202
  $match: {
187
203
  date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
188
204
  sourceCheckList_id: { $in: taskIdList },
189
- ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
205
+ // ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
206
+ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ],
190
207
  },
191
208
  },
192
209
  ...groupQuery,
@@ -217,7 +234,8 @@ export const approvalTableV1 = async ( req, res ) => {
217
234
  $match: {
218
235
  date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
219
236
  sourceCheckList_id: { $in: checklistIdList },
220
- ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } : {},
237
+ // ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } : {},
238
+ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ],
221
239
  },
222
240
  },
223
241
  ...groupQuery,
@@ -281,11 +299,16 @@ export const activityLogV1 = async ( req, res ) => {
281
299
  let findQuery = [];
282
300
  let findAndQuery = [];
283
301
 
302
+ // Get User Based Checklist //
303
+ // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
304
+ // let getUserEmails = await getChecklistUsers( loginUser );
305
+ // End: Get User Based Checklist////
284
306
 
285
307
  findAndQuery.push(
286
308
  { client_id: requestData.clientId },
287
- { store_id: { $in: requestData.storeId } },
288
309
  { action: { $in: [ 'submitted', 'started' ] } },
310
+ // { store_id: { $in: requestData.storeId } },
311
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
289
312
  );
290
313
 
291
314
 
@@ -294,6 +317,9 @@ export const activityLogV1 = async ( req, res ) => {
294
317
  $project: {
295
318
  checkListName: 1,
296
319
  storeName: 1,
320
+ userEmail: 1,
321
+ userName: 1,
322
+ coverage: 1,
297
323
  action: 1,
298
324
  createdAt: 1,
299
325
  type: 1,
@@ -1,6 +1,6 @@
1
1
  import * as taskService from '../service/task.service.js';
2
2
  import * as processedTaskService from '../service/processedTaskList.service.js';
3
- import { logger, download } from 'tango-app-api-middleware';
3
+ import { logger, download } from 'tango-app-api-middleware'; // getChecklistUsers
4
4
  import dayjs from 'dayjs';
5
5
  import mongoose from 'mongoose';
6
6
  // const ObjectId = mongoose.Types.ObjectId;
@@ -57,10 +57,16 @@ export const overallCardsV1 = async ( req, res ) => {
57
57
  let findQuery = [];
58
58
  let findAndQuery = [];
59
59
 
60
+ // Get User Based Checklist //
61
+ // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
62
+ // let getUserEmails = await getChecklistUsers( loginUser );
63
+ // End: Get User Based Checklist////
64
+
60
65
  findAndQuery.push(
61
66
  { date_iso: { $gte: fromDate, $lte: toDate } },
62
67
  { client_id: requestData.clientId },
63
- { store_id: { $in: requestData.storeId } },
68
+ // { store_id: { $in: requestData.storeId } },
69
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
64
70
  );
65
71
 
66
72
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -228,11 +234,17 @@ export const taskInfoTableV1 = async ( req, res ) => {
228
234
  let findQuery = [];
229
235
  let findAndQuery = [];
230
236
 
237
+ // Get User Based Checklist //
238
+ // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
239
+ // let getUserEmails = await getChecklistUsers( loginUser );
240
+ // End: Get User Based Checklist////
241
+
231
242
  findAndQuery.push(
232
243
  { date_iso: { $lte: new Date( dayjs().format( 'YYYY-MM-DD' ) ) } },
233
244
  { client_id: requestData.clientId },
234
- { store_id: { $in: requestData.storeId } },
235
245
  { sourceCheckList_id: new mongoose.Types.ObjectId( requestData.taskId ) },
246
+ // { store_id: { $in: requestData.storeId } },
247
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
236
248
  );
237
249
  if ( requestData.checklistStatus && requestData.checklistStatus != 'All' ) {
238
250
  if ( requestData.checklistStatus == 'redo' ) {
@@ -253,7 +265,7 @@ export const taskInfoTableV1 = async ( req, res ) => {
253
265
  findQuery.push( { $addFields: { store: { $toLower: '$storeName' } } } );
254
266
  query = { store: { $in: storeList } };
255
267
  } else {
256
- query = { storeName: { $regex: requestData.searchValue.trim(), $options: 'i' } };
268
+ query = { $or: [ { storeName: { $regex: requestData.searchValue.trim(), $options: 'i' } }, { userName: { $regex: requestData.searchValue.trim(), $options: 'i' } }, { userEmail: { $regex: requestData.searchValue.trim(), $options: 'i' } } ] };
257
269
  }
258
270
  findQuery.push( { $match: { $or: [ query ] } } );
259
271
  }
@@ -393,6 +405,21 @@ export const taskInfoTableV1 = async ( req, res ) => {
393
405
  taskInfoData[0].data[i].scheduleEndTime_iso = dayjs.utc( taskInfoData[0].data[i].scheduleEndTime_iso ).format( 'DD MMM YYYY' );
394
406
  }
395
407
  result.taskInfo = taskInfoData[0].data;
408
+ if ( req.body.export ) {
409
+ const exportResult = [];
410
+ for ( let task of result.taskInfo ) {
411
+ exportResult.push( {
412
+ 'Store': task?.storeName ||'--',
413
+ 'Store SPOC': task?.userEmail ||'--',
414
+ 'Due On': dayjs.utc( task?.scheduleEndTime_iso ).format( 'DD MMM, YYYY' ) || '--',
415
+ 'Submitted On': task?.submitTime_string || '--',
416
+ 'Assigned To': task?.storeCount ||'--',
417
+ 'status': task?.checklistStatus ||'--',
418
+ } );
419
+ }
420
+ await download( exportResult, res );
421
+ return;
422
+ }
396
423
  return res.sendSuccess( result );
397
424
  } catch ( error ) {
398
425
  console.log( 'error =>', error );
@@ -735,8 +762,9 @@ export const taskDropdownListV1 = async ( req, res ) => {
735
762
  checkListName: { $first: '$checkListName' },
736
763
  checkListType: { $first: '$checkListType' },
737
764
  createdByName: { $first: '$createdByName' },
738
- storeCount: { $first: '$storeCount' },
765
+ storeCount: { $sum: 1 },
739
766
  scheduleEndTimeISO: { $first: '$scheduleEndTimeISO' },
767
+ coverage: { $first: '$coverage' },
740
768
  // submitTime_string: { $first: '$submitTime_string' },
741
769
  },
742
770
  },
@@ -751,6 +779,7 @@ export const taskDropdownListV1 = async ( req, res ) => {
751
779
  createdByName: 1,
752
780
  storeCount: 1,
753
781
  scheduleEndTimeISO: 1,
782
+ coverage: 1,
754
783
  // submitTime_string: 1,
755
784
  },
756
785
  } );
@@ -966,6 +995,12 @@ export async function taskDetails( req, res ) {
966
995
  return res.sendError( 'clientId is required', 400 );
967
996
  }
968
997
 
998
+ let requestData = req.body;
999
+ // Get User Based Checklist //
1000
+ // let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
1001
+ // let getUserEmails = await getChecklistUsers( loginUser );
1002
+ // End: Get User Based Checklist////
1003
+
969
1004
  let toDate = new Date( req.body.toDate );
970
1005
  let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
971
1006
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
@@ -990,23 +1025,34 @@ export async function taskDetails( req, res ) {
990
1025
  $match: {
991
1026
  date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
992
1027
  client_id: req.body.clientId,
993
- ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } : {},
994
1028
  ...( idList.length ) ? { sourceCheckList_id: { $in: idList } } : {},
1029
+ // store_id: { $in: req.body.storeId },
1030
+ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ],
995
1031
  },
996
1032
  },
997
1033
  { $sort: { date_iso: -1 } },
998
1034
  {
999
1035
  $group: {
1000
- _id: '$sourceCheckList_id',
1001
- checkListName: { $first: '$checkListName' },
1002
- createdByName: { $first: '$createdByName' },
1003
- publishDate: { $first: '$publishDate' },
1004
- priorityType: { $first: '$priorityType' },
1005
- storeCount: { $first: '$storeCount' },
1006
- submitCount: { $sum: { $cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, 1, 0 ] } },
1007
- redoCount: { $sum: { $cond: [ { $and: [ { $eq: [ '$redoStatus', true ] }, { $ne: [ '$checklistStatus', 'submit' ] } ] }, 1, 0 ] } },
1008
- scheduleEndTime_iso: { $first: '$scheduleEndTime_iso' },
1009
- checkListChar: { $first: { $toUpper: { $substr: [ '$createdByName', 0, 2 ] } } },
1036
+ '_id': '$sourceCheckList_id',
1037
+ 'checkListName': { $first: '$checkListName' },
1038
+ 'coverage': {
1039
+ '$first': {
1040
+ '$cond': {
1041
+ 'if': { '$gt': [ { '$ifNull': [ '$referenceCheckListId', '' ] }, '' ] },
1042
+ 'then': 'checklist',
1043
+ 'else': '$coverage',
1044
+ },
1045
+ },
1046
+ },
1047
+ 'publishDate': { $first: '$publishDate' },
1048
+ 'priorityType': { $first: '$priorityType' },
1049
+ 'createdByName': { $first: '$createdByName' },
1050
+ // storeCount: { $first: '$storeCount' },
1051
+ 'storeCount': { $sum: 1 },
1052
+ 'submitCount': { $sum: { $cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, 1, 0 ] } },
1053
+ 'redoCount': { $sum: { $cond: [ { $and: [ { $eq: [ '$redoStatus', true ] }, { $ne: [ '$checklistStatus', 'submit' ] } ] }, 1, 0 ] } },
1054
+ 'scheduleEndTime_iso': { $first: '$scheduleEndTime_iso' },
1055
+ 'checkListChar': { $first: { $toUpper: { $substr: [ '$createdByName', 0, 2 ] } } },
1010
1056
  },
1011
1057
  },
1012
1058
  ];
@@ -0,0 +1,74 @@
1
+ import Joi from 'joi';
2
+
3
+
4
+ export const aitaskvalidationSchema = Joi.object().keys( {
5
+ storeName: Joi.string().required(),
6
+ taskName: Joi.string().required(),
7
+ question: Joi.string().required(),
8
+ answerType: Joi.string().required(),
9
+ approver: Joi.string().required(),
10
+ creator: Joi.string().required(),
11
+ options: Joi.string().optional(),
12
+ scheduleDate: Joi.string().optional(),
13
+ scheduleEndTime: Joi.string().optional(),
14
+ } );
15
+ export const StoreHygienetaskSchema = Joi.object().keys( {
16
+ storeName: Joi.string().required(),
17
+ taskName: Joi.string().required(),
18
+ question: Joi.string().required(),
19
+ answerType: Joi.string().required(),
20
+ options: Joi.string().optional(),
21
+ scheduleDate: Joi.string().optional(),
22
+ scheduleEndTime: Joi.string().optional(),
23
+ referenceImage: Joi.array().required(),
24
+ count: Joi.number().required(),
25
+ } );
26
+
27
+
28
+ export const eyeTesttaskSchema = Joi.object().keys( {
29
+ storeName: Joi.string().required(),
30
+ taskName: Joi.string().required(),
31
+ question: Joi.string().required(),
32
+ answerType: Joi.string().required(),
33
+ scheduleDate: Joi.string().required(),
34
+ scheduleEndTime: Joi.string().required(),
35
+ referenceImage: Joi.any().optional(),
36
+ } );
37
+ export const commonAiTaskSchema = Joi.object().keys( {
38
+ storeName: Joi.string().required(),
39
+ taskName: Joi.string().required(),
40
+ question: Joi.string().required(),
41
+ answerType: Joi.string().required(),
42
+ options: Joi.string().optional(),
43
+ scheduleDate: Joi.string().optional(),
44
+ scheduleEndTime: Joi.string().optional(),
45
+ referenceImage: Joi.array().required(),
46
+ } );
47
+ export const taskcreationSchema = Joi.object().keys( {
48
+ storeName: Joi.string().required(),
49
+ taskName: Joi.string().required(),
50
+ user: Joi.string().required(),
51
+ question: Joi.string().required(),
52
+ answerType: Joi.string().required(),
53
+ options: Joi.array().optional(),
54
+ scheduleDate: Joi.string().optional(),
55
+ scheduleEndTime: Joi.string().optional(),
56
+ approver: Joi.string().required(),
57
+ creator: Joi.string().required(),
58
+ } );
59
+
60
+ export const commonAiTaskvalidation = {
61
+ body: commonAiTaskSchema,
62
+ };
63
+ export const taskcreationvalidation = {
64
+ body: taskcreationSchema,
65
+ };
66
+ export const aitaskvalidation = {
67
+ body: aitaskvalidationSchema,
68
+ };
69
+ export const StoreHygienetaskvalidation = {
70
+ body: StoreHygienetaskSchema,
71
+ };
72
+ export const eyeTesttaskvalidation = {
73
+ body: eyeTesttaskSchema,
74
+ };
@@ -1,8 +1,8 @@
1
1
 
2
2
  import * as taskController from '../controllers/task.controller.js';
3
- import { isAllowedSessionHandler, accessVerification, isAllowedClient } from 'tango-app-api-middleware';
3
+ import { isAllowedSessionHandler, validate, accessVerification, isAllowedClient, isAllowedInternalAPIHandler } from 'tango-app-api-middleware';
4
4
  import express from 'express';
5
-
5
+ import { aitaskvalidation, StoreHygienetaskvalidation, eyeTesttaskvalidation, commonAiTaskvalidation, taskcreationvalidation } from '../dtos/task.dto.js';
6
6
  export const taskRouter = express.Router();
7
7
 
8
8
  taskRouter
@@ -10,7 +10,7 @@ taskRouter
10
10
  .post( '/delete/:taskIds', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.deleteTask )
11
11
  .get( '/details', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskController.taskDetails )
12
12
  .get( '/userDetails', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskController.userDetails )
13
- .post( '/upload', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.validateUser )
13
+ .post( '/upload', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.validateUserv1 )
14
14
  .post( '/uploadImage', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.uploadImage )
15
15
  .post( '/config', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.taskConfig )
16
16
  .post( '/reinitiate', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.reinitiateTask )
@@ -25,6 +25,17 @@ taskRouter
25
25
  .get( '/task-list', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ ] } ] } ), taskController.taskList )
26
26
  .put( '/publish', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.updatePublish )
27
27
  .get( '/duplicateTask/:checklistId', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.duplicateChecklist )
28
- .get( '/teamMigrations', taskController.teamMigrations );
28
+ .get( '/teamMigrations', taskController.teamMigrations )
29
+ .get( '/clusterMigrations', taskController.clusterMigrations )
30
+ .post( '/createaiChecklist', isAllowedInternalAPIHandler, taskController.createAiChecklist )
31
+ .post( '/createaiTask', isAllowedInternalAPIHandler, taskController.createAiTask )
32
+ .post( '/assign', isAllowedSessionHandler, taskController.taskAssign )
33
+ .post( '/createaiTask', isAllowedInternalAPIHandler, validate( aitaskvalidation ), taskController.createAiTask )
34
+ .post( '/StoreHygienetask', isAllowedInternalAPIHandler, validate( StoreHygienetaskvalidation ), taskController.StoreHygienetask )
35
+ .post( '/eyeTesttask', isAllowedInternalAPIHandler, validate( eyeTesttaskvalidation ), taskController.eyeTesttask )
36
+ .post( '/commonAiTask', isAllowedInternalAPIHandler, validate( commonAiTaskvalidation ), taskController.commonAiTask )
37
+ .post( '/updateAssign', isAllowedSessionHandler, taskController.updateAssign )
38
+ .post( '/taskcreation', isAllowedInternalAPIHandler, validate( taskcreationvalidation ), taskController.taskcreation )
39
+ .get( '/getcoustemer', taskController.customertrial );
29
40
 
30
41
 
@@ -8,14 +8,14 @@ import {
8
8
 
9
9
  taskDashboardRouter
10
10
  .post( '/overallcards', isAllowedSessionHandler, overallCards )
11
- .post( '/overallcardsV1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), overallCardsV1 )
12
11
  .post( '/taskTable', isAllowedSessionHandler, taskTable )
13
12
  .post( '/taskTableV1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskTableV1 )
14
13
  .post( '/taskInfoTable', isAllowedSessionHandler, taskInfoTable )
15
- .post( '/taskInfoTableV1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskInfoTableV1 )
16
14
  .post( '/taskDropdownList', isAllowedSessionHandler, taskDropdownList )
17
- .post( '/taskDropdownListV1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskDropdownListV1 )
18
15
  .post( '/taskDeleteV1', isAllowedSessionHandler, taskDeleteV1 )
19
- .post( '/taskDetails', isAllowedSessionHandler, taskDetails );
16
+ .post( '/taskDropdownListV1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskDropdownListV1 )
17
+ .post( '/overallcardsV1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), overallCardsV1 )
18
+ .post( '/taskDetails', isAllowedSessionHandler, taskDetails )
19
+ .post( '/taskInfoTableV1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskInfoTableV1 );
20
20
 
21
21
  export default taskDashboardRouter;
@@ -0,0 +1,31 @@
1
+ import model from 'tango-api-schema';
2
+
3
+ export const find = async ( query={}, field={} ) => {
4
+ return model.checklistassignconfigModel.find( query, field );
5
+ };
6
+
7
+ export const findOne = async ( query={}, field={} ) => {
8
+ return model.checklistassignconfigModel.findOne( query, field );
9
+ };
10
+
11
+ export const create = async ( document = {} ) => {
12
+ return model.checklistassignconfigModel.create( document );
13
+ };
14
+
15
+ export const insertMany = async ( document = {} ) => {
16
+ return model.checklistassignconfigModel.insertMany( document );
17
+ };
18
+
19
+ export const deleteMany = async ( document = {} ) => {
20
+ return model.checklistassignconfigModel.deleteMany( document );
21
+ };
22
+
23
+ export const updateMany = async ( query = {}, record={} ) => {
24
+ return model.checklistassignconfigModel.updateMany( query, { $set: record } );
25
+ };
26
+
27
+ export const aggregate = async ( query = {} ) => {
28
+ return model.checklistassignconfigModel.aggregate( query );
29
+ };
30
+
31
+
@@ -0,0 +1,31 @@
1
+ import clusterModel from 'tango-api-schema/schema/cluster.model.js';
2
+
3
+ export async function updateOneCluster( query, record ) {
4
+ return await clusterModel.updateOne( query, { $set: record } );
5
+ };
6
+
7
+ export async function updateCluster( query, record ) {
8
+ return await clusterModel.updateMany( query, record );
9
+ };
10
+
11
+ export async function aggregateCluster( query ) {
12
+ return await clusterModel.aggregate( query );
13
+ };
14
+
15
+ export async function findOneCluster( query ={}, field={} ) {
16
+ return await clusterModel.findOne( query, field );
17
+ };
18
+ export async function deleteCluster( query ={} ) {
19
+ return await clusterModel.deleteOne( query );
20
+ };
21
+
22
+ export async function createclusterModel( data ) {
23
+ return await clusterModel.create( data );
24
+ };
25
+
26
+ export async function findcluster( query, project ) {
27
+ return await clusterModel.find( query, project );
28
+ };
29
+ export function countDocumentsClusters( query ) {
30
+ return clusterModel.countDocuments( query );
31
+ }
@@ -13,7 +13,7 @@ export const updateMany = async ( query = {}, record={} ) => {
13
13
  };
14
14
 
15
15
  export const updateOne = async ( query = {}, record={} ) => {
16
- return model.taskAssignModel.updateOne( query, { $set: record } );
16
+ return model.taskAssignModel.updateOne( query, { $set: record }, { upsert: true } );
17
17
  };
18
18
 
19
19
  export const insertMany = async ( data = [] ) => {
@@ -0,0 +1,30 @@
1
+ import teamsModel from 'tango-api-schema/schema/teams.model.js';
2
+
3
+
4
+ export async function createTeamsModel( data ) {
5
+ return await teamsModel.create( data );
6
+ };
7
+ export async function updateOneTeams( query, record ) {
8
+ return await teamsModel.updateOne( query, { $set: record }, { upsert: true } );
9
+ };
10
+
11
+ export async function aggregateTeams( query ) {
12
+ return await teamsModel.aggregate( query );
13
+ };
14
+ export async function deleteTeams( query ={} ) {
15
+ return await teamsModel.deleteOne( query );
16
+ };
17
+
18
+ export async function findOneTeams( query ={}, field={} ) {
19
+ return await teamsModel.findOne( query, field );
20
+ };
21
+ export async function findteams( query ={}, field={} ) {
22
+ return await teamsModel.find( query, field );
23
+ };
24
+
25
+ export async function updateOneTeamModel( query, record ) {
26
+ return await teamsModel.updateOne( query, record );
27
+ }
28
+ export function countDocumentsTeams( query ) {
29
+ return teamsModel.countDocuments( query );
30
+ }
@@ -19,6 +19,8 @@ export async function findOneTeams( query ={}, field={} ) {
19
19
  return await teamsModel.findOne( query, field );
20
20
  };
21
21
  export async function findteams( query ={}, field={} ) {
22
+ console.log( query );
23
+
22
24
  return await teamsModel.find( query, field );
23
25
  };
24
26
 
@@ -20,6 +20,10 @@ export const updateOne = async ( query = {}, record={} ) => {
20
20
  return model.userModel.updateOne( query, { $set: record } );
21
21
  };
22
22
 
23
+ export const upsert = async ( query = {}, record={} ) => {
24
+ return model.userModel.updateOne( query, { $set: record }, { upsert: true } );
25
+ };
26
+
23
27
  export const aggregate = async ( query = {} ) => {
24
28
  return model.userModel.aggregate( query );
25
29
  };