feat: get all ads

This commit is contained in:
ericprd
2025-03-09 00:55:40 +08:00
parent 213d370332
commit 1ae192ccef
7 changed files with 61 additions and 4 deletions
+15
View File
@@ -0,0 +1,15 @@
package adsrepository
import (
"fmt"
adsdomain "legalgo-BE-go/internal/domain/ads"
)
func (a *accessor) GetAll() ([]adsdomain.Ads, error) {
var ads []adsdomain.Ads
if err := a.db.Find(&ads).Error; err != nil {
return ads, fmt.Errorf("failed to get all ads: %v", err)
}
return ads, nil
}
+1
View File
@@ -11,6 +11,7 @@ type accessor struct {
type Ads interface {
Create(adsdomain.Ads) error
GetAll() ([]adsdomain.Ads, error)
}
func New(