* INFRA-3664 : Make get users in conversation api more performant * INFRA-3664 : Add apis for incident user sync and get users in incident performance improvements * INFRA-3664 : Self review * INFRA-3664 : Add migration script * INFRA-3664 : Review comments * INFRA-3664 : Constant chanes * INFRA-3664 : Add rate limit constants * INFRA-3664 : Add rate limit constants * INFRA-3664 : Fix failing tests * INFRA-3664 : Add UT's
43 lines
1.0 KiB
Go
43 lines
1.0 KiB
Go
package handler
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/google/uuid"
|
|
"houston/service/requestStatus"
|
|
common "houston/service/response/common"
|
|
"net/http"
|
|
)
|
|
|
|
type RequestStatusHandler struct {
|
|
gin *gin.Engine
|
|
service requestStatus.RequestStatusService
|
|
}
|
|
|
|
func NewRequestStatusHandler(
|
|
gin *gin.Engine,
|
|
requestStatusService requestStatus.RequestStatusService,
|
|
) *RequestStatusHandler {
|
|
return &RequestStatusHandler{
|
|
gin: gin,
|
|
service: requestStatusService,
|
|
}
|
|
}
|
|
|
|
func (handler *RequestStatusHandler) HandleGetRequestStatusByRequestId(c *gin.Context) {
|
|
requestId, err := uuid.Parse(c.Param(REQUEST_ID_PARAM))
|
|
if err != nil {
|
|
c.JSON(http.StatusBadRequest, common.ErrorResponse(err, http.StatusBadRequest, nil))
|
|
return
|
|
}
|
|
|
|
response, err := handler.service.GetRequestStatusByRequestId(requestId)
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, common.ErrorResponse(err, http.StatusInternalServerError, nil))
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, common.SuccessResponse(response, http.StatusOK))
|
|
}
|
|
|
|
const REQUEST_ID_PARAM = "request_id"
|