Apply patch [skip ci]
This commit is contained in:
parent
432faeb4ac
commit
67cad2a3bb
@ -83,21 +83,24 @@ export const handler = define.handlers({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const approvedLease = result[0];
|
const approvedLease = result[0];
|
||||||
const tenant = await getUserById(lease.tenant_id);
|
|
||||||
const landlord = await getUserById(user_id);
|
if (lease.tenant_id) {
|
||||||
const property = lease.property_id
|
const tenant = await getUserById(lease.tenant_id);
|
||||||
? await getPropertyById(lease.property_id)
|
const landlord = await getUserById(user_id);
|
||||||
: null;
|
const property = lease.property_id
|
||||||
|
? await getPropertyById(lease.property_id)
|
||||||
|
: null;
|
||||||
|
|
||||||
await sendLeaseApproved(lease.tenant_id, {
|
await sendLeaseApproved(lease.tenant_id, {
|
||||||
lease_id: lease.id,
|
lease_id: lease.id,
|
||||||
property_address: property?.address_1
|
property_address: property?.address_1
|
||||||
? `${property.address_1}, ${property.city}, ${property.state}`
|
? `${property.address_1}, ${property.city}, ${property.state}`
|
||||||
: lease.property_address || "Property",
|
: lease.property_address || "Property",
|
||||||
tenant_name: tenant?.name || "Tenant",
|
tenant_name: tenant?.name || "Tenant",
|
||||||
landlord_name: landlord?.name || "Landlord",
|
landlord_name: landlord?.name || "Landlord",
|
||||||
monthly_rent: property?.monthly_rent || lease.rent,
|
monthly_rent: property?.monthly_rent || lease.rent,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return new Response(
|
return new Response(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user