HerbeMalveillante
02/15/2022, 6:21 PMHerbeMalveillante
02/15/2022, 6:22 PMjavascript
async function queryDatabase(){
const { data, error } = await supabase
.from('posts')
.select()
console.log(data)
}
HerbeMalveillante
02/15/2022, 6:22 PMHerbeMalveillante
02/15/2022, 6:23 PMits-pablo
02/16/2022, 2:17 AMgaryaustin
02/16/2022, 2:50 AMNull
02/16/2022, 4:22 PMNull
02/16/2022, 4:23 PMuser
02/16/2022, 5:03 PMcase 'checkout.session.completed':
const checkoutSession = event.data
.object as Stripe.Checkout.Session;
await upsertOrderRecord(event.data.object as Stripe.Checkout.Session, checkoutSession.customer as string,);
break;
useDatabase
`const upsertOrderRecord = async (session: Stripe.Checkout.Session, customerId: string) => {
const { data: customerData, error: noCustomerError } = await supabaseAdmin
.from('customers')
.select('id')
.eq('stripe_customer_id', customerId)
.single();
if (noCustomerError) throw noCustomerError;
const { id: uuid } = customerData || {};
const sessionData: Session = {
id: session.id,
amount_total: session.amount_total ?? undefined,
user_id: uuid ?? undefined
};
const { error } = await supabaseAdmin.from('orders').insert([sessionData], { upsert: true });
if (error) throw error;
console.log(Product inserted/updated: ${session.id}
);
};`reubence
02/17/2022, 5:31 AMconst { data, error } = await supabase
.from("company")
.update([inputFields.values])
.match([originalFields.values]);
};
This is what inputFields.values / originalFields.values look like
{
"name": "Piramal Glassed",
"email": "piramal@glass.com",
"contact": "98203"
}
Maus
02/17/2022, 12:48 PMdata
will always be in the same order as the original insert data? Eg:
const { data, error } = await supabase.from("table").insert([{name: 'a'}, {name: 'b'}, {name: 'c'}])
console.log(data)
// data: {data: [{id: 1, name: 'a'}, {id: 2, name: 'b'}, {id: 3, name: 'c'}]}
reubence
02/17/2022, 1:18 PMgaryaustin
02/17/2022, 2:24 PM「 stripess 」
02/17/2022, 7:54 PM「 stripess 」
02/17/2022, 7:55 PM「 stripess 」
02/17/2022, 7:55 PM「 stripess 」
02/17/2022, 7:56 PM「 stripess 」
02/17/2022, 7:58 PMts
const { error } = await supabase.auth.signIn(
{ provider: 'google', },
{ redirectTo: `${REDIRECT_URL_BASE}/next-steps`,}
)
「 stripess 」
02/17/2022, 7:58 PM/next-steps
fetches profile「 stripess 」
02/17/2022, 7:58 PM/next-steps
but that's a heck of a hacksilentworks
02/17/2022, 8:20 PMVeld
02/20/2022, 2:14 AMjs
const allSubscriptions = await this.supabase
.from<DiscordChannelSubscription>("discordChannelEventSubscriptions")
.select("*")
.or(`worldIdFilter.is.null,worldIdFilter.eq.${event.new.locationId}`)
.or(`teamIdFilter.is.null,teamIdFilter.eq.${event.new.organizerId}`)
RyanHirsch
02/20/2022, 12:30 PMsubscription
table, but getting nothing when I do inserts to one of them.
ts
supabase
.from("*")
.on("*", (payload) => {
console.log("Change received!", payload);
})
.subscribe();
RyanHirsch
02/20/2022, 12:33 PMservice_role
to connectdarkgod
02/20/2022, 7:29 PMdarkgod
02/20/2022, 7:29 PMSteve
02/21/2022, 4:40 PMYonben
02/21/2022, 4:59 PMusers
, groups
and groups_users
. The last one is a table containing `userId`/`groupId` links, to join between them.
What would be the ideal queries to get "All users of group `i`" and "All groups of user `j`"?João Vitor
02/21/2022, 7:28 PMposts
with a user_id
foreign key to auth.users.id
and I'm trying to query the user info like this :
js
supabase.from('posts').select('*, users(*)')
but I'm getting this error "Could not find a relationship between 'posts' and 'users' in the schema cache"phollome
02/21/2022, 9:20 PMsuperbase.auth.session
was always null
so the anon key was used on requests and updates where not applied (response 404
). For now, I use a workaround: set access_token
with the result of strategy.checkSession
(https://github.com/mint-vernetzt/remix-supabase-test/commit/ae4eb834fcd10ca9aa5d3863fa3846fd4126e05a). I don't know, if it's the best solution, but maybe it helps others.