https://supabase.com/ logo
#javascript
Title
# javascript
b

Bicijay

06/07/2022, 1:56 PM
Hey guys, i would like to return the number of files that a user has on storage, can i query the storage schema through the sdk?
g

garyaustin

06/07/2022, 2:03 PM
Probably yes, but you would have to init the client with that schema and a client can only access one schema at a time. Default is public. I would use an rpc function to do it.
b

Bicijay

06/07/2022, 3:06 PM
great, another question, lets say i need to use the logged in user inside the query of this new RPC, i would probably use auth.uid(), is there any way i could mock its value for debugging purposes?
yeah, just found out you can create consts, dont worry
g

garyaustin

06/07/2022, 3:15 PM
Using auth.uid() is the way to go so then you don't have to worry about it being a parameter the client could change.
b

Bicijay

06/07/2022, 3:15 PM
but that creates another interesting question, lets say i need to login as a specific user to debug my app, is that possible somehow?
manually update the jwt payload and use it on the sdk?
g

garyaustin

06/07/2022, 3:16 PM
Not sure how that is different than RLS. You could have a fake jwt you make with a long expiration time then use it.
b

Bicijay

06/07/2022, 3:17 PM
makes sense
thank you for the help gary!