123456789101112131415161718192021222324252627282930313233343536 |
- package interfaces
- import (
- "context"
- "github.com/dmitriygnatenko/internal/models"
- )
- type ArticleRepository interface {
- GetAll(ctx context.Context) ([]models.Article, error)
- GetAllPreview(ctx context.Context) ([]models.ArticlePreview, error)
- GetPreviewByTagID(ctx context.Context, tagID int) ([]models.ArticlePreview, error)
- GetByURL(ctx context.Context, url string) (*models.Article, error)
- GetByID(ctx context.Context, ID int) (*models.Article, error)
- Add(ctx context.Context, m models.Article) (int, error)
- Update(ctx context.Context, m models.Article) error
- Delete(ctx context.Context, ID int) error
- }
- type TagRepository interface {
- GetAll(ctx context.Context) ([]models.Tag, error)
- GetAllUsed(ctx context.Context) ([]models.Tag, error)
- IsUsed(ctx context.Context, ID int) (bool, error)
- GetByArticleID(ctx context.Context, ID int) ([]models.Tag, error)
- GetByURL(ctx context.Context, tag string) (*models.Tag, error)
- GetByID(ctx context.Context, ID int) (*models.Tag, error)
- Add(ctx context.Context, m models.Tag) error
- Update(ctx context.Context, m models.Tag) error
- Delete(ctx context.Context, ID int) error
- }
- type ArticleTagRepository interface {
- Add(ctx context.Context, articleID int, tagIDs []int) error
- Delete(ctx context.Context, articleID int, tagIDs []int) error
- DeleteByArticleID(ctx context.Context, articleID int) error
- }
|