diff --git a/server/kolide/queries.go b/server/kolide/queries.go index c5f320b107..003ddd8171 100644 --- a/server/kolide/queries.go +++ b/server/kolide/queries.go @@ -25,6 +25,7 @@ type QueryService interface { type QueryPayload struct { Name *string + Description *string Query *string Interval *uint Snapshot *bool @@ -43,6 +44,7 @@ type Query struct { CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` Name string `json:"name" gorm:"not null;unique_index:idx_query_unique_name"` + Description string `json:"description"` Query string `json:"query" gorm:"not null"` Interval uint `json:"interval"` Snapshot bool `json:"snapshot"` diff --git a/server/service/service_queries.go b/server/service/service_queries.go index a908e7b465..2defa7831a 100644 --- a/server/service/service_queries.go +++ b/server/service/service_queries.go @@ -20,6 +20,10 @@ func (svc service) NewQuery(ctx context.Context, p kolide.QueryPayload) (*kolide query.Name = *p.Name } + if p.Description != nil { + query.Description = *p.Description + } + if p.Query != nil { query.Query = *p.Query } @@ -61,6 +65,10 @@ func (svc service) ModifyQuery(ctx context.Context, id uint, p kolide.QueryPaylo query.Name = *p.Name } + if p.Description != nil { + query.Description = *p.Description + } + if p.Query != nil { query.Query = *p.Query }