GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
679 B

  1. package services
  2. import (
  3. "git.aiterp.net/rpdata/api/repositories"
  4. "git.aiterp.net/rpdata/api/services/loaders"
  5. )
  6. // A Bundle contains all services.
  7. type Bundle struct {
  8. Tags *TagService
  9. Characters *CharacterService
  10. Changes *ChangeService
  11. }
  12. // NewBundle creates a new bundle.
  13. func NewBundle(repos *repositories.Bundle) *Bundle {
  14. bundle := &Bundle{}
  15. bundle.Changes = &ChangeService{
  16. changes: repos.Changes,
  17. }
  18. bundle.Tags = &TagService{tags: repos.Tags}
  19. bundle.Characters = &CharacterService{
  20. characters: repos.Characters,
  21. loader: loaders.CharacterLoaderFromRepository(repos.Characters),
  22. changeService: bundle.Changes,
  23. }
  24. return bundle
  25. }