2026-06-08 19:00:23 +08:00

48 lines
1.6 KiB
Go

package managerapi
import (
"hyapp/services/gateway-service/internal/client"
"hyapp/services/gateway-service/internal/transport/http/httproutes"
)
// Handler owns manager-center HTTP endpoints that are still part of the app gateway.
// Capability checks stay in user-service, and resource grants stay in wallet-service.
type Handler struct {
walletClient client.WalletClient
userHostClient client.UserHostClient
userProfileClient client.UserProfileClient
growthLevelClient client.GrowthLevelClient
}
type Config struct {
WalletClient client.WalletClient
UserHostClient client.UserHostClient
UserProfileClient client.UserProfileClient
GrowthLevelClient client.GrowthLevelClient
}
func New(config Config) *Handler {
return &Handler{
walletClient: config.WalletClient,
userHostClient: config.UserHostClient,
userProfileClient: config.UserProfileClient,
growthLevelClient: config.GrowthLevelClient,
}
}
func (h *Handler) ManagerHandlers() httproutes.ManagerHandlers {
return httproutes.ManagerHandlers{
ListManagerGrantResources: h.listManagerGrantResources,
GrantManagerResource: h.grantManagerResource,
LookupBusinessUsers: h.lookupBusinessUsers,
GetManagerOverview: h.getManagerOverview,
SearchManagerUsers: h.searchManagerUsers,
GrantManagerVIP: h.grantManagerVIP,
ManagerBlocks: h.managerBlocks,
ListManagerBlocks: h.listManagerBlocks,
CreateManagerBlock: h.createManagerBlock,
UnblockManagerBlock: h.unblockManagerBlock,
SetManagerUserLevel: h.setManagerUserLevel,
}
}