backend: fix channel name length limits

This commit is contained in:
hippoz 2022-04-26 04:04:40 +03:00
parent 96da377e4e
commit 444fcb2087
Signed by: hippoz
GPG key ID: 7C52899193467641

View file

@ -12,7 +12,7 @@ const router = express.Router();
router.post( router.post(
"/", "/",
authenticateRoute(), authenticateRoute(),
body("name").isLength({ min: 1, max: 40 }).isAlphanumeric("en-US", { ignore: " _-" }), body("name").isLength({ min: 1, max: 32 }).isAlphanumeric("en-US", { ignore: " _-" }),
async (req, res) => { async (req, res) => {
const validationErrors = validationResult(req); const validationErrors = validationResult(req);
if (!validationErrors.isEmpty()) { if (!validationErrors.isEmpty()) {
@ -43,7 +43,7 @@ router.post(
router.put( router.put(
"/:id", "/:id",
authenticateRoute(), authenticateRoute(),
body("name").isLength({ min: 1, max: 40 }).isAlphanumeric("en-US", { ignore: " _-" }), body("name").isLength({ min: 1, max: 32 }).isAlphanumeric("en-US", { ignore: " _-" }),
param("id").isNumeric(), param("id").isNumeric(),
async (req, res) => { async (req, res) => {
const validationErrors = validationResult(req); const validationErrors = validationResult(req);