Skip to content

Commit 34003dc

Browse files
committed
feat: create new sql query and generate code
1 parent e97c9db commit 34003dc

File tree

11 files changed

+298
-0
lines changed

11 files changed

+298
-0
lines changed

coderd/apidoc/docs.go

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dbauthz/dbauthz.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3581,6 +3581,10 @@ func (q *querier) OrganizationMembers(ctx context.Context, arg database.Organiza
35813581
return fetchWithPostFilter(q.auth, policy.ActionRead, q.db.OrganizationMembers)(ctx, arg)
35823582
}
35833583

3584+
func (q *querier) PaginatedOrganizationMembers(ctx context.Context, arg database.PaginatedOrganizationMembersParams) ([]database.PaginatedOrganizationMembersRow, error) {
3585+
panic("not implemented")
3586+
}
3587+
35843588
func (q *querier) ReduceWorkspaceAgentShareLevelToAuthenticatedByTemplate(ctx context.Context, templateID uuid.UUID) error {
35853589
template, err := q.db.GetTemplateByID(ctx, templateID)
35863590
if err != nil {

coderd/database/dbmem/dbmem.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9584,6 +9584,15 @@ func (q *FakeQuerier) OrganizationMembers(_ context.Context, arg database.Organi
95849584
return tmp, nil
95859585
}
95869586

9587+
func (q *FakeQuerier) PaginatedOrganizationMembers(ctx context.Context, arg database.PaginatedOrganizationMembersParams) ([]database.PaginatedOrganizationMembersRow, error) {
9588+
err := validateDatabaseType(arg)
9589+
if err != nil {
9590+
return nil, err
9591+
}
9592+
9593+
panic("not implemented")
9594+
}
9595+
95879596
func (q *FakeQuerier) ReduceWorkspaceAgentShareLevelToAuthenticatedByTemplate(_ context.Context, templateID uuid.UUID) error {
95889597
err := validateDatabaseType(templateID)
95899598
if err != nil {

coderd/database/dbmetrics/querymetrics.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dbmock/dbmock.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/querier.go

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

coderd/database/queries/organizationmembers.sql

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,26 @@ WHERE
6666
user_id = @user_id
6767
AND organization_id = @org_id
6868
RETURNING *;
69+
70+
-- name: PaginatedOrganizationMembers :many
71+
SELECT
72+
sqlc.embed(organization_members),
73+
users.username, users.avatar_url, users.name, users.email, users.rbac_roles as "global_roles",
74+
COUNT(*) OVER() AS count
75+
FROM
76+
organization_members
77+
INNER JOIN
78+
users ON organization_members.user_id = users.id AND users.deleted = false
79+
WHERE
80+
-- Filter by organization id
81+
CASE
82+
WHEN @organization_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
83+
organization_id = @organization_id
84+
ELSE true
85+
END
86+
ORDER BY
87+
-- Deterministic and consistent ordering of all users. This is to ensure consistent pagination.
88+
LOWER(username) ASC OFFSET @offset_opt
89+
LIMIT
90+
-- A null limit means "no limit", so 0 means return all
91+
NULLIF(@limit_opt :: int, 0);

docs/reference/api/members.md

Lines changed: 81 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/api/typesGenerated.ts

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)