tango-app-api-trax 3.3.1-hotfix-22 → 3.3.1-hotfix-23

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.3.1-hotfix-22",
3
+ "version": "3.3.1-hotfix-23",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -242,12 +242,14 @@ export const downloadInsertAI = async ( req, res ) => {
242
242
  console.log( insertData );
243
243
 
244
244
  let resultData = await downloadService.insert( insertData );
245
+ console.log( resultData );
245
246
  if ( resultData ) {
246
247
  let sqsMessageRequestData = {
247
248
  'zipId': resultData._id,
248
249
  'fileType': fileType || 'zip',
249
250
  'storeId': requestData.storeIds || [],
250
251
  };
252
+ console.log( sqsMessageRequestData );
251
253
  if ( fileType === 'csv' || fileType === 'pdf' || fileType === 'csvzip' || fileType === 'pdfzip' || fileType === 'zipfiles' ) {
252
254
  const msg = await sendMessageToQueue( `${JSON.parse( process.env.SQS ).url}${JSON.parse( process.env.SQS ).AIchecklistExport}`, JSON.stringify( sqsMessageRequestData ) );
253
255
  console.log( 'Send SQS Message CSV/PDF=>', msg );
@@ -578,6 +580,36 @@ export const getChecklistFromZipId = async ( req, res ) => {
578
580
  return res.sendError( error, 500 );
579
581
  }
580
582
  };
583
+ export const getAiChecklistDataFromZipId = async ( req, res ) => {
584
+ try {
585
+ let reqquery = req.query;
586
+ let getzipdata = await downloadService.findOne( { _id: new mongoose.Types.ObjectId( reqquery.zipId ) } );
587
+ let brandInfo = {
588
+ clientName: '',
589
+ brandLogo: '',
590
+ checkListDescription: '',
591
+ };
592
+ if ( getzipdata ) {
593
+ let getClientData = await clientService.findOne( { clientId: getzipdata.client_id } );
594
+ if ( getClientData ) {
595
+ brandInfo.clientName = getClientData.clientName;
596
+ brandInfo.brandLogo = getzipdata.client_id + '/logo/' + getClientData.profileDetails.logo;
597
+ }
598
+
599
+ getzipdata.brandInfo = brandInfo;
600
+ console.log( getzipdata );
601
+
602
+
603
+ return res.sendSuccess( getzipdata );
604
+ } else {
605
+ return res.sendError( { error: 'No Data Found' }, 204 );
606
+ }
607
+ } catch ( error ) {
608
+ console.log( 'error =>', error );
609
+ logger.error( { error: error, function: 'getChecklistFromZipId' } );
610
+ return res.sendError( error, 500 );
611
+ }
612
+ };
581
613
 
582
614
  export const getPDFCSVChecklistDetails = async ( req, res ) => {
583
615
  try {
@@ -12,6 +12,7 @@ import {
12
12
  getPDFCSVChecklistDetails,
13
13
  cancelDownload,
14
14
  downloadInsertAI,
15
+ getAiChecklistDataFromZipId,
15
16
  } from '../controllers/download.controller.js';
16
17
 
17
18
  downloadRouter
@@ -20,6 +21,7 @@ downloadRouter
20
21
  .post( '/downloadList', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [] } ] } ), validate( downloadValidationDtos.validateDownloadListParams ), downloadList )
21
22
  .post( '/downloadUpdate', downloadUpdate ) // isAllowedInternalAPIHandler,
22
23
  .get( '/getChecklistFromZipId', getChecklistFromZipId ) // isAllowedInternalAPIHandler,
24
+ .get( '/getAiChecklistDataFromZipId', getAiChecklistDataFromZipId ) // isAllowedInternalAPIHandler,
23
25
  .post( '/getChecklistDetails', getPDFCSVChecklistDetails )
24
26
  .put( '/cancelDownload/:id', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [] } ] } ), cancelDownload );
25
27