feat: improve email status querying and URL handling
- Updated email status query to execute only when there are email IDs, enhancing performance. - Ensured URL handling in email sending functions always includes a protocol, improving reliability. - Added new queries for fetching emails by IDs and listing scheduled emails, enriching email management capabilities.
This commit is contained in:
@@ -440,7 +440,12 @@ export const enviarMensagem = mutation({
|
||||
const usuarioParticipante = await ctx.db.get(participanteId);
|
||||
if (usuarioParticipante?.email) {
|
||||
// Obter URL do sistema (padrão: localhost para dev)
|
||||
const urlSistema = process.env.FRONTEND_URL || "http://localhost:5173";
|
||||
let urlSistema = process.env.FRONTEND_URL || "http://localhost:5173";
|
||||
|
||||
// Garantir que a URL sempre tenha protocolo
|
||||
if (!urlSistema.match(/^https?:\/\//i)) {
|
||||
urlSistema = `http://${urlSistema}`;
|
||||
}
|
||||
|
||||
ctx.scheduler.runAfter(1000, api.email.enviarEmailComTemplate, {
|
||||
destinatario: usuarioParticipante.email,
|
||||
|
||||
Reference in New Issue
Block a user