feat(supabase): auth, profile and roles services; professional columns on profiles; OAuth + TOTP config
- packages/supabase: signIn/signUp/OAuth/reset/updatePassword/signOut wrappers with a closed AuthFailure kind, fetch/update own profile, own platform roles - migration 20261011100000: practice_name, professional_title, siret (format-checked, column grants); pgTAP 009; database.types regenerated - config.toml: TOTP enroll/verify on, [auth.external.google|apple] via env(), wildcard redirect URLs - app config: authProviders (APP_AUTH_PROVIDERS / VITE_AUTH_PROVIDERS), entrypoint env.js, DEPLOY table - TODO: Step 7 plan
This commit is contained in:
1 parent
c746952d7f
commit
b10b227ee9
13 files changed
+427
-10
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import type { FaunosteoClient } from './client'
|
||||
import type { Enums } from './database.types'
|
||||
|
||||
export type PlatformRole = Enums<'platform_role'>
|
||||
|
||||
/** Active platform roles of the signed-in user (RLS: own rows, or any as admin). */
|
||||
export async function fetchOwnPlatformRoles(
|
||||
client: FaunosteoClient,
|
||||
userId: string,
|
||||
): Promise<PlatformRole[]> {
|
||||
const { data, error } = await client
|
||||
.from('profile_roles')
|
||||
.select('role')
|
||||
.eq('user_id', userId)
|
||||
.is('revoked_at', null)
|
||||
if (error) throw new Error(error.message, { cause: error })
|
||||
return data.map((row) => row.role)
|
||||
}
|
||||
Reference in new issue
Block a user