From bb987b1f8ba7ba3c89ff2272e27e4b532ec99013 Mon Sep 17 00:00:00 2001 From: d3m0k1d Date: Wed, 18 Feb 2026 13:43:00 +0300 Subject: [PATCH] feat: add logic for repository --- .../repositories/comments_repository.go | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/backend/internal/repositories/comments_repository.go b/backend/internal/repositories/comments_repository.go index bd3f456..8d53d19 100644 --- a/backend/internal/repositories/comments_repository.go +++ b/backend/internal/repositories/comments_repository.go @@ -21,8 +21,16 @@ func NewCommentsRepository(db *sql.DB) CommentRepository { } } -func (c *commentsRepository) CreateComment(ctx context.Context, comment *storage.CommentCreate) error { - _, err := c.db.Exec("INSERT INTO comments(content, post_id) VALUES(?, ?, ?)", comment.Content, comment.PostID, comment.UserID) +func (c *commentsRepository) CreateComment( + ctx context.Context, + comment *storage.CommentCreate, +) error { + _, err := c.db.Exec( + "INSERT INTO comments(content, post_id) VALUES(?, ?, ?)", + comment.Content, + comment.PostID, + comment.UserID, + ) if err != nil { c.logger.Error("error insert: " + err.Error()) return err @@ -58,7 +66,10 @@ func (c *commentsRepository) GetAllComments(ctx context.Context) ([]storage.Comm return result, nil } -func (c *commentsRepository) GetCommentsOfPost(ctx context.Context, id int) ([]storage.Comment, error) { +func (c *commentsRepository) GetCommentsOfPost( + ctx context.Context, + id int, +) ([]storage.Comment, error) { return nil, nil } @@ -66,6 +77,10 @@ func (c *commentsRepository) DeleteComment(ctx context.Context, id int) error { return nil } -func (c *commentsRepository) UpdateComment(ctx context.Context, id int, comment *storage.Comment) error { +func (c *commentsRepository) UpdateComment( + ctx context.Context, + id int, + comment *storage.Comment, +) error { return nil }