Skip to content

feat: audit addition and removal of licenses #6125

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 11 commits into from
Feb 14, 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
Merge remote-tracking branch 'origin/main' into audit-licenses/kira-p…
…ilot
  • Loading branch information
Kira-Pilot committed Feb 14, 2023
commit e66b9a83e4cfdf47af99735d1a051f37b4450090
8 changes: 4 additions & 4 deletions coderd/database/dbfake/databasefake.go
Original file line number Diff line number Diff line change
Expand Up @@ -3860,13 +3860,13 @@ func (q *fakeQuerier) InsertLicense(
return l, nil
}

func (q *fakeQuerier) GetLicense(_ context.Context, id int32) (database.License, error) {
func (q *fakeQuerier) GetLicenseByID(_ context.Context, id int32) (database.License, error) {
q.mutex.RLock()
defer q.mutex.RUnlock()

for _, l := range q.licenses {
if l.ID == id {
return l, nil
for _, license := range q.licenses {
if license.ID == id {
return license, nil
}
}
return database.License{}, sql.ErrNoRows
Expand Down
2 changes: 1 addition & 1 deletion coderd/database/querier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions coderd/database/queries/licenses.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ INSERT INTO
VALUES
($1, $2, $3, $4) RETURNING *;

-- name: GetLicense :one
SELECT *
FROM licenses
WHERE id = $1;

-- name: GetLicenses :many
SELECT *
FROM licenses
Expand Down
2 changes: 1 addition & 1 deletion enterprise/coderd/licenses.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (api *API) deleteLicense(rw http.ResponseWriter, r *http.Request) {
return
}

dl, err := api.Database.GetLicense(ctx, int32(id))
dl, err := api.Database.GetLicenseByID(ctx, int32(id))
if err != nil {
// don't fail the HTTP request simply because we cannot audit
api.Logger.Warn(context.Background(), "could not retrieve license; cannot audit", slog.Error(err))
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.