2026-06-25 22:00:49 +08:00

115 lines
4.9 KiB
Go

package userapi
import (
"net/http"
"hyapp/services/gateway-service/internal/client"
"hyapp/services/gateway-service/internal/transport/http/httproutes"
)
// Handler owns user-facing HTTP endpoints and relationship endpoints.
// It delegates user facts to user-service and only translates HTTP protocol shape.
type Handler struct {
userIdentityClient client.UserIdentityClient
userProfileClient client.UserProfileClient
userSocialClient client.UserSocialClient
userCPClient client.UserCPClient
userCountryClient client.UserCountryQueryClient
userHostClient client.UserHostClient
walletClient client.WalletClient
growthLevelClient client.GrowthLevelClient
achievementClient client.AchievementClient
broadcastClient client.BroadcastClient
}
type Config struct {
UserIdentityClient client.UserIdentityClient
UserProfileClient client.UserProfileClient
UserSocialClient client.UserSocialClient
UserCPClient client.UserCPClient
UserCountryClient client.UserCountryQueryClient
UserHostClient client.UserHostClient
WalletClient client.WalletClient
GrowthLevelClient client.GrowthLevelClient
AchievementClient client.AchievementClient
BroadcastClient client.BroadcastClient
}
func New(config Config) *Handler {
return &Handler{
userIdentityClient: config.UserIdentityClient,
userProfileClient: config.UserProfileClient,
userSocialClient: config.UserSocialClient,
userCPClient: config.UserCPClient,
userCountryClient: config.UserCountryClient,
userHostClient: config.UserHostClient,
walletClient: config.WalletClient,
growthLevelClient: config.GrowthLevelClient,
achievementClient: config.AchievementClient,
broadcastClient: config.BroadcastClient,
}
}
func (h *Handler) UserHandlers() httproutes.UserHandlers {
return httproutes.UserHandlers{
ResolveDisplayUserID: h.resolveDisplayUserID,
GetMyOverview: h.getMyOverview,
GetMyInviteOverview: h.getMyInviteOverview,
GetMyIdentity: h.getMyIdentity,
GetMyHostIdentity: h.getMyHostIdentity,
GetMyRoleSummary: h.getMyRoleSummary,
SearchHostAgencies: h.searchHostAgencies,
ApplyToHostAgency: h.applyToHostAgency,
GetHostCenterAgency: h.getHostCenterAgency,
GetHostCenterPlatformPolicy: h.getHostCenterPlatformPolicy,
GetAgencyCenterOverview: h.getAgencyCenterOverview,
GetAgencyCenterPlatformPolicy: h.getAgencyCenterPlatformPolicy,
ListAgencyCenterHosts: h.listAgencyCenterHosts,
ListAgencyCenterApplications: h.listAgencyCenterApplications,
ReviewAgencyCenterApplication: h.reviewAgencyCenterApplication,
RemoveAgencyCenterHost: h.removeAgencyCenterHost,
InviteAgencyCenterHost: h.inviteAgencyCenterHost,
GetBDLeaderCenterOverview: h.getBDLeaderCenterOverview,
ListBDLeaderCenterBDs: h.listBDLeaderCenterBDs,
ListBDLeaderCenterAgencies: h.listBDLeaderCenterAgencies,
InviteBDLeaderBD: h.inviteBDLeaderBD,
InviteBDLeaderAgency: h.inviteBDLeaderAgency,
GetBDCenterOverview: h.getBDCenterOverview,
ListBDCenterAgencies: h.listBDCenterAgencies,
InviteBDAgency: h.inviteBDAgency,
ListMyRoleInvitations: h.listMyRoleInvitations,
ProcessMyRoleInvitation: h.processMyRoleInvitation,
CompleteMyOnboarding: h.completeMyOnboarding,
UpdateMyProfile: h.updateMyProfile,
UpdateMyProfileBackground: h.updateMyProfileBackground,
ChangeMyCountry: h.changeMyCountry,
ChangeMyDisplayUserID: h.changeMyDisplayUserID,
ApplyMyPrettyDisplayUserID: h.applyMyPrettyDisplayUserID,
ListAvailablePrettyDisplayIDs: h.listAvailablePrettyDisplayIDs,
ApplyPrettyDisplayIDFromPool: h.applyPrettyDisplayIDFromPool,
ListMyProfileVisitors: h.listMyProfileVisitors,
ListMyFollowing: h.listMyFollowing,
ListMyFriends: h.listMyFriends,
ListMyFriendApplications: h.listMyFriendApplications,
ListCPApplications: h.listCPApplications,
AcceptCPApplication: h.acceptCPApplication,
RejectCPApplication: h.rejectCPApplication,
ListCPRelationships: h.listCPRelationships,
ListCPIntimacyLeaderboard: h.listCPIntimacyLeaderboard,
BreakCPRelationship: h.breakCPRelationship,
GetMyProfile: h.getMyProfile,
GetMyAppearance: h.getMyAppearance,
GetUserAppearance: h.getUserAppearance,
UserSocialAction: h.userSocialAction,
SubmitReport: h.submitReport,
}
}
func (h *Handler) ListRegistrationCountries(writer http.ResponseWriter, request *http.Request) {
h.listRegistrationCountries(writer, request)
}
func (h *Handler) ListLoginRiskBlockedCountries(writer http.ResponseWriter, request *http.Request) {
h.listLoginRiskBlockedCountries(writer, request)
}