2022-08-29 18:30:36 -08:00
|
|
|
package services
|
|
|
|
|
2022-09-24 11:33:38 -08:00
|
|
|
import "github.com/hay-kot/homebox/backend/internal/repo"
|
2022-08-29 18:30:36 -08:00
|
|
|
|
|
|
|
type AllServices struct {
|
2022-08-30 21:22:01 -08:00
|
|
|
User *UserService
|
|
|
|
Admin *AdminService
|
|
|
|
Location *LocationService
|
2022-09-01 17:52:40 -08:00
|
|
|
Labels *LabelService
|
2022-09-03 01:17:48 -08:00
|
|
|
Items *ItemService
|
2022-08-29 18:30:36 -08:00
|
|
|
}
|
|
|
|
|
2022-09-24 11:33:38 -08:00
|
|
|
func NewServices(repos *repo.AllRepos, root string) *AllServices {
|
|
|
|
if repos == nil {
|
|
|
|
panic("repos cannot be nil")
|
|
|
|
}
|
|
|
|
if root == "" {
|
|
|
|
panic("root cannot be empty")
|
|
|
|
}
|
|
|
|
|
2022-08-29 18:30:36 -08:00
|
|
|
return &AllServices{
|
2022-08-30 21:22:01 -08:00
|
|
|
User: &UserService{repos},
|
|
|
|
Admin: &AdminService{repos},
|
|
|
|
Location: &LocationService{repos},
|
2022-09-01 17:52:40 -08:00
|
|
|
Labels: &LabelService{repos},
|
2022-09-12 14:47:27 -08:00
|
|
|
Items: &ItemService{
|
|
|
|
repo: repos,
|
2022-09-24 11:33:38 -08:00
|
|
|
filepath: root,
|
|
|
|
at: attachmentTokens{},
|
2022-09-12 14:47:27 -08:00
|
|
|
},
|
2022-08-29 18:30:36 -08:00
|
|
|
}
|
|
|
|
}
|