Skip to content

Commit

Permalink
default label color (#70)
Browse files Browse the repository at this point in the history
fixes #70
  • Loading branch information
dheidemann committed Jul 27, 2024
1 parent 4a1bb3d commit 9b48e1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ mutation {
```

### `addLabel`
Adds a new event label. `kind` takes `TOPIC` or `EVENT_TYPE` as value.
Adds a new event label. `kind` takes `TOPIC` or `EVENT_TYPE` as value. *Note: when no coler provided, default is #F1F5F9*
#### Arguments:
- `label: NewLabel!` - Details of the new label.

Expand Down
6 changes: 5 additions & 1 deletion server/graph/schema.resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,14 @@ func (r *mutationResolver) DeleteRoom(ctx context.Context, number string, buildi

// AddLabel is the resolver for the addLabel field.
func (r *mutationResolver) AddLabel(ctx context.Context, label models.Label) (string, error) {
if label.Color == "" {
label.Color = "#F1F5F9"
}

if _, err := r.DB.NewInsert().
Model(&label).
Exec(ctx); err != nil {
return "Failed to insert topic", err
return "", fmt.Errorf("failed to insert label: %s", err)
}

return "Successfully inserted new label", nil
Expand Down

0 comments on commit 9b48e1a

Please sign in to comment.