avalanche
10/21/2022, 10:38 AMmatteo
10/21/2022, 1:44 PMRed Baron
10/21/2022, 2:23 PMThoth Trismegistus
10/21/2022, 2:53 PMprofiles
table upon user login.
Is there a callback function which is called upon user login?thomas_mol
10/21/2022, 3:09 PMinaxium
10/21/2022, 4:27 PMkomagata
10/21/2022, 5:26 PMRawa
10/21/2022, 6:41 PMrgfx
10/21/2022, 6:46 PMdrgonxoo
10/21/2022, 7:22 PMguifromrio
10/21/2022, 7:50 PMlawnday
10/21/2022, 10:05 PMsupabase.auth.signUp
, I get the session data with an initial JWT back immediately, before the trigger runs. Is there any way to force a refresh of the JWT so that I get a version with the new claim in it? Right now, I'm only able to get it working by logging out and logging back in again. I've tried a few combinations of setSession
, updateUser
, etc, but I only ever get the initial JWT back.CerfDareDevil
10/21/2022, 10:12 PMbeeman
10/21/2022, 11:18 PMKTibow
10/22/2022, 12:51 AM.eq
filters are stacking between requests, which means the request is asking for a row with an id that is 2 things at once
how do i fix this?jon.m
10/22/2022, 3:59 AMVWL Tobias Hassebrock
10/22/2022, 9:32 AMrelationship_of_following (
Relationship_id uuid,
Follower uuid,
Follows uuid
)
usersFollowingCounter(
User_id uuid,
following_counter number
)
userFollowsCounter(
User_id uuid,
follows_counter number
)
Then I have 3 functions:
1. Function Insert insertFollowingFollowerRelationship()
2. Function increment_follower_counter()
3. Function increment_following_counter()
insertFollowingFollowerRelationship(follower uuid, following uuid)
BEGIN
INSERT INTO "following_profile_system"
VALUES (follower, following);
END;
function increment_tfollower_counter(userId uuid)
BEGIN
update userFollowsCounter
set " follows_counter " = " follows_counter" + 1
where id = userId;
END;
function increment_following_counter(userId uuid)
BEGIN
update usersFollowingCounter
set " following_counter " = following_counter + 1
where id = userId;
END;
$$;
And a transaction:
function followTransaction(followerId uuid, followingId uuid)
BEGIN
PERFORM insertFollowingFollowerRelationship(followerId, followingId);
PERFORM increment_follower_counter(followingId);
PERFORM increment_following_counter(followerId);
END;
The client only calls the FollowerTransaction() with .rpc()
How would I design security rules for this architecture with the following requirements?
1. Users should only be able to insert a unique combination in the “relationship_of_following” table
2. Users should only be able to increase follower and following counter once (if relationship did not exist before)
1. Can I ensure that the counters are only incremented if the .rpc FollowerTransaction() was called or that the increase counter is only called once after insertFollowingFollowerRelationship()? Should I use a triggers?
3. Did I understand it correctly that if one of PERFORM calls from the transaction fails, all changes are not committed?
Any best practice recommendations?Captain
10/22/2022, 10:30 AMmattposgate
10/22/2022, 11:11 AMavalanche
10/22/2022, 11:58 AMdart
for (final testUser in testUsers) {
final res = await Supabase.instance.client.auth.signUp(
email: testUser.email,
password: testUser.password,
);
}
This code was working with previous version of supabase_flutter 0.3.3. Any ideas?boeledi
10/22/2022, 12:05 PMStorageError(message: new row violates row-level security policy for table "objects", statusCode: 42501, error: )
--
The code to upload is the following:
await Supabase.initialize(
url: "https://${Environment.supabaseUrl}.supabase.co",
anonKey: Environment.supabaseAnon,
debug: !kReleaseMode,
);
...
File? fileToUpload;
try {
///
/// We first need to transfer the base64 content to a real file
///
fileToUpload = await FileHelper().writeStringToFile('temp', 'profile_picture.png', base64Content.replaceAll('base64:', ''));
///
/// Now, we need to upload the file onto the Storage bucket
///
final StorageResponse<String> storageResponse = await Supabase.instance.client.storage.from('avatars').upload(
'avatar1.jpg',
fileToUpload,
fileOptions: const FileOptions(cacheControl: '3600', upsert: true),
);
if (storageResponse.hasError) {
log('STORAGE ERROR => ${storageResponse.error}');
} else {
log('STORAGE SUCCESS => ${storageResponse.data}');
}
} catch (e) {
// Nothing
log('STORAGE ERROR (Exception)=> $e');
} finally {
if (fileToUpload != null) {
fileToUpload.delete();
}
}
I also tried to set the default "Policies" (Allow access to JPG images..) but still the same error.
Could anyone please help me?
Many thanksteiki
10/22/2022, 1:19 PM𝖘𝖚𝖗𝖌𝖎𝖊𝖇𝖔𝖎 | Drooler
10/22/2022, 2:38 PMCaptain
10/22/2022, 3:31 PMkvnfo
10/22/2022, 3:47 PMconst { data: commentList, error } = useSWR(`/api/comments/`, fetcher);
And then in my comments.js (api)
case "GET":
const { data, error } = await supabase
.from("comments")
.select("*, user_id (username, avatar_url)")
.order("created_at", { ascending: false })
if (error) {
res.status(500).json({ error: error.message });
} else {
res.status(200).json(data);
}
break;
Any help or advice would be appreciatedtpz
10/22/2022, 4:33 PMB3n
10/22/2022, 5:14 PMflapili (FR, bad EN)
10/22/2022, 5:20 PMSpoonz
10/22/2022, 5:44 PMomar
10/22/2022, 6:03 PM