Add description field to Query (#358)

This commit is contained in:
Mike Arpaia 2016-10-31 17:05:02 -04:00 committed by GitHub
parent cd7f925fdb
commit 4f83220870
2 changed files with 10 additions and 0 deletions

View File

@ -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"`

View File

@ -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
}