mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-29 22:32:40 +03:00
81b57c504a
* feat: add 20230717173000_add_get_user_id_by_user_email * feat(ShareableBrain): add update access endpoint * feat(sdk): add updateBrainAccess * feat: add brain access control * feat: improve ux
18 lines
476 B
PL/PgSQL
18 lines
476 B
PL/PgSQL
CREATE OR REPLACE FUNCTION public.get_user_id_by_user_email(user_email text)
|
|
RETURNS TABLE (user_id uuid)
|
|
SECURITY DEFINER
|
|
AS $$
|
|
BEGIN
|
|
RETURN QUERY SELECT au.id::uuid FROM auth.users au WHERE au.email = user_email;
|
|
END;
|
|
$$ LANGUAGE plpgsql;
|
|
|
|
-- Update migrations table
|
|
INSERT INTO migrations (name)
|
|
SELECT '20230717173000_add_get_user_id_by_user_email'
|
|
WHERE NOT EXISTS (
|
|
SELECT 1 FROM migrations WHERE name = '20230717173000_add_get_user_id_by_user_email'
|
|
);
|
|
|
|
COMMIT;
|