import { pool } from '../db/schema.js'; export async function getBusinessInfo(params: { slug: string }): Promise> { const result = await pool.query( `SELECT name, category, address, city, state, zip, phone, website, story, owner_bio, photos FROM businesses WHERE slug = $1`, [params.slug] ); if (result.rows.length === 0) { return { error: `Business '${params.slug}' not found` }; } const b = result.rows[0]; return { name: b.name, category: b.category, location: { address: b.address, city: b.city, state: b.state, zip: b.zip }, phone: b.phone, website: b.website, story: b.story, owner_bio: b.owner_bio, photos: JSON.parse(b.photos), }; }