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} service_event.InfoResult // @Failure 400 {string} string "Invalid Input" // @Failure 404 {string} string "Event Not Found" // @Failure 500 {string} string "Internal Server Error" // @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.Info(&service_event.InfoPayload{ Context: c, Data: &service_event.InfoData{ 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) }