fix: get news by query category and tags filters

This commit is contained in:
ericprd
2025-03-07 00:55:50 +08:00
parent e3a9b67e28
commit 51b50a3132
10 changed files with 114 additions and 10 deletions
@@ -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
}
+1
View File
@@ -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