Skip to content

feat(coder): Add PATCH /templateversions/:templateversion endpoint #6698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix a few tests
  • Loading branch information
BrunoQuaresma committed Mar 21, 2023
commit 7be61cdc93ccf92a39672e5e8446b16d70265b2b
2 changes: 1 addition & 1 deletion coderd/database/dbauthz/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ func (s *MethodTestSuite) TestTemplate() {
check.Args(database.UpdateTemplateVersionByIDParams{
ID: tv.ID,
TemplateID: uuid.NullUUID{UUID: t1.ID, Valid: true},
}).Asserts(t1, rbac.ActionUpdate).Returns()
}).Asserts(t1, rbac.ActionUpdate).Returns(tv)
}))
s.Run("UpdateTemplateVersionDescriptionByJobID", s.Subtest(func(db database.Store, check *expects) {
jobID := uuid.New()
Expand Down
1 change: 1 addition & 0 deletions coderd/templateversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (api *API) templateVersion(rw http.ResponseWriter, r *http.Request) {
// @Summary Patch template version by ID
// @ID patch-template-version-by-id
// @Security CoderSessionToken
// @Accept json
// @Produce json
// @Tags Templates
// @Param templateversion path string true "Template version ID" format(uuid)
Expand Down
4 changes: 2 additions & 2 deletions codersdk/templateversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ func (c *Client) PreviousTemplateVersion(ctx context.Context, organization uuid.
return version, json.NewDecoder(res.Body).Decode(&version)
}

func (c *Client) UpdateTemplateVersion(ctx context.Context, versionId uuid.UUID, req PatchTemplateVersionRequest) (TemplateVersion, error) {
res, err := c.Request(ctx, http.MethodPatch, fmt.Sprintf("/api/v2/templateversions/%s", versionId), req)
func (c *Client) UpdateTemplateVersion(ctx context.Context, versionID uuid.UUID, req PatchTemplateVersionRequest) (TemplateVersion, error) {
res, err := c.Request(ctx, http.MethodPatch, fmt.Sprintf("/api/v2/templateversions/%s", versionID), req)
if err != nil {
return TemplateVersion{}, err
}
Expand Down