tango-app-api-trax 3.8.2 → 3.8.4

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.2",
3
+ "version": "3.8.4",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -169,10 +169,12 @@ export const checklistDropdown = async ( req, res ) => {
169
169
 
170
170
  let findQuery = [];
171
171
  let findAndQuery = [];
172
+ let type = req.body?.type == 'aiChecklist' ? { checkListType: { $ne: 'custom' } } : { checkListType: 'custom' };
172
173
  findAndQuery.push(
173
174
  { client_id: requestData.clientId },
174
175
  { date_iso: { $gte: fromDate } },
175
176
  { date_iso: { $lte: toDate } },
177
+ type,
176
178
  // { checkListType: { $eq: 'custom' } },
177
179
  );
178
180
 
@@ -34,6 +34,7 @@ import { getBrowser as getBrowserInstance } from '../utils/browserPool.utils.js'
34
34
  import fs from 'fs';
35
35
  import path from 'path';
36
36
  import { fileURLToPath as toPath } from 'url';
37
+ import * as cameraService from '../services/camera.service.js';
37
38
 
38
39
  const __ctrlDir = path.dirname( toPath( import.meta.url ) );
39
40
  const tangoyeLogoSvg = fs.readFileSync(
@@ -2149,15 +2150,11 @@ export async function AiPushNotificationAlert( req, res ) {
2149
2150
 
2150
2151
  export async function liveAiPushNotificationAlert( req, res ) {
2151
2152
  try {
2152
- // console.log( req.body );
2153
- let findAichecklist = await PCLconfig.findOne( { checkListType: req.body.checkListType, client_id: req.body.clientId, date_string: req.body.Date }, { aiConfig: 1 } );
2154
- if ( findAichecklist?.aiConfig?.alertConfig?.mobile.length ) {
2155
- // console.log( findAichecklist.aiConfig.alerts.users );
2156
- 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 ) {
2157
2156
  let findOneUser = await userService.findOne( { email: user.value }, { fcmToken: 1 } );
2158
- // console.log( findOneUser );
2159
2157
  if ( findOneUser&&findOneUser.fcmToken&&findOneUser.fcmToken!='' ) {
2160
- // console.log( findOneUser.fcmToken );
2161
2158
  try {
2162
2159
  await sendPushNotification( req.body.title, req.body.description, findOneUser.fcmToken );
2163
2160
  } catch ( e ) {
@@ -4193,3 +4190,17 @@ export async function aiChecklistDetails( req, res ) {
4193
4190
  return res.sendError( e, 500 );
4194
4191
  }
4195
4192
  }
4193
+
4194
+ export async function getEyetestStream( req, res ) {
4195
+ try {
4196
+ if ( !req.body.storeId ) {
4197
+ return res.sendError( 'storeId is required', 400 );
4198
+ }
4199
+ let eyeTestStreamDetails = await cameraService.find( { storeId: req.body.storeId, isEyeTestStream: true }, { streamName: 1 } );
4200
+
4201
+ return res.sendSuccess( eyeTestStreamDetails?.map( ( ele ) => ele?.streamName ) );
4202
+ } catch ( e ) {
4203
+ logger.error( { functionName: 'getEyetestStream', error: e } );
4204
+ return res.sendError( e, 500 );
4205
+ }
4206
+ }
@@ -42,6 +42,7 @@ internalTraxRouter
42
42
  .post( '/sendAIEmailList', isAllowedInternalAPIHandler, internalController.sendAIEmailList )
43
43
  .post( '/liveAiPushNotificationAlert', isAllowedInternalAPIHandler, internalController.liveAiPushNotificationAlert )
44
44
  .get( '/aiChecklistDetails', isAllowedInternalAPIHandler, internalController.aiChecklistDetails )
45
+ .get( '/getEyetestStream', isAllowedInternalAPIHandler, internalController.getEyetestStream )
45
46
  ;
46
47
 
47
48
 
@@ -12,3 +12,7 @@ export const findOne = async ( query ={}, field={} ) => {
12
12
  return model.cameraModel.findOne( query, field );
13
13
  };
14
14
 
15
+ export const find = async ( query ={}, field={} ) => {
16
+ return model.cameraModel.find( query, field );
17
+ };
18
+