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

Skip to content

Commit 4d8e565

Browse files
committed
Fix model queries
1 parent 32168a5 commit 4d8e565

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

coderd/database/modelqueries.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ func (q *sqlQuerier) GetAuthorizedWorkspaces(ctx context.Context, arg GetWorkspa
218218
func (q *sqlQuerier) GetAuthorizedWorkspaceCount(ctx context.Context, arg GetWorkspaceCountParams, authorizedFilter rbac.AuthorizeFilter) (int64, error) {
219219
// In order to properly use ORDER BY, OFFSET, and LIMIT, we need to inject the
220220
// authorizedFilter between the end of the where clause and those statements.
221-
filter := strings.Replace(getWorkspaces, "-- @authorize_filter", fmt.Sprintf(" AND %s", authorizedFilter.SQLString(rbac.NoACLConfig())), 1)
221+
filter := strings.Replace(getWorkspaceCount, "-- @authorize_filter", fmt.Sprintf(" AND %s", authorizedFilter.SQLString(rbac.NoACLConfig())), 1)
222222
// The name comment is for metric tracking
223-
query := fmt.Sprintf("-- name: GetAuthorizedWorkspaces :many\n%s", filter)
223+
query := fmt.Sprintf("-- name: GetAuthorizedWorkspaceCount :many\n%s", filter)
224224
rows, err := q.db.QueryContext(ctx, query,
225225
arg.Deleted,
226226
arg.Status,
@@ -229,8 +229,6 @@ func (q *sqlQuerier) GetAuthorizedWorkspaceCount(ctx context.Context, arg GetWor
229229
arg.TemplateName,
230230
pq.Array(arg.TemplateIds),
231231
arg.Name,
232-
arg.Offset,
233-
arg.Limit,
234232
)
235233
if err != nil {
236234
return 0, xerrors.Errorf("get authorized workspaces: %w", err)

0 commit comments

Comments
 (0)