Files
latosa-escrima/backend/api/get_event.go
2025-01-27 11:37:13 +01:00

29 lines
603 B
Go

package api
import (
"context"
"net/http"
core "fr.latosa-escrima/api/core"
)
func HandleGetEvent(w http.ResponseWriter, r *http.Request) {
event_uuid := r.PathValue("event_uuid")
var event core.Event
_, err := core.DB.NewSelect().Model(&event).Where("uuid = ?", event_uuid).ScanAndCount(context.Background())
if err != nil {
core.JSONError{
Status: core.Error,
Message: err.Error(),
}.Respond(w, http.StatusInternalServerError)
return
}
core.JSONSuccess{
Status: core.Success,
Message: "Event successfully sent",
Data: event,
}.Respond(w, http.StatusOK)
return
}