refactor: migrate core page layouts to use SafeAreaView and add utility notification scripts and Stepper component
This commit is contained in:
36
test_notif.mjs
Normal file
36
test_notif.mjs
Normal file
@@ -0,0 +1,36 @@
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
const supabaseUrl = 'https://jqklhhpyykzrktikjnmb.supabase.co';
|
||||
const supabaseAnonKey = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Impxa2xoaHB5eWt6cmt0aWtqbm1iIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjgzODQ0MDgsImV4cCI6MjA4Mzk2MDQwOH0.QsPuBnyUtRPSavlqKj3IGR9c8juT02LY_hSi-j3c6M0';
|
||||
|
||||
const supabase = createClient(supabaseUrl, supabaseAnonKey);
|
||||
|
||||
async function testNotif() {
|
||||
console.log("A obter um utilizador da base de dados...");
|
||||
const { data: users, error: err1 } = await supabase.from('profiles').select('id, fcm_token').limit(1);
|
||||
|
||||
if (err1 || !users || users.length === 0) {
|
||||
console.error("Erro ao obter utilizador:", err1);
|
||||
return;
|
||||
}
|
||||
|
||||
const userId = users[0].id;
|
||||
console.log(`Utilizador selecionado: ${userId}`);
|
||||
console.log(`Token FCM atual: ${users[0].fcm_token || "Nenhum"}`);
|
||||
|
||||
console.log("A inserir notificação de teste para despontar o Webhook...");
|
||||
const { data, error } = await supabase.from('notifications').insert([{
|
||||
user_id: userId,
|
||||
message: 'Teste automático de Push Notification - Smart Agenda!',
|
||||
read: false
|
||||
}]).select();
|
||||
|
||||
if (error) {
|
||||
console.error("Falha ao inserir notificação:", error.message);
|
||||
} else {
|
||||
console.log("Notificação inserida com sucesso no Supabase! O webhook deve encadear a invocação da Edge Function.");
|
||||
console.log(data);
|
||||
}
|
||||
}
|
||||
|
||||
testNotif();
|
||||
Reference in New Issue
Block a user