Enhance sticky columns in import, enhance forecasting page

This commit is contained in:
2026-04-02 16:20:24 -04:00
parent e43abdafd0
commit 4b2b3d5a9f
6 changed files with 1809 additions and 633 deletions
+8 -10
View File
@@ -134,11 +134,10 @@ router.post('/', async (req, res) => {
res.status(201).json(result.rows[0]);
} catch (error) {
console.error('Error creating template:', error);
// Check for unique constraint violation
if (error instanceof Error && error.message.includes('unique constraint')) {
return res.status(409).json({
error: 'Template already exists for this company and product type',
details: error.message
// Check for unique constraint violation (PostgreSQL error code 23505)
if (error?.code === '23505') {
return res.status(409).json({
error: 'A template already exists for this company and product type combination. Please edit the existing template instead.',
});
}
res.status(500).json({
@@ -232,11 +231,10 @@ router.put('/:id', async (req, res) => {
res.json(result.rows[0]);
} catch (error) {
console.error('Error updating template:', error);
// Check for unique constraint violation
if (error instanceof Error && error.message.includes('unique constraint')) {
return res.status(409).json({
error: 'Template already exists for this company and product type',
details: error.message
// Check for unique constraint violation (PostgreSQL error code 23505)
if (error?.code === '23505') {
return res.status(409).json({
error: 'A template already exists for this company and product type combination. Please edit the existing template instead.',
});
}
res.status(500).json({