Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const validateInt = (key: string): ValidationChain =>
query(key)
.isInt()
.toInt()
export const validateOptionalString = (key: string): ValidationChain =>
query(key)
.optional()
.customSanitizer(value => value || '')
export const validateOptionalInt = (key: string): ValidationChain =>
query(key)
.optional()
.isInt()
.toInt()
],
controllers.read
);
comment.route("/add").post(
passport.authenticate("bearer", { session: false }),
[
check("content", "toast.comment.content_empty").not().isEmpty(),
query("targetType", "toast.user.attack_alert").isIn(Object.values(PostType)),
query("targetId", "toast.user.attack_alert").not().isEmpty(),
],
controllers.add
);
comment.route("/rate").get(
passport.authenticate("bearer", { session: false }),
[
query("id", "toast.user.attack_alert").not().isEmpty(),
query("rating", "toast.user.attack_alert").isIn(["0", "1"]),
],
controllers.like
);
comment.route("/remove/:id").get(
passport.authenticate("bearer", { session: false }),
controllers.remove
);
export default comment;