34 lines
972 B
Go
34 lines
972 B
Go
package activityapi
|
|
|
|
import (
|
|
"hyapp/services/gateway-service/internal/client"
|
|
"hyapp/services/gateway-service/internal/transport/http/httproutes"
|
|
)
|
|
|
|
// Handler owns activity-facing HTTP endpoints.
|
|
// It keeps task and registration reward reads/writes behind activity-service, with gateway only adding auth context.
|
|
type Handler struct {
|
|
taskClient client.TaskClient
|
|
registrationReward client.RegistrationRewardClient
|
|
}
|
|
|
|
type Config struct {
|
|
TaskClient client.TaskClient
|
|
RegistrationReward client.RegistrationRewardClient
|
|
}
|
|
|
|
func New(config Config) *Handler {
|
|
return &Handler{
|
|
taskClient: config.TaskClient,
|
|
registrationReward: config.RegistrationReward,
|
|
}
|
|
}
|
|
|
|
func (h *Handler) TaskHandlers() httproutes.TaskHandlers {
|
|
return httproutes.TaskHandlers{
|
|
ListTaskTabs: h.listTaskTabs,
|
|
ClaimTaskReward: h.claimTaskReward,
|
|
GetRegistrationRewardEligibility: h.getRegistrationRewardEligibility,
|
|
}
|
|
}
|