13 lines
356 B
JavaScript
13 lines
356 B
JavaScript
import pool from '../db/index.js';
|
|
|
|
export async function getBlockTypes(req, res) {
|
|
try {
|
|
const { rows } = await pool.query(
|
|
'SELECT id, code, label, base_price_chf, width_min_mm, width_max_mm FROM block_types WHERE active = true ORDER BY id'
|
|
);
|
|
res.json(rows);
|
|
} catch (err) {
|
|
res.status(500).json({ error: err.message });
|
|
}
|
|
}
|