Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename the path getCurrencyByName api for public #288

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 28 additions & 29 deletions app/controllers/api/v1/currencies.ts
Original file line number Diff line number Diff line change
@@ -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 = [];
Expand Down Expand Up @@ -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 = [];
Expand Down
Loading