interface.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. package backend
  2. import (
  3. "bytes"
  4. "context"
  5. "io"
  6. "kpt-tmr-group/config"
  7. "kpt-tmr-group/pkg/di"
  8. operationPb "kpt-tmr-group/proto/go/backend/operation"
  9. "kpt-tmr-group/store/kptstore"
  10. "go.uber.org/dig"
  11. )
  12. var Module = di.Options(di.Provide(NewStore))
  13. type Hub struct {
  14. dig.In
  15. OpsService KptService
  16. }
  17. type StoreEntry struct {
  18. dig.In
  19. Cfg *config.AppConfig
  20. DB *kptstore.DB
  21. //SSO *sso.Cache
  22. // AsynqClient asynqsvc.Client
  23. // Cache *redis.Client
  24. }
  25. func NewStore(store StoreEntry) KptService {
  26. return &store
  27. }
  28. type KptService interface {
  29. Operation
  30. SystemOperation
  31. }
  32. type Operation interface {
  33. // CreateGroupPasture 牧场管理相关
  34. CreateGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error
  35. EditGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error
  36. SearchGroupPastureList(ctx context.Context, req *operationPb.SearchPastureRequest) (*operationPb.SearchPastureResponse, error)
  37. DeleteGroupPasture(ctx context.Context, pastureId int64) error
  38. ResetPasswordGroupPasture(ctx context.Context, pastureId int64) error
  39. IsShowGroupPasture(ctx context.Context, req *operationPb.IsShowGroupPasture) error
  40. // ParentCattleCategoryList 牧畜类别
  41. ParentCattleCategoryList(ctx context.Context) map[operationPb.CattleCategoryParent_Kind]string
  42. AddCattleCategory(ctx context.Context, req *operationPb.AddCattleCategoryRequest) error
  43. EditCattleCategory(ctx context.Context, req *operationPb.AddCattleCategoryRequest) error
  44. IsShowCattleCategory(ctx context.Context, req *operationPb.IsShowCattleCategory) error
  45. DeleteCattleCategory(ctx context.Context, cattleCategoryId int64) error
  46. SearchCattleCategoryList(ctx context.Context, req *operationPb.SearchCattleCategoryRequest) (*operationPb.SearchCattleCategoryResponse, error)
  47. // ParentForageCategoryList 饲料类别相关
  48. ParentForageCategoryList(ctx context.Context) map[operationPb.ForageCategoryParent_Kind]string
  49. AddForageCategory(ctx context.Context, req *operationPb.AddForageCategoryRequest) error
  50. EditForageCategory(ctx context.Context, req *operationPb.AddForageCategoryRequest) error
  51. IsShowForageCategory(ctx context.Context, req *operationPb.IsShowForageCategory) error
  52. DeleteForageCategory(ctx context.Context, cattleCategoryId int64) error
  53. SearchForageCategoryList(ctx context.Context, req *operationPb.SearchForageCategoryRequest) (*operationPb.SearchForageCategoryResponse, error)
  54. // CreateForage 饲料相关
  55. CreateForage(ctx context.Context, req *operationPb.AddForageRequest) error
  56. EditForage(ctx context.Context, req *operationPb.AddForageRequest) error
  57. SearchForageList(ctx context.Context, req *operationPb.SearchForageListRequest) (*operationPb.SearchForageListResponse, error)
  58. ForageEnumList(ctx context.Context) *operationPb.ForageEnumList
  59. DeleteForageList(ctx context.Context, ids []int64) error
  60. IsShowForage(ctx context.Context, req *operationPb.IsShowForage) error
  61. ExcelImportForage(ctx context.Context, req io.Reader) error
  62. ExcelExportForage(ctx context.Context, req *operationPb.SearchForageListRequest) (*bytes.Buffer, error)
  63. ExcelTemplateForage(ctx context.Context) (*bytes.Buffer, error)
  64. }
  65. type SystemOperation interface {
  66. // Auth 系统用户相关
  67. Auth(ctx context.Context, auth *operationPb.UserAuthData) (*operationPb.SystemToken, error)
  68. GetUserInfo(ctx context.Context, token string) (*operationPb.UserAuth, error)
  69. CreateSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error
  70. SearchSystemUserList(ctx context.Context, req *operationPb.SearchUserRequest) (*operationPb.SearchUserResponse, error)
  71. EditSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error
  72. DeleteSystemUser(ctx context.Context, userId int64) error
  73. ResetPasswordSystemUser(ctx context.Context, userId int64) error
  74. DetailsSystemUser(ctx context.Context, userId int64) (*operationPb.UserDetails, error)
  75. IsShowSystemUser(ctx context.Context, req *operationPb.IsShowSystemUserRequest) error
  76. GetSystemUserPermissions(ctx context.Context, token string) (*operationPb.SystemUserMenuPermissions, error)
  77. // CreateSystemRole 系统角色相关
  78. CreateSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error
  79. EditSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error
  80. DeleteSystemRole(ctx context.Context, roleId int64) error
  81. GetRolePermissions(ctx context.Context, roleId int64) (*operationPb.RolePermissionsList, error)
  82. SearchSystemRoleList(ctx context.Context, req *operationPb.SearchRoleRequest) (*operationPb.SearchRoleResponse, error)
  83. // CreateSystemMenu 系统菜单权限
  84. CreateSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error
  85. EditSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error
  86. IsShowSystemMenu(ctx context.Context, req *operationPb.IsShowSystemMenuRequest) error
  87. SearchSystemMenuList(ctx context.Context, req *operationPb.SearchMenuRequest) (*operationPb.SearchMenuResponse, error)
  88. DeleteSystemMenu(ctx context.Context, menuId int64) error
  89. // SearchMobileList 移动端
  90. SearchMobileList(ctx context.Context, req *operationPb.SearchMobileRequest) (*operationPb.SearchMobileResponse, error)
  91. }