From 052ec0ceb0342ed71ec988c27fd2d52f0ba3318b Mon Sep 17 00:00:00 2001 From: LinkinStar Date: Thu, 2 Feb 2023 16:30:37 +0800 Subject: [PATCH] fix(comment): add comment original text limiting condition --- internal/schema/comment_schema.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/schema/comment_schema.go b/internal/schema/comment_schema.go index c7af388d..7648ff12 100644 --- a/internal/schema/comment_schema.go +++ b/internal/schema/comment_schema.go @@ -14,7 +14,7 @@ type AddCommentReq struct { // reply comment id ReplyCommentID string `validate:"omitempty" json:"reply_comment_id"` // original comment content - OriginalText string `validate:"required" json:"original_text"` + OriginalText string `validate:"required,gte=2,lte=600" json:"original_text"` // parsed comment content ParsedText string `json:"-"` // @ user id list @@ -47,7 +47,7 @@ type UpdateCommentReq struct { // comment id CommentID string `validate:"required" json:"comment_id"` // original comment content - OriginalText string `validate:"omitempty" json:"original_text"` + OriginalText string `validate:"required,gte=2,lte=600" json:"original_text"` // parsed comment content ParsedText string `json:"-"` // user id