INFRA-2887 : Upsert users cron refactor (#412)
* INFRA-2887 : Upsert users cron refactor * INFRA-2887 : Review changes * INFRA-2887 : added UT's * INFRA-2887 : Second round review changes * INFRA-2887 : Add default ack * INFRA-2887 : Add default ack * INFRA-2887 : make flow async
This commit is contained in:
22
cmd/app/handler/user_handler.go
Normal file
22
cmd/app/handler/user_handler.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
common "houston/service/response/common"
|
||||
userService "houston/service/user"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type UserHandler struct {
|
||||
gin *gin.Engine
|
||||
service userService.UserService
|
||||
}
|
||||
|
||||
func NewUserHandler(gin *gin.Engine, service userService.UserService) *UserHandler {
|
||||
return &UserHandler{gin: gin, service: service}
|
||||
}
|
||||
|
||||
func (handler *UserHandler) HandleUpsertHoustonUsers(c *gin.Context) {
|
||||
handler.service.UpsertUsers()
|
||||
c.JSON(http.StatusOK, common.SuccessResponse("Acknowledged request to upsert users", http.StatusOK))
|
||||
}
|
||||
@@ -290,8 +290,11 @@ func (s *Server) usersHandler(houstonGroup *gin.RouterGroup) {
|
||||
|
||||
houstonGroup.GET("/users/:id", usersHandler.GetUserInfo)
|
||||
houstonGroup.GET("/users", usersHandler.GetUsersInConversation)
|
||||
houstonGroup.GET("/users/update", usersHandler.UpdateHoustonUsers)
|
||||
houstonGroup.GET("/bots", usersHandler.GetAllHoustonUserBots)
|
||||
|
||||
usersHandlerV2 := handler.NewUserHandler(s.gin, appcontext.GetUserService())
|
||||
|
||||
houstonGroup.PUT("/users", usersHandlerV2.HandleUpsertHoustonUsers)
|
||||
}
|
||||
func (s *Server) filtersHandler(houstonGroup *gin.RouterGroup) {
|
||||
filtersHandler := service.NewFilterService(s.gin, s.db)
|
||||
|
||||
Reference in New Issue
Block a user