Skip to content

Commit 8b9e1b4

Browse files
coadlerkylecarbs
authored andcommitted
feat: add template description (#1489)
1 parent b76740a commit 8b9e1b4

File tree

16 files changed

+57
-23
lines changed

16 files changed

+57
-23
lines changed

coderd/audit/table.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ var AuditableResources = auditMap(map[any]map[string]Action{
6969
"name": ActionTrack,
7070
"provisioner": ActionTrack,
7171
"active_version_id": ActionTrack,
72+
"description": ActionTrack,
7273
},
7374
&database.TemplateVersion{}: {
7475
"id": ActionTrack,

coderd/coderd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func New(options *Options) (http.Handler, func()) {
144144
r.Get("/provisionerdaemons", api.provisionerDaemonsByOrganization)
145145
r.Post("/templateversions", api.postTemplateVersionsByOrganization)
146146
r.Route("/templates", func(r chi.Router) {
147-
r.Post("/", api.postTemplatesByOrganization)
147+
r.Post("/", api.postTemplateByOrganization)
148148
r.Get("/", api.templatesByOrganization)
149149
r.Get("/{templatename}", api.templateByOrganizationAndName)
150150
})

coderd/coderdtest/coderdtest.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,9 @@ func CreateTemplateVersion(t *testing.T, client *codersdk.Client, organizationID
291291
// compatibility with testing. The name assigned is randomly generated.
292292
func CreateTemplate(t *testing.T, client *codersdk.Client, organization uuid.UUID, version uuid.UUID) codersdk.Template {
293293
template, err := client.CreateTemplate(context.Background(), organization, codersdk.CreateTemplateRequest{
294-
Name: randomUsername(),
295-
VersionID: version,
294+
Name: randomUsername(),
295+
Description: randomUsername(),
296+
VersionID: version,
296297
})
297298
require.NoError(t, err)
298299
return template

coderd/database/databasefake/databasefake.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,7 @@ func (q *fakeQuerier) InsertTemplate(_ context.Context, arg database.InsertTempl
11711171
Name: arg.Name,
11721172
Provisioner: arg.Provisioner,
11731173
ActiveVersionID: arg.ActiveVersionID,
1174+
Description: arg.Description,
11741175
}
11751176
q.templates = append(q.templates, template)
11761177
return template, nil

coderd/database/dump.sql

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE templates DROP COLUMN description;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE templates ADD COLUMN description VARCHAR(128) NOT NULL DEFAULT '';

coderd/database/models.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 14 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/templates.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ INSERT INTO
4646
organization_id,
4747
"name",
4848
provisioner,
49-
active_version_id
49+
active_version_id,
50+
description
5051
)
5152
VALUES
52-
($1, $2, $3, $4, $5, $6, $7) RETURNING *;
53+
($1, $2, $3, $4, $5, $6, $7, $8) RETURNING *;
5354

5455
-- name: UpdateTemplateActiveVersionByID :exec
5556
UPDATE

0 commit comments

Comments
 (0)