article

package
v0.0.0-...-bceaf69 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	Index(ctx context.Context, request *filter.Request) (*database.Paginator[*model.Article], error)
	Create(ctx context.Context, article *model.Article) (*model.Article, error)
	Update(ctx context.Context, article *model.Article) (*model.Article, error)
	GetByID(ctx context.Context, id uint) (*model.Article, error)
	GetBySlug(ctx context.Context, slug string) (*model.Article, error)
	Delete(ctx context.Context, id uint) error
	IsOwner(ctx context.Context, resourceID, ownerID uint) (bool, error)
}

type Service

type Service struct {
	Session    session.Session
	Repository Repository
}

func NewService

func NewService(session session.Session, repository Repository) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, createDTO *dto.CreateArticle) error

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id uint) error

func (*Service) GenerateSlug

func (s *Service) GenerateSlug(title string) (string, error)

func (*Service) GetBySlug

func (s *Service) GetBySlug(ctx context.Context, slug string) (*dto.Article, error)

func (*Service) Index

func (s *Service) Index(ctx context.Context, request *filter.Request) (*database.PaginatorDTO[*dto.Article], error)

func (*Service) IsOwner

func (s *Service) IsOwner(ctx context.Context, resourceID, ownerID uint) (bool, error)

func (*Service) Name

func (s *Service) Name() string

func (*Service) Update

func (s *Service) Update(ctx context.Context, id uint, updateDTO *dto.UpdateArticle) error

Jump to

Keyboard shortcuts

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