[GodderE2D]
01/12/2023, 3:02 PMid
field doesn't exceed 3 upon INSERT in my table apps
.
I was trying to use this (supabase converted my policy to this): sql
(( SELECT count(*) AS count
FROM apps apps_1
WHERE (apps_1.owner = uid())) <= 3)
But that didn't work, it bypassed it every time and I can create as many apps as I want.
Original policy was (not converted by supabase): sql
(
(
SELECT count(*) FROM apps WHERE (apps.owner = auth.uid())
) <= 3
)
freshandlow
01/12/2023, 3:03 PMSandySeagull
01/12/2023, 3:25 PMtkrunning
01/12/2023, 3:39 PMaccess_token
and refresh_token
for each webinar host so that we can create the webinars in their Zoom account and add attendees. Is this data stored somewhere? I had a quick look in the auth
schema, but didn't spot it there.
If it's not stored and accessible server-side, is it possible to "intercept" it somehow when users sign up or sign in with the Zoom OAuth provider (so I can manage the tokens elsewhere)?Hermes
01/12/2023, 3:43 PMjinsley8
01/12/2023, 4:11 PMmoralis
SDK to sign a message through MetaMask and it returns a profileId
(66 character) and the walletAddress
(42 character) from Moralis Auth.
2. Use this address to generate a unique email that is only used for login - e.g. - ${walletAddress}@domain.com
3. Generate a password from a JWT using a payload of:
{
walletAddress,
profileId: profileId+${randomShortSecret}
}
Then sign the JWT with another secret so technically the password should always be the same every time its generated when someone clicks the "Connect" button.
4. In the connect() function, check if a user exists in the Supabase database with this unique email and profileId (user_meta). If user exists use signInWithPassword(), if not then use signUp() to create the user.LucianoNeo
01/12/2023, 5:26 PM44 const users = await prisma.users.findMany(
Error querying the database: db error: FATAL: remaining connection slots are reserved for non-replication superuser connection
mynamejeff
01/12/2023, 5:38 PMEmbm
01/12/2023, 5:55 PMpublic.users
table and a public.users_roles
table like so:
sql
create table public.users (
"id" uuid not null unique primary key,
"first_name" text,
"last_name" text,
...
);
create table public.users_roles (
"user_id" uuid not null unique,
"role" public.user_role not null default 'visitor'::public.user_role,
"updated_by_id" uuid not null references public.users(id)
primary key (user_id, role)
);
Where public.user_role
is an enum.
I also have a public.user_role_details
table with some human-readable info about the roles, that is seeded by default:
sql
create table public.user_role_details (
"role" public.user_role not null unique primary key,
"label" text not null,
"description" text not null
);
Now, with this setup I'd expect to be able to use postgrest (with the js client) to join public.user_role_details
when selecting a user from public.users
because of the 2-step fkey-pkey relation allowed by the composite fkey of public.users_roles
public.users(id)
↓
public.users_roles(user_id, role)
↓
public.user_role_details(role)
...but instead I get a warning that no relation is found.
I think this might be due to the fact that to join public.users_roles
to public.users
I need to disambiguate which column to use in the former (user_id
vs updated_by_id
). But from trying and reading the docs, I can't find a syntax for doing that when using an intermediary join table 😦 I know how to disambiguate when doing a first-order join, but here I'm interested about a second-order join. Is this a thing or will I have to resort to using a view/two queries?Kottalo Laurant
01/12/2023, 6:22 PMkrummens
01/12/2023, 7:35 PMuser8923
01/12/2023, 7:59 PMmadjar
01/12/2023, 8:24 PMRelisora
01/12/2023, 9:12 PMerock
01/12/2023, 9:52 PMauth.inviteUserByEmail
method as described here (https://supabase.com/docs/reference/javascript/auth-admin-resetpasswordforemail) and it seems to be ignoring the options.redirectTo
setting with my dynamic URL and only using the Site URL.
How can I resolve this?CaptCuddleFish
01/12/2023, 10:13 PMDanMossa
01/12/2023, 10:32 PMRich
01/12/2023, 10:50 PMDDupasquier
01/12/2023, 11:28 PMDECLARE
deleted_page_number INTEGER;
story_id INTEGER;
BEGIN
-- Get the page number and story id of the deleted page
WITH deleted_page AS (
DELETE FROM pages
RETURNING pageNumber, storyId
)
SELECT pageNumber, storyId INTO deleted_page_number, story_id
FROM deleted_page;
-- Update the page numbers of all pages with the same story id
UPDATE pages
SET pageNumber = pageNumber - 1
WHERE storyId = story_id AND pageNumber > deleted_page_number;
END;
If you spot anything in this function that looks stupid then please shout it out to me.
My issue here is that I created this function:
@picture #1
And it was saved to my functions:
@picture#2
But when I go to create the trigger, the function doesn't show up:
@picture#3
Does anyone have some insight as to what I may have done wrong?Solemensis
01/12/2023, 11:55 PMAlanK
01/13/2023, 12:49 AM{
"type": "Point",
"crs": {
"type": "name",
"properties": {
"name": "EPSG:4326"
}
},
"coordinates": [
152.21575417252868,
-31.964690337055764,
0
]
}
I would like to insert it into auth.users.raw_user_meta_data using the signUp function:
const { data: userData, error: errorSignUp } = await supabaseClient.auth.signUp({
email: email!,
password: password,
options: {
data: {
principaladdresssiteoid: parseInt(oid),
addresspointcrs: pointcrs,
addresspoint: pointgeometry /// this is the JSON
},
emailRedirectTo: `${supabaseRedirectBase}/auth/redirect`
}
});
and then be able to query the coordinates in a trigger function.
If I add the JSON directly I get [object Object]
as the value, if I stringify first I get a mess.
Can anyone tell me what I'm missing?JoshTheNerd
01/13/2023, 5:04 AMAzura
01/13/2023, 5:38 AMts
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
const supabase = createServerSupabaseClient(ctx);
const {
data: { session },
} = await supabase.auth.getSession();
if (!session)
return {
redirect: {
destination: '/login',
permanent: false,
},
};
return {
props: {
initialSession: session,
user: session.user,
},
};
};
This approach works seamlessly, however, when the browser tab is inactive for some time, the app takes a very long time to load the next page, which is also a protected route.
Is there any hack to this use case where the SSR protected route could be updated to work better?laubonghaudoi
01/13/2023, 5:58 AMgetStaticProps()
but there is no way to create the client because getStaticProps()
doesn't have a context param. I checked the docs and it doesn't mention it either, there is only documentation on `getServerSideProps()`: https://supabase.com/docs/guides/auth/auth-helpers/nextjs#server-side-rendering-ssranggoran
01/13/2023, 6:37 AMsupabase_migrations
schema okay if I don't do migrate-related things?tkrunning
01/13/2023, 8:37 AMlake_mattiato
01/13/2023, 9:34 AMtaunoha
01/13/2023, 10:17 AMUberzeek
01/13/2023, 10:32 AMローリー Laurie
01/13/2023, 11:42 AM