88 lines
3.4 KiB
Go
88 lines
3.4 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
|
|
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
|
|
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,
|
|
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,
|
|
GetMyIdentity: h.getMyIdentity,
|
|
GetMyHostIdentity: h.getMyHostIdentity,
|
|
GetMyRoleSummary: h.getMyRoleSummary,
|
|
SearchHostAgencies: h.searchHostAgencies,
|
|
ApplyToHostAgency: h.applyToHostAgency,
|
|
GetAgencyCenterOverview: h.getAgencyCenterOverview,
|
|
ListAgencyCenterHosts: h.listAgencyCenterHosts,
|
|
ListAgencyCenterApplications: h.listAgencyCenterApplications,
|
|
ReviewAgencyCenterApplication: h.reviewAgencyCenterApplication,
|
|
RemoveAgencyCenterHost: h.removeAgencyCenterHost,
|
|
CompleteMyOnboarding: h.completeMyOnboarding,
|
|
UpdateMyProfile: h.updateMyProfile,
|
|
ChangeMyCountry: h.changeMyCountry,
|
|
ChangeMyDisplayUserID: h.changeMyDisplayUserID,
|
|
ApplyMyPrettyDisplayUserID: h.applyMyPrettyDisplayUserID,
|
|
ListMyProfileVisitors: h.listMyProfileVisitors,
|
|
ListMyFollowing: h.listMyFollowing,
|
|
ListMyFriends: h.listMyFriends,
|
|
ListMyFriendApplications: h.listMyFriendApplications,
|
|
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)
|
|
}
|