api/graph: Make createLabel consistent with updateLabel
Rename createLabel parameter names to match those used in UpdateLabelInput.
This commit is contained in:
parent
9a205600aa
commit
8dd35065ed
|
@ -883,7 +883,7 @@ type Mutation {
|
|||
red.
|
||||
"""
|
||||
createLabel(trackerId: Int!, name: String!,
|
||||
foreground: String!, background: String!): Label @access(scope: TRACKERS, kind: RW)
|
||||
foregroundColor: String!, backgroundColor: String!): Label @access(scope: TRACKERS, kind: RW)
|
||||
|
||||
"Changes the name or colors for a label."
|
||||
updateLabel(id: Int!, input: UpdateLabelInput!): Label @access(scope: TRACKERS, kind: RW)
|
||||
|
|
|
@ -516,16 +516,16 @@ func (r *mutationResolver) TicketUnsubscribe(ctx context.Context, trackerID int,
|
|||
return &sub, nil
|
||||
}
|
||||
|
||||
func (r *mutationResolver) CreateLabel(ctx context.Context, trackerID int, name string, foreground string, background string) (*model.Label, error) {
|
||||
func (r *mutationResolver) CreateLabel(ctx context.Context, trackerID int, name string, foregroundColor string, backgroundColor string) (*model.Label, error) {
|
||||
var (
|
||||
err error
|
||||
label model.Label
|
||||
)
|
||||
user := auth.ForContext(ctx)
|
||||
if _, err = parseColor(foreground); err != nil {
|
||||
if _, err = parseColor(foregroundColor); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, err = parseColor(background); err != nil {
|
||||
if _, err = parseColor(backgroundColor); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(name) <= 0 {
|
||||
|
@ -551,7 +551,7 @@ func (r *mutationResolver) CreateLabel(ctx context.Context, trackerID int, name
|
|||
NOW() at time zone 'utc',
|
||||
$1, $2, $3, $4
|
||||
) RETURNING id, created, name, color, text_color, tracker_id;
|
||||
`, tracker.ID, name, background, foreground)
|
||||
`, tracker.ID, name, backgroundColor, foregroundColor)
|
||||
|
||||
if err := row.Scan(&label.ID, &label.Created, &label.Name,
|
||||
&label.BackgroundColor, &label.ForegroundColor,
|
||||
|
|
|
@ -281,12 +281,12 @@ def tracker_labels_POST(owner, name):
|
|||
**valid.kwargs), 400
|
||||
|
||||
exec_gql(current_app.site, """
|
||||
mutation CreateLabel($trackerId: Int!, $name: String!, $foreground: String!, $background: String!) {
|
||||
createLabel(trackerId: $trackerId, name: $name, foreground: $foreground, background: $background) {
|
||||
mutation CreateLabel($trackerId: Int!, $name: String!, $foregroundColor: String!, $backgroundColor: String!) {
|
||||
createLabel(trackerId: $trackerId, name: $name, foregroundColor: $foregroundColor, backgroundColor: $backgroundColor) {
|
||||
id
|
||||
}
|
||||
}
|
||||
""", valid=valid, trackerId=tracker.id, name=data["name"], foreground=data["text_color"], background=data["color"])
|
||||
""", valid=valid, trackerId=tracker.id, name=data["name"], foregroundColor=data["text_color"], backgroundColor=data["color"])
|
||||
|
||||
if not valid.ok:
|
||||
return render_template("tracker-labels.html",
|
||||
|
|
Loading…
Reference in New Issue