Skip to content

Commit

Permalink
chore: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed May 2, 2024
1 parent eac8454 commit 8642094
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 0 additions & 2 deletions query/config_changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ type ConfigChangeRow struct {
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"`
AuthorName string `json:"author_name,omitempty"`
AuthorAvatar string `json:"author_avatar,omitempty"`
}

type CatalogChangesSearchResponse struct {
Expand Down
9 changes: 2 additions & 7 deletions views/006_config_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ END;
$$ LANGUAGE plpgsql;

-- related config changes recursively
DROP FUNCTION IF EXISTS related_changes_recursive CASCADE;
CREATE OR REPLACE FUNCTION related_changes_recursive (
lookup_id UUID,
type_filter TEXT DEFAULT 'downstream', -- 'downstream', 'upstream', or 'all'
Expand All @@ -569,9 +568,7 @@ CREATE OR REPLACE FUNCTION related_changes_recursive (
source TEXT,
summary TEXT,
created_by uuid,
agent_id uuid,
author_name TEXT,
author_avatar TEXT
agent_id uuid
) AS $$
BEGIN
IF type_filter NOT IN ('upstream', 'downstream', 'all') THEN
Expand All @@ -581,11 +578,9 @@ BEGIN
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,
COALESCE(p.name, cc.external_created_by, cc.source) AS author_name, p.avatar AS author_avatar
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
LEFT JOIN people p on p.id = cc.created_by
WHERE cc.config_id = lookup_id
OR cc.config_id IN (
SELECT related_config_ids_recursive.id
Expand Down

0 comments on commit 8642094

Please sign in to comment.