feat: Implement a new push notification service and enhance appointment reminder functionality with new database columns and logic.

This commit is contained in:
2026-03-25 12:08:09 +00:00
parent cb1cf4335b
commit 5d16602ceb
3 changed files with 120 additions and 24 deletions

View File

@@ -0,0 +1,13 @@
-- 1. Adicionar coluna para controlo de lembretes enviados
-- Isto evita que o utilizador receba o mesmo lembrete várias vezes
ALTER TABLE appointments
ADD COLUMN IF NOT EXISTS reminder_sent BOOLEAN DEFAULT false;
-- 2. Garantir que a coluna reminder_minutes existe (caso não tenha sido criada no outro PC)
ALTER TABLE appointments
ADD COLUMN IF NOT EXISTS reminder_minutes INTEGER DEFAULT 1440;
-- 3. Criar índice para performance na busca de lembretes pendentes
CREATE INDEX IF NOT EXISTS idx_appointments_reminder_status
ON appointments (status, reminder_sent)
WHERE status = 'pendente' AND reminder_sent = false;