tango-app-api-task 3.7.17 → 3.7.18

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.7.17",
3
+ "version": "3.7.18",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1704,7 +1704,7 @@ async function createUser( data ) {
1704
1704
  ],
1705
1705
  },
1706
1706
  {
1707
- featurName: 'TangoEye',
1707
+ featureName: 'TangoEye',
1708
1708
  modules: [
1709
1709
  {
1710
1710
  name: 'ZoneTag',
@@ -1715,7 +1715,7 @@ async function createUser( data ) {
1715
1715
  ],
1716
1716
  },
1717
1717
  {
1718
- featurName: 'TangoTrax',
1718
+ featureName: 'TangoTrax',
1719
1719
  modules: [
1720
1720
  {
1721
1721
  name: 'checklist',
@@ -1731,6 +1731,29 @@ async function createUser( data ) {
1731
1731
  },
1732
1732
  ],
1733
1733
  },
1734
+ {
1735
+ featureName: 'FootfallDirectory',
1736
+ modules: [
1737
+ {
1738
+ name: 'creator',
1739
+ isAdd: true,
1740
+ isEdit: true,
1741
+
1742
+ },
1743
+ {
1744
+ name: 'reviewer',
1745
+ isAdd: false,
1746
+ isEdit: false,
1747
+
1748
+ },
1749
+ {
1750
+ name: 'approver',
1751
+ isAdd: false,
1752
+ isEdit: false,
1753
+
1754
+ },
1755
+ ],
1756
+ },
1734
1757
  ],
1735
1758
  };
1736
1759
  let response = await userService.create( params );
@@ -5015,9 +5038,12 @@ export async function taskcreation( req, res ) {
5015
5038
  inputBody.clientId = 458;
5016
5039
  inputBody.taskDescription = '';
5017
5040
  let userId;
5018
- let storeDetails = await storeService.findOne( { storeName: inputBody.storeName, clientId: inputBody.clientId, status: 'active' }, { storeId: 1, storeName: 1, storeProfile: 1 } );
5019
- if ( !storeDetails ) {
5020
- return res.sendError( 'Store Not Found', 500 );
5041
+ let storeDetails;
5042
+ if ( inputBody?.coverage == 'store' ) {
5043
+ storeDetails = await storeService.findOne( { storeName: inputBody.storeName, clientId: inputBody.clientId, status: 'active' }, { storeId: 1, storeName: 1, storeProfile: 1 } );
5044
+ if ( !storeDetails ) {
5045
+ return res.sendError( 'Store Not Found', 500 );
5046
+ }
5021
5047
  }
5022
5048
 
5023
5049
 
@@ -5033,10 +5059,10 @@ export async function taskcreation( req, res ) {
5033
5059
  inputBody.userEmail = finduser.email;
5034
5060
 
5035
5061
 
5036
- let title = `New Task Alert ${inputBody.taskName}-${storeDetails.storeName}-${dayjs().format( 'YYYY-MM-DD' )}`;
5062
+ let title = `New Task Alert ${inputBody.taskName}-`+storeDetails?.storeName ? storeDetails?.storeName : ``+`-${dayjs().format( 'YYYY-MM-DD' )}`;
5037
5063
  let time = inputBody?.scheduleEndTime || '11:59 PM';
5038
5064
  let date = inputBody?.scheduleDate || dayjs().format( 'YYYY-MM-DD' );
5039
- let description = `A new task has been assigned to ${storeDetails.storeName}. Please complete it before the due date of ${date}.`;
5065
+ let description = `A new task has been assigned to`+storeDetails?.storeName ? storeDetails?.storeName : `you` +`. Please complete it before the due date of ${date}.`;
5040
5066
  if ( userDetails && userDetails.fcmToken ) {
5041
5067
  const fcmToken = userDetails.fcmToken;
5042
5068
  await sendPushNotification( title, description, fcmToken );
@@ -5063,13 +5089,19 @@ export async function taskcreation( req, res ) {
5063
5089
  if ( req.body && req.body.referenceImage && req.body.referenceImage.length > 3 ) {
5064
5090
  return res.sendError( 'Maximum 3 referenceImage only allowed', 500 );
5065
5091
  }
5092
+ let taskName;
5093
+ if ( inputBody.coverage == 'store' ) {
5094
+ taskName = `${inputBody.taskName}(${storeDetails.storeName}-${dayjs().format( 'YYYY-MM-DD' )})`;
5095
+ } else {
5096
+ taskName = `${inputBody.taskName}(-${dayjs().format( 'YYYY-MM-DD' )})`;
5097
+ }
5066
5098
  let data = {
5067
- checkListName: `${inputBody.taskName}(${storeDetails.storeName}-${dayjs().format( 'YYYY-MM-DD' )})`,
5099
+ checkListName: taskName,
5068
5100
  checkListDescription: inputBody.taskDescription,
5069
5101
  createdBy: creator[0]._id,
5070
5102
  createdByName: creator[0].userName,
5071
5103
  publish: true,
5072
- questionCount: 1,
5104
+ questionCount: inputBody?.questions?.length || 1,
5073
5105
  storeCount: 1,
5074
5106
  scheduleDate: date,
5075
5107
  scheduleEndTime: time,
@@ -5080,6 +5112,7 @@ export async function taskcreation( req, res ) {
5080
5112
  publishDate: new Date(),
5081
5113
  locationCount: 1,
5082
5114
  ...( inputBody?.checkListId ) ? { referenceCheckListId: inputBody?.checkListId } : {},
5115
+ coverage: inputBody.coverage,
5083
5116
  };
5084
5117
  let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
5085
5118
  data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
@@ -5187,8 +5220,8 @@ export async function taskcreation( req, res ) {
5187
5220
  let userDetails = {
5188
5221
  userName: inputBody.userName,
5189
5222
  userEmail: inputBody.userEmail,
5190
- store_id: storeDetails.storeId,
5191
- storeName: storeDetails.storeName,
5223
+ store_id: storeDetails?.storeId,
5224
+ storeName: storeDetails?.storeName,
5192
5225
  city: storeDetails?.storeProfile?.city,
5193
5226
  checkFlag: true,
5194
5227
  checkListId: response?._id,
@@ -5198,6 +5231,7 @@ export async function taskcreation( req, res ) {
5198
5231
  assignId: storeDetails?._id,
5199
5232
  country: storeDetails?.storeProfile?.country,
5200
5233
  state: storeDetails?.storeProfile?.state,
5234
+ coverage: inputBody.coverage,
5201
5235
  };
5202
5236
  await taskAssignService.create( userDetails );
5203
5237
  await insertSingleProcessData( response?._id );
@@ -55,7 +55,7 @@ const gettaskSchema = Joi.object( {
55
55
  sourceCheckList_id: Joi.string().required(),
56
56
  } );
57
57
  export const taskcreationSchema = Joi.object().keys( {
58
- storeName: Joi.string().required(),
58
+ storeName: Joi.string().optional().allow( '' ),
59
59
  taskName: Joi.string().required(),
60
60
  user: Joi.string().required(),
61
61
  questions: Joi.array().items( questionSchema ).required(),
@@ -64,6 +64,7 @@ export const taskcreationSchema = Joi.object().keys( {
64
64
  scheduleEndTime: Joi.string().optional(),
65
65
  approver: Joi.string().required(),
66
66
  creator: Joi.string().required(),
67
+ coverage: Joi.string().optional(),
67
68
  } );
68
69
 
69
70
  export const commonAiTaskvalidation = {