File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020//
2121// List comments for a task:
2222//
23- // comments, err := svc.ListByTask(ctx, taskID)
23+ // pagination := &db.Pagination{}
24+ // comments, err := svc.ListByTask(ctx, taskID, pagination)
2425//
2526// Update a comment:
2627//
2728// update := comments.CommentUpdate{Content: "Updated content"}
28- // err := svc.Update(ctx, commentID, userID , update)
29+ // err := svc.Update(ctx, userID, commentID , update)
2930//
3031// Delete a comment (soft delete):
3132//
32- // err := svc.Delete(ctx, commentID, userID )
33+ // err := svc.Delete(ctx, userID, commentID )
3334package comments
Original file line number Diff line number Diff line change 44 "fmt"
55 "strings"
66 "time"
7+ "unicode/utf8"
78
89 "github.com/bit-issues/backend/internal/db"
910)
@@ -54,7 +55,7 @@ func (i CommentInput) Validate() error {
5455 return fmt .Errorf ("%w: content is required" , ErrValidationFailed )
5556 }
5657
57- if len (content ) > MaxContentLength {
58+ if utf8 . RuneCountInString (content ) > MaxContentLength {
5859 return fmt .Errorf ("%w: content too long (max %d characters)" , ErrValidationFailed , MaxContentLength )
5960 }
6061
@@ -69,7 +70,7 @@ func (u CommentUpdate) Validate() error {
6970 return fmt .Errorf ("%w: content is required" , ErrValidationFailed )
7071 }
7172
72- if len (content ) > MaxContentLength {
73+ if utf8 . RuneCountInString (content ) > MaxContentLength {
7374 return fmt .Errorf ("%w: content too long (max %d characters)" , ErrValidationFailed , MaxContentLength )
7475 }
7576
You can’t perform that action at this time.
0 commit comments