tango-app-api-task 3.3.1-beta-1 → 3.3.1-beta-3
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 +3 -3
- package/src/controllers/task.controller.js +1065 -190
- package/src/controllers/taskActionCenter.controllers.js +17 -12
- package/src/controllers/taskDashboard.controllers.js +30 -12
- package/src/dtos/task.dto.js +28 -0
- package/src/routes/task.routes.js +7 -2
- package/src/service/taskAssign.service.js +1 -1
- package/src/service/teams.service copy.js +30 -0
- package/src/service/user.service.js +4 -0
|
@@ -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
|
|
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';
|
|
@@ -48,8 +48,8 @@ export const overallCardsV1 = async ( req, res ) => {
|
|
|
48
48
|
|
|
49
49
|
let requestData = req.body;
|
|
50
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 );
|
|
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
53
|
// End: Get User Based Checklist////
|
|
54
54
|
|
|
55
55
|
let taskQuery = [
|
|
@@ -60,7 +60,7 @@ export const overallCardsV1 = async ( req, res ) => {
|
|
|
60
60
|
checklistStatus: 'submit',
|
|
61
61
|
approvalStatus: false,
|
|
62
62
|
// ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
|
|
63
|
-
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
63
|
+
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes || [] } } ],
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
{ ...groupQuery },
|
|
@@ -74,7 +74,7 @@ export const overallCardsV1 = async ( req, res ) => {
|
|
|
74
74
|
checklistStatus: 'submit',
|
|
75
75
|
approvalStatus: false,
|
|
76
76
|
// ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
|
|
77
|
-
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
77
|
+
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes || [] } } ],
|
|
78
78
|
},
|
|
79
79
|
},
|
|
80
80
|
{ ...groupQuery },
|
|
@@ -159,6 +159,7 @@ export const approvalTableV1 = async ( req, res ) => {
|
|
|
159
159
|
],
|
|
160
160
|
},
|
|
161
161
|
},
|
|
162
|
+
coverage: { $first: '$coverage' },
|
|
162
163
|
},
|
|
163
164
|
},
|
|
164
165
|
{
|
|
@@ -177,6 +178,7 @@ export const approvalTableV1 = async ( req, res ) => {
|
|
|
177
178
|
unApproveCount: 1,
|
|
178
179
|
storeName: 1,
|
|
179
180
|
redo: '$_id.redoType',
|
|
181
|
+
coverage: 1,
|
|
180
182
|
},
|
|
181
183
|
},
|
|
182
184
|
{
|
|
@@ -190,8 +192,8 @@ export const approvalTableV1 = async ( req, res ) => {
|
|
|
190
192
|
|
|
191
193
|
let requestData = req.body;
|
|
192
194
|
// Get User Based Checklist //
|
|
193
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
194
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
195
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
196
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
195
197
|
// End: Get User Based Checklist////
|
|
196
198
|
|
|
197
199
|
if ( [ 'task', 'all' ].includes( req.body.type ) ) {
|
|
@@ -201,7 +203,7 @@ export const approvalTableV1 = async ( req, res ) => {
|
|
|
201
203
|
date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
|
|
202
204
|
sourceCheckList_id: { $in: taskIdList },
|
|
203
205
|
// ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
|
|
204
|
-
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
206
|
+
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes || [] } } ],
|
|
205
207
|
},
|
|
206
208
|
},
|
|
207
209
|
...groupQuery,
|
|
@@ -233,7 +235,7 @@ export const approvalTableV1 = async ( req, res ) => {
|
|
|
233
235
|
date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
|
|
234
236
|
sourceCheckList_id: { $in: checklistIdList },
|
|
235
237
|
// ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } : {},
|
|
236
|
-
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
238
|
+
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes || [] } } ],
|
|
237
239
|
},
|
|
238
240
|
},
|
|
239
241
|
...groupQuery,
|
|
@@ -298,15 +300,15 @@ export const activityLogV1 = async ( req, res ) => {
|
|
|
298
300
|
let findAndQuery = [];
|
|
299
301
|
|
|
300
302
|
// Get User Based Checklist //
|
|
301
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
302
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
303
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
304
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
303
305
|
// End: Get User Based Checklist////
|
|
304
306
|
|
|
305
307
|
findAndQuery.push(
|
|
306
308
|
{ client_id: requestData.clientId },
|
|
307
309
|
{ action: { $in: [ 'submitted', 'started' ] } },
|
|
308
310
|
// { store_id: { $in: requestData.storeId } },
|
|
309
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
311
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes || [] } } ] },
|
|
310
312
|
);
|
|
311
313
|
|
|
312
314
|
|
|
@@ -315,6 +317,9 @@ export const activityLogV1 = async ( req, res ) => {
|
|
|
315
317
|
$project: {
|
|
316
318
|
checkListName: 1,
|
|
317
319
|
storeName: 1,
|
|
320
|
+
userEmail: 1,
|
|
321
|
+
userName: 1,
|
|
322
|
+
coverage: 1,
|
|
318
323
|
action: 1,
|
|
319
324
|
createdAt: 1,
|
|
320
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
|
|
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;
|
|
@@ -58,15 +58,15 @@ export const overallCardsV1 = async ( req, res ) => {
|
|
|
58
58
|
let findAndQuery = [];
|
|
59
59
|
|
|
60
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 );
|
|
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
63
|
// End: Get User Based Checklist////
|
|
64
64
|
|
|
65
65
|
findAndQuery.push(
|
|
66
66
|
{ date_iso: { $gte: fromDate, $lte: toDate } },
|
|
67
67
|
{ client_id: requestData.clientId },
|
|
68
68
|
// { store_id: { $in: requestData.storeId } },
|
|
69
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
69
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes || [] } } ] },
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
@@ -235,8 +235,8 @@ export const taskInfoTableV1 = async ( req, res ) => {
|
|
|
235
235
|
let findAndQuery = [];
|
|
236
236
|
|
|
237
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 );
|
|
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
240
|
// End: Get User Based Checklist////
|
|
241
241
|
|
|
242
242
|
findAndQuery.push(
|
|
@@ -244,7 +244,7 @@ export const taskInfoTableV1 = async ( req, res ) => {
|
|
|
244
244
|
{ client_id: requestData.clientId },
|
|
245
245
|
{ sourceCheckList_id: new mongoose.Types.ObjectId( requestData.taskId ) },
|
|
246
246
|
// { store_id: { $in: requestData.storeId } },
|
|
247
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
247
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes || [] } } ] },
|
|
248
248
|
);
|
|
249
249
|
if ( requestData.checklistStatus && requestData.checklistStatus != 'All' ) {
|
|
250
250
|
if ( requestData.checklistStatus == 'redo' ) {
|
|
@@ -265,7 +265,7 @@ export const taskInfoTableV1 = async ( req, res ) => {
|
|
|
265
265
|
findQuery.push( { $addFields: { store: { $toLower: '$storeName' } } } );
|
|
266
266
|
query = { store: { $in: storeList } };
|
|
267
267
|
} else {
|
|
268
|
-
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' } } ] };
|
|
269
269
|
}
|
|
270
270
|
findQuery.push( { $match: { $or: [ query ] } } );
|
|
271
271
|
}
|
|
@@ -405,6 +405,21 @@ export const taskInfoTableV1 = async ( req, res ) => {
|
|
|
405
405
|
taskInfoData[0].data[i].scheduleEndTime_iso = dayjs.utc( taskInfoData[0].data[i].scheduleEndTime_iso ).format( 'DD MMM YYYY' );
|
|
406
406
|
}
|
|
407
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
|
+
}
|
|
408
423
|
return res.sendSuccess( result );
|
|
409
424
|
} catch ( error ) {
|
|
410
425
|
console.log( 'error =>', error );
|
|
@@ -747,8 +762,9 @@ export const taskDropdownListV1 = async ( req, res ) => {
|
|
|
747
762
|
checkListName: { $first: '$checkListName' },
|
|
748
763
|
checkListType: { $first: '$checkListType' },
|
|
749
764
|
createdByName: { $first: '$createdByName' },
|
|
750
|
-
storeCount: { $
|
|
765
|
+
storeCount: { $sum: 1 },
|
|
751
766
|
scheduleEndTimeISO: { $first: '$scheduleEndTimeISO' },
|
|
767
|
+
coverage: { $first: '$coverage' },
|
|
752
768
|
// submitTime_string: { $first: '$submitTime_string' },
|
|
753
769
|
},
|
|
754
770
|
},
|
|
@@ -763,6 +779,7 @@ export const taskDropdownListV1 = async ( req, res ) => {
|
|
|
763
779
|
createdByName: 1,
|
|
764
780
|
storeCount: 1,
|
|
765
781
|
scheduleEndTimeISO: 1,
|
|
782
|
+
coverage: 1,
|
|
766
783
|
// submitTime_string: 1,
|
|
767
784
|
},
|
|
768
785
|
} );
|
|
@@ -980,8 +997,8 @@ export async function taskDetails( req, res ) {
|
|
|
980
997
|
|
|
981
998
|
let requestData = req.body;
|
|
982
999
|
// Get User Based Checklist //
|
|
983
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
984
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
1000
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1001
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
985
1002
|
// End: Get User Based Checklist////
|
|
986
1003
|
|
|
987
1004
|
let toDate = new Date( req.body.toDate );
|
|
@@ -1010,7 +1027,7 @@ export async function taskDetails( req, res ) {
|
|
|
1010
1027
|
client_id: req.body.clientId,
|
|
1011
1028
|
...( idList.length ) ? { sourceCheckList_id: { $in: idList } } : {},
|
|
1012
1029
|
// store_id: { $in: req.body.storeId },
|
|
1013
|
-
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
1030
|
+
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes || [] } } ],
|
|
1014
1031
|
},
|
|
1015
1032
|
},
|
|
1016
1033
|
{ $sort: { date_iso: -1 } },
|
|
@@ -1029,6 +1046,7 @@ export async function taskDetails( req, res ) {
|
|
|
1029
1046
|
},
|
|
1030
1047
|
'publishDate': { $first: '$publishDate' },
|
|
1031
1048
|
'priorityType': { $first: '$priorityType' },
|
|
1049
|
+
'createdByName': { $first: '$createdByName' },
|
|
1032
1050
|
// storeCount: { $first: '$storeCount' },
|
|
1033
1051
|
'storeCount': { $sum: 1 },
|
|
1034
1052
|
'submitCount': { $sum: { $cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, 1, 0 ] } },
|
package/src/dtos/task.dto.js
CHANGED
|
@@ -34,7 +34,35 @@ export const eyeTesttaskSchema = Joi.object().keys( {
|
|
|
34
34
|
scheduleEndTime: Joi.string().required(),
|
|
35
35
|
referenceImage: Joi.any().optional(),
|
|
36
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
|
+
} );
|
|
37
59
|
|
|
60
|
+
export const commonAiTaskvalidation = {
|
|
61
|
+
body: commonAiTaskSchema,
|
|
62
|
+
};
|
|
63
|
+
export const taskcreationvalidation = {
|
|
64
|
+
body: taskcreationSchema,
|
|
65
|
+
};
|
|
38
66
|
export const aitaskvalidation = {
|
|
39
67
|
body: aitaskvalidationSchema,
|
|
40
68
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as taskController from '../controllers/task.controller.js';
|
|
3
3
|
import { isAllowedSessionHandler, validate, accessVerification, isAllowedClient, isAllowedInternalAPIHandler } from 'tango-app-api-middleware';
|
|
4
4
|
import express from 'express';
|
|
5
|
-
import { aitaskvalidation, StoreHygienetaskvalidation, eyeTesttaskvalidation } from '../dtos/task.dto.js';
|
|
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.
|
|
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 )
|
|
@@ -28,9 +28,14 @@ taskRouter
|
|
|
28
28
|
.get( '/teamMigrations', taskController.teamMigrations )
|
|
29
29
|
.get( '/clusterMigrations', taskController.clusterMigrations )
|
|
30
30
|
.post( '/createaiChecklist', isAllowedInternalAPIHandler, taskController.createAiChecklist )
|
|
31
|
+
.post( '/createaiTask', isAllowedInternalAPIHandler, taskController.createAiTask )
|
|
32
|
+
.post( '/assign', isAllowedSessionHandler, taskController.taskAssign )
|
|
31
33
|
.post( '/createaiTask', isAllowedInternalAPIHandler, validate( aitaskvalidation ), taskController.createAiTask )
|
|
32
34
|
.post( '/StoreHygienetask', isAllowedInternalAPIHandler, validate( StoreHygienetaskvalidation ), taskController.StoreHygienetask )
|
|
33
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 )
|
|
34
39
|
.get( '/getcoustemer', taskController.customertrial );
|
|
35
40
|
|
|
36
41
|
|
|
@@ -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
|
+
}
|
|
@@ -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
|
};
|