diff --git a/README.md b/README.md index 20381d6..92c30c5 100644 --- a/README.md +++ b/README.md @@ -228,6 +228,7 @@ CREATE OR REPLACE FUNCTION public.create_thread(uid uuid, last_message_at timest RETURNS json LANGUAGE plpgsql SECURITY DEFINER + SET search_path = extensions, public AS $function$DECLARE thread_id UUID; BEGIN @@ -268,6 +269,22 @@ AS $function$BEGIN RETURN json_build_object(); END;$function$ +CREATE OR REPLACE FUNCTION public.update_thread_title(uid uuid, thread_id uuid, t text) + RETURNS json + LANGUAGE plpgsql + SECURITY DEFINER +AS $function$BEGIN + UPDATE threads + SET + title = t, + updated_by = uid, + updated_at = now() + WHERE id = thread_id + AND created_by = uid; + + RETURN json_build_object(); +END;$function$ + CREATE OR REPLACE FUNCTION public.get_messages_by_thread_and_user(uid uuid, tid uuid) RETURNS json LANGUAGE plpgsql @@ -305,6 +322,7 @@ CREATE OR REPLACE FUNCTION public.create_message(uid uuid, tid uuid, pid uuid, f RETURNS json LANGUAGE plpgsql SECURITY DEFINER + SET search_path = extensions, public AS $function$DECLARE mid UUID; BEGIN