Skip to content

Commit

Permalink
fix(server): Ensure db connection before fetching property details
Browse files Browse the repository at this point in the history
  • Loading branch information
csulit committed Oct 30, 2024
1 parent 2b96ef5 commit 6ae2865
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,13 +499,14 @@ app.get("/api/properties/cities", async (c: Context) => {
});

app.get("/api/properties/generate-ai-description", async (c: Context) => {
using client = await dbPool.connect();
const id = c.req.param("id");

if (!id) {
return c.json({ error: "Property ID is required" }, 400);
}

const property = await client.queryObject({
const property = await client.queryObject({
args: [id],
text: `
SELECT
Expand Down

0 comments on commit 6ae2865

Please sign in to comment.