refactor: update GetAll method to return NewsResponse and rename clicked to views
This commit is contained in:
@@ -37,7 +37,6 @@ func (i *impl) Create(spec newsdomain.NewsReq, staffId string) error {
|
||||
AuthorID: staffId,
|
||||
Tags: tags,
|
||||
Categories: categories,
|
||||
Clicked: 0,
|
||||
}
|
||||
|
||||
if err := i.newsRepo.Create(newSpec); err != nil {
|
||||
|
||||
@@ -5,12 +5,12 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (i *impl) GetAll(filter newsdomain.Filter) ([]newsdomain.News, error) {
|
||||
func (i *impl) GetAll(filter newsdomain.Filter) ([]newsdomain.NewsResponse, error) {
|
||||
var err error
|
||||
|
||||
categories := []string{}
|
||||
tags := []string{}
|
||||
news := []newsdomain.News{}
|
||||
news := []newsdomain.NewsResponse{}
|
||||
|
||||
tagCodeArr := strings.Split(filter.Tags, " ")
|
||||
categoryCodeArr := strings.Split(filter.Category, " ")
|
||||
|
||||
@@ -16,7 +16,7 @@ type impl struct {
|
||||
}
|
||||
|
||||
type News interface {
|
||||
GetAll(filter newsdomain.Filter) ([]newsdomain.News, error)
|
||||
GetAll(filter newsdomain.Filter) ([]newsdomain.NewsResponse, error)
|
||||
GetBySlug(string) (*newsdomain.News, error)
|
||||
GetByID(string) (*newsdomain.News, error)
|
||||
Create(newsdomain.NewsReq, string) error
|
||||
|
||||
Reference in New Issue
Block a user