Merge pull request #33 from killer-cf/refinament-1

Refinament 1
This commit is contained in:
Kilder Costa
2025-11-20 14:17:11 -03:00
committed by GitHub
12 changed files with 82 additions and 232 deletions

View File

@@ -162,6 +162,29 @@ export const enfileirarEmail = mutation({
},
});
/**
* Cancelar agendamento de email
*/
export const cancelarAgendamentoEmail = mutation({
args: {
emailId: v.id("notificacoesEmail"),
},
handler: async (ctx, args) => {
const email = await ctx.db.get(args.emailId);
if (!email) {
return { sucesso: false, erro: "Email não encontrado" };
}
if (email.status !== "pendente") {
return { sucesso: false, erro: "Apenas emails pendentes podem ser cancelados" };
}
// Remove o email da fila
await ctx.db.delete(args.emailId);
return { sucesso: true };
},
});
/**
* Enviar email usando template
*/