Files
supabase/apps/studio/data/auth/auth.sql.ts
T
Joshen LimandAli Waseem b94538268b Joshen/fe 2558 shift sql queries to contextual folders update codeowners (#42770)
## Context

Related to Dashboard Scalability, specifically having Postgres team as
CODEOWNERS for dashboard queries

This is just a clean up as we're currently piling manual queries into
one folder under `data/sql/queries`, whereas I reckon it'll be better
for each query to sit within their RQ folder for better context.

Am opting the naming format for files housing queries to be `*.sql.ts`,
and also updating CODEOWNERS to reflect as such

Next step will also be to shift all the dashboard queries within pg-meta
into studio itself as requested by the pg-meta team

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Consolidated and reorganized internal module structure for the data
layer to improve maintainability and reduce redundancy.
* Streamlined import paths across components to align with new
consolidated module organization.

* **Chores**
* Updated code ownership patterns to reflect reorganized file structure.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Ali Waseem <waseema393@gmail.com>
2026-02-16 18:34:08 +00:00

36 lines
706 B
TypeScript

export const getUserSQL = (userId: string) => {
const sql = /* SQL */ `
select
auth.users.id,
auth.users.email,
auth.users.banned_until,
auth.users.created_at,
auth.users.confirmed_at,
auth.users.confirmation_sent_at,
auth.users.is_anonymous,
auth.users.is_sso_user,
auth.users.invited_at,
auth.users.last_sign_in_at,
auth.users.phone,
auth.users.raw_app_meta_data,
auth.users.raw_user_meta_data,
auth.users.updated_at,
coalesce(
(
select
array_agg(distinct i.provider)
from
auth.identities i
where
i.user_id = users.id
),
'{}'::text[]
) as providers
from
auth.users
where id = '${userId}';
`.trim()
return sql
}