tango-app-api-trax 3.8.3 → 3.8.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-trax",
3
- "version": "3.8.3",
3
+ "version": "3.8.5",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -122,6 +122,19 @@ export async function storeOpencloselist( req, res ) {
122
122
 
123
123
  export async function getcustomerunattendedlist( req, res ) {
124
124
  try {
125
+ let config = [];
126
+ if ( req.body.ChecklistType == 'storeopenandclose' ) {
127
+ config = await processedchecklistconfigService.find( { date_string: { $gte: req.body.fromDate, $lte: req.body.toDate }, checkListType: req.body.ChecklistType }, { date_string: 1, aiConfig: 1 } );
128
+ req.body.liveDate = [];
129
+ req.body.eodDate = [];
130
+ config.forEach( ( data ) => {
131
+ if ( data?.aiConfig?.advancedConfig?.dataProcessing == 'live' ) {
132
+ req.body.liveDate.push( data.date_string );
133
+ } else {
134
+ req.body.eodDate.push( data.date_string );
135
+ }
136
+ } );
137
+ }
125
138
  let url = JSON.parse( process.env.LAMBDAURL );
126
139
  let resultData = await LamdaServiceCall( url.customerUnattended, req.body );
127
140
  if ( resultData ) {
@@ -169,10 +182,12 @@ export const checklistDropdown = async ( req, res ) => {
169
182
 
170
183
  let findQuery = [];
171
184
  let findAndQuery = [];
185
+ let type = req.body?.type == 'aiChecklist' ? { checkListType: { $ne: 'custom' } } : { checkListType: 'custom' };
172
186
  findAndQuery.push(
173
187
  { client_id: requestData.clientId },
174
188
  { date_iso: { $gte: fromDate } },
175
189
  { date_iso: { $lte: toDate } },
190
+ type,
176
191
  // { checkListType: { $eq: 'custom' } },
177
192
  );
178
193
 
@@ -2150,15 +2150,11 @@ export async function AiPushNotificationAlert( req, res ) {
2150
2150
 
2151
2151
  export async function liveAiPushNotificationAlert( req, res ) {
2152
2152
  try {
2153
- // console.log( req.body );
2154
- let findAichecklist = await PCLconfig.findOne( { checkListType: req.body.checkListType, client_id: req.body.clientId, date_string: req.body.Date }, { aiConfig: 1 } );
2155
- if ( findAichecklist?.aiConfig?.alertConfig?.mobile.length ) {
2156
- // console.log( findAichecklist.aiConfig.alerts.users );
2157
- for ( let user of findAichecklist?.aiConfig?.alertConfig?.mobile ) {
2153
+ let findAichecklist = await CLconfig.findOne( { checkListType: req.body.checkListType, client_id: req.body.client_id }, { aiConfig: 1 } );
2154
+ if ( findAichecklist?.aiConfig?.alertConfig?.alertSendTo?.mobile.length ) {
2155
+ for ( let user of findAichecklist?.aiConfig?.alertConfig?.alertSendTo?.mobile ) {
2158
2156
  let findOneUser = await userService.findOne( { email: user.value }, { fcmToken: 1 } );
2159
- // console.log( findOneUser );
2160
2157
  if ( findOneUser&&findOneUser.fcmToken&&findOneUser.fcmToken!='' ) {
2161
- // console.log( findOneUser.fcmToken );
2162
2158
  try {
2163
2159
  await sendPushNotification( req.body.title, req.body.description, findOneUser.fcmToken );
2164
2160
  } catch ( e ) {
@@ -574,7 +574,7 @@ export const userlist = async ( req, res ) => {
574
574
  let query = {
575
575
  clientId: req.query.clientId,
576
576
  isActive: true,
577
- role: { $ne: 'user' },
577
+ // role: { $ne: 'user' },
578
578
  };
579
579
 
580
580
  let userDetails = await userService.find( query );