refactor: clean up code formatting and improve error handling in job scheduling

- Simplified code formatting for better readability in various components.
- Updated job scheduling functions to handle errors gracefully, ensuring that failures in scheduling do not disrupt the overall process.
- Enhanced logging for better traceability of job scheduling issues.

These changes improve code maintainability and user experience by providing clearer error messages and more organized code structure.
This commit is contained in:
Mauricio Siu
2026-04-11 10:04:29 -06:00
parent f404b231a6
commit d6124aae81
7 changed files with 59 additions and 44 deletions

View File

@@ -205,7 +205,10 @@ export const stripeRouter = createTRPCRouter({
mode: "subscription",
line_items: items,
...(stripeCustomerId
? { customer: stripeCustomerId, customer_update: { name: "auto", address: "auto" } }
? {
customer: stripeCustomerId,
customer_update: { name: "auto", address: "auto" },
}
: { customer_email: owner.email }),
metadata: {
adminId: owner.id,

View File

@@ -32,10 +32,7 @@ export const sendInvoiceEmail = async (
if (!invoice.hosted_invoice_url) return;
try {
const amountFormatted = formatAmount(
invoice.amount_paid,
invoice.currency,
);
const amountFormatted = formatAmount(invoice.amount_paid, invoice.currency);
const htmlContent = await renderAsync(
InvoiceNotificationEmail({
@@ -85,10 +82,7 @@ export const sendPaymentFailedEmail = async (
if (!invoice.hosted_invoice_url) return;
try {
const amountFormatted = formatAmount(
invoice.amount_due,
invoice.currency,
);
const amountFormatted = formatAmount(invoice.amount_due, invoice.currency);
const htmlContent = await renderAsync(
PaymentFailedEmail({