const AppVersion = require("../Model/AppVersion"); const AsyncHandler = require("../Middleware/async"); const ErrorResponse = require("../utils/errorResponse"); const sequelize = require("sequelize"); const { Json } = require("sequelize/lib/utils"); exports.getAppVersion = AsyncHandler(async (req, res, next) => { try { const appVersions = await AppVersion.findOne({ where: { app_name: "POS", // temporary change to MBN status: 1, } }); if (appVersions) // throw 'Testing Error ' res.status(200).send(JSON.stringify(appVersions)); else return next(new ErrorResponse('No app version of Wholesaler are found', 404)); } catch (e) { console.log("EE", e) // return next(new ErrorResponse(e)) res.status(500).send(JSON.stringify(e)) } });