diff --git a/server/README.md b/server/README.md index ae7d0aa..057108a 100644 --- a/server/README.md +++ b/server/README.md @@ -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. diff --git a/server/graph/schema.resolvers.go b/server/graph/schema.resolvers.go index 064bfbd..8693837 100644 --- a/server/graph/schema.resolvers.go +++ b/server/graph/schema.resolvers.go @@ -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