diff --git a/api/ani/v1/routes/series/edits.js b/api/ani/v1/routes/series/edits.js index aa5a551..fc32a8a 100644 --- a/api/ani/v1/routes/series/edits.js +++ b/api/ani/v1/routes/series/edits.js @@ -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.");} }) - .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()}); 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}); + }) + .get(app.auth.tokenPass, app.auth.permsPass('series-approve'), async (req, res) => { + }); [ //?SINGLE STRING FIELDS @@ -58,11 +61,14 @@ module.exports = (app, router) => { [ //?STRING LIST FIELDS ['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], - ['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 - - - //router.use('/:id/altnames', app.auth.tokenPass, app.auth.permsPass('series-approve')) + //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 + // /ani/v1/series/code-geass --> /ep-1 /episode-1 /ep1 /1 /e1 -> seasons/1/episodes/1/ }; \ No newline at end of file diff --git a/db/ani/series.js b/db/ani/series.js index 3184955..8fc930d 100644 --- a/db/ani/series.js +++ b/db/ani/series.js @@ -79,10 +79,10 @@ module.exports = (connection) => connection.model('series', new Schema({ reviews: {type: [{ //full review vs rating user: String, ratings: { - plot: Number, - characters: Number, - soundtrack: Number, - animation: Number + plot: {type: Number, min: 1, max: 5, required: true}, + characters: {type: Number, min: 1, max: 5, required: true}, + soundtrack: {type: Number, min: 1, max: 5, required: true}, + animation: {type: Number, min: 1, max: 5, required: true} }, comments: {type: String, maxLength: 2000} }], default: () => ([])