|
|
@ -41,10 +41,13 @@ module.exports = (app, router) => { |
|
|
|
} |
|
|
|
} |
|
|
|
catch {return res.status(500).send("There was an error trying to update your synopsis. Please try again.");} |
|
|
|
catch {return res.status(500).send("There was an error trying to update your synopsis. Please try again.");} |
|
|
|
}) |
|
|
|
}) |
|
|
|
.get(app.auth.tokenPass, app.auth.permsPass('series-approve'), async (req, res) => { //working
|
|
|
|
.get(app.auth.tokenPass, app.auth.permsPass('series-approve'), async (req, res) => { |
|
|
|
const series = await Anime.findOne({id: req.params.id.toLowerCase()}); |
|
|
|
const series = await Anime.findOne({id: req.params.id.toLowerCase()}); |
|
|
|
if (!series || (series && !series.meta.completed && req.unauthorized)) {return res.status(400).send("A series with that ID doesn't exist!");} |
|
|
|
if (!series || (series && !series.meta.completed && req.unauthorized)) {return res.status(400).send("A series with that ID doesn't exist!");} |
|
|
|
return res.send({synopsis: series.synopsis.synopsis, by: series.synopsis.by}); |
|
|
|
return res.send({synopsis: series.synopsis.synopsis, by: series.synopsis.by}); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.get(app.auth.tokenPass, app.auth.permsPass('series-approve'), async (req, res) => { |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
[ //?SINGLE STRING FIELDS
|
|
|
|
[ //?SINGLE STRING FIELDS
|
|
|
@ -58,11 +61,14 @@ module.exports = (app, router) => { |
|
|
|
[ //?STRING LIST FIELDS
|
|
|
|
[ //?STRING LIST FIELDS
|
|
|
|
['tags', 'tag', x => x.match(/^[a-z-]+$/) && x.length < 25], //TODO set list length limits
|
|
|
|
['tags', 'tag', x => x.match(/^[a-z-]+$/) && x.length < 25], //TODO set list length limits
|
|
|
|
['genres', 'genre', x => x.match(/^[a-zA-Z- ]+$/) && x.length < 25], |
|
|
|
['genres', 'genre', x => x.match(/^[a-zA-Z- ]+$/) && x.length < 25], |
|
|
|
['stream-at', 'location', x => x.match(/^[\w- ]+$/) && x.length < 40] //TODO doc cheeky field
|
|
|
|
['stream-at', 'location', x => x.match(/^[\w- ]+$/) && x.length < 25], //TODO doc cheeky field
|
|
|
|
|
|
|
|
['alt-names', 'name', x => x.match(/^[\w\-!?.:; ]+$/gm) && x.length < 150], |
|
|
|
|
|
|
|
['publishers', 'publisher', x => x.match(/^[\w\-!?.:; ]+$/gm) && x.length < 150], |
|
|
|
|
|
|
|
['studios', 'studio', x => x.match(/^[\w\-!?.:; ]+$/gm) && x.length < 150] |
|
|
|
].forEach(x => edits.list(...x)); //it's just that shrimple
|
|
|
|
].forEach(x => edits.list(...x)); //it's just that shrimple
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//air, completed, nsfw, externalLinks, videos, art, ratings, rating, watchers, likes, reviews, seasons, characters, related
|
|
|
|
|
|
|
|
//dependent fields can be modified string lists into number lists; seasons stored purely by numerical ID
|
|
|
|
//router.use('/:id/altnames', app.auth.tokenPass, app.auth.permsPass('series-approve'))
|
|
|
|
// /ani/v1/series/code-geass --> /ep-1 /episode-1 /ep1 /1 /e1 -> seasons/1/episodes/1/
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |