package event import ( "nixcn-cms/internal/exception" "nixcn-cms/service/service_event" "nixcn-cms/utils" "github.com/gin-gonic/gin" "github.com/google/uuid" ) // Info retrieves basic information about a specific event. // // @Summary Get Event Information // @Description Fetches the name, start time, and end time of an event using its UUID. // @Tags Event // @Accept json // @Produce json // @Param event_id query string true "Event UUID" // @Success 200 {object} utils.RespStatus{data=service_event.EventInfoResponse} "Successful retrieval" // @Failure 400 {object} utils.RespStatus{data=nil} "Invalid Input" // @Failure 404 {object} utils.RespStatus{data=nil} "Event Not Found" // @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error" // @Security ApiKeyAuth // @Router /event/info [get] func (self *EventHandler) Info(c *gin.Context) { eventIdOrig := c.Query("event_id") eventId, err := uuid.Parse(eventIdOrig) if err != nil { errorCode := new(exception.Builder). SetStatus(exception.StatusServer). SetService(exception.ServiceEvent). SetEndpoint(exception.EndpointEventServiceInfo). SetType(exception.TypeCommon). SetOriginal(exception.CommonErrorUuidParseFailed). SetError(err). Throw(c). String() utils.HttpResponse(c, 500, errorCode) return } result := self.svc.GetEventInfo(&service_event.EventInfoPayload{ Context: c, Data: &service_event.EventInfoData{ EventId: eventId, }, }) if result.Common.Exception.Original != exception.CommonSuccess { utils.HttpResponse(c, result.Common.HttpCode, result.Common.Exception.String()) return } utils.HttpResponse(c, 200, result.Common.Exception.String(), result.Data) }