feat: support created_at filter for the GET /users endpoint (#15633)

Closes https://github.com/coder/coder/issues/12747

We support these filters currently:
https://coder.com/docs/v2/latest/admin/users#user-filtering, adding
`created_at` filter as well.
This commit is contained in:
Joobi S B
2024-12-17 09:54:54 +05:30
committed by GitHub
parent f16c80916e
commit e191d9650c
8 changed files with 170 additions and 4 deletions

View File

@ -199,6 +199,17 @@ WHERE
last_seen_at >= @last_seen_after
ELSE true
END
-- Filter by created_at
AND CASE
WHEN @created_before :: timestamp with time zone != '0001-01-01 00:00:00Z' THEN
created_at <= @created_before
ELSE true
END
AND CASE
WHEN @created_after :: timestamp with time zone != '0001-01-01 00:00:00Z' THEN
created_at >= @created_after
ELSE true
END
-- End of filters
-- Authorize Filter clause will be injected below in GetAuthorizedUsers