interface.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package backend
  2. import (
  3. "context"
  4. "kpt-tmr-group/config"
  5. "kpt-tmr-group/model"
  6. "kpt-tmr-group/pkg/di"
  7. operationPb "kpt-tmr-group/proto/go/backend/operation"
  8. "kpt-tmr-group/store/kptstore"
  9. "go.uber.org/dig"
  10. )
  11. var Module = di.Options(di.Provide(NewStore))
  12. type Hub struct {
  13. dig.In
  14. OpsService KptService
  15. }
  16. type StoreEntry struct {
  17. dig.In
  18. Cfg *config.AppConfig
  19. DB *kptstore.DB
  20. //SSO *sso.Cache
  21. // AsynqClient asynqsvc.Client
  22. // Cache *redis.Client
  23. }
  24. func NewStore(store StoreEntry) KptService {
  25. return &store
  26. }
  27. type KptService interface {
  28. Operation
  29. SSOAuth
  30. }
  31. type Operation interface {
  32. CreateSystemRoleList(ctx context.Context, req []*operationPb.AddRoleRequest) error
  33. // CreatePastureList 牧场管理相关
  34. CreatePastureList(ctx context.Context, req []*operationPb.AddPastureRequest) error
  35. SearchPastureList(ctx context.Context, req *operationPb.SearchPastureRequest) (*model.GroupPastureResponse, error)
  36. }
  37. type SSOAuth interface {
  38. Auth(ctx context.Context, auth *operationPb.UserAuth) (*operationPb.SystemToken, error)
  39. GetUserInfo(ctx context.Context, token string) (*operationPb.UserAuth, error)
  40. }