tango-app-api-task 3.2.1 → 3.3.1-beta-1
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 +1211 -13386
- package/src/controllers/taskActionCenter.controllers.js +27 -6
- package/src/controllers/taskDashboard.controllers.js +42 -14
- package/src/dtos/task.dto.js +46 -0
- package/src/routes/task.routes.js +9 -3
- package/src/routes/taskDashboard.routes.js +4 -4
- package/src/service/checklistAssign.service.js +31 -0
- package/src/service/cluster.service.js +31 -0
- package/src/service/teams.service.js +2 -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 } from 'tango-app-api-middleware';
|
|
3
|
+
import { logger, getChecklistUsers } from 'tango-app-api-middleware';
|
|
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: getUserEmails } } ],
|
|
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 },
|
|
@@ -180,13 +188,20 @@ export const approvalTableV1 = async ( req, res ) => {
|
|
|
180
188
|
|
|
181
189
|
const promises = [];
|
|
182
190
|
|
|
191
|
+
let requestData = req.body;
|
|
192
|
+
// 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
|
+
// End: Get User Based Checklist////
|
|
196
|
+
|
|
183
197
|
if ( [ 'task', 'all' ].includes( req.body.type ) ) {
|
|
184
198
|
query = [
|
|
185
199
|
{
|
|
186
200
|
$match: {
|
|
187
201
|
date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
|
|
188
202
|
sourceCheckList_id: { $in: taskIdList },
|
|
189
|
-
...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
|
|
203
|
+
// ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
|
|
204
|
+
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ],
|
|
190
205
|
},
|
|
191
206
|
},
|
|
192
207
|
...groupQuery,
|
|
@@ -217,7 +232,8 @@ export const approvalTableV1 = async ( req, res ) => {
|
|
|
217
232
|
$match: {
|
|
218
233
|
date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
|
|
219
234
|
sourceCheckList_id: { $in: checklistIdList },
|
|
220
|
-
...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } : {},
|
|
235
|
+
// ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } : {},
|
|
236
|
+
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ],
|
|
221
237
|
},
|
|
222
238
|
},
|
|
223
239
|
...groupQuery,
|
|
@@ -281,11 +297,16 @@ export const activityLogV1 = async ( req, res ) => {
|
|
|
281
297
|
let findQuery = [];
|
|
282
298
|
let findAndQuery = [];
|
|
283
299
|
|
|
300
|
+
// 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
|
+
// End: Get User Based Checklist////
|
|
284
304
|
|
|
285
305
|
findAndQuery.push(
|
|
286
306
|
{ client_id: requestData.clientId },
|
|
287
|
-
{ store_id: { $in: requestData.storeId } },
|
|
288
307
|
{ action: { $in: [ 'submitted', 'started' ] } },
|
|
308
|
+
// { store_id: { $in: requestData.storeId } },
|
|
309
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
|
|
289
310
|
);
|
|
290
311
|
|
|
291
312
|
|
|
@@ -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, getChecklistUsers } from 'tango-app-api-middleware';
|
|
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: getUserEmails } } ] },
|
|
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: getUserEmails } } ] },
|
|
236
248
|
);
|
|
237
249
|
if ( requestData.checklistStatus && requestData.checklistStatus != 'All' ) {
|
|
238
250
|
if ( requestData.checklistStatus == 'redo' ) {
|
|
@@ -966,6 +978,12 @@ export async function taskDetails( req, res ) {
|
|
|
966
978
|
return res.sendError( 'clientId is required', 400 );
|
|
967
979
|
}
|
|
968
980
|
|
|
981
|
+
let requestData = req.body;
|
|
982
|
+
// 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 );
|
|
985
|
+
// End: Get User Based Checklist////
|
|
986
|
+
|
|
969
987
|
let toDate = new Date( req.body.toDate );
|
|
970
988
|
let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
|
|
971
989
|
toDate = new Date( toDate.getTime() - userTimezoneOffset );
|
|
@@ -990,23 +1008,33 @@ export async function taskDetails( req, res ) {
|
|
|
990
1008
|
$match: {
|
|
991
1009
|
date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
|
|
992
1010
|
client_id: req.body.clientId,
|
|
993
|
-
...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } : {},
|
|
994
1011
|
...( idList.length ) ? { sourceCheckList_id: { $in: idList } } : {},
|
|
1012
|
+
// store_id: { $in: req.body.storeId },
|
|
1013
|
+
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ],
|
|
995
1014
|
},
|
|
996
1015
|
},
|
|
997
1016
|
{ $sort: { date_iso: -1 } },
|
|
998
1017
|
{
|
|
999
1018
|
$group: {
|
|
1000
|
-
_id: '$sourceCheckList_id',
|
|
1001
|
-
checkListName: { $first: '$checkListName' },
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1019
|
+
'_id': '$sourceCheckList_id',
|
|
1020
|
+
'checkListName': { $first: '$checkListName' },
|
|
1021
|
+
'coverage': {
|
|
1022
|
+
'$first': {
|
|
1023
|
+
'$cond': {
|
|
1024
|
+
'if': { '$gt': [ { '$ifNull': [ '$referenceCheckListId', '' ] }, '' ] },
|
|
1025
|
+
'then': 'checklist',
|
|
1026
|
+
'else': '$coverage',
|
|
1027
|
+
},
|
|
1028
|
+
},
|
|
1029
|
+
},
|
|
1030
|
+
'publishDate': { $first: '$publishDate' },
|
|
1031
|
+
'priorityType': { $first: '$priorityType' },
|
|
1032
|
+
// storeCount: { $first: '$storeCount' },
|
|
1033
|
+
'storeCount': { $sum: 1 },
|
|
1034
|
+
'submitCount': { $sum: { $cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, 1, 0 ] } },
|
|
1035
|
+
'redoCount': { $sum: { $cond: [ { $and: [ { $eq: [ '$redoStatus', true ] }, { $ne: [ '$checklistStatus', 'submit' ] } ] }, 1, 0 ] } },
|
|
1036
|
+
'scheduleEndTime_iso': { $first: '$scheduleEndTime_iso' },
|
|
1037
|
+
'checkListChar': { $first: { $toUpper: { $substr: [ '$createdByName', 0, 2 ] } } },
|
|
1010
1038
|
},
|
|
1011
1039
|
},
|
|
1012
1040
|
];
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
|
|
38
|
+
export const aitaskvalidation = {
|
|
39
|
+
body: aitaskvalidationSchema,
|
|
40
|
+
};
|
|
41
|
+
export const StoreHygienetaskvalidation = {
|
|
42
|
+
body: StoreHygienetaskSchema,
|
|
43
|
+
};
|
|
44
|
+
export const eyeTesttaskvalidation = {
|
|
45
|
+
body: eyeTesttaskSchema,
|
|
46
|
+
};
|
|
@@ -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 } from '../dtos/task.dto.js';
|
|
6
6
|
export const taskRouter = express.Router();
|
|
7
7
|
|
|
8
8
|
taskRouter
|
|
@@ -25,6 +25,12 @@ 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, validate( aitaskvalidation ), taskController.createAiTask )
|
|
32
|
+
.post( '/StoreHygienetask', isAllowedInternalAPIHandler, validate( StoreHygienetaskvalidation ), taskController.StoreHygienetask )
|
|
33
|
+
.post( '/eyeTesttask', isAllowedInternalAPIHandler, validate( eyeTesttaskvalidation ), taskController.eyeTesttask )
|
|
34
|
+
.get( '/getcoustemer', taskController.customertrial );
|
|
29
35
|
|
|
30
36
|
|
|
@@ -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( '/
|
|
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
|
+
}
|
|
@@ -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
|
|