proper typing

This commit is contained in:
2026-03-20 02:59:29 -05:00
parent e078c9aa7a
commit b367c7d1fc
2 changed files with 3 additions and 2 deletions

View File

@@ -40,7 +40,7 @@ router.post('/', async (req, res) => {
) VALUES (
$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,
$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25
) RETURNING *`,
) RETURNING *, percentage_full::float AS percentage_full, expiration_date::text AS expiration_date`,
[
req.user!.id, b.piFirstName, b.physicalState, b.chemicalName, b.bldgCode, b.lab,
b.storageLocation, b.storageDevice, b.numberOfContainers, b.amountPerContainer,
@@ -72,7 +72,8 @@ router.patch('/:id', async (req, res) => {
const result = await pool.query(
`UPDATE chemicals SET ${setClauses}, updated_at = NOW()
WHERE id = $1 AND user_id = $2 RETURNING *`,
WHERE id = $1 AND user_id = $2
RETURNING *, percentage_full::float AS percentage_full, expiration_date::text AS expiration_date`,
[req.params.id, req.user!.id, ...values]
);
if (result.rows.length === 0) return res.status(404).json({ error: 'Not found' });