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

Commit44a70a5

Browse files
authored
feat: edit org display names and descriptions (#13474)
1 parent1131772 commit44a70a5

22 files changed

+359
-90
lines changed

‎coderd/apidoc/docs.go

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

‎coderd/apidoc/swagger.json

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

‎coderd/database/dbgen/dbgen.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ func Organization(t testing.TB, db database.Store, orig database.Organization) d
336336
org,err:=db.InsertOrganization(genCtx, database.InsertOrganizationParams{
337337
ID:takeFirst(orig.ID,uuid.New()),
338338
Name:takeFirst(orig.Name,namesgenerator.GetRandomName(1)),
339+
DisplayName:takeFirst(orig.Name,namesgenerator.GetRandomName(1)),
339340
Description:takeFirst(orig.Description,namesgenerator.GetRandomName(1)),
340341
CreatedAt:takeFirst(orig.CreatedAt,dbtime.Now()),
341342
UpdatedAt:takeFirst(orig.UpdatedAt,dbtime.Now()),

‎coderd/database/dbmem/dbmem.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ func New() database.Store {
8686
defaultOrg,err:=q.InsertOrganization(context.Background(), database.InsertOrganizationParams{
8787
ID:uuid.New(),
8888
Name:"first-organization",
89+
DisplayName:"first-organization",
8990
Description:"Builtin default organization.",
9091
CreatedAt:dbtime.Now(),
9192
UpdatedAt:dbtime.Now(),
@@ -6179,11 +6180,13 @@ func (q *FakeQuerier) InsertOrganization(_ context.Context, arg database.InsertO
61796180
deferq.mutex.Unlock()
61806181

61816182
organization:= database.Organization{
6182-
ID:arg.ID,
6183-
Name:arg.Name,
6184-
CreatedAt:arg.CreatedAt,
6185-
UpdatedAt:arg.UpdatedAt,
6186-
IsDefault:len(q.organizations)==0,
6183+
ID:arg.ID,
6184+
Name:arg.Name,
6185+
DisplayName:arg.DisplayName,
6186+
Description:arg.Description,
6187+
CreatedAt:arg.CreatedAt,
6188+
UpdatedAt:arg.UpdatedAt,
6189+
IsDefault:len(q.organizations)==0,
61876190
}
61886191
q.organizations=append(q.organizations,organization)
61896192
returnorganization,nil
@@ -7324,6 +7327,8 @@ func (q *FakeQuerier) UpdateOrganization(_ context.Context, arg database.UpdateO
73247327
fori,org:=rangeq.organizations {
73257328
iforg.ID==arg.ID {
73267329
org.Name=arg.Name
7330+
org.DisplayName=arg.DisplayName
7331+
org.Description=arg.Description
73277332
q.organizations[i]=org
73287333
returnorg,nil
73297334
}

‎coderd/database/dump.sql

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
altertable organizations
2+
drop column display_name;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- This default is just a temporary thing to avoid null errors when first creating the column.
2+
altertable organizations
3+
add column display_nametextnot null default'';
4+
5+
update organizations
6+
set display_name= name;
7+
8+
-- We can remove the default now that everything has been copied.
9+
altertable organizations
10+
alter column display_name drop default;

‎coderd/database/models.go

Lines changed: 1 addition & 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: 33 additions & 14 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/organizations.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,19 @@ WHERE
4949

5050
-- name: InsertOrganization :one
5151
INSERT INTO
52-
organizations (id,"name", description, created_at, updated_at, is_default)
52+
organizations (id,"name",display_name,description, created_at, updated_at, is_default)
5353
VALUES
5454
-- If no organizations exist, and this is the first, make it the default.
55-
($1, $2, $3, $4, $5, (SELECT TRUEFROM organizationsLIMIT1) ISNULL) RETURNING*;
55+
(@id, @name, @display_name, @description, @created_at, @updated_at, (SELECT TRUEFROM organizationsLIMIT1) ISNULL) RETURNING*;
5656

5757
-- name: UpdateOrganization :one
5858
UPDATE
5959
organizations
6060
SET
6161
updated_at= @updated_at,
62-
name= @name
62+
name= @name,
63+
display_name= @display_name,
64+
description= @description
6365
WHERE
6466
id= @id
6567
RETURNING*;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp