tango-app-api-trax 3.9.70 → 3.9.72
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
|
@@ -1566,17 +1566,18 @@ export async function list( req, res ) {
|
|
|
1566
1566
|
|
|
1567
1567
|
export async function aomupdateCollection( req, res ) {
|
|
1568
1568
|
try {
|
|
1569
|
-
|
|
1569
|
+
const lenskart = JSON.parse( process.env.LENSKART );
|
|
1570
|
+
let url = lenskart.authUrl;
|
|
1570
1571
|
let authOptions = {
|
|
1571
1572
|
method: 'POST',
|
|
1572
1573
|
headers: {
|
|
1573
1574
|
'Content-Type': 'application/json',
|
|
1574
1575
|
'Accept': 'application/json',
|
|
1575
|
-
'X-Lenskart-App-Id':
|
|
1576
|
-
'X-Lenskart-API-Key':
|
|
1577
|
-
'Cookie':
|
|
1576
|
+
'X-Lenskart-App-Id': lenskart.appId,
|
|
1577
|
+
'X-Lenskart-API-Key': lenskart.apiKey,
|
|
1578
|
+
'Cookie': lenskart.authCookie,
|
|
1578
1579
|
},
|
|
1579
|
-
body: JSON.stringify( { isEncodingRequired: true, password:
|
|
1580
|
+
body: JSON.stringify( { isEncodingRequired: true, password: lenskart.password, userName: lenskart.userName } ),
|
|
1580
1581
|
};
|
|
1581
1582
|
const authResponse = await fetch( url, authOptions );
|
|
1582
1583
|
|
|
@@ -1585,16 +1586,16 @@ export async function aomupdateCollection( req, res ) {
|
|
|
1585
1586
|
}
|
|
1586
1587
|
|
|
1587
1588
|
let response = await authResponse.json();
|
|
1588
|
-
url =
|
|
1589
|
+
url = `${lenskart.amMappingUrl}?pageNumber=1&pageSize=100`;
|
|
1589
1590
|
let mappingOptions = {
|
|
1590
1591
|
method: 'GET',
|
|
1591
1592
|
headers: {
|
|
1592
1593
|
'accept': '*/*',
|
|
1593
|
-
'X-Lenskart-API-Key':
|
|
1594
|
-
'X-Lenskart-App-Id':
|
|
1594
|
+
'X-Lenskart-API-Key': lenskart.apiKey,
|
|
1595
|
+
'X-Lenskart-App-Id': lenskart.appId,
|
|
1595
1596
|
'X-Lenskart-Session-Token': `${response.sessionToken}`,
|
|
1596
1597
|
'X-Api-Client': 'tango',
|
|
1597
|
-
'Cookie':
|
|
1598
|
+
'Cookie': lenskart.dataCookie,
|
|
1598
1599
|
},
|
|
1599
1600
|
};
|
|
1600
1601
|
let mappingResponse = await fetch( url, mappingOptions );
|
|
@@ -1602,16 +1603,16 @@ export async function aomupdateCollection( req, res ) {
|
|
|
1602
1603
|
const mappingPages = mappingResponse?.content.pageable.total_pages;
|
|
1603
1604
|
for ( let index = mappingPages; index > 0; index-- ) {
|
|
1604
1605
|
const page = index;
|
|
1605
|
-
url =
|
|
1606
|
+
url = `${lenskart.amMappingUrl}?pageNumber=${page}&pageSize=100`;
|
|
1606
1607
|
const mappingOptions = {
|
|
1607
1608
|
method: 'GET',
|
|
1608
1609
|
headers: {
|
|
1609
1610
|
'accept': '*/*',
|
|
1610
|
-
'X-Lenskart-API-Key':
|
|
1611
|
-
'X-Lenskart-App-Id':
|
|
1611
|
+
'X-Lenskart-API-Key': lenskart.apiKey,
|
|
1612
|
+
'X-Lenskart-App-Id': lenskart.appId,
|
|
1612
1613
|
'X-Lenskart-Session-Token': `${response.sessionToken}`,
|
|
1613
1614
|
'X-Api-Client': 'tango',
|
|
1614
|
-
'Cookie':
|
|
1615
|
+
'Cookie': lenskart.dataCookie,
|
|
1615
1616
|
},
|
|
1616
1617
|
};
|
|
1617
1618
|
let mappingResponse = await fetch( url, mappingOptions );
|
|
@@ -1638,21 +1639,18 @@ export async function aomupdateCollection( req, res ) {
|
|
|
1638
1639
|
|
|
1639
1640
|
export async function saleUpdateCollection( req, res ) {
|
|
1640
1641
|
try {
|
|
1641
|
-
|
|
1642
|
+
const lenskart = JSON.parse( process.env.LENSKART );
|
|
1643
|
+
let url = lenskart.authUrl;
|
|
1642
1644
|
const authOptions = {
|
|
1643
1645
|
method: 'POST',
|
|
1644
1646
|
headers: {
|
|
1645
1647
|
'Content-Type': 'application/json',
|
|
1646
1648
|
'Accept': 'application/json',
|
|
1647
|
-
'X-Lenskart-App-Id':
|
|
1648
|
-
'X-Lenskart-API-Key':
|
|
1649
|
-
'Cookie':
|
|
1649
|
+
'X-Lenskart-App-Id': lenskart.appId,
|
|
1650
|
+
'X-Lenskart-API-Key': lenskart.apiKey,
|
|
1651
|
+
'Cookie': lenskart.authCookie,
|
|
1650
1652
|
},
|
|
1651
|
-
body: JSON.stringify( {
|
|
1652
|
-
isEncodingRequired: true,
|
|
1653
|
-
password: '55eyetango123',
|
|
1654
|
-
userName: 'tango.eye',
|
|
1655
|
-
} ),
|
|
1653
|
+
body: JSON.stringify( { isEncodingRequired: true, password: lenskart.password, userName: lenskart.userName } ),
|
|
1656
1654
|
};
|
|
1657
1655
|
let authResponse = await fetch( url, authOptions );
|
|
1658
1656
|
|
|
@@ -1662,16 +1660,16 @@ export async function saleUpdateCollection( req, res ) {
|
|
|
1662
1660
|
|
|
1663
1661
|
authResponse = await authResponse.json();
|
|
1664
1662
|
|
|
1665
|
-
url
|
|
1663
|
+
url=`${lenskart.salesmanUrl}?pageNumber=1&pageSize=100`;
|
|
1666
1664
|
const salesmanDetailsOptions = {
|
|
1667
1665
|
method: 'GET',
|
|
1668
1666
|
headers: {
|
|
1669
1667
|
'accept': '*/*',
|
|
1670
|
-
'X-Lenskart-API-Key':
|
|
1671
|
-
'X-Lenskart-App-Id':
|
|
1668
|
+
'X-Lenskart-API-Key': lenskart.apiKey,
|
|
1669
|
+
'X-Lenskart-App-Id': lenskart.appId,
|
|
1672
1670
|
'X-Lenskart-Session-Token': `${authResponse.sessionToken}`,
|
|
1673
1671
|
'X-Api-Client': 'tango',
|
|
1674
|
-
'Cookie':
|
|
1672
|
+
'Cookie': lenskart.dataCookie,
|
|
1675
1673
|
},
|
|
1676
1674
|
};
|
|
1677
1675
|
let salesmanDetailsResponse = await fetch( url, salesmanDetailsOptions );
|
|
@@ -1679,16 +1677,16 @@ export async function saleUpdateCollection( req, res ) {
|
|
|
1679
1677
|
const salesmanDetailsPages = salesmanDetailsResponse?.content.pageable.total_pages;
|
|
1680
1678
|
for ( let index = salesmanDetailsPages; index > 0; index-- ) {
|
|
1681
1679
|
const page = index;
|
|
1682
|
-
url=
|
|
1680
|
+
url= `${lenskart.salesmanUrl}?pageNumber=${page}&pageSize=100`;
|
|
1683
1681
|
const mappingOptions = {
|
|
1684
1682
|
method: 'GET',
|
|
1685
1683
|
headers: {
|
|
1686
1684
|
'accept': '*/*',
|
|
1687
|
-
'X-Lenskart-API-Key':
|
|
1688
|
-
'X-Lenskart-App-Id':
|
|
1685
|
+
'X-Lenskart-API-Key': lenskart.apiKey,
|
|
1686
|
+
'X-Lenskart-App-Id': lenskart.appId,
|
|
1689
1687
|
'X-Lenskart-Session-Token': `${authResponse.sessionToken}`,
|
|
1690
1688
|
'X-Api-Client': 'tango',
|
|
1691
|
-
'Cookie':
|
|
1689
|
+
'Cookie': lenskart.dataCookie,
|
|
1692
1690
|
},
|
|
1693
1691
|
};
|
|
1694
1692
|
let salesmanDetailsResponse = await fetch( url, mappingOptions );
|
|
@@ -2434,7 +2432,6 @@ export async function internalSendPushNotification( req, res ) {
|
|
|
2434
2432
|
}
|
|
2435
2433
|
|
|
2436
2434
|
let fcmToken;
|
|
2437
|
-
// fcmToken = 'dwm2tz9WfUq1jdz1H8hfSf:APA91bF9BhTsG9ZDnutQfseGueXk7FZ4RhB8v3G_xJOZhkiZz8vsw3SUWk5su8ZN37lx3-H50eouBKinbwg4zE_br6f483jUswA_44f1XG8k7Sok995f77M';
|
|
2438
2435
|
if ( requestHeader.email && requestHeader.email !='' ) {
|
|
2439
2436
|
fcmToken = await getUserToken( requestHeader.clientid, requestHeader.email );
|
|
2440
2437
|
} else {
|
|
@@ -4115,8 +4112,7 @@ export const downloadInsertPdfOld = async ( req, res ) => {
|
|
|
4115
4112
|
};
|
|
4116
4113
|
|
|
4117
4114
|
|
|
4118
|
-
|
|
4119
|
-
let complianceURL = 'https://pbxdm4nstcpbaz6gf6c53ofeee0zvmfy.lambda-url.ap-south-1.on.aws/';
|
|
4115
|
+
let complianceURL = JSON.parse( process.env.LAMBDAURL ).complianceHistory;
|
|
4120
4116
|
const complianceData = await LamdaServiceCall( complianceURL, detectionPayload );
|
|
4121
4117
|
if ( complianceData?.data.length ) {
|
|
4122
4118
|
doc['historyData'] = complianceData.data;
|
|
@@ -447,7 +447,7 @@ export const flagCardsV1 = async ( req, res ) => {
|
|
|
447
447
|
// These three lookups are independent of one another, so run them concurrently
|
|
448
448
|
// instead of sequentially (Mongo aggregation + config find + detection Lambda).
|
|
449
449
|
const detectionPayload = { fromDate, toDate, storeId, clientId };
|
|
450
|
-
const lambdaURL =
|
|
450
|
+
const lambdaURL = JSON.parse( process.env.LAMBDAURL ).flagTablesV2;
|
|
451
451
|
|
|
452
452
|
const [ getOverallChecklistData, publishedAiChecklists, resultData ] = await Promise.all( [
|
|
453
453
|
processedchecklistService.aggregate( findQuery ),
|
|
@@ -598,7 +598,7 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
|
|
|
598
598
|
return 0;
|
|
599
599
|
}
|
|
600
600
|
|
|
601
|
-
const LamdaURL =
|
|
601
|
+
const LamdaURL = JSON.parse( process.env.LAMBDAURL ).flagTablesV2;
|
|
602
602
|
const resultData = await LamdaServiceCall( LamdaURL, detectionPayload );
|
|
603
603
|
const published = publishedAiChecklists.map( ( val ) => val?.checkListType );
|
|
604
604
|
if ( resultData?.status_code === '200' ) {
|
|
@@ -854,7 +854,7 @@ export const flagTablesV1 = async ( req, res ) => {
|
|
|
854
854
|
'clientId': requestData.clientId,
|
|
855
855
|
};
|
|
856
856
|
|
|
857
|
-
let LamdaURL =
|
|
857
|
+
let LamdaURL = JSON.parse( process.env.LAMBDAURL ).flagTablesV2;
|
|
858
858
|
let resultData = await LamdaServiceCall( LamdaURL, detectionPayload );
|
|
859
859
|
if ( resultData ) {
|
|
860
860
|
if ( resultData.status_code == '200' ) {
|
|
@@ -2005,7 +2005,7 @@ export const flagComparisonCardsV2 = async ( req, res ) => {
|
|
|
2005
2005
|
};
|
|
2006
2006
|
|
|
2007
2007
|
// The config lookup and the detection Lambda are independent — run them together.
|
|
2008
|
-
const LamdaURL =
|
|
2008
|
+
const LamdaURL = JSON.parse( process.env.LAMBDAURL ).flagTablesV2;
|
|
2009
2009
|
const [ publishedAiChecklists, resultData ] = await Promise.all( [
|
|
2010
2010
|
checklistconfigService.find(
|
|
2011
2011
|
{
|
|
@@ -2291,7 +2291,7 @@ export const flagTablesV2 = async ( req, res ) => {
|
|
|
2291
2291
|
'storeId': requestData.storeId,
|
|
2292
2292
|
'clientId': requestData.clientId,
|
|
2293
2293
|
};
|
|
2294
|
-
// const LamdaURL =
|
|
2294
|
+
// const LamdaURL = JSON.parse( process.env.LAMBDAURL ).flagTablesV2;
|
|
2295
2295
|
|
|
2296
2296
|
let LamdaURL = lamdaUrl.flagTablesV2;
|
|
2297
2297
|
|