ReactingMe
03/11/2022, 5:29 AMexport async function getServerSideProps({ req }) {
//Base Url
const gBaseUrl = 'https://www.googleapis.com/youtube/v3';
//Supabase related
//Insert many rows
// const { data, error } = await supabase
// .from('table')
// .insert([
// { some_column: 'someValue' },
// { some_column: 'otherValue' },
// ])
const channelID = [];
for (const channel of channelList) {
const channelData = await fetch(
`${gBaseUrl}/channels?part=snippet,contentDetails,statistics&id=${channel.channelID}&key=${process.env.YOUTUBE_API_KEY}`
).then((res) => res.json());
channelID.push(channelData.items); // Need to save "channelData.items" coming from YoutubeAPI to the database.
}
//Return data
return {
props: {
channelID,
},
};
}
What to do?Ic3m4n
03/11/2022, 6:20 AMfig.newton
03/11/2022, 8:11 AM| uuid | data |
-----------------------------------------------------------
| cafe | {"foo": "bar", "applications": [{"job": "baz"}]} |
So far this plain SQL query works:
SELECT c.uuid, c.data
FROM candidate as c
WHERE c.data->'applications' @> '[{"job": "baz"}]'::jsonb
as does this:
SELECT c.uuid, c.data
FROM candidate as c
WHERE EXISTS (
SELECT TRUE
FROM jsonb_array_elements(data->'applications') AS apps
WHERE apps->>'job' IN ('baz')
)`
but I’m pretty stumped about translating this to a Supabase query.
The PostgREST docs do mention that these JSON operations should be possible, but it’s not clear how to safely construct this query. The only thing that comes to mind is something like "'[{\"job\": \"" + job_id_here "\"}]'" 😦georgeaffield
03/11/2022, 9:19 AMpkovzz
03/11/2022, 10:11 AMak4zh
03/11/2022, 3:04 PMauth.signIn()
supabase stores the session in the browser local storage. Now does the client check that localStorage every-time a request is being made and add the user in the api calls.
What happens when the session in localStorage has expired and my app tries to make api call?
Will supabase just keep working and stop adding the user info in api calls and does not remove the session stored in local storage?
Or it checks during every api call if session is still valid and if valid it adds user else deleted the session from local storage so my apps knows thatbuser is logged out and I redirect them to login page.
In my app I am simply accessing the localStorage to know if user is logged in, when I call auth.signOut()
supabase removed the localstorage so login logout seems to work already without over complicating the setup.Colin
03/11/2022, 3:50 PMInvalid Date
for created/last sign in, but if I log these values it seems fine, what am I missing? 🤔Mopsior
03/11/2022, 4:41 PM"supabase-realtime | 2022-03-11 16:38:34.261 [error] Postgrex.Protocol (#PID<0.232.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (db:5432): non-existing domain - :nxdomain"
.Shneor
03/11/2022, 5:07 PMAnorok
03/11/2022, 8:11 PMjustinjunodev
03/11/2022, 8:33 PMsocial
table that includes a row for each user
. Within that row are columns for several social networks (twitter, youtube, twitch, whatever, etc.).
Question: Chances are most users will not have every social network listed, but the form will include inputs for each social column available. That said, is there a specific way I should structure the update query? Or is it standard to submit all the fields and include fallback values with the existing state to catch those that are not in use/ okay as is?
*Example: Is this standard/ okay? *
const { data, error } = await supabase
.from('social')
.update(
{ twitter: newStateValue || prevStateValue},
{ youtube: newStateValue || prevStateValue},
{ twitch: newStateValue || prevStateValue}
)
.eq('user', user.id)
DanMossa
03/12/2022, 12:53 AMfinal StorageResponse<String> res = await _supabase.client.storage.from('profile-pictures').upload('uuid/0', file,
fileOptions: const FileOptions(upsert: true));
return res.data;
res.data shows
profile-pictures/uuid/0
When I then go to download that file
final StorageResponse<Uint8List> res = await _supabase.client.storage.from('profile-pictures').download("uuid/0");
return res.data;
res.data says 404BakaPresident
03/12/2022, 3:14 AMcardyet
03/12/2022, 3:43 AMselect
cron.schedule(
'webhook-every-day', -- name of the cron job
'1 0 * * *', -- every day at 12:01am
$$
-- declare variable
declare
results setof events
-- start::query reminders table
RETURN QUERY SELECT title, date
INTO results
FROM events
WHERE CAST(date AS DATE) = NOW()::DATE
-- end::query
select status
from
http_post(
'https://api.com/',
results, -- payload as an array of rows?
'application/json'
)
$$
);
This produces an error at or near setof events
AmusedGrape
03/12/2022, 3:48 AMak4zh
03/12/2022, 8:44 AMekansh005
03/12/2022, 10:46 AMSeñor Bruno
03/12/2022, 9:04 PMcliffordfajardo
03/12/2022, 11:59 PMFROM cities SELECT * WHERE zipcode = '95555' AND state = 'California'
supabase
const { data, error } = await supabase
.from('cities')
.filter('zipcode', 'eq', 'category)
girishso
03/13/2022, 5:56 AMx-client-info: supabase-js/1.31.1
in Elm app to see if it makes any difference.
Any hints?Mopsior
03/13/2022, 7:57 AMYänz
03/13/2022, 10:45 AMgralp
03/13/2022, 12:32 PMApfelsaft
03/13/2022, 1:47 PMd33pu
03/13/2022, 2:00 PMNeedle
03/13/2022, 2:00 PM/title
command!
We have solved your problem?
Click the button below to archive it.d33pu
03/13/2022, 2:02 PMselect
cron.schedule(
'webhook-every-minutex', -- name of the cron job
'* * * * *', -- every minute
$$
select content::json->'results'
from http_get('https://swapi.dev/api/people');
$$
);
thats the code I am trying to run but doesn't work
If I manually run the select statement it returns the json results
any help is highly appreciated 🙏Needle
03/13/2022, 2:02 PM/title
command!
We have solved your problem?
Click the button below to archive it.Ludvig
03/13/2022, 3:01 PMAmatewasu
03/13/2022, 5:43 PMprofiles
table with data such as the firstname & lastname. But then I would like to retrieve a user email from its profiles.id. Is it possible. How would you do? Thanks a lot!