26 lines
460 B
Go
26 lines
460 B
Go
package routesrepo
|
|
|
|
import (
|
|
"git.ma-al.com/goc_daniel/b2b/app/db"
|
|
"git.ma-al.com/goc_daniel/b2b/app/model"
|
|
)
|
|
|
|
type UIRoutesRepo interface {
|
|
GetRoutes(langId uint) ([]model.Route, error)
|
|
}
|
|
|
|
type RoutesRepo struct{}
|
|
|
|
func New() UIRoutesRepo {
|
|
return &RoutesRepo{}
|
|
}
|
|
|
|
func (p *RoutesRepo) GetRoutes(langId uint) ([]model.Route, error) {
|
|
routes := []model.Route{}
|
|
err := db.DB.Find(&routes).Error
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return routes, nil
|
|
}
|