Milou
02/18/2022, 10:58 PMMilou
02/18/2022, 10:59 PMts
getQuestion(id : string) : Observable<question> {
const question = from(this.supabase.from('question').select('*').eq('id', id).single())
return question as unknown as Observable<question>
}
Milou
02/18/2022, 10:59 PMferpintado
02/19/2022, 2:18 AMsupabase cli
? I am trying to connect pgadmin but I can't find the server user's passwordAsh
02/19/2022, 3:13 AMsilentworks
02/19/2022, 4:39 PMphil
02/19/2022, 5:28 PMnpm i @supabase/supabase-js
i dont see it in packages.json
This is the output:
├── @supabase/supabase-js@1.30.3 extraneous
├── UNMET PEER DEPENDENCY fibers@>= 3.1.0
├── UNMET PEER DEPENDENCY node-sass@^4.0.0 || ^5.0.0 || ^6.0.0
└── UNMET PEER DEPENDENCY typescript@>=3.3.1
However I see it in node_modules. How come its not in packages.json?PixelPage ᶠᵒˡᶤᶻᶻᵃ
02/19/2022, 7:43 PMts
import { createClient } from "https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm"
const supabase = createClient('---', '---', {})
let table = supabase.from("guild_settings")
let tableselect = table.select()
console.log(tableselect)
i get this back
ts
h {
shouldThrowOnError: false,
fetch: <ref *1> [Function: A] {
ponyfill: true,
default: [Circular *1],
fetch: [Circular *1],
Headers: [Function: p],
Request: [Function: v],
Response: [Function: E] { error: [Function], redirect: [Function] }
},
url: URL {
href: "---",
origin: "---",
protocol: "https:",
username: "",
password: "",
host: "---",
hostname: "---",
port: "",
pathname: "/rest/v1/guild_settings",
hash: "",
search: "?select=*"
},
headers: {
"X-Client-Info": "supabase-js/1.30.3",
apikey: "---",
Authorization: "---"
},
schema: "public",
_subscription: null,
_realtime: k {
accessToken: null,
channels: [],
endPoint: "---",
headers: { "X-Client-Info": "supabase-js/1.30.3" },
params: {
apikey: "---"
},
timeout: 10000,
transport: [Function: r],
heartbeatIntervalMs: 30000,
longpollerTimeout: 20000,
heartbeatTimer: undefined,
pendingHeartbeatRef: null,
ref: 0,
logger: [Function: T],
conn: null,
sendBuffer: [],
serializer: j { HEADER_LENGTH: 1 },
stateChangeCallbacks: { open: [], close: [], error: [], message: [] },
reconnectAfterMs: [Function],
encode: [Function],
decode: [Function: bound decode],
reconnectTimer: g { callback: [Function], timerCalc: [Function], timer: undefined, tries: 0 }
},
( a lot more but no actual data )chipilov
02/19/2022, 7:59 PMlet tableselect = (await table.select()).data
console.log(data)
chipilov
02/20/2022, 6:32 PMPixelPage ᶠᵒˡᶤᶻᶻᵃ
02/19/2022, 8:11 PMrealjesset
02/19/2022, 8:16 PMprofile_roles
table with id
referred to user.id
from supabase and it also has role
which is my own custom values.
so a policy for a different table I tried doing:
sql
SELECT CASE WHEN EXISTS (
SELECT id, role
FROM public.profile_roles
WHERE id = auth.uid()
AND role = "administrator"
)
THEN CAST(1 AS BIT)
ELSE CAST(0 AS BIT) END
basically what I am trying to do is select from profile_roles
and see if the auth.id
from supabase and role
is of admin. if so, pass, if not, fail.
however I get an error message saying policy syntax error on/near SELECT
any help is appreciated, thanks!jjj.westra
02/19/2022, 9:43 PMjjj.westra
02/19/2022, 10:02 PMphil
02/20/2022, 3:02 AMMrBaconDev
02/20/2022, 3:36 AMand3rsonsousa
02/20/2022, 3:37 AMand3rsonsousa
02/20/2022, 3:38 AMMrBaconDev
02/20/2022, 3:55 AMphil
02/20/2022, 4:08 AMvalues (new.id, new.raw_user_meta_data ->> 'username');
Where does it get the username from? Like can i pass it to this from the form when i create the user?phil
02/20/2022, 4:25 AMand3rsonsousa
02/20/2022, 4:37 AMnsadeh
02/20/2022, 4:53 AMjon.m
02/20/2022, 6:10 AMphil
02/20/2022, 6:11 AMselect * from my_table
order by id desc
limit 1
jon.m
02/20/2022, 6:12 AMwarlic
02/20/2022, 6:12 AMwarlic
02/20/2022, 6:12 AMwarlic
02/20/2022, 6:12 AMphil
02/20/2022, 6:13 AMonst { data, error } = await supabase
.from('my_table')
.select('*')
.order('id', { ascending: false })