tango-app-api-task 3.7.18 → 3.7.20
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
|
+
featurName: '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
|
+
featurName: 'TangoTrax',
|
|
1719
1719
|
modules: [
|
|
1720
1720
|
{
|
|
1721
1721
|
name: 'checklist',
|
|
@@ -1731,29 +1731,6 @@ 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
|
-
},
|
|
1757
1734
|
],
|
|
1758
1735
|
};
|
|
1759
1736
|
let response = await userService.create( params );
|
|
@@ -5038,12 +5015,9 @@ export async function taskcreation( req, res ) {
|
|
|
5038
5015
|
inputBody.clientId = 458;
|
|
5039
5016
|
inputBody.taskDescription = '';
|
|
5040
5017
|
let userId;
|
|
5041
|
-
let storeDetails;
|
|
5042
|
-
if (
|
|
5043
|
-
|
|
5044
|
-
if ( !storeDetails ) {
|
|
5045
|
-
return res.sendError( 'Store Not Found', 500 );
|
|
5046
|
-
}
|
|
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 );
|
|
5047
5021
|
}
|
|
5048
5022
|
|
|
5049
5023
|
|
|
@@ -5059,10 +5033,10 @@ export async function taskcreation( req, res ) {
|
|
|
5059
5033
|
inputBody.userEmail = finduser.email;
|
|
5060
5034
|
|
|
5061
5035
|
|
|
5062
|
-
let title = `New Task Alert ${inputBody.taskName}
|
|
5036
|
+
let title = `New Task Alert ${inputBody.taskName}-${storeDetails.storeName}-${dayjs().format( 'YYYY-MM-DD' )}`;
|
|
5063
5037
|
let time = inputBody?.scheduleEndTime || '11:59 PM';
|
|
5064
5038
|
let date = inputBody?.scheduleDate || dayjs().format( 'YYYY-MM-DD' );
|
|
5065
|
-
let description = `A new task has been assigned to
|
|
5039
|
+
let description = `A new task has been assigned to ${storeDetails.storeName}. Please complete it before the due date of ${date}.`;
|
|
5066
5040
|
if ( userDetails && userDetails.fcmToken ) {
|
|
5067
5041
|
const fcmToken = userDetails.fcmToken;
|
|
5068
5042
|
await sendPushNotification( title, description, fcmToken );
|
|
@@ -5089,19 +5063,13 @@ export async function taskcreation( req, res ) {
|
|
|
5089
5063
|
if ( req.body && req.body.referenceImage && req.body.referenceImage.length > 3 ) {
|
|
5090
5064
|
return res.sendError( 'Maximum 3 referenceImage only allowed', 500 );
|
|
5091
5065
|
}
|
|
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
|
-
}
|
|
5098
5066
|
let data = {
|
|
5099
|
-
checkListName: taskName
|
|
5067
|
+
checkListName: `${inputBody.taskName}(${storeDetails.storeName}-${dayjs().format( 'YYYY-MM-DD' )})`,
|
|
5100
5068
|
checkListDescription: inputBody.taskDescription,
|
|
5101
5069
|
createdBy: creator[0]._id,
|
|
5102
5070
|
createdByName: creator[0].userName,
|
|
5103
5071
|
publish: true,
|
|
5104
|
-
questionCount:
|
|
5072
|
+
questionCount: 1,
|
|
5105
5073
|
storeCount: 1,
|
|
5106
5074
|
scheduleDate: date,
|
|
5107
5075
|
scheduleEndTime: time,
|
|
@@ -5112,7 +5080,6 @@ export async function taskcreation( req, res ) {
|
|
|
5112
5080
|
publishDate: new Date(),
|
|
5113
5081
|
locationCount: 1,
|
|
5114
5082
|
...( inputBody?.checkListId ) ? { referenceCheckListId: inputBody?.checkListId } : {},
|
|
5115
|
-
coverage: inputBody.coverage,
|
|
5116
5083
|
};
|
|
5117
5084
|
let clientDetails = await clientService.findOne( { clientId: inputBody?.clientId }, { traxVideoUploadTimeLimit: 1 } );
|
|
5118
5085
|
data['videoUploadTimeLimit'] = clientDetails?.traxVideoUploadTimeLimit || 0;
|
|
@@ -5220,8 +5187,8 @@ export async function taskcreation( req, res ) {
|
|
|
5220
5187
|
let userDetails = {
|
|
5221
5188
|
userName: inputBody.userName,
|
|
5222
5189
|
userEmail: inputBody.userEmail,
|
|
5223
|
-
store_id: storeDetails
|
|
5224
|
-
storeName: storeDetails
|
|
5190
|
+
store_id: storeDetails.storeId,
|
|
5191
|
+
storeName: storeDetails.storeName,
|
|
5225
5192
|
city: storeDetails?.storeProfile?.city,
|
|
5226
5193
|
checkFlag: true,
|
|
5227
5194
|
checkListId: response?._id,
|
|
@@ -5231,7 +5198,6 @@ export async function taskcreation( req, res ) {
|
|
|
5231
5198
|
assignId: storeDetails?._id,
|
|
5232
5199
|
country: storeDetails?.storeProfile?.country,
|
|
5233
5200
|
state: storeDetails?.storeProfile?.state,
|
|
5234
|
-
coverage: inputBody.coverage,
|
|
5235
5201
|
};
|
|
5236
5202
|
await taskAssignService.create( userDetails );
|
|
5237
5203
|
await insertSingleProcessData( response?._id );
|
|
@@ -5549,8 +5515,9 @@ export async function userMigrations( req, res ) {
|
|
|
5549
5515
|
export async function StoreHygienetask( req, res ) {
|
|
5550
5516
|
try {
|
|
5551
5517
|
let inputBody = req.body;
|
|
5552
|
-
|
|
5553
|
-
|
|
5518
|
+
if ( !inputBody?.clientId ) {
|
|
5519
|
+
inputBody.clientId = 11;
|
|
5520
|
+
}
|
|
5554
5521
|
inputBody.taskDescription = '';
|
|
5555
5522
|
let userId;
|
|
5556
5523
|
let storeDetails = await storeService.findOne( { storeName: inputBody.storeName, clientId: inputBody.clientId, status: 'active' }, { storeId: 1, storeName: 1, storeProfile: 1 } );
|
package/src/dtos/task.dto.js
CHANGED
|
@@ -22,6 +22,7 @@ export const StoreHygienetaskSchema = Joi.object().keys( {
|
|
|
22
22
|
scheduleEndTime: Joi.string().optional(),
|
|
23
23
|
referenceImage: Joi.array().required(),
|
|
24
24
|
zoneName: Joi.string().required(),
|
|
25
|
+
clientId: Joi.string().optional(),
|
|
25
26
|
} );
|
|
26
27
|
|
|
27
28
|
|
|
@@ -55,7 +56,7 @@ const gettaskSchema = Joi.object( {
|
|
|
55
56
|
sourceCheckList_id: Joi.string().required(),
|
|
56
57
|
} );
|
|
57
58
|
export const taskcreationSchema = Joi.object().keys( {
|
|
58
|
-
storeName: Joi.string().
|
|
59
|
+
storeName: Joi.string().required(),
|
|
59
60
|
taskName: Joi.string().required(),
|
|
60
61
|
user: Joi.string().required(),
|
|
61
62
|
questions: Joi.array().items( questionSchema ).required(),
|
|
@@ -64,7 +65,6 @@ export const taskcreationSchema = Joi.object().keys( {
|
|
|
64
65
|
scheduleEndTime: Joi.string().optional(),
|
|
65
66
|
approver: Joi.string().required(),
|
|
66
67
|
creator: Joi.string().required(),
|
|
67
|
-
coverage: Joi.string().optional(),
|
|
68
68
|
} );
|
|
69
69
|
|
|
70
70
|
export const commonAiTaskvalidation = {
|