tango-app-api-task 3.7.16 → 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
|
@@ -1704,7 +1704,7 @@ async function createUser( data ) {
|
|
|
1704
1704
|
],
|
|
1705
1705
|
},
|
|
1706
1706
|
{
|
|
1707
|
-
|
|
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
|
-
|
|
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
|
|
5019
|
-
if (
|
|
5020
|
-
|
|
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}
|
|
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
|
|
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:
|
|
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,10 +5112,12 @@ 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;
|
|
5086
5119
|
data['approver'] = userAdmin;
|
|
5120
|
+
data['rawImageUpload'] = inputBody.rawImageUpload;
|
|
5087
5121
|
|
|
5088
5122
|
let response = await taskService.create( data );
|
|
5089
5123
|
if ( response?.approver.length ) {
|
|
@@ -5186,8 +5220,8 @@ export async function taskcreation( req, res ) {
|
|
|
5186
5220
|
let userDetails = {
|
|
5187
5221
|
userName: inputBody.userName,
|
|
5188
5222
|
userEmail: inputBody.userEmail,
|
|
5189
|
-
store_id: storeDetails
|
|
5190
|
-
storeName: storeDetails
|
|
5223
|
+
store_id: storeDetails?.storeId,
|
|
5224
|
+
storeName: storeDetails?.storeName,
|
|
5191
5225
|
city: storeDetails?.storeProfile?.city,
|
|
5192
5226
|
checkFlag: true,
|
|
5193
5227
|
checkListId: response?._id,
|
|
@@ -5197,6 +5231,7 @@ export async function taskcreation( req, res ) {
|
|
|
5197
5231
|
assignId: storeDetails?._id,
|
|
5198
5232
|
country: storeDetails?.storeProfile?.country,
|
|
5199
5233
|
state: storeDetails?.storeProfile?.state,
|
|
5234
|
+
coverage: inputBody.coverage,
|
|
5200
5235
|
};
|
|
5201
5236
|
await taskAssignService.create( userDetails );
|
|
5202
5237
|
await insertSingleProcessData( response?._id );
|
package/src/dtos/task.dto.js
CHANGED
|
@@ -55,14 +55,16 @@ 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().
|
|
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(),
|
|
62
62
|
scheduleDate: Joi.string().optional(),
|
|
63
|
+
rawImageUpload: Joi.boolean().optional(),
|
|
63
64
|
scheduleEndTime: Joi.string().optional(),
|
|
64
65
|
approver: Joi.string().required(),
|
|
65
66
|
creator: Joi.string().required(),
|
|
67
|
+
coverage: Joi.string().optional(),
|
|
66
68
|
} );
|
|
67
69
|
|
|
68
70
|
export const commonAiTaskvalidation = {
|