Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: include created by details in catalog change api #728

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions query/config_changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,18 @@ func (t *CatalogChangesSearchRequest) Validate() error {
}

type ConfigChangeRow struct {
ExternalChangeId string `gorm:"column:external_change_id" json:"external_change_id"`
ID string `gorm:"primaryKey;unique_index;not null;column:id" json:"id"`
ConfigID string `gorm:"column:config_id;default:''" json:"config_id"`
ChangeType string `gorm:"column:change_type" json:"change_type" faker:"oneof: RunInstances, diff" `
Severity string `gorm:"column:severity" json:"severity" faker:"oneof: critical, high, medium, low, info"`
Source string `gorm:"column:source" json:"source"`
Summary string `gorm:"column:summary;default:null" json:"summary,omitempty"`
CreatedAt *time.Time `gorm:"column:created_at" json:"created_at"`
ConfigName string `gorm:"column:name" json:"name,omitempty"`
ConfigType string `gorm:"column:type" json:"type,omitempty"`
ExternalChangeId string `gorm:"column:external_change_id" json:"external_change_id"`
ID string `gorm:"primaryKey;unique_index;not null;column:id" json:"id"`
ConfigID string `gorm:"column:config_id;default:''" json:"config_id"`
ChangeType string `gorm:"column:change_type" json:"change_type" faker:"oneof: RunInstances, diff"`
Severity string `gorm:"column:severity" json:"severity" faker:"oneof: critical, high, medium, low, info"`
Source string `gorm:"column:source" json:"source"`
Summary string `gorm:"column:summary;default:null" json:"summary,omitempty"`
CreatedAt *time.Time `gorm:"column:created_at" json:"created_at"`
ConfigName string `gorm:"column:name" json:"name,omitempty"`
ConfigType string `gorm:"column:type" json:"type,omitempty"`
CreatedBy *uuid.UUID `gorm:"column:created_by" json:"created_by,omitempty"`
ExternalCreatedBy string `gorm:"column:external_created_by" json:"external_created_by,omitempty"`
}

type CatalogChangesSearchResponse struct {
Expand Down
4 changes: 3 additions & 1 deletion views/006_config_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,9 @@ BEGIN
END IF;

RETURN query
SELECT cc.id, cc.config_id, c.name, c.type, cc.external_created_by, cc.created_at, cc.severity, cc.change_type, cc.source, cc.summary, cc.created_by, c.agent_id
SELECT
cc.id, cc.config_id, c.name, c.type, cc.external_created_by,
cc.created_at, cc.severity, cc.change_type, cc.source, cc.summary, cc.created_by, c.agent_id
FROM config_changes cc
LEFT JOIN config_items c on c.id = cc.config_id
WHERE cc.config_id = lookup_id
Expand Down
Loading