Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 048f0d1

Browse files
committed
fix: update template updated_at value
1 parent baa3618 commit 048f0d1

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

coderd/database/databasefake/databasefake.go

+2
Original file line numberDiff line numberDiff line change
@@ -1830,6 +1830,7 @@ func (q *fakeQuerier) UpdateTemplateActiveVersionByID(_ context.Context, arg dat
18301830
continue
18311831
}
18321832
template.ActiveVersionID = arg.ActiveVersionID
1833+
template.UpdatedAt = arg.UpdatedAt
18331834
q.templates[index] = template
18341835
return nil
18351836
}
@@ -1845,6 +1846,7 @@ func (q *fakeQuerier) UpdateTemplateDeletedByID(_ context.Context, arg database.
18451846
continue
18461847
}
18471848
template.Deleted = arg.Deleted
1849+
template.UpdatedAt = arg.UpdatedAt
18481850
q.templates[index] = template
18491851
return nil
18501852
}

coderd/database/queries.sql.go

+10-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/templates.sql

+4-2
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,17 @@ VALUES
7373
UPDATE
7474
templates
7575
SET
76-
active_version_id = $2
76+
active_version_id = $2,
77+
updated_at = $3
7778
WHERE
7879
id = $1;
7980

8081
-- name: UpdateTemplateDeletedByID :exec
8182
UPDATE
8283
templates
8384
SET
84-
deleted = $2
85+
deleted = $2,
86+
updated_at = $3
8587
WHERE
8688
id = $1;
8789

coderd/templates.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ func (api *API) deleteTemplate(rw http.ResponseWriter, r *http.Request) {
9696
return
9797
}
9898
err = api.Database.UpdateTemplateDeletedByID(r.Context(), database.UpdateTemplateDeletedByIDParams{
99-
ID: template.ID,
100-
Deleted: true,
99+
ID: template.ID,
100+
Deleted: true,
101+
UpdatedAt: database.Now(),
101102
})
102103
if err != nil {
103104
httpapi.Write(rw, http.StatusInternalServerError, httpapi.Response{

coderd/templateversions.go

+1
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ func (api *API) patchActiveTemplateVersion(rw http.ResponseWriter, r *http.Reque
564564
err = store.UpdateTemplateActiveVersionByID(r.Context(), database.UpdateTemplateActiveVersionByIDParams{
565565
ID: template.ID,
566566
ActiveVersionID: req.ID,
567+
UpdatedAt: database.Now(),
567568
})
568569
if err != nil {
569570
return xerrors.Errorf("update active version: %w", err)

0 commit comments

Comments
 (0)