forked from midday-ai/midday
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
185 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,30 @@ | ||
project_id = "pytddvqiozwrhfbwqazp" | ||
|
||
[api] | ||
enabled = true | ||
port = 54321 | ||
schemas = ["public", "storage"] | ||
extra_search_path = ["public", "extensions"] | ||
max_rows = 1000000 | ||
|
||
[auth] | ||
site_url = "http://localhost:3001" | ||
additional_redirect_urls = ["https://localhost:3001", "http://localhost:54321/auth/v1/callback"] | ||
jwt_expiry = 36000 | ||
|
||
[db] | ||
port = 54322 | ||
|
||
[studio] | ||
port = 54323 | ||
|
||
[auth.external.google] | ||
enabled = true | ||
client_id = "env(GOOGLE_CLIENT_ID)" | ||
secret = "env(GOOGLE_SECRET)" | ||
secret = "env(GOOGLE_SECRET)" | ||
redirect_uri = "http://localhost:54321/auth/v1/callback" | ||
|
||
[auth.email] | ||
double_confirm_changes = true | ||
enable_confirmations = true | ||
enable_signup = true |
5 changes: 5 additions & 0 deletions
5
apps/api/supabase/migrations/20240624054956_remote_schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CREATE TRIGGER on_auth_user_created AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION handle_new_user(); | ||
|
||
CREATE TRIGGER user_registered AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION supabase_functions.http_request('https://app.midday.ai/api/webhook/registered', 'POST', '{"Content-type":"application/json","x-api-key":"szlv1yTFbgV7rmwchh2r3Medq28ZbDMF4QiPKE2Mr5fGADKTl1xTH1vKjxLf2vsj"}', '{}', '1000'); | ||
|
||
|
155 changes: 155 additions & 0 deletions
155
apps/api/supabase/migrations/20240624060151_remote_schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
set check_function_bodies = off; | ||
|
||
CREATE OR REPLACE FUNCTION storage.extension(name text) | ||
RETURNS text | ||
LANGUAGE plpgsql | ||
AS $function$ | ||
DECLARE | ||
_parts text[]; | ||
_filename text; | ||
BEGIN | ||
select string_to_array(name, '/') into _parts; | ||
select _parts[array_length(_parts,1)] into _filename; | ||
-- @todo return the last part instead of 2 | ||
return split_part(_filename, '.', 2); | ||
END | ||
$function$ | ||
; | ||
|
||
CREATE OR REPLACE FUNCTION storage.filename(name text) | ||
RETURNS text | ||
LANGUAGE plpgsql | ||
AS $function$ | ||
DECLARE | ||
_parts text[]; | ||
BEGIN | ||
select string_to_array(name, '/') into _parts; | ||
return _parts[array_length(_parts,1)]; | ||
END | ||
$function$ | ||
; | ||
|
||
CREATE OR REPLACE FUNCTION storage.foldername(name text) | ||
RETURNS text[] | ||
LANGUAGE plpgsql | ||
AS $function$ | ||
DECLARE | ||
_parts text[]; | ||
BEGIN | ||
select string_to_array(name, '/') into _parts; | ||
return _parts[1:array_length(_parts,1)-1]; | ||
END | ||
$function$ | ||
; | ||
|
||
create policy "Give members access to team folder 1oj01fe_0" | ||
on "storage"."objects" | ||
as permissive | ||
for select | ||
to public | ||
using (((bucket_id = 'avatars'::text) AND (EXISTS ( SELECT 1 | ||
FROM users_on_team | ||
WHERE ((users_on_team.user_id = auth.uid()) AND ((users_on_team.team_id)::text = (storage.foldername(objects.name))[1])))))); | ||
|
||
|
||
create policy "Give members access to team folder 1oj01fe_1" | ||
on "storage"."objects" | ||
as permissive | ||
for insert | ||
to public | ||
with check (((bucket_id = 'avatars'::text) AND (EXISTS ( SELECT 1 | ||
FROM users_on_team | ||
WHERE ((users_on_team.user_id = auth.uid()) AND ((users_on_team.team_id)::text = (storage.foldername(objects.name))[1])))))); | ||
|
||
|
||
create policy "Give members access to team folder 1oj01fe_2" | ||
on "storage"."objects" | ||
as permissive | ||
for update | ||
to public | ||
using (((bucket_id = 'avatars'::text) AND (EXISTS ( SELECT 1 | ||
FROM users_on_team | ||
WHERE ((users_on_team.user_id = auth.uid()) AND ((users_on_team.team_id)::text = (storage.foldername(objects.name))[1])))))); | ||
|
||
|
||
create policy "Give members access to team folder 1oj01fe_3" | ||
on "storage"."objects" | ||
as permissive | ||
for delete | ||
to public | ||
using (((bucket_id = 'avatars'::text) AND (EXISTS ( SELECT 1 | ||
FROM users_on_team | ||
WHERE ((users_on_team.user_id = auth.uid()) AND ((users_on_team.team_id)::text = (storage.foldername(objects.name))[1])))))); | ||
|
||
|
||
create policy "Give members access to team folder 1uo56a_0" | ||
on "storage"."objects" | ||
as permissive | ||
for select | ||
to authenticated | ||
using (((bucket_id = 'vault'::text) AND (EXISTS ( SELECT 1 | ||
FROM users_on_team | ||
WHERE ((users_on_team.user_id = auth.uid()) AND ((users_on_team.team_id)::text = (storage.foldername(objects.name))[1])))))); | ||
|
||
|
||
create policy "Give members access to team folder 1uo56a_1" | ||
on "storage"."objects" | ||
as permissive | ||
for insert | ||
to authenticated | ||
with check (((bucket_id = 'vault'::text) AND (EXISTS ( SELECT 1 | ||
FROM users_on_team | ||
WHERE ((users_on_team.user_id = auth.uid()) AND ((users_on_team.team_id)::text = (storage.foldername(objects.name))[1])))))); | ||
|
||
|
||
create policy "Give members access to team folder 1uo56a_2" | ||
on "storage"."objects" | ||
as permissive | ||
for update | ||
to authenticated | ||
using (((bucket_id = 'vault'::text) AND (EXISTS ( SELECT 1 | ||
FROM users_on_team | ||
WHERE ((users_on_team.user_id = auth.uid()) AND ((users_on_team.team_id)::text = (storage.foldername(objects.name))[1])))))); | ||
|
||
|
||
create policy "Give members access to team folder 1uo56a_3" | ||
on "storage"."objects" | ||
as permissive | ||
for delete | ||
to authenticated | ||
using (((bucket_id = 'vault'::text) AND (EXISTS ( SELECT 1 | ||
FROM users_on_team | ||
WHERE ((users_on_team.user_id = auth.uid()) AND ((users_on_team.team_id)::text = (storage.foldername(objects.name))[1])))))); | ||
|
||
|
||
create policy "Give users access to own folder 1oj01fe_0" | ||
on "storage"."objects" | ||
as permissive | ||
for select | ||
to authenticated | ||
using (((bucket_id = 'avatars'::text) AND ((auth.uid())::text = (storage.foldername(name))[1]))); | ||
|
||
|
||
create policy "Give users access to own folder 1oj01fe_1" | ||
on "storage"."objects" | ||
as permissive | ||
for insert | ||
to authenticated | ||
with check (((bucket_id = 'avatars'::text) AND ((auth.uid())::text = (storage.foldername(name))[1]))); | ||
|
||
|
||
create policy "Give users access to own folder 1oj01fe_2" | ||
on "storage"."objects" | ||
as permissive | ||
for update | ||
to authenticated | ||
using (((bucket_id = 'avatars'::text) AND ((auth.uid())::text = (storage.foldername(name))[1]))); | ||
|
||
|
||
create policy "Give users access to own folder 1oj01fe_3" | ||
on "storage"."objects" | ||
as permissive | ||
for delete | ||
to authenticated | ||
using (((bucket_id = 'avatars'::text) AND ((auth.uid())::text = (storage.foldername(name))[1]))); | ||
|