30 lines
633 B
Go
30 lines
633 B
Go
package events
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
core "fr.latosa-escrima/core"
|
|
"fr.latosa-escrima/core/models"
|
|
)
|
|
|
|
func HandleEvent(w http.ResponseWriter, r *http.Request) {
|
|
event_uuid := r.PathValue("event_uuid")
|
|
var event models.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
|
|
}
|