The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: auth users search (#20362)
hallidayo97a38375f057
diff --git a/apps/studio/components/interfaces/Auth/Users/UsersV1/Users.tsx b/apps/studio/components/interfaces/Auth/Users/UsersV1/Users.tsxindex 15453e9fb30..d4d85ef1dda 100644--- a/apps/studio/components/interfaces/Auth/Users/UsersV1/Users.tsx+++ b/apps/studio/components/interfaces/Auth/Users/UsersV1/Users.tsx@@ -81,10 +81,10 @@ export const Users = () => {onKeyDown={(e) => {if (e.keyCode == 13) setFilterKeywords(search)}}- className="min-w-[275px]"+ className="min-w-[300px]"name="email"id="email"- placeholder="Search by email or phone number"+ placeholder="Search by email, phone number or UID"icon={<Search size={14} />}actions={[search && (diff --git a/apps/studio/components/interfaces/Auth/Users/UsersV2.tsx b/apps/studio/components/interfaces/Auth/Users/UsersV2.tsxindex 0ad52b0b5b7..e0dc2d0a536 100644--- a/apps/studio/components/interfaces/Auth/Users/UsersV2.tsx+++ b/apps/studio/components/interfaces/Auth/Users/UsersV2.tsx@@ -385,7 +385,7 @@ export const UsersV2 = () => {size="tiny"className="w-64"icon={<Search size={14} className="text-foreground-lighter" />}- placeholder="Search by email or phone number"+ placeholder="Search by email, phone number or UID"value={search}onChange={(e) => setSearch(e.target.value)}onKeyDown={(e) => {diff --git a/apps/studio/pages/api/auth/[ref]/users.ts b/apps/studio/pages/api/auth/[ref]/users.tsindex 536b8591808..5acfcfd044c 100644--- a/apps/studio/pages/api/auth/[ref]/users.ts+++ b/apps/studio/pages/api/auth/[ref]/users.ts@@ -35,12 +35,13 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {let queryUsers = ''if (hasValidKeywords && !hasVerifiedValue) {- queryCount = SqlString.format('SELECT count(*) from auth.users WHERE email ilike ?;', [- `%${keywords}%`,- ])+ queryCount = SqlString.format(+ 'SELECT count(*) from auth.users WHERE (email ilike ? OR id::text ilike ?);',+ [`%${keywords}%`, `%${keywords}%`]+ )queryUsers = SqlString.format(- 'SELECT * from auth.users WHERE email ilike ? ORDER BY created_at DESC LIMIT ? OFFSET ?;',- [`%${keywords}%`, limitInt, offsetInt]+ 'SELECT * from auth.users WHERE (email ilike ? OR id::text ilike ?) ORDER BY created_at DESC LIMIT ? OFFSET ?;',+ [`%${keywords}%`, `%${keywords}%`, limitInt, offsetInt])}@@ -68,22 +69,22 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {if (hasValidKeywords && hasVerifiedValue) {if (verified === 'verified') {queryCount = SqlString.format(- 'SELECT count(*) from auth.users WHERE (email_confirmed_at IS NOT NULL or phone_confirmed_at IS NOT NULL) AND email ilike ?;',- [`%${keywords}%`]+ 'SELECT count(*) from auth.users WHERE (email_confirmed_at IS NOT NULL or phone_confirmed_at IS NOT NULL) AND (email ilike ? OR id::text ilike ?);',+ [`%${keywords}%`, `%${keywords}%`])queryUsers = SqlString.format(- 'SELECT * from auth.users WHERE (email_confirmed_at IS NOT NULL or phone_confirmed_at IS NOT NULL) AND email ilike ? ORDER BY created_at DESC LIMIT ? OFFSET ?;',- [`%${keywords}%`, limitInt, offsetInt]+ 'SELECT * from auth.users WHERE (email_confirmed_at IS NOT NULL or phone_confirmed_at IS NOT NULL) AND (email ilike ? OR id::text ilike ?) ORDER BY created_at DESC LIMIT ? OFFSET ?;',+ [`%${keywords}%`, `%${keywords}%`, limitInt, offsetInt])}if (verified === 'unverified') {queryCount = SqlString.format(- 'SELECT count(*) from auth.users WHERE (email_confirmed_at IS NULL AND phone_confirmed_at IS NULL) AND email ilike ?;',- [`%${keywords}%`]+ 'SELECT count(*) from auth.users WHERE (email_confirmed_at IS NULL AND phone_confirmed_at IS NULL) AND (email ilike ? OR id::text ilike ?);',+ [`%${keywords}%`, `%${keywords}%`])queryUsers = SqlString.format(- 'SELECT * from auth.users WHERE (email_confirmed_at IS NULL AND phone_confirmed_at IS NULL) AND email ilike ? ORDER BY created_at DESC LIMIT ? OFFSET ?;',- [`%${keywords}%`, limitInt, offsetInt]+ 'SELECT * from auth.users WHERE (email_confirmed_at IS NULL AND phone_confirmed_at IS NULL) AND (email ilike ? OR id::text ilike ?) ORDER BY created_at DESC LIMIT ? OFFSET ?;',+ [`%${keywords}%`, `%${keywords}%`, limitInt, offsetInt])}}