comment

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(g *echo.Group, service Service,
	requireLogin echo.MiddlewareFunc, logger log.Logger)

Types

type Comment

type Comment struct {
	entity.Comment
}

Comment represents a comment made by a user for a file.

type CreateCommentRequest

type CreateCommentRequest struct {
	Body     string `json:"body" validate:"required"`
	SHA256   string `json:"sha256" validate:"required,alphanum,len=64"`
	Username string
}

CreateCommentRequest represents a comment creation request.

type Repository

type Repository interface {
	// Get returns the comment with the specified comment ID.
	Get(ctx context.Context, id string) (entity.Comment, error)
	// Create saves a new comment in the storage.
	Create(ctx context.Context, Comment entity.Comment) error
}

Repository encapsulates the logic to access comments from the data source.

func NewRepository

func NewRepository(db *dbcontext.DB, logger log.Logger) Repository

NewRepository creates a new comment repository.

type Service

type Service interface {
	Get(ctx context.Context, id string) (Comment, error)
	Create(ctx context.Context, input CreateCommentRequest) (Comment, error)
}

Service encapsulates usecase logic for files.

func NewService

func NewService(repo Repository, logger log.Logger, actSvc activity.Service,
	userSvc user.Service, fileSvc file.Service) Service

NewService creates a new user service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL