Skip to content

Commit 083bf7f

Browse files
committed
fix: updates for pr review
1 parent 9e4ceea commit 083bf7f

File tree

9 files changed

+9
-13
lines changed

9 files changed

+9
-13
lines changed

coderd/database/dbauthz/dbauthz.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3737,7 +3737,6 @@ func (q *querier) UpdateOrganizationDeletedByID(ctx context.Context, arg databas
37373737
deleteF := func(ctx context.Context, id uuid.UUID) error {
37383738
return q.db.UpdateOrganizationDeletedByID(ctx, database.UpdateOrganizationDeletedByIDParams{
37393739
ID: id,
3740-
Deleted: true,
37413740
UpdatedAt: dbtime.Now(),
37423741
})
37433742
}

coderd/database/dbmem/dbmem.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3680,7 +3680,7 @@ func (q *FakeQuerier) GetOrganizationByName(_ context.Context, params database.G
36803680
defer q.mutex.RUnlock()
36813681

36823682
for _, organization := range q.organizations {
3683-
if organization.Name == params.Name {
3683+
if organization.Name == params.Name && organization.Deleted == params.Deleted {
36843684
return organization, nil
36853685
}
36863686
}
@@ -3737,7 +3737,7 @@ func (q *FakeQuerier) GetOrganizationsByUserID(_ context.Context, arg database.G
37373737
continue
37383738
}
37393739
for _, organization := range q.organizations {
3740-
if organization.ID != organizationMember.OrganizationID {
3740+
if organization.ID != organizationMember.OrganizationID || organization.Deleted != arg.Deleted {
37413741
continue
37423742
}
37433743
organizations = append(organizations, organization)
@@ -9821,7 +9821,7 @@ func (q *FakeQuerier) UpdateOrganizationDeletedByID(_ context.Context, arg datab
98219821
if organization.ID != arg.ID || organization.IsDefault {
98229822
continue
98239823
}
9824-
organization.Deleted = arg.Deleted
9824+
organization.Deleted = true
98259825
organization.UpdatedAt = arg.UpdatedAt
98269826
q.organizations[index] = organization
98279827
return nil

coderd/database/dbmetrics/querymetrics.go

Lines changed: 0 additions & 1 deletion
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: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/organizations.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ RETURNING *;
8989
-- name: UpdateOrganizationDeletedByID :exec
9090
UPDATE organizations
9191
SET
92-
deleted = @deleted,
92+
deleted = true,
9393
updated_at = @updated_at
9494
WHERE
9595
id = @id AND

enterprise/audit/table.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ var auditableResourcesTypes = map[any]map[string]Action{
275275
"id": ActionIgnore,
276276
"name": ActionTrack,
277277
"description": ActionTrack,
278-
"deleted": ActionIgnore,
278+
"deleted": ActionTrack,
279279
"created_at": ActionIgnore,
280280
"updated_at": ActionTrack,
281281
"is_default": ActionTrack,

enterprise/coderd/organizations.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ func (api *API) deleteOrganization(rw http.ResponseWriter, r *http.Request) {
153153
err := api.Database.InTx(func(tx database.Store) error {
154154
err := tx.UpdateOrganizationDeletedByID(ctx, database.UpdateOrganizationDeletedByIDParams{
155155
ID: organization.ID,
156-
Deleted: true,
157156
UpdatedAt: dbtime.Now(),
158157
})
159158
if err != nil {

0 commit comments

Comments
 (0)