interface.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. // CreatePasture 牧场管理相关
  33. CreatePasture(ctx context.Context, req *operationPb.AddPastureRequest) error
  34. SearchPastureList(ctx context.Context, req *operationPb.SearchPastureRequest) (*model.GroupPastureResponse, error)
  35. }
  36. type SystemOperation interface {
  37. // Auth 系统用户相关
  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. SearchSystemUserList(ctx context.Context, req *operationPb.SearchUserRequest) (*model.SystemUserResponse, error)
  42. EditSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error
  43. DeleteSystemUser(ctx context.Context, userId int64) error
  44. IsShowSystemUser(ctx context.Context, req *operationPb.IsShowSystemUserRequest) error
  45. // CreateSystemRole 系统角色相关
  46. CreateSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error
  47. EditSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error
  48. DeleteSystemRole(ctx context.Context, roleId int64) error
  49. SearchSystemRoleList(ctx context.Context, req *operationPb.SearchRoleRequest) (*model.SystemRoleResponse, error)
  50. // CreateSystemMenu 系统菜单权限
  51. CreateSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error
  52. EditSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error
  53. IsShowSystemMenu(ctx context.Context, req *operationPb.IsShowSystemMenuRequest) error
  54. SearchSystemMenuList(ctx context.Context, req *operationPb.SearchMenuRequest) (*model.SystemMenuResponse, error)
  55. DeleteSystemMenu(ctx context.Context, menuId int64) error
  56. }