package user import ( "nixcn-cms/data" "time" "github.com/gin-gonic/gin" "github.com/google/uuid" ) func Checkin(c *gin.Context) { data := new(data.User) userId, ok := c.Get("user_id") if !ok { c.JSON(401, gin.H{ "status": "unauthorized", }) return } // Get event id from query eventIdOrig, ok := c.GetQuery("event_id") if !ok { c.JSON(400, gin.H{ "status": "undefinded event id", }) return } // Parse event id to uuid eventId, err := uuid.Parse(eventIdOrig) if err != nil { c.JSON(500, gin.H{ "status": "error parsing string to uuid", }) return } data.UpdateCheckin(userId.(uuid.UUID), eventId, time.Now()) c.JSON(200, gin.H{ "status": "success", }) }