){returnres.status(400).send("The server cannot accept your request as your body is missing fields or is malformed. Ensure fields aren't too long and that they don't contain illegal characters.");}
if(options.nsfw===true&&!(options.nsfwReason||['gore','language','nudity','themes'].includes(options.nsfwReason))){returnbadReq("You marked this series as nsfw, but did not provide a reason.");}
returnres.send(`Your series was successfully ${series.meta.submitted?'submitted':"added"}.`);
}).catch((e)=>{console.error(e);res.status(500).send("There was an error trying to process your request. It's likely that our database found something wrong with your body fields, and the server didn't realize. Check your request and try again.");});
};//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
if(!series){res.status(400).send("A series with that ID doesn't exist!");return0;}
if(series.meta.locked){res.status(401).send("This series has been locked. Nobody can edit it unless it has been unlocked. Please contact API admin to have it unlocked if you believe there is erroneous information.");return0;}
if(series.meta.approved&&!series.meta.locked&&req.unauthorized){res.status(401).send("This series has been approved, so you must have series approval permissions in order to do that.");return0;}
if(series.meta.creator!==req.authenticatedUser&&req.unauthorized){res.status(401).send("You must have series approval permissions or be the series' creator to do that !");return0;}
if(!req.authenticatedUser||!req.authenticatedUser.id){res.status(401).send("You are not authorized to do that!");return0;}