Kosh
07/28/2021, 12:01 PMcreate
or replace function get_fcm_body(
push_token text,
title text,
body text,
ref_id uuid,
creator_id uuid,
n_type text
) returns json AS $$
declare
notification json;
n_data json;
begin
notification := json_build_object(
'title', title,
'body', body,
'clickAction', 'FLUTTER_NOTIFICATION_CLICK',
'sound', 'default',
'tag', ref_id::text
);
n_data := json_build_object(
'title', title,
'body', body,
'type', n_type,
'refId', ref_id,
'creatorId', creator_id::text
);
return json_build_object(
'to', push_token,
'notification', notification,
'data', n_data
);
end;
$$ language plpgsql;