Extended comment max characters

This commit is contained in:
Rykkel
2024-08-13 13:16:57 +08:00
parent 82a42eb41d
commit 3772ca03eb
3 changed files with 4 additions and 13 deletions

View File

@@ -13,7 +13,7 @@ const validationSchema = Yup.object({
content: Yup.string()
.trim()
.min(3, "Content must be at least 3 characters")
.max(500, "Content must be at most 500 characters")
.max(3000, "Content must be at most 3000 characters")
});
export default function CommentInputModule() {

View File

@@ -25,7 +25,7 @@ const validationSchema = Yup.object({
content: Yup.string()
.trim()
.min(3, "Content must be at least 3 characters")
.max(500, "Content must be at most 500 characters")
.max(3000, "Content must be at most 3000 characters")
.required("Content is required"),
});

View File

@@ -91,15 +91,6 @@ router.post(
}
);
// // sequelize method findAll is used to generate a standard SELECT query which will retrieve all entries from the table
// router.get("/", async (req, res) => {
// let list = await Tutorial.findAll({
// // order option takes an array of items. These items are themselves in the form of [column, direction]
// order: [['createdAt', 'DESC']]
// });
// res.json(list);
// });
router.get("/", async (req, res) => {
let condition = {
where: {},
@@ -281,7 +272,7 @@ router.post("/:id/comments", async (req, res) => {
// Validate request body
let validationSchema = yup.object({
content: yup.string().trim().min(3).max(500).required(),
content: yup.string().trim().min(3).max(3000).required(),
userId: yup.string().required(),
postId: yup.string().required(),
});
@@ -307,7 +298,7 @@ router.put("/comments/:id", async (req, res) => {
// Validate request body
let validationSchema = yup.object({
content: yup.string().trim().min(3).max(500).required(),
content: yup.string().trim().min(3).max(3000).required(),
userId: yup.string().required(),
postId: yup.string().required(),
});