tango-app-api-task 3.3.1-beta-3 → 3.3.1-beta-5

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.3.1-beta-3",
3
+ "version": "3.3.1-beta-5",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -24,6 +24,7 @@ import * as taskProcessedService from '../service/processedTaskList.service.js';
24
24
  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
+ import * as checklistService from '../service/checklist.service.js';
27
28
  async function LamdaServiceCall( url, data ) {
28
29
  try {
29
30
  const requestOptions = {
@@ -1185,7 +1186,7 @@ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date,
1185
1186
  if ( teamsList.length ) {
1186
1187
  let teamDetails = await teamsServices.findteams( { _id: { $in: teamsList } } );
1187
1188
  if ( teamDetails.length ) {
1188
- let idList = teamDetails.flatMap( ( item ) => item.users.map( ( ele ) => ele.userId ) );
1189
+ let idList = [ ...teamDetails.flatMap( ( item ) => item.users.map( ( ele ) => ele.userId ) ), ...teamDetails.flatMap( ( item ) => item.Teamlead.map( ( ele ) => ele.userId ) ) ];
1189
1190
  let userIdList = allQuestion.filter( ( qn ) => !qn?.teamName ).map( ( qn ) => qn.assignId.toString() );
1190
1191
  idList = idList.filter( ( id ) => !userIdList.includes( id.toString() ) );
1191
1192
  let getUserDetails = await userService.find( { _id: { $in: idList } } );
@@ -1564,6 +1565,7 @@ export async function createChecklistTask( req, res ) {
1564
1565
 
1565
1566
  let time = inputBody?.scheduleEndTime || '11:59 PM';
1566
1567
  let date = inputBody?.scheduleDate || dayjs().format( 'YYYY-MM-DD' );
1568
+ let checklistDetails = await checklistService.findOne( { _id: inputBody?.checkListId }, { coverage: 1 } );
1567
1569
  let data = {
1568
1570
  checkListName: inputBody.checkListName,
1569
1571
  checkListDescription: inputBody.checkListDescription,
@@ -1581,6 +1583,7 @@ export async function createChecklistTask( req, res ) {
1581
1583
  publishDate: new Date(),
1582
1584
  locationCount: 1,
1583
1585
  ...( inputBody?.checkListId ) ? { referenceCheckListId: inputBody?.checkListId } : {},
1586
+ coverage: checklistDetails?.coverage || 'store',
1584
1587
  };
1585
1588
 
1586
1589
  if ( req.user.userType == 'tango' || ( req.user.userType == 'client' && [ 'user' ].includes( req.user.role ) ) ) {
@@ -0,0 +1,5 @@
1
+ import model from 'tango-api-schema';
2
+
3
+ export const findOne = async ( query={}, field={} ) => {
4
+ return model.checklistconfigModel.findOne( query, field );
5
+ };