mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
backend: populated routes
This commit is contained in:
parent
723ab51eef
commit
6ffdca22d7
5 changed files with 25 additions and 9 deletions
|
@ -1,11 +1,11 @@
|
|||
const { User, Route } = require('../../models');
|
||||
const { Route } = require('../../models');
|
||||
|
||||
module.exports = async (req, res) => {
|
||||
const { query: { id, token, name } } = req;
|
||||
const { query: { name } } = req;
|
||||
|
||||
if (!name) return res.send({ success: false, mode: 'not_found_1' });
|
||||
|
||||
const exists = await Route.findOne({ _id: name }).populate('owner');
|
||||
const exists = await Route.findOne({ _id: name }).populate('owner', '_id');
|
||||
|
||||
if (!exists) return res.send({ success: false, mode: 'not_found_2' });
|
||||
const data = exists.toObject();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue