tango-app-api-trax 3.6.0-inditech-1 → 3.6.0-inditech-2

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.6.0-inditech-1",
3
+ "version": "3.6.0-inditech-2",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "mongodb": "^6.8.0",
27
27
  "nodemon": "^3.1.4",
28
28
  "path": "^0.12.7",
29
- "tango-api-schema": "^2.2.120",
29
+ "tango-api-schema": "^2.2.142",
30
30
  "tango-app-api-middleware": "^3.1.77",
31
31
  "url": "^0.11.4",
32
32
  "winston": "^3.13.1",
@@ -3672,6 +3672,40 @@ export async function checkVersion( req, res ) {
3672
3672
  // if ( minor1 < minor2 ) resultData.showPopup = true;
3673
3673
  // if ( patch1 < patch2 ) resultData.showPopup = true;
3674
3674
  return res.sendSuccess( resultData );
3675
+ } catch ( e ) {
3676
+ console.log( 'e', e );
3677
+ logger.error( 'checkVersion', e );
3678
+ return res.sendError( e, 500 );
3679
+ }
3680
+ }
3681
+
3682
+ export async function checkVersionV1( req, res ) {
3683
+ try {
3684
+ const appVersionNo = req.body.versionNo;
3685
+ if ( req.body.clientId ) {
3686
+ let getDBVersion;
3687
+ getDBVersion = await appService.findOne( { appName: req.body.type, clientId: req.body.clientId } );
3688
+ if ( !getDBVersion ) {
3689
+ getDBVersion = await appService.findOne( { appName: req.body.type } );
3690
+ }
3691
+ let dbVersion = getDBVersion;
3692
+ let resultData = {
3693
+ showPopup: false,
3694
+ forceUpdate: dbVersion.forceUpdate,
3695
+ appVersion: dbVersion.appVersion,
3696
+ appVersionNo: dbVersion.appVersionNo,
3697
+ appName: dbVersion.appName,
3698
+ clientId: dbVersion.clientId || '',
3699
+ };
3700
+ if ( dbVersion ) {
3701
+ if ( parseInt( dbVersion.appVersionNo ) > parseInt( appVersionNo ) ) {
3702
+ resultData.showPopup = true;
3703
+ }
3704
+ }
3705
+ return res.sendSuccess( resultData );
3706
+ } else {
3707
+ return res.sendError( 'clientId is Required', 400 );
3708
+ }
3675
3709
  } catch ( e ) {
3676
3710
  logger.error( 'checkVersion', e );
3677
3711
  return res.sendError( e, 500 );
@@ -26,6 +26,7 @@ mobileRouter
26
26
  .post( '/verifylocation', isAllowedSessionHandler, mobileController.getStoreLocation, mobileController.location )
27
27
  .post( '/login', mobileController.login )
28
28
  .post( '/checkUpdateVersion', mobileController.checkVersion )
29
+ .post( '/checkUpdateVersionv1', mobileController.checkVersionV1 )
29
30
  .post( '/checkClientConfig', isAllowedSessionHandler, mobileController.clientConfig )
30
31
  .post( '/updatePlanoStatus', isAllowedSessionHandler, mobileController.updatePlanoStatus );
31
32