feat: get all ads
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -11,6 +11,7 @@ type accessor struct {
|
||||
|
||||
type Ads interface {
|
||||
Create(adsdomain.Ads) error
|
||||
GetAll() ([]adsdomain.Ads, error)
|
||||
}
|
||||
|
||||
func New(
|
||||
|
||||
Reference in New Issue
Block a user