interface.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. // CreateGroupPasture 牧场管理相关
  33. CreateGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error
  34. EditGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error
  35. SearchGroupPastureList(ctx context.Context, req *operationPb.SearchPastureRequest) (*model.GroupPastureResponse, error)
  36. DeleteGroupPasture(ctx context.Context, pastureId int64) error
  37. ResetPasswordGroupPasture(ctx context.Context, req *operationPb.RestPasswordGroupPasture) error
  38. IsShowGroupPasture(ctx context.Context, req *operationPb.IsShowGroupPasture) error
  39. // ParentCattleCategoryList 牧畜类别
  40. ParentCattleCategoryList(ctx context.Context) map[operationPb.CattleCategoryParent_Kind]string
  41. AddCattleCategory(ctx context.Context, req *operationPb.AddCattleCategoryRequest) error
  42. EditCattleCategory(ctx context.Context, req *operationPb.AddCattleCategoryRequest) error
  43. IsShowCattleCategory(ctx context.Context, req *operationPb.IsShowCattleCategory) error
  44. DeleteCattleCategory(ctx context.Context, cattleCategoryId int64) error
  45. SearchCattleCategoryList(ctx context.Context, req *operationPb.SearchCattleCategoryRequest) (*model.CattleCategoryResponse, error)
  46. // ParentForageCategoryList 饲料类别相关
  47. ParentForageCategoryList(ctx context.Context) map[operationPb.ForageCategoryParent_Kind]string
  48. AddForageCategory(ctx context.Context, req *operationPb.AddForageCategoryRequest) error
  49. EditForageCategory(ctx context.Context, req *operationPb.AddForageCategoryRequest) error
  50. IsShowForageCategory(ctx context.Context, req *operationPb.IsShowForageCategory) error
  51. DeleteForageCategory(ctx context.Context, cattleCategoryId int64) error
  52. SearchForageCategoryList(ctx context.Context, req *operationPb.SearchForageCategoryRequest) (*model.ForageCategoryResponse, error)
  53. // CreateForage 饲料相关
  54. CreateForage(ctx context.Context, req *operationPb.AddForageRequest) error
  55. EditForage(ctx context.Context, req *operationPb.AddForageRequest) error
  56. SearchForageList(ctx context.Context, req *operationPb.SearchForageListRequest) (*operationPb.SearchForageListResponse, error)
  57. ForageEnumList(ctx context.Context) *ForageEnumList
  58. DeleteForageList(ctx context.Context, ids []int64) error
  59. IsShowForage(ctx context.Context, req *operationPb.IsShowForage) error
  60. }
  61. type SystemOperation interface {
  62. // Auth 系统用户相关
  63. Auth(ctx context.Context, auth *operationPb.UserAuth) (*operationPb.SystemToken, error)
  64. GetUserInfo(ctx context.Context, token string) (*operationPb.UserAuth, error)
  65. CreateSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error
  66. SearchSystemUserList(ctx context.Context, req *operationPb.SearchUserRequest) (*model.SystemUserResponse, error)
  67. EditSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error
  68. DeleteSystemUser(ctx context.Context, userId int64) error
  69. IsShowSystemUser(ctx context.Context, req *operationPb.IsShowSystemUserRequest) error
  70. GetSystemUserPermissions(ctx context.Context, token string) (*operationPb.SystemUserMenuPermissions, error)
  71. // CreateSystemRole 系统角色相关
  72. CreateSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error
  73. EditSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error
  74. DeleteSystemRole(ctx context.Context, roleId int64) error
  75. GetRolePermissions(ctx context.Context, roleId int64) (*operationPb.RolePermissionsList, error)
  76. SearchSystemRoleList(ctx context.Context, req *operationPb.SearchRoleRequest) (*operationPb.SearchRoleResponse, error)
  77. // CreateSystemMenu 系统菜单权限
  78. CreateSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error
  79. EditSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error
  80. IsShowSystemMenu(ctx context.Context, req *operationPb.IsShowSystemMenuRequest) error
  81. SearchSystemMenuList(ctx context.Context, req *operationPb.SearchMenuRequest) (*model.SystemMenuResponse, error)
  82. DeleteSystemMenu(ctx context.Context, menuId int64) error
  83. // SearchMobileList 移动端
  84. SearchMobileList(ctx context.Context, req *operationPb.SearchMobileRequest) (*operationPb.SearchMobileResponse, error)
  85. }