From d0b1363bd46675943be6f618d789c447e55b10e3 Mon Sep 17 00:00:00 2001 From: Zikriya Date: Tue, 22 Aug 2023 13:51:59 +0500 Subject: [PATCH] rename the path getCurrencyByName api for public --- app/controllers/api/v1/currencies.ts | 57 ++++++++++++++-------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/app/controllers/api/v1/currencies.ts b/app/controllers/api/v1/currencies.ts index 86e384fd..042a39db 100644 --- a/app/controllers/api/v1/currencies.ts +++ b/app/controllers/api/v1/currencies.ts @@ -1,6 +1,34 @@ var mongoose = require("mongoose"); module.exports = function (router: any) { + router.get("/:name", async (req: any, res: any) => { + let filter = {}; + filter = { name: req.params.name.toUpperCase() }; + + let currency = await db.Currencies.findOne(filter) + .populate({ + path: "currencyAddressesByNetwork", + populate: { + path: "network", + model: "networks", + }, + }) + .populate({ + path: "currencyAddressesByNetwork", + populate: { + path: "networkDex", + populate: { + path: "dex", + model: "decentralizedExchanges", + }, + }, + }); + + return res.http200({ + currency: currency, + }); + }); + router.get("/cabn/list", async (req: any, res: any) => { var matchFilter: any = {}; var filterOrList = []; @@ -125,35 +153,6 @@ module.exports = function (router: any) { }); }); - router.get('/cabn/:name', async (req: any, res: any) => { - let filter = {} - filter = { name: req.params.name.toUpperCase() } - - let currencyAddressesByNetwork = [] - let currency = await db.Currencies.findOne(filter) - .populate({ - path: 'currencyAddressesByNetwork', - populate: { - path: 'network', - model: 'networks' - } - }) - .populate({ - path: 'currencyAddressesByNetwork', - populate: { - path: 'networkDex', - populate: { - path: 'dex', - model: 'decentralizedExchanges' - } - } - }) - - return res.http200({ - currency: currency - }); - }); - router.get("/cabn/for/fee/token/list", async (req: any, res: any) => { var matchFilter: any = {}; var filterOrList: any = [];