Apply patch [skip ci]

This commit is contained in:
open-swe-dev-andrinoid[bot] 2026-01-29 19:07:33 +00:00 committed by Nathan Anderson
parent d9c3b8ced3
commit 949c3830cd

View File

@ -4,7 +4,9 @@ import { SessionCookie } from "../../auth/callback.ts";
import { approveLease, getLeaseById } from "../../../services/leaseService.ts"; import { approveLease, getLeaseById } from "../../../services/leaseService.ts";
import { getUserById } from "../../../services/userService.ts"; import { getUserById } from "../../../services/userService.ts";
import { getPropertyById } from "../../../services/propertyService.ts"; import { getPropertyById } from "../../../services/propertyService.ts";
import { sendLeaseApproved } from "../../../services/notificationService.ts"; import {
sendLeaseApproved,
} from "../../../services/notificationService.ts";
export const handler = define.handlers({ export const handler = define.handlers({
async POST(ctx) { async POST(ctx) {
@ -81,8 +83,6 @@ export const handler = define.handlers({
} }
const approvedLease = result[0]; const approvedLease = result[0];
if (lease.tenant_id) {
const tenant = await getUserById(lease.tenant_id); const tenant = await getUserById(lease.tenant_id);
const landlord = await getUserById(user_id); const landlord = await getUserById(user_id);
const property = lease.property_id const property = lease.property_id
@ -96,14 +96,14 @@ export const handler = define.handlers({
: 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 ?? undefined, monthly_rent: property?.monthly_rent || lease.rent,
}); });
}
return new Response( return new Response(
JSON.stringify({ JSON.stringify({
success: true, success: true,
lease: approvedLease, lease: approvedLease,
lease: approvedLease,
}), }),
{ {
status: 200, status: 200,