series viewable flag

master
Kit Kasune 1 year ago
parent 351d7e7431
commit 77946475a1
  1. 8
      api/ani/v1/routes/series/add.js
  2. 2
      api/ani/v1/routes/series/edits.js
  3. 3
      db/ani/series.js

@ -106,7 +106,7 @@ module.exports = (app, router) => {
})
.get(app.auth.tokenPass, app.auth.permsPass('series-approve'), async (req, res, next) => {
const series = req.params.id.match(/^\d+$/) ? await Anime.findOne({numericalId: req.params.id.toLowerCase()}) : await Anime.findOne({id: req.params.id.toLowerCase()}); //TODO make sure all ID calls are lowercased
if (!series || (series && !series.meta.completed && req.unauthorized)) {
if (!series || (series && !series.meta.completed && !series.meta.viewable && req.unauthorized)) {
if (req.params.id.toLowerCase() === 'queue') {return next();}
return res.status(400).send("A series with that ID doesn't exist!");
}
@ -117,4 +117,8 @@ module.exports = (app, router) => {
meta: {completed: series.meta.completed, creator: series.meta.creator, locked: series.meta.locked}
});
});
}; //TODO check that series can be submitted but not completed. consider making this not allowed, or figure out what to do about the fact that editing all the fields is a complete pain
}; /**TODO check that series can be submitted but not completed. consider making this not allowed, or figure out what to do about the fact that editing all the fields is a complete pain
* a series must have an ID, name, romaji, and genres listed to be submitted
* series can be submitted with those but making a series public requires more fields
* for special cases, a series can be marked by an admin as viewable (confirmed second season or series, etc)
*/

@ -53,6 +53,8 @@ module.exports = (app, router) => {
].forEach(field => edits.stringWrap(field[0], field[1]));
//router.use('/:id/altnames', app.auth.tokenPass, app.auth.permsPass('series-approve'))
};

@ -12,13 +12,14 @@ module.exports = (connection) => connection.model('series', new Schema({
action: String
}], default: []},
completed: {type: Boolean, default: false}, //SUBMISSION completed
viewable: {type: Boolean, default: false}, // exists solely as completion override. WILL NOT make a completed series invisible if false
approved: {type: Schema.Types.Mixed, default: false}, //boolean or {approved: Boolean, by: <uid>}
submitted: Schema.Types.Mixed, //can be false or a string with the ID of the submitter, //!REQ
hidden: {type: Boolean, default: false},
reviewFlags: {type: [{
by: String,
reason: String,
}], default: []}
}], default: []} // notes left by an admin or curator about work that needs to be done on a series for it to be approved
}, //!REQ
name: {type: String, required: true, maxLength: 150}, //!REQ

Loading…
Cancel
Save