Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita61ca1f

Browse files
committed
chore: templates return organization display name and icon
1 parent7574a2d commita61ca1f

File tree

6 files changed

+73
-5
lines changed

6 files changed

+73
-5
lines changed

‎coderd/database/dump.sql

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
DROPVIEW template_with_names;
2+
3+
CREATE VIEW
4+
template_with_names
5+
AS
6+
SELECT
7+
templates.*,
8+
coalesce(visible_users.avatar_url,'')AS created_by_avatar_url,
9+
coalesce(visible_users.username,'')AS created_by_username,
10+
coalesce(organizations.name,'')AS organization_name
11+
FROM
12+
templates
13+
LEFT JOIN
14+
visible_users
15+
ON
16+
templates.created_by=visible_users.id
17+
LEFT JOIN
18+
organizations
19+
ONtemplates.organization_id=organizations.id
20+
;
21+
22+
COMMENT ON VIEW template_with_names IS'Joins in the display name information such as username, avatar, and organization name.';
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
-- Update the template_with_names view by recreating it.
2+
DROPVIEW template_with_names;
3+
CREATE VIEW
4+
template_with_names
5+
AS
6+
SELECT
7+
templates.*,
8+
coalesce(visible_users.avatar_url,'')AS created_by_avatar_url,
9+
coalesce(visible_users.username,'')AS created_by_username,
10+
coalesce(organizations.name,'')AS organization_name,
11+
coalesce(organizations.display_name,'')AS organization_display_name,
12+
coalesce(organizations.description,'')AS organization_description,
13+
coalesce(organizations.icon,'')AS organization_icon
14+
FROM
15+
templates
16+
LEFT JOIN
17+
visible_users
18+
ON
19+
templates.created_by=visible_users.id
20+
LEFT JOIN
21+
organizations
22+
ONtemplates.organization_id=organizations.id
23+
;
24+
25+
COMMENT ON VIEW template_with_names IS'Joins in the display name information such as username, avatar, and organization name.';

‎coderd/database/modelqueries.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ func (q *sqlQuerier) GetAuthorizedTemplates(ctx context.Context, arg GetTemplate
117117
&i.CreatedByAvatarURL,
118118
&i.CreatedByUsername,
119119
&i.OrganizationName,
120+
&i.OrganizationDisplayName,
121+
&i.OrganizationDescription,
122+
&i.OrganizationIcon,
120123
);err!=nil {
121124
returnnil,err
122125
}

‎coderd/database/models.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries.sql.go

Lines changed: 16 additions & 4 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp