diff --git a/api/ani/v1/routes/series/add.js b/api/ani/v1/routes/series/add.js index b9d0782..72727c0 100644 --- a/api/ani/v1/routes/series/add.js +++ b/api/ani/v1/routes/series/add.js @@ -110,9 +110,10 @@ module.exports = (app, router) => { if (req.params.id.toLowerCase() === 'queue') {return next();} return res.status(400).send("A series with that ID doesn't exist!"); } - let {name, id, romaji, kanji, air, rating, likes, seasons, characters, altNames, genres, tags, nsfw, nsfwReason, synopsis, numericalId, completed, publishers, studios} = series; + let {name, id, romaji, kanji, air, rating, likes, seasons, characters, altNames, genres, tags, nsfw, nsfwReason, numericalId, completed, publishers, studios} = series; return res.json({ - name, id, romaji, kanji, air, rating, likes, seasons, characters, altNames, genres, tags, nsfw, nsfwReason, synopsis, numericalId, completed, publishers, studios, + name, id, romaji, kanji, air, rating, likes, seasons, characters, altNames, genres, tags, nsfw, nsfwReason, numericalId, completed, publishers, studios, + synopsis: {by: series.synopsis.by, synopsis: series.synopsis.synopsis}, meta: {completed: series.meta.completed, creator: series.meta.creator, locked: series.meta.locked} }); }); diff --git a/api/ani/v1/routes/user.js b/api/ani/v1/routes/user.js index 8ed01ab..2796131 100644 --- a/api/ani/v1/routes/user.js +++ b/api/ani/v1/routes/user.js @@ -49,10 +49,7 @@ module.exports = (app, router) => { .catch(e => {console.error("Error trying to add new user", e); res.status(500).send("Something went wrong.");}); } catch (e) {console.error("Error trying to add new user", e); res.status(500).send("Something went wrong.");} - }) - .put(app.auth.token, async (req, res) => { - - }); + }); //TODO user editing router.route('/user/:id/auth') .post(async (req, res) => { diff --git a/api/index.js b/api/index.js index bf5f396..690c014 100644 --- a/api/index.js +++ b/api/index.js @@ -3,6 +3,7 @@ const bodyParser = require('body-parser'); const cors = require('cors'); const helmet = require('helmet'); const {set, createConnection} = require('mongoose'); +const chalk = require('chalk'); const app = express(); set('strictQuery', false); @@ -48,9 +49,17 @@ server = app.listen(4062, async () => { require('./v1/index')(app); //initialize bot API branch require('./ani/index')(app); //initialize ani API branch + const reqTypeColors = { + GET: 'greenBright', + POST: 'blueBright', + PATCH: 'yellowBright', + PUT: 'yellow', + DELETE: 'redBright' + }; + const checkMiddleware = (middleware, string) => { if (middleware.route) {Object.keys(middleware.route.methods).forEach(method => { - if (middleware.route.methods[method]) {console.log(`[${method.toUpperCase()}] ${string}${middleware.route.path}`);} + if (middleware.route.methods[method]) {console.log(`${chalk.gray(`[`)}${chalk[reqTypeColors[method.toUpperCase()]](method.toUpperCase())}${chalk.gray(`]`)} ${string}${middleware.route.path}`);} });} else if (middleware.name === 'router') {middleware.handle.stack.forEach(handler => {checkMiddleware(handler, string + middleware.handle.location);});} }; app._router.stack.forEach(middleware => checkMiddleware(middleware, '')); //log all routes