feat(api): include dba_name in AZ stores API response
Add dba_name to DISPENSARY_COLUMNS for the /api/az/stores list endpoint and getDispensaryById for the single store endpoint. This allows the frontend to display DBA names (trade names) when available, falling back to the legal entity name. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,7 @@ import { crawlDispensaryProducts } from '../services/product-crawler';
|
|||||||
|
|
||||||
// Explicit column list for dispensaries table (avoids SELECT * issues with schema differences)
|
// Explicit column list for dispensaries table (avoids SELECT * issues with schema differences)
|
||||||
const DISPENSARY_COLUMNS = `
|
const DISPENSARY_COLUMNS = `
|
||||||
id, name, slug, city, state, zip, address, latitude, longitude,
|
id, name, dba_name, slug, city, state, zip, address, latitude, longitude,
|
||||||
menu_type, menu_url, platform_dispensary_id, website,
|
menu_type, menu_url, platform_dispensary_id, website,
|
||||||
provider_detection_data, created_at, updated_at
|
provider_detection_data, created_at, updated_at
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ export function mapDbRowToDispensary(row: any): Dispensary {
|
|||||||
id: row.id,
|
id: row.id,
|
||||||
platform: row.platform || 'dutchie', // keep platform as-is, default to 'dutchie'
|
platform: row.platform || 'dutchie', // keep platform as-is, default to 'dutchie'
|
||||||
name: row.name,
|
name: row.name,
|
||||||
|
dbaName: row.dbaName || row.dba_name,
|
||||||
slug: row.slug,
|
slug: row.slug,
|
||||||
city: row.city,
|
city: row.city,
|
||||||
state: row.state,
|
state: row.state,
|
||||||
@@ -376,6 +377,7 @@ export async function getDispensaryById(id: number): Promise<Dispensary | null>
|
|||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
|
dba_name AS "dbaName",
|
||||||
slug,
|
slug,
|
||||||
city,
|
city,
|
||||||
state,
|
state,
|
||||||
|
|||||||
Reference in New Issue
Block a user