Moved the route under the search route

This commit is contained in:
Mathias Wagner 2022-07-09 19:14:20 +02:00
parent 841cab36da
commit f9cb2cbed1
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -12,14 +12,6 @@ const {
const {isAuthenticatedUser} = require('../middlewares/authenticate');
const {removeAllReleases} = require('../controller/release');
// Gets the addon object by id
app.get("/:addonId", async (req, res) => {
const addon = await getAddonById(req.params.addonId);
if (addon === null) return res.status(404).json({message: "The provided addon does not exist"});
res.json(addon);
});
// Gets a list of all addons by an author
app.get("/:authorName/list", async (req, res) => {
const addons = await listAddonsByAuthorName(req.params.authorName);
@ -44,6 +36,14 @@ app.get("/search", async (req, res) => {
res.json(await searchAddon(req.query.query, req.query.limit || 25));
});
// Gets the addon object by id
app.get("/:addonId", async (req, res) => {
const addon = await getAddonById(req.params.addonId);
if (addon === null) return res.status(404).json({message: "The provided addon does not exist"});
res.json(addon);
});
// Creates a new addon
app.put("/", isAuthenticatedUser, async (req, res) => {
const validation = await validateSchema(create, req.body);