fix: get news by query category and tags filters
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package categoryrepository
|
||||
|
||||
import (
|
||||
categorydomain "legalgo-BE-go/internal/domain/category"
|
||||
)
|
||||
|
||||
func (a *accessor) GetIDByCode(code string) (string, error) {
|
||||
var category string
|
||||
|
||||
if err := a.db.
|
||||
Model(&categorydomain.Category{}).
|
||||
Select("id").Where("code = ?", code).
|
||||
Pluck("id", &category).
|
||||
Error; err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return category, nil
|
||||
}
|
||||
@@ -12,6 +12,7 @@ type accessor struct {
|
||||
type Category interface {
|
||||
GetAllModel() ([]categorydomain.Category, error)
|
||||
GetByIDs([]string) ([]categorydomain.Category, error)
|
||||
GetIDByCode(string) (string, error)
|
||||
CreateModel(categorydomain.CategoryReq) error
|
||||
Update(categorydomain.Category) error
|
||||
Delete(string) error
|
||||
|
||||
Reference in New Issue
Block a user