From 6f04b3dad509b59de18c606366c1b6b6ef0574b3 Mon Sep 17 00:00:00 2001 From: "open-swe-dev-andrinoid[bot]" Date: Thu, 29 Jan 2026 19:07:44 +0000 Subject: [PATCH] Apply patch [skip ci] --- routes/api/lease/reject.ts | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/routes/api/lease/reject.ts b/routes/api/lease/reject.ts index b29db0d..2770689 100644 --- a/routes/api/lease/reject.ts +++ b/routes/api/lease/reject.ts @@ -1,10 +1,12 @@ // routes/api/lease/reject.ts import { define } from "../../../utils.ts"; import { SessionCookie } from "../../auth/callback.ts"; -import { getLeaseById, rejectLease } from "../../../services/leaseService.ts"; +import { rejectLease, getLeaseById } from "../../../services/leaseService.ts"; import { getUserById } from "../../../services/userService.ts"; import { getPropertyById } from "../../../services/propertyService.ts"; -import { sendLeaseRejected } from "../../../services/notificationService.ts"; +import { + sendLeaseRejected, +} from "../../../services/notificationService.ts"; export const handler = define.handlers({ async POST(ctx) { @@ -83,29 +85,27 @@ export const handler = define.handlers({ } const rejectedLease = result[0]; + const tenant = await getUserById(lease.tenant_id); + const landlord = await getUserById(user_id); + const property = lease.property_id + ? await getPropertyById(lease.property_id) + : null; - if (lease.tenant_id) { - const tenant = await getUserById(lease.tenant_id); - const landlord = await getUserById(user_id); - const property = lease.property_id - ? await getPropertyById(lease.property_id) - : null; - - await sendLeaseRejected(lease.tenant_id, { - lease_id: lease.id, - property_address: property?.address_1 - ? `${property.address_1}, ${property.city}, ${property.state}` - : lease.property_address || "Property", - tenant_name: tenant?.name || "Tenant", - landlord_name: landlord?.name || "Landlord", - monthly_rent: property?.monthly_rent ?? lease.rent ?? undefined, - }); - } + await sendLeaseRejected(lease.tenant_id, { + lease_id: lease.id, + property_address: property?.address_1 + ? `${property.address_1}, ${property.city}, ${property.state}` + : lease.property_address || "Property", + tenant_name: tenant?.name || "Tenant", + landlord_name: landlord?.name || "Landlord", + monthly_rent: property?.monthly_rent || lease.rent, + }); return new Response( JSON.stringify({ success: true, lease: rejectedLease, + lease: rejectedLease, }), { status: 200,