I have a tables in my supabase database called properties, profile and saved.
The schema for the tables looks like this:
properties
id int8 (pk),
created_at timestamptz,
description text,
price text,
address text,
profiles
id uuid (pk),
updated_at timestamptz,
username text,
email text,
saved
id uuid (pk),
created_at timestamptz,
userid uuid (fk) references id from profile,
propertyid int8 fk) references id from properties
I created a CustomLikeButton in the below like_button.dart
import 'package:flutter/material.dart';
class CustomLikeButton extends StatelessWidget {
final bool isLiked;
void Function()? onTap;
CustomLikeButton({super.key, required this.onTap, required this.isLiked});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Icon(
isLiked ? Icons.favorite : Icons.favorite_border,
color: isLiked ? Colors.red : Colors.grey,
)
);
}
}
I’m having trouble creating functions that can query the saved table, insert rows into the query table and also delete rows from the query table whenever a property listing is liked or unliked. Any help especially tried and tested will be helpful
2
Answers
these are what my functions look like(They don't work):
Have you tried Postgres Functions and RPC?