diff --git a/routes/api/lease/request-approval.ts b/routes/api/lease/request-approval.ts index 0446d13..e00acb3 100644 --- a/routes/api/lease/request-approval.ts +++ b/routes/api/lease/request-approval.ts @@ -99,7 +99,7 @@ export const handler = define.handlers({ await updateTenantInvite(invite_id, { lease_id: lease.id }); -if (invite.landlord_id) { + if (invite.landlord_id) { const tenant = await getUserById(user_id); const landlord = await getUserById(invite.landlord_id); @@ -113,6 +113,16 @@ if (invite.landlord_id) { monthly_rent: property.monthly_rent, }); } + await sendLeaseApprovalRequest(invite.landlord_id, { + lease_id: lease.id, + property_address: property.address_1 + ? `${property.address_1}, ${property.city}, ${property.state}` + : property.title || "Property", + tenant_name: tenant?.name || "Tenant", + landlord_name: landlord?.name || "Landlord", + monthly_rent: property.monthly_rent, + }); + } return new Response( JSON.stringify({