Skip to content

Commit

Permalink
Fix event updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaptoss committed Sep 24, 2024
1 parent 3bc9a3c commit e959b35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion internal/service/handlers/update_event_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@ func UpdateEventType(w http.ResponseWriter, r *http.Request) {
return
}

typeModel := models.ResourceToModel(req.Data.Attributes)
typeModel := *evType
model := req.Data.Attributes
typeModel.Description = model.Description
typeModel.ShortDescription = model.ShortDescription
typeModel.Reward = model.Reward
typeModel.Title = model.Title
typeModel.AutoClaim = model.AutoClaim
typeModel.Disabled = model.Disabled
typeModel.ActionURL = model.ActionUrl
typeModel.Logo = model.Logo

var updated []models.EventType
err = EventsQ(r).Transaction(func() error {
Expand Down
4 changes: 2 additions & 2 deletions internal/service/requests/update_event_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func NewUpdateEventType(r *http.Request) (req resources.EventTypeResponse, err e
// not updatable, as QR code includes event type name
"data/attributes/qr_code_value": val.Validate(attr.QrCodeValue, val.Empty),

"data/attributes/poll_event_id": val.Validate(attr.PollEventId, val.Nil),
"data/attributes/poll_contract": val.Validate(attr.PollContract, val.Nil),
"data/attributes/poll_event_id": val.Validate(attr.PollEventId, val.Empty),
"data/attributes/poll_contract": val.Validate(attr.PollContract, val.Empty),
// these fields are not currently supported, because cron jobs implementation is required
"data/attributes/starts_at": val.Validate(attr.StartsAt, val.Empty),
"data/attributes/expires_at": val.Validate(attr.ExpiresAt, val.Empty),
Expand Down

0 comments on commit e959b35

Please sign in to comment.