fix mistake

This commit is contained in:
kandrusyak
2023-07-18 02:21:41 +03:00
parent 03cb8c3e38
commit 46afe2e794
2 changed files with 3 additions and 4 deletions

View File

@@ -8,7 +8,6 @@ import (
"github.com/hashicorp/go-set"
"github.com/labstack/echo/v4"
"net/http"
"strconv"
)
func (h *Handler) CreateEvent(c echo.Context) (err error) {
@@ -91,7 +90,7 @@ func (h *Handler) GetEvents(c echo.Context) (err error) {
func (h *Handler) GetEvent(c echo.Context) error {
var event model.Event
id := c.Param("id")
orgId, err := strconv.Atoi(c.Request().Header.Get("UserOrganizationId"))
orgId, err := uuid.Parse(c.Request().Header.Get("UserOrganizationId"))
if err != nil {
return c.NoContent(http.StatusUnauthorized)
@@ -120,7 +119,7 @@ func (h *Handler) GetEvent(c echo.Context) error {
func (h *Handler) DeleteEvent(c echo.Context) error {
id := c.Param("id")
orgId, err := strconv.Atoi(c.Request().Header.Get("UserOrganizationId"))
orgId, err := uuid.Parse(c.Request().Header.Get("UserOrganizationId"))
if err != nil {
return c.NoContent(http.StatusUnauthorized)

View File

@@ -8,8 +8,8 @@ import (
)
type Event struct {
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primarykey"`
gorm.Model
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primarykey"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
Author User `json:"author" gorm:"-"`