Apply patch [skip ci]
This commit is contained in:
parent
d9c3b8ced3
commit
949c3830cd
@ -4,7 +4,9 @@ import { SessionCookie } from "../../auth/callback.ts";
|
||||
import { approveLease, getLeaseById } from "../../../services/leaseService.ts";
|
||||
import { getUserById } from "../../../services/userService.ts";
|
||||
import { getPropertyById } from "../../../services/propertyService.ts";
|
||||
import { sendLeaseApproved } from "../../../services/notificationService.ts";
|
||||
import {
|
||||
sendLeaseApproved,
|
||||
} from "../../../services/notificationService.ts";
|
||||
|
||||
export const handler = define.handlers({
|
||||
async POST(ctx) {
|
||||
@ -81,8 +83,6 @@ export const handler = define.handlers({
|
||||
}
|
||||
|
||||
const approvedLease = result[0];
|
||||
|
||||
if (lease.tenant_id) {
|
||||
const tenant = await getUserById(lease.tenant_id);
|
||||
const landlord = await getUserById(user_id);
|
||||
const property = lease.property_id
|
||||
@ -96,14 +96,14 @@ export const handler = define.handlers({
|
||||
: lease.property_address || "Property",
|
||||
tenant_name: tenant?.name || "Tenant",
|
||||
landlord_name: landlord?.name || "Landlord",
|
||||
monthly_rent: property?.monthly_rent ?? lease.rent ?? undefined,
|
||||
monthly_rent: property?.monthly_rent || lease.rent,
|
||||
});
|
||||
}
|
||||
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
success: true,
|
||||
lease: approvedLease,
|
||||
lease: approvedLease,
|
||||
}),
|
||||
{
|
||||
status: 200,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user