import { Router } from "express"; import { pool } from "../db/pool.ts"; import { err, h, type AuthedRequest } from "../lib/auth.ts"; export const businessRouter = Router(); businessRouter.get( "/", h(async (req: AuthedRequest, res) => { const { rows } = await pool.query( `SELECT id, name, industry, currency, currency_symbol, phone, address, slug, timezone, working_hours, status FROM businesses WHERE id = $1`, [req.user!.business_id] ); if (!rows[0]) { err(res, 404, "Negocio no encontrado"); return; } res.json({ business: rows[0] }); }) );