interface.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. SystemOperation
  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 SystemOperation interface {
  38. Auth(ctx context.Context, auth *operationPb.UserAuth) (*operationPb.SystemToken, error)
  39. GetUserInfo(ctx context.Context, token string) (*operationPb.UserAuth, error)
  40. CreateSystemUser(ctx context.Context, req []*operationPb.AddSystemUser) error
  41. }