skyinteractive
10/05/2022, 4:54 AMThoth Trismegistus
10/05/2022, 6:20 AMtsnakejake
10/05/2022, 6:21 AMzisvh
10/05/2022, 7:20 AMtonyhart
10/05/2022, 7:43 AMFrancoT
10/05/2022, 8:43 AMconst blockObject = blockArray.map((index) => ({
name: `Training block ${index + 1}`,
program_id: programId,
user_id: currentUser?.id,
state: 1,
index: index + 1,
}));
const createBlocks = async () => {
const { data, error } = await supabase
.from('blocks')
.insert([...blockObject]);
createDaysPerBlock(data);
return data;
};
const createDaysPerBlock = async (trainingBlocks) => {
const days = trainingBlocks.map(async (block) => {
const dayObject = dayArray.map((index) => ({
name: `Day ${index + 1}`,
block_id: block.block_id,
index: index + 1,
program_id: programId,
}));
const { data, error } = await supabase
.from('block_day')
.insert([...dayObject]);
return data;
});
const result = await Promise.all(days);
return result;
};
avalanche
10/05/2022, 8:52 AMdart
return _client
.from(_conversationTable) //
.select('''
id,
sender:profile(*)&profile.user_id=sender_id,
receiver:profile(*)&profile.user_id=receiver_id,
item:item_id(*),
created_at
''')
.eq('id', conversationId)
.limit(1)
.single()
.execute()
Excitor
10/05/2022, 9:18 AMBartWestenenk
10/05/2022, 10:11 AMcuca
10/05/2022, 10:16 AMAlex CC
10/05/2022, 10:35 AMauth.uid()
?
Many thankszisvh
10/05/2022, 11:14 AMKedge
10/05/2022, 2:42 PMheysagnik
10/05/2022, 3:29 PMmerlo
10/05/2022, 6:54 PMexists (
select 1
from condos
where auth.uid() = condos.admin_id
)
But I'm getting new row violates row-level security policy for table \"amenities\
What am I doing wrong?Marcus Arnfast
10/05/2022, 10:15 PMMilou
10/05/2022, 11:04 PMKTibow
10/05/2022, 11:45 PMjs
const { data, error } = await schoologyUsers.select().eq("email", email);
if (!data) throw error;
const user = data[0];
however this has some problems
- boilerplatey
- declares data
and error
so i can't use them again
what's a better way to do this? (and yes thankfully this is inside of another reusable function, but i've had to do something like this a couple times)deX
10/06/2022, 12:23 AMhongymagic
10/06/2022, 2:11 AMven
10/06/2022, 2:48 AM// console.log("client", client);
// get users
client
.from("User")
.select("*")
.then(({ data, error }) => {
console.log("data", data);
console.log("error", error);
});
Matt
10/06/2022, 3:08 AMarnu515
10/06/2022, 6:07 AMsupabase.auth.setSession
.
The refresh token doesn't look like a JWT token, but some kind of custom string.
I found some code to create it in supabase/gotrue
(https://github.com/supabase/gotrue/blob/master/models/refresh_token.go#L101), but I can't seem to understand it.
Please can someone help me?dmytro.eth
10/06/2022, 8:56 AMcreate table countries {
id: uuid();
name: string;
}
create table cities {
id: uuid();
name: string;
counry_id: uuid references countries(id)
}
CREATE VIEW cities_fts
SELECT
cities.id as city_id,
cities.country_id as county_id, to_tsvector('english', concat_ws(' ', cities.name, country.name )) AS fts
FROM countries, cities
WHERE (cities.country_id = countries.id);
If I query .from('custom_view').select(*, counties(*))
I will get a response with country object included.
But if I query .from('custom_view').select(*, cities(*))
I'll get an error about no relationship between custom_view
view and cities
This is because I create a view with cities.id
which is just a id and not a foreign key and cities.county_id
which is a foreign key, right?
How can I go around it?zisvh
10/06/2022, 9:58 AMjs
const fetchPlayers = async () => {
const { data, error } = await supabase
.from('export')
.select('data')
.limit(1)
.order('inserted_at', { ascending: false })
if (error) {
setFetchError('Could not fetch')
setPlayers(null)
console.log(error)
}
if (data) {
console.log(data)
console.log(jsonB)
setPlayers(data)
setFetchError(null)
}
}
franfernandez
10/06/2022, 11:42 AMpemontto
10/06/2022, 2:22 PM- ./volumes/db/data:/var/lib/postgresql/data
. However when I down/up the project supabase-db
refuses to start with 2022-10-06 12:19:52.986 UTC [1] FATAL: data directory "/var/lib/postgresql/data" has wrong ownership
... The server must be started by the user that owns the data directory.
However I'm not sure what UID the container is using. As a last resort I tried chmod -R 777 docker/volumes/db/data
to no availtkrunning
10/06/2022, 2:31 PMReuben
10/06/2022, 2:43 PMPatD
10/06/2022, 2:53 PM