Update Send notification telegram SQL requets

This commit is contained in:
xbgmsharp
2023-05-25 16:37:01 +02:00
parent 970c85c11e
commit 99e258c974

View File

@@ -701,7 +701,7 @@ AS $send_notification$
END IF; END IF;
-- Send notification telegram -- Send notification telegram
SELECT (preferences->'telegram'->'from'->'id') IS NOT NULL,preferences['telegram']['from']['id'] INTO _telegram_notifications,_telegram_chat_id SELECT (preferences->'telegram'->'chat'->'id') IS NOT NULL,preferences['telegram']['chat']['id'] INTO _telegram_notifications,_telegram_chat_id
FROM auth.accounts a FROM auth.accounts a
WHERE a.email = user_settings->>'email'::TEXT; WHERE a.email = user_settings->>'email'::TEXT;
RAISE NOTICE '--> send_notification_fn telegram_notifications [%]', _telegram_notifications; RAISE NOTICE '--> send_notification_fn telegram_notifications [%]', _telegram_notifications;
@@ -849,6 +849,11 @@ BEGIN
--RAISE WARNING 'jwt email %', current_setting('request.jwt.claims', true)::json->>'email'; --RAISE WARNING 'jwt email %', current_setting('request.jwt.claims', true)::json->>'email';
--RAISE WARNING 'jwt role %', current_setting('request.jwt.claims', true)::json->>'role'; --RAISE WARNING 'jwt role %', current_setting('request.jwt.claims', true)::json->>'role';
--RAISE WARNING 'cur_user %', current_user; --RAISE WARNING 'cur_user %', current_user;
--TODO SELECT current_setting('request.jwt.uid', true)::json->>'uid' INTO _user_id;
--TODO RAISE WARNING 'jwt user_id %', current_setting('request.jwt.uid', true)::json->>'uid';
--TODO SELECT current_setting('request.jwt.vid', true)::json->>'vid' INTO _vessel_id;
--TODO RAISE WARNING 'jwt vessel_id %', current_setting('request.jwt.vid', true)::json->>'vid';
IF _role = 'user_role' THEN IF _role = 'user_role' THEN
-- Check the user exist in the accounts table -- Check the user exist in the accounts table
SELECT * INTO account_rec SELECT * INTO account_rec