72 lines
2.5 KiB
Go
72 lines
2.5 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
|
|
broadcastClient client.BroadcastClient
|
|
}
|
|
|
|
type Config struct {
|
|
UserIdentityClient client.UserIdentityClient
|
|
UserProfileClient client.UserProfileClient
|
|
UserSocialClient client.UserSocialClient
|
|
UserCountryClient client.UserCountryQueryClient
|
|
UserHostClient client.UserHostClient
|
|
WalletClient client.WalletClient
|
|
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,
|
|
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,
|
|
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,
|
|
UserSocialAction: h.userSocialAction,
|
|
}
|
|
}
|
|
|
|
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)
|
|
}
|