Modify auth middleware
All checks were successful
Build Backend (NixCN CMS) TeamCity build finished
Build Frontend (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-02 13:00:02 +08:00
parent bd8eecbc7d
commit 4dfd4cd529
10 changed files with 41 additions and 89 deletions

View File

@@ -11,26 +11,20 @@ func Info(c *gin.Context) {
eventData := new(data.Event)
eventIdOrig, ok := c.GetQuery("event_id")
if !ok {
c.JSON(400, gin.H{
"status": "undefinded event id",
})
c.JSON(400, gin.H{"status": "undefinded event id"})
return
}
// Parse event id
eventId, err := uuid.Parse(eventIdOrig)
if err != nil {
c.JSON(500, gin.H{
"status": "error parsing string to uuid",
})
c.JSON(500, gin.H{"status": "error parsing string to uuid"})
return
}
event, err := eventData.GetEventById(eventId)
if err != nil {
c.JSON(404, gin.H{
"status": "event id not found",
})
c.JSON(404, gin.H{"status": "event id not found"})
return
}