tango-app-api-task 3.2.1-beta-41 → 3.2.1-hotfix-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.
@@ -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, getChecklistUsers } from 'tango-app-api-middleware';
3
+ import { logger } 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,21 +46,14 @@ 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
-
55
49
  let taskQuery = [
56
50
  {
57
51
  $match: {
58
52
  date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
59
53
  sourceCheckList_id: { $in: taskIdList },
60
54
  checklistStatus: 'submit',
55
+ ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
61
56
  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 } } ],
64
57
  },
65
58
  },
66
59
  { ...groupQuery },
@@ -72,9 +65,8 @@ export const overallCardsV1 = async ( req, res ) => {
72
65
  date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
73
66
  sourceCheckList_id: { $in: checklistIdList },
74
67
  checklistStatus: 'submit',
68
+ ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
75
69
  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 } } ],
78
70
  },
79
71
  },
80
72
  { ...groupQuery },
@@ -159,7 +151,6 @@ export const approvalTableV1 = async ( req, res ) => {
159
151
  ],
160
152
  },
161
153
  },
162
- coverage: { $first: '$coverage' },
163
154
  },
164
155
  },
165
156
  {
@@ -178,7 +169,6 @@ export const approvalTableV1 = async ( req, res ) => {
178
169
  unApproveCount: 1,
179
170
  storeName: 1,
180
171
  redo: '$_id.redoType',
181
- coverage: 1,
182
172
  },
183
173
  },
184
174
  {
@@ -190,20 +180,13 @@ export const approvalTableV1 = async ( req, res ) => {
190
180
 
191
181
  const promises = [];
192
182
 
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
-
199
183
  if ( [ 'task', 'all' ].includes( req.body.type ) ) {
200
184
  query = [
201
185
  {
202
186
  $match: {
203
187
  date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
204
188
  sourceCheckList_id: { $in: taskIdList },
205
- // ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
206
- $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ],
189
+ ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
207
190
  },
208
191
  },
209
192
  ...groupQuery,
@@ -234,8 +217,7 @@ export const approvalTableV1 = async ( req, res ) => {
234
217
  $match: {
235
218
  date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
236
219
  sourceCheckList_id: { $in: checklistIdList },
237
- // ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } : {},
238
- $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ],
220
+ ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } : {},
239
221
  },
240
222
  },
241
223
  ...groupQuery,
@@ -299,16 +281,11 @@ export const activityLogV1 = async ( req, res ) => {
299
281
  let findQuery = [];
300
282
  let findAndQuery = [];
301
283
 
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////
306
284
 
307
285
  findAndQuery.push(
308
286
  { client_id: requestData.clientId },
287
+ { store_id: { $in: requestData.storeId } },
309
288
  { action: { $in: [ 'submitted', 'started' ] } },
310
- // { store_id: { $in: requestData.storeId } },
311
- { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
312
289
  );
313
290
 
314
291
 
@@ -317,9 +294,6 @@ export const activityLogV1 = async ( req, res ) => {
317
294
  $project: {
318
295
  checkListName: 1,
319
296
  storeName: 1,
320
- userEmail: 1,
321
- userName: 1,
322
- coverage: 1,
323
297
  action: 1,
324
298
  createdAt: 1,
325
299
  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, getChecklistUsers } from 'tango-app-api-middleware';
3
+ import { logger, download } 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,16 +57,10 @@ 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
-
65
60
  findAndQuery.push(
66
61
  { date_iso: { $gte: fromDate, $lte: toDate } },
67
62
  { client_id: requestData.clientId },
68
- // { store_id: { $in: requestData.storeId } },
69
- { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
63
+ { store_id: { $in: requestData.storeId } },
70
64
  );
71
65
 
72
66
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -234,17 +228,11 @@ export const taskInfoTableV1 = async ( req, res ) => {
234
228
  let findQuery = [];
235
229
  let findAndQuery = [];
236
230
 
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
-
242
231
  findAndQuery.push(
243
232
  { date_iso: { $lte: new Date( dayjs().format( 'YYYY-MM-DD' ) ) } },
244
233
  { client_id: requestData.clientId },
234
+ { store_id: { $in: requestData.storeId } },
245
235
  { 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 } } ] },
248
236
  );
249
237
  if ( requestData.checklistStatus && requestData.checklistStatus != 'All' ) {
250
238
  if ( requestData.checklistStatus == 'redo' ) {
@@ -265,7 +253,7 @@ export const taskInfoTableV1 = async ( req, res ) => {
265
253
  findQuery.push( { $addFields: { store: { $toLower: '$storeName' } } } );
266
254
  query = { store: { $in: storeList } };
267
255
  } else {
268
- query = { $or: [ { storeName: { $regex: requestData.searchValue.trim(), $options: 'i' } }, { userName: { $regex: requestData.searchValue.trim(), $options: 'i' } }, { userEmail: { $regex: requestData.searchValue.trim(), $options: 'i' } } ] };
256
+ query = { storeName: { $regex: requestData.searchValue.trim(), $options: 'i' } };
269
257
  }
270
258
  findQuery.push( { $match: { $or: [ query ] } } );
271
259
  }
@@ -405,21 +393,6 @@ export const taskInfoTableV1 = async ( req, res ) => {
405
393
  taskInfoData[0].data[i].scheduleEndTime_iso = dayjs.utc( taskInfoData[0].data[i].scheduleEndTime_iso ).format( 'DD MMM YYYY' );
406
394
  }
407
395
  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
- }
423
396
  return res.sendSuccess( result );
424
397
  } catch ( error ) {
425
398
  console.log( 'error =>', error );
@@ -762,9 +735,8 @@ export const taskDropdownListV1 = async ( req, res ) => {
762
735
  checkListName: { $first: '$checkListName' },
763
736
  checkListType: { $first: '$checkListType' },
764
737
  createdByName: { $first: '$createdByName' },
765
- storeCount: { $sum: 1 },
738
+ storeCount: { $first: '$storeCount' },
766
739
  scheduleEndTimeISO: { $first: '$scheduleEndTimeISO' },
767
- coverage: { $first: '$coverage' },
768
740
  // submitTime_string: { $first: '$submitTime_string' },
769
741
  },
770
742
  },
@@ -779,7 +751,6 @@ export const taskDropdownListV1 = async ( req, res ) => {
779
751
  createdByName: 1,
780
752
  storeCount: 1,
781
753
  scheduleEndTimeISO: 1,
782
- coverage: 1,
783
754
  // submitTime_string: 1,
784
755
  },
785
756
  } );
@@ -995,12 +966,6 @@ export async function taskDetails( req, res ) {
995
966
  return res.sendError( 'clientId is required', 400 );
996
967
  }
997
968
 
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
-
1004
969
  let toDate = new Date( req.body.toDate );
1005
970
  let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
1006
971
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
@@ -1025,34 +990,23 @@ export async function taskDetails( req, res ) {
1025
990
  $match: {
1026
991
  date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
1027
992
  client_id: req.body.clientId,
993
+ store_id: { $in: req.body.storeId },
1028
994
  ...( 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: getUserEmails } } ],
1031
995
  },
1032
996
  },
1033
997
  { $sort: { date_iso: -1 } },
1034
998
  {
1035
999
  $group: {
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 ] } } },
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 ] } } },
1056
1010
  },
1057
1011
  },
1058
1012
  ];
@@ -23,16 +23,6 @@ export const StoreHygienetaskSchema = Joi.object().keys( {
23
23
  referenceImage: Joi.array().required(),
24
24
  count: Joi.number().required(),
25
25
  } );
26
- export const commonAiTaskSchema = Joi.object().keys( {
27
- storeName: Joi.string().required(),
28
- taskName: Joi.string().required(),
29
- question: Joi.string().required(),
30
- answerType: Joi.string().required(),
31
- options: Joi.string().optional(),
32
- scheduleDate: Joi.string().optional(),
33
- scheduleEndTime: Joi.string().optional(),
34
- referenceImage: Joi.array().required(),
35
- } );
36
26
 
37
27
 
38
28
  export const eyeTesttaskSchema = Joi.object().keys( {
@@ -51,9 +41,6 @@ export const aitaskvalidation = {
51
41
  export const StoreHygienetaskvalidation = {
52
42
  body: StoreHygienetaskSchema,
53
43
  };
54
- export const commonAiTaskvalidation = {
55
- body: commonAiTaskSchema,
56
- };
57
44
  export const eyeTesttaskvalidation = {
58
45
  body: eyeTesttaskSchema,
59
46
  };
@@ -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, commonAiTaskvalidation } from '../dtos/task.dto.js';
5
+ import { aitaskvalidation, StoreHygienetaskvalidation, eyeTesttaskvalidation } 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.validateUserv1 )
13
+ .post( '/upload', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.validateUser )
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,14 +28,9 @@ 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 )
33
- // .post( '/assignUpload', isAllowedSessionHandler, taskController.assignTaskUser )
34
31
  .post( '/createaiTask', isAllowedInternalAPIHandler, validate( aitaskvalidation ), taskController.createAiTask )
35
32
  .post( '/StoreHygienetask', isAllowedInternalAPIHandler, validate( StoreHygienetaskvalidation ), taskController.StoreHygienetask )
36
33
  .post( '/eyeTesttask', isAllowedInternalAPIHandler, validate( eyeTesttaskvalidation ), taskController.eyeTesttask )
37
- .post( '/commonAiTask', isAllowedInternalAPIHandler, validate( commonAiTaskvalidation ), taskController.commonAiTask )
38
- .get( '/getcoustemer', taskController.customertrial )
39
- .post( '/updateAssign', isAllowedSessionHandler, taskController.updateAssign );
34
+ .get( '/getcoustemer', taskController.customertrial );
40
35
 
41
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 )
11
12
  .post( '/taskTable', isAllowedSessionHandler, taskTable )
12
13
  .post( '/taskTableV1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskTableV1 )
13
14
  .post( '/taskInfoTable', isAllowedSessionHandler, taskInfoTable )
15
+ .post( '/taskInfoTableV1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskInfoTableV1 )
14
16
  .post( '/taskDropdownList', isAllowedSessionHandler, taskDropdownList )
15
- .post( '/taskDeleteV1', isAllowedSessionHandler, taskDeleteV1 )
16
17
  .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 );
18
+ .post( '/taskDeleteV1', isAllowedSessionHandler, taskDeleteV1 )
19
+ .post( '/taskDetails', isAllowedSessionHandler, taskDetails );
20
20
 
21
21
  export default taskDashboardRouter;
@@ -26,7 +26,6 @@ export async function createclusterModel( data ) {
26
26
  export async function findcluster( query, project ) {
27
27
  return await clusterModel.find( query, project );
28
28
  };
29
-
30
29
  export function countDocumentsClusters( query ) {
31
30
  return clusterModel.countDocuments( query );
32
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 }, { upsert: true } );
16
+ return model.taskAssignModel.updateOne( query, { $set: record } );
17
17
  };
18
18
 
19
19
  export const insertMany = async ( data = [] ) => {
@@ -20,10 +20,6 @@ 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
-
27
23
  export const aggregate = async ( query = {} ) => {
28
24
  return model.userModel.aggregate( query );
29
25
  };
@@ -1,30 +0,0 @@
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
- }